Skip to content

Commit

Permalink
Merge branch 'master' into descriptive-error-httpvalidationserver
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli authored Jul 12, 2024
2 parents 783f12f + 5237c93 commit 67b23a9
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 8 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/submodule-pin-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

declare -Ar exceptions=(
[contracts]=origin/develop
[nitro-testnode]=origin/master

#TODO Rachel to check these are the intended branches.
[arbitrator/langs/c]=origin/vm-storage-cache
[arbitrator/tools/wasmer]=origin/adopt-v4.2.8
)

divergent=0
for mod in `git submodule --quiet foreach 'echo $name'`; do
branch=origin/HEAD
if [[ -v exceptions[$mod] ]]; then
branch=${exceptions[$mod]}
fi

if ! git -C $mod merge-base --is-ancestor HEAD $branch; then
echo $mod diverges from $branch
divergent=1
fi
done

exit $divergent

21 changes: 21 additions & 0 deletions .github/workflows/submodule-pin-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Submodule Pin Check

on:
pull_request:
branches: [ master ]
types: [synchronize, opened, reopened]

jobs:
submodule-pin-check:
name: Submodule Pin Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Check all submodules are ancestors of origin/HEAD or configured branch
run: ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh

2 changes: 1 addition & 1 deletion arbitrator/langs/bf
Submodule bf updated 1 files
+2 −2 README.md
2 changes: 1 addition & 1 deletion staker/l1_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (v *L1Validator) generateNodeAction(
return nil, false, nil
}

successorNodes, err := v.rollup.LookupNodeChildren(ctx, stakerInfo.LatestStakedNode, stakerInfo.LatestStakedNodeHash)
successorNodes, err := v.rollup.LookupNodeChildren(ctx, stakerInfo.LatestStakedNode, stakerConfig.LogQueryBatchSize, stakerInfo.LatestStakedNodeHash)
if err != nil {
return nil, false, fmt.Errorf("error looking up node %v (hash %v) children: %w", stakerInfo.LatestStakedNode, stakerInfo.LatestStakedNodeHash, err)
}
Expand Down
28 changes: 22 additions & 6 deletions staker/rollup_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/core/types"
)

var rollupInitializedID common.Hash
Expand Down Expand Up @@ -165,7 +166,7 @@ func (r *RollupWatcher) LookupNode(ctx context.Context, number uint64) (*NodeInf
}, nil
}

func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64, nodeHash common.Hash) ([]*NodeInfo, error) {
func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64, logQueryRangeSize uint64, nodeHash common.Hash) ([]*NodeInfo, error) {
node, err := r.RollupUserLogic.GetNode(r.getCallOpts(ctx), nodeNum)
if err != nil {
return nil, err
Expand All @@ -180,17 +181,32 @@ func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64,
Addresses: []common.Address{r.address},
Topics: [][]common.Hash{{nodeCreatedID}, nil, {nodeHash}},
}
query.FromBlock, err = r.getNodeCreationBlock(ctx, nodeNum)
fromBlock, err := r.getNodeCreationBlock(ctx, nodeNum)
if err != nil {
return nil, err
}
query.ToBlock, err = r.getNodeCreationBlock(ctx, node.LatestChildNumber)
toBlock, err := r.getNodeCreationBlock(ctx, node.LatestChildNumber)
if err != nil {
return nil, err
}
logs, err := r.client.FilterLogs(ctx, query)
if err != nil {
return nil, err
var logs []types.Log
// break down the query to avoid eth_getLogs query limit
for toBlock.Cmp(fromBlock) > 0 {
query.FromBlock = fromBlock
if logQueryRangeSize == 0 {
query.ToBlock = toBlock
} else {
query.ToBlock = new(big.Int).Add(fromBlock, big.NewInt(int64(logQueryRangeSize)))
}
if query.ToBlock.Cmp(toBlock) > 0 {
query.ToBlock = toBlock
}
segment, err := r.client.FilterLogs(ctx, query)
if err != nil {
return nil, err
}
logs = append(logs, segment...)
fromBlock = new(big.Int).Add(query.ToBlock, big.NewInt(1))
}
infos := make([]*NodeInfo, 0, len(logs))
lastHash := nodeHash
Expand Down
4 changes: 4 additions & 0 deletions staker/staker.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type L1ValidatorConfig struct {
ExtraGas uint64 `koanf:"extra-gas" reload:"hot"`
Dangerous DangerousConfig `koanf:"dangerous"`
ParentChainWallet genericconf.WalletConfig `koanf:"parent-chain-wallet"`
LogQueryBatchSize uint64 `koanf:"log-query-batch-size" reload:"hot"`

strategy StakerStrategy
gasRefunder common.Address
Expand Down Expand Up @@ -156,6 +157,7 @@ var DefaultL1ValidatorConfig = L1ValidatorConfig{
ExtraGas: 50000,
Dangerous: DefaultDangerousConfig,
ParentChainWallet: DefaultValidatorL1WalletConfig,
LogQueryBatchSize: 0,
}

var TestL1ValidatorConfig = L1ValidatorConfig{
Expand All @@ -176,6 +178,7 @@ var TestL1ValidatorConfig = L1ValidatorConfig{
ExtraGas: 50000,
Dangerous: DefaultDangerousConfig,
ParentChainWallet: DefaultValidatorL1WalletConfig,
LogQueryBatchSize: 0,
}

var DefaultValidatorL1WalletConfig = genericconf.WalletConfig{
Expand All @@ -201,6 +204,7 @@ func L1ValidatorConfigAddOptions(prefix string, f *flag.FlagSet) {
f.String(prefix+".gas-refunder-address", DefaultL1ValidatorConfig.GasRefunderAddress, "The gas refunder contract address (optional)")
f.String(prefix+".redis-url", DefaultL1ValidatorConfig.RedisUrl, "redis url for L1 validator")
f.Uint64(prefix+".extra-gas", DefaultL1ValidatorConfig.ExtraGas, "use this much more gas than estimation says is necessary to post transactions")
f.Uint64(prefix+".log-query-batch-size", DefaultL1ValidatorConfig.LogQueryBatchSize, "range ro query from eth_getLogs")
dataposter.DataPosterConfigAddOptions(prefix+".data-poster", f, dataposter.DefaultDataPosterConfigForValidator)
DangerousConfigAddOptions(prefix+".dangerous", f)
genericconf.WalletConfigAddOptions(prefix+".parent-chain-wallet", f, DefaultL1ValidatorConfig.ParentChainWallet.Pathname)
Expand Down

0 comments on commit 67b23a9

Please sign in to comment.