Skip to content

Commit

Permalink
Merge branch 'master' into fix-hot-reload-config-overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuacolvin0 authored Jul 12, 2024
2 parents e1cae5c + 9e5f946 commit 5a9d31f
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/merge-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
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
3 changes: 3 additions & 0 deletions cmd/nitro-val/nitro_val.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
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
8 changes: 7 additions & 1 deletion staker/stateless_block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"errors"
"fmt"
"net/url"
"testing"

"github.com/offchainlabs/nitro/arbstate/daprovider"
Expand Down Expand Up @@ -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 != "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)
}
}
return err
}
}
Expand Down

0 comments on commit 5a9d31f

Please sign in to comment.