From 947af3099059ba58a13c66797fcdfa34e8c419b2 Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Fri, 28 Jun 2024 18:45:03 +0800 Subject: [PATCH 01/23] refactor: breakdown query to eth_getLogs --- staker/l1_validator.go | 2 +- staker/rollup_watcher.go | 24 ++++++++++++++++++------ staker/staker.go | 4 ++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/staker/l1_validator.go b/staker/l1_validator.go index d68365ede0..14c46b5ddb 100644 --- a/staker/l1_validator.go +++ b/staker/l1_validator.go @@ -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.LogQueryRange, stakerInfo.LatestStakedNodeHash) if err != nil { return nil, false, fmt.Errorf("error looking up node %v (hash %v) children: %w", stakerInfo.LatestStakedNode, stakerInfo.LatestStakedNodeHash, err) } diff --git a/staker/rollup_watcher.go b/staker/rollup_watcher.go index 118ce15b44..1fbc783b47 100644 --- a/staker/rollup_watcher.go +++ b/staker/rollup_watcher.go @@ -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 @@ -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, logQueryRange uint64, nodeHash common.Hash) ([]*NodeInfo, error) { node, err := r.RollupUserLogic.GetNode(r.getCallOpts(ctx), nodeNum) if err != nil { return nil, err @@ -180,17 +181,28 @@ 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 + query.ToBlock = new(big.Int).Add(fromBlock, big.NewInt(logQueryRange)) + 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 diff --git a/staker/staker.go b/staker/staker.go index da6413e122..f7f412ca16 100644 --- a/staker/staker.go +++ b/staker/staker.go @@ -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"` + LogQueryRange uint64 `koanf:"log-query-range" reload:"hot"` strategy StakerStrategy gasRefunder common.Address @@ -156,6 +157,7 @@ var DefaultL1ValidatorConfig = L1ValidatorConfig{ ExtraGas: 50000, Dangerous: DefaultDangerousConfig, ParentChainWallet: DefaultValidatorL1WalletConfig, + LogQueryRange: 999, } var TestL1ValidatorConfig = L1ValidatorConfig{ @@ -176,6 +178,7 @@ var TestL1ValidatorConfig = L1ValidatorConfig{ ExtraGas: 50000, Dangerous: DefaultDangerousConfig, ParentChainWallet: DefaultValidatorL1WalletConfig, + LogQueryRange: 999, } var DefaultValidatorL1WalletConfig = genericconf.WalletConfig{ @@ -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-range", DefaultL1ValidatorConfig.LogQueryRange, "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) From ea08ba547fc4ad87b6cbef3ebc44712b481a98d0 Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Fri, 28 Jun 2024 18:51:20 +0800 Subject: [PATCH 02/23] fix: array append --- staker/rollup_watcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staker/rollup_watcher.go b/staker/rollup_watcher.go index 1fbc783b47..6d871be24e 100644 --- a/staker/rollup_watcher.go +++ b/staker/rollup_watcher.go @@ -201,7 +201,7 @@ func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64, if err != nil { return nil, err } - logs = append(logs, segment) + logs = append(logs, segment...) fromBlock = new(big.Int).Add(query.ToBlock, big.NewInt(1)) } infos := make([]*NodeInfo, 0, len(logs)) From 40ff63075e231db86a7dde9d3e9b3876bf98495b Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Fri, 28 Jun 2024 18:55:25 +0800 Subject: [PATCH 03/23] fix: log query range type error --- staker/rollup_watcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staker/rollup_watcher.go b/staker/rollup_watcher.go index 6d871be24e..4ff8db0ce3 100644 --- a/staker/rollup_watcher.go +++ b/staker/rollup_watcher.go @@ -193,7 +193,7 @@ func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64, // break down the query to avoid eth_getLogs query limit for toBlock.Cmp(fromBlock) > 0 { query.FromBlock = fromBlock - query.ToBlock = new(big.Int).Add(fromBlock, big.NewInt(logQueryRange)) + query.ToBlock = new(big.Int).Add(fromBlock, big.NewInt(int64(logQueryRange))) if query.ToBlock.Cmp(toBlock) > 0 { query.ToBlock = toBlock } From b017e98eb9936fb0f3e12f24250bfaf2f7bc6ab9 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 11:46:04 -0700 Subject: [PATCH 04/23] Add submodule pin check to CI This checks that submodules are ancestors of origin/HEAD so that non-merged branches aren't accidentally checked in. --- .github/workflows/submodule-pin-check.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/submodule-pin-check.yml diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml new file mode 100644 index 0000000000..43984f1158 --- /dev/null +++ b/.github/workflows/submodule-pin-check.yml @@ -0,0 +1,15 @@ +name: Merge Checks + +on: + pull_request: + branches: [ master ] + types: [synchronize, opened, reopened, labeled, unlabeled] + +jobs: + submodule-pin-check: + name: Submodule Pin Check + runs-on: ubuntu-latest + steps: + - name: Check all submodules are under origin/HEAD + run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD + From b64dc4fcc611592653d7b3f7b032afb0bb780ebf Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 12:02:50 -0700 Subject: [PATCH 05/23] Add checkout step --- .github/workflows/submodule-pin-check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 43984f1158..050eea4b25 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -10,6 +10,9 @@ jobs: name: Submodule Pin Check runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check all submodules are under origin/HEAD run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD From 9e45391518493f4bfebd0e52e207572b0db9fb8d Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 12:05:41 -0700 Subject: [PATCH 06/23] Check out submodules --- .github/workflows/submodule-pin-check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 050eea4b25..86a69c94cd 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: recursive - name: Check all submodules are under origin/HEAD run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD From 30870b5a05af710cf56d03208ecd17bb626ae2db Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 3 Jul 2024 12:12:16 -0700 Subject: [PATCH 07/23] Update arbitrator/langs/bf pin --- arbitrator/langs/bf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/langs/bf b/arbitrator/langs/bf index 062b87bad1..cb5750580f 160000 --- a/arbitrator/langs/bf +++ b/arbitrator/langs/bf @@ -1 +1 @@ -Subproject commit 062b87bad1ec00d42b9cc2b5ee41e63cd6ff1cbb +Subproject commit cb5750580f6990b5166ffce83de11b766a25ca31 From bbd649e664d4a1c47b0b09986015c6a548ddb12c Mon Sep 17 00:00:00 2001 From: Tristan-Wilson <87238672+Tristan-Wilson@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:55:22 -0700 Subject: [PATCH 08/23] Update .github/workflows/submodule-pin-check.yml Co-authored-by: Gabriel de Quadros Ligneul <8294320+gligneul@users.noreply.github.com> --- .github/workflows/submodule-pin-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 86a69c94cd..ac0b8fba89 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -1,4 +1,4 @@ -name: Merge Checks +name: Submodule Pin Check on: pull_request: From c3999026cff51e75226072a300467cdc7f07126a Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 8 Jul 2024 04:44:35 -0700 Subject: [PATCH 09/23] Remove check for labeled/unlabeled --- .github/workflows/submodule-pin-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index ac0b8fba89..b37cc7b9d5 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -3,7 +3,7 @@ name: Submodule Pin Check on: pull_request: branches: [ master ] - types: [synchronize, opened, reopened, labeled, unlabeled] + types: [synchronize, opened, reopened] jobs: submodule-pin-check: From fc3402e43f3f5975fba15c26ed7d114bd09822c3 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 9 Jul 2024 11:25:36 +0200 Subject: [PATCH 10/23] Support different branches for submodule pin check --- .github/workflows/submodule-pin-check.sh | 22 ++++++++++++++++++++++ .github/workflows/submodule-pin-check.yml | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 .github/workflows/submodule-pin-check.sh diff --git a/.github/workflows/submodule-pin-check.sh b/.github/workflows/submodule-pin-check.sh new file mode 100755 index 0000000000..a246e2e3e9 --- /dev/null +++ b/.github/workflows/submodule-pin-check.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +declare -Ar exceptions=( + [contracts]=origin/develop + [nitro-testnode]=origin/master +) + +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 + diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index b37cc7b9d5..56dd2148f8 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -16,5 +16,5 @@ jobs: submodules: recursive - name: Check all submodules are under origin/HEAD - run: git submodule foreach git merge-base --is-ancestor HEAD origin/HEAD + run: ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh From 919b73742cfd0c01faf7afee40d761a2c11b981c Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 9 Jul 2024 11:30:41 +0200 Subject: [PATCH 11/23] Fetch submodule branches --- .github/workflows/submodule-pin-check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submodule-pin-check.yml b/.github/workflows/submodule-pin-check.yml index 56dd2148f8..e459bad34d 100644 --- a/.github/workflows/submodule-pin-check.yml +++ b/.github/workflows/submodule-pin-check.yml @@ -13,8 +13,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: recursive - - name: Check all submodules are under origin/HEAD + - name: Check all submodules are ancestors of origin/HEAD or configured branch run: ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh From a464232191be272f487ec248fcd8d994a2131083 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 10 Jul 2024 13:25:26 +0200 Subject: [PATCH 12/23] Add exceptions for some arbitrator submodules --- .github/workflows/submodule-pin-check.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/submodule-pin-check.sh b/.github/workflows/submodule-pin-check.sh index a246e2e3e9..aecb287ce1 100755 --- a/.github/workflows/submodule-pin-check.sh +++ b/.github/workflows/submodule-pin-check.sh @@ -3,6 +3,10 @@ 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 From 8daee6e3dbf3e17b951ffa62b59be25bb8cf1874 Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Wed, 10 Jul 2024 16:49:50 -0500 Subject: [PATCH 13/23] Produce a more descriptive error when validation server url is not set to a WS/WSS server --- staker/stateless_block_validator.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/staker/stateless_block_validator.go b/staker/stateless_block_validator.go index 1cf3d7a4c3..61ace07cb5 100644 --- a/staker/stateless_block_validator.go +++ b/staker/stateless_block_validator.go @@ -7,6 +7,7 @@ import ( "context" "errors" "fmt" + "net/url" "testing" "github.com/offchainlabs/nitro/arbstate/daprovider" @@ -428,8 +429,13 @@ func (v *StatelessBlockValidator) Start(ctx_in context.Context) error { return fmt.Errorf("starting execution spawner: %w", err) } } - for _, spawner := range v.execSpawners { + for i, spawner := range v.execSpawners { if err := spawner.Start(ctx_in); err != nil { + if u, parseErr := url.Parse(v.config.ValidationServerConfigs[i].URL); parseErr == nil { + if u.Scheme == "http" || u.Scheme == "https" { + return fmt.Errorf("validation server's url scheme: %s is unsupported, it should either be ws or wss, err: %w", u.Scheme, err) + } + } return err } } From 725baeffbe1376bde833d082df82fbffe2e27245 Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 11 Jul 2024 10:21:24 +0800 Subject: [PATCH 14/23] refactor: rename and set the default value to 0 for log query batch size --- staker/l1_validator.go | 2 +- staker/rollup_watcher.go | 4 ++-- staker/staker.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/staker/l1_validator.go b/staker/l1_validator.go index 14c46b5ddb..dd9673ee0b 100644 --- a/staker/l1_validator.go +++ b/staker/l1_validator.go @@ -381,7 +381,7 @@ func (v *L1Validator) generateNodeAction( return nil, false, nil } - successorNodes, err := v.rollup.LookupNodeChildren(ctx, stakerInfo.LatestStakedNode, stakerConfig.LogQueryRange, 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) } diff --git a/staker/rollup_watcher.go b/staker/rollup_watcher.go index 4ff8db0ce3..2c6841eb49 100644 --- a/staker/rollup_watcher.go +++ b/staker/rollup_watcher.go @@ -166,7 +166,7 @@ func (r *RollupWatcher) LookupNode(ctx context.Context, number uint64) (*NodeInf }, nil } -func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64, logQueryRange 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 @@ -193,7 +193,7 @@ func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64, // break down the query to avoid eth_getLogs query limit for toBlock.Cmp(fromBlock) > 0 { query.FromBlock = fromBlock - query.ToBlock = new(big.Int).Add(fromBlock, big.NewInt(int64(logQueryRange))) + query.ToBlock = new(big.Int).Add(fromBlock, big.NewInt(int64(logQueryRangeSize))) if query.ToBlock.Cmp(toBlock) > 0 { query.ToBlock = toBlock } diff --git a/staker/staker.go b/staker/staker.go index f7f412ca16..6d3b246230 100644 --- a/staker/staker.go +++ b/staker/staker.go @@ -90,7 +90,7 @@ type L1ValidatorConfig struct { ExtraGas uint64 `koanf:"extra-gas" reload:"hot"` Dangerous DangerousConfig `koanf:"dangerous"` ParentChainWallet genericconf.WalletConfig `koanf:"parent-chain-wallet"` - LogQueryRange uint64 `koanf:"log-query-range" reload:"hot"` + LogQueryBatchSize uint64 `koanf:"log-query-batch-size" reload:"hot"` strategy StakerStrategy gasRefunder common.Address @@ -157,7 +157,7 @@ var DefaultL1ValidatorConfig = L1ValidatorConfig{ ExtraGas: 50000, Dangerous: DefaultDangerousConfig, ParentChainWallet: DefaultValidatorL1WalletConfig, - LogQueryRange: 999, + LogQueryBatchSize: 0, } var TestL1ValidatorConfig = L1ValidatorConfig{ @@ -178,7 +178,7 @@ var TestL1ValidatorConfig = L1ValidatorConfig{ ExtraGas: 50000, Dangerous: DefaultDangerousConfig, ParentChainWallet: DefaultValidatorL1WalletConfig, - LogQueryRange: 999, + LogQueryBatchSize: 999, } var DefaultValidatorL1WalletConfig = genericconf.WalletConfig{ @@ -204,7 +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-range", DefaultL1ValidatorConfig.LogQueryRange, "range ro query from eth_getLogs") + f.Uint64(prefix+".log-query-range", 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) From 0433d001bcee54de25fedcba0a51eb8bfb4963e5 Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 11 Jul 2024 10:23:54 +0800 Subject: [PATCH 15/23] chore: rename command name --- staker/staker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staker/staker.go b/staker/staker.go index 6d3b246230..a924660b7e 100644 --- a/staker/staker.go +++ b/staker/staker.go @@ -204,7 +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-range", DefaultL1ValidatorConfig.LogQueryBatchSize, "range ro query from eth_getLogs") + f.Uint64(prefix+".log-query-range-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) From e89e283295a6bcaad610fe1ee11b4fded1160627 Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 11 Jul 2024 10:30:57 +0800 Subject: [PATCH 16/23] chore: set the default value to 0 for TestL1ValidatorConfig --- staker/staker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staker/staker.go b/staker/staker.go index a924660b7e..5bc96f5192 100644 --- a/staker/staker.go +++ b/staker/staker.go @@ -178,7 +178,7 @@ var TestL1ValidatorConfig = L1ValidatorConfig{ ExtraGas: 50000, Dangerous: DefaultDangerousConfig, ParentChainWallet: DefaultValidatorL1WalletConfig, - LogQueryBatchSize: 999, + LogQueryBatchSize: 0, } var DefaultValidatorL1WalletConfig = genericconf.WalletConfig{ From d22da37b44e6fb29bce333a08885497994a1762f Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 11 Jul 2024 12:01:17 +0800 Subject: [PATCH 17/23] fix: query all requested logs while logQueryRangeSize is 0 --- staker/rollup_watcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/staker/rollup_watcher.go b/staker/rollup_watcher.go index 2c6841eb49..b35bebd1c6 100644 --- a/staker/rollup_watcher.go +++ b/staker/rollup_watcher.go @@ -193,7 +193,11 @@ func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, nodeNum uint64, // break down the query to avoid eth_getLogs query limit for toBlock.Cmp(fromBlock) > 0 { query.FromBlock = fromBlock - query.ToBlock = new(big.Int).Add(fromBlock, big.NewInt(int64(logQueryRangeSize))) + 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 } From 4781fdfa0c550c51a944ce7090330e749c2d022b Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 11 Jul 2024 12:11:51 +0800 Subject: [PATCH 18/23] fix: subcommand name for LogQueryBatchSize --- staker/staker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staker/staker.go b/staker/staker.go index 5bc96f5192..24f5dc61e3 100644 --- a/staker/staker.go +++ b/staker/staker.go @@ -204,7 +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-range-size", DefaultL1ValidatorConfig.LogQueryBatchSize, "range ro query from eth_getLogs") + 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) From bca0114226d2973fd1ab31d6e3f7b2313b6e6d40 Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Thu, 11 Jul 2024 11:26:29 -0500 Subject: [PATCH 19/23] address PR comments --- staker/stateless_block_validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staker/stateless_block_validator.go b/staker/stateless_block_validator.go index 61ace07cb5..e263e1c402 100644 --- a/staker/stateless_block_validator.go +++ b/staker/stateless_block_validator.go @@ -433,7 +433,7 @@ func (v *StatelessBlockValidator) Start(ctx_in context.Context) error { if err := spawner.Start(ctx_in); err != nil { if u, parseErr := url.Parse(v.config.ValidationServerConfigs[i].URL); parseErr == nil { if u.Scheme == "http" || u.Scheme == "https" { - return fmt.Errorf("validation server's url scheme: %s is unsupported, it should either be ws or wss, err: %w", u.Scheme, err) + return fmt.Errorf("validation server's url scheme is unsupported, it should either be ws or wss, url:%s err: %w", v.config.ValidationServerConfigs[i].URL, err) } } return err From 11de4f95a2f715081b0eaad2ed0f8fae45c11fd4 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Thu, 11 Jul 2024 15:02:23 -0600 Subject: [PATCH 20/23] Add check for after-next-version label to design approved status --- .github/workflows/merge-checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge-checks.yml b/.github/workflows/merge-checks.yml index 6561c429e2..28b29d5cec 100644 --- a/.github/workflows/merge-checks.yml +++ b/.github/workflows/merge-checks.yml @@ -1,7 +1,7 @@ name: Merge Checks on: - pull_request_target: + pull_request: branches: [ master ] types: [synchronize, opened, reopened, labeled, unlabeled] @@ -17,7 +17,7 @@ jobs: run: | set -x pipefail status_state="pending" - if ${{ contains(github.event.*.labels.*.name, 'design-approved') }}; then + if ${{ contains(github.event.pull_request.labels.*.name, 'design-approved') && !contains(github.event.pull_request.labels.*.name, 'after-next-version') }}; then status_state="success" else resp="$(curl -sSL --fail-with-body \ From 13433ce94961182ac586d86190cb56c90b6132e2 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Thu, 11 Jul 2024 15:04:08 -0600 Subject: [PATCH 21/23] Undo change for testing --- .github/workflows/merge-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge-checks.yml b/.github/workflows/merge-checks.yml index 28b29d5cec..c9f7957389 100644 --- a/.github/workflows/merge-checks.yml +++ b/.github/workflows/merge-checks.yml @@ -1,7 +1,7 @@ name: Merge Checks on: - pull_request: + pull_request_target: branches: [ master ] types: [synchronize, opened, reopened, labeled, unlabeled] From 783f12f9877c89421fe57652e61c463a871d32af Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Fri, 12 Jul 2024 16:21:28 -0500 Subject: [PATCH 22/23] address PR comments --- staker/stateless_block_validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staker/stateless_block_validator.go b/staker/stateless_block_validator.go index e263e1c402..ec235c4bf5 100644 --- a/staker/stateless_block_validator.go +++ b/staker/stateless_block_validator.go @@ -432,7 +432,7 @@ func (v *StatelessBlockValidator) Start(ctx_in context.Context) error { for i, spawner := range v.execSpawners { if err := spawner.Start(ctx_in); err != nil { if u, parseErr := url.Parse(v.config.ValidationServerConfigs[i].URL); parseErr == nil { - if u.Scheme == "http" || u.Scheme == "https" { + if u.Scheme != "ws" && u.Scheme != "wss" { return fmt.Errorf("validation server's url scheme is unsupported, it should either be ws or wss, url:%s err: %w", v.config.ValidationServerConfigs[i].URL, err) } } From cbdf31fe9d5e071272a5e4bbdfc05af6cef1c711 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Fri, 12 Jul 2024 15:28:07 -0600 Subject: [PATCH 23/23] Fix disabling P2P --- cmd/nitro-val/nitro_val.go | 3 +++ cmd/nitro/nitro.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/cmd/nitro-val/nitro_val.go b/cmd/nitro-val/nitro_val.go index 6f5f546430..1a7d2e6283 100644 --- a/cmd/nitro-val/nitro_val.go +++ b/cmd/nitro-val/nitro_val.go @@ -70,6 +70,9 @@ func mainImpl() int { nodeConfig.WS.Apply(&stackConf) nodeConfig.Auth.Apply(&stackConf) nodeConfig.IPC.Apply(&stackConf) + stackConf.P2P.ListenAddr = "" + stackConf.P2P.NoDial = true + stackConf.P2P.NoDiscovery = true vcsRevision, strippedRevision, vcsTime := confighelpers.GetVersion() stackConf.Version = strippedRevision diff --git a/cmd/nitro/nitro.go b/cmd/nitro/nitro.go index 04bdeb3228..a4ef1b2945 100644 --- a/cmd/nitro/nitro.go +++ b/cmd/nitro/nitro.go @@ -183,6 +183,9 @@ func mainImpl() int { if nodeConfig.WS.ExposeAll { stackConf.WSModules = append(stackConf.WSModules, "personal") } + stackConf.P2P.ListenAddr = "" + stackConf.P2P.NoDial = true + stackConf.P2P.NoDiscovery = true vcsRevision, strippedRevision, vcsTime := confighelpers.GetVersion() stackConf.Version = strippedRevision