Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull in geth changes for state recreation #2005

Merged
merged 49 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8eebd46
update geth and adjust tests
magicxyyz Dec 7, 2023
6fb2ba5
update geth
magicxyyz Dec 7, 2023
f865d1e
Merge branch 'master' into state-release
magicxyyz Dec 7, 2023
a40f8f1
Merge branch 'master' into state-release
magicxyyz Dec 8, 2023
d21fdd8
update geth
magicxyyz Dec 11, 2023
a1ac5d0
Merge branch 'master' into state-release
magicxyyz Dec 11, 2023
4ff776d
Revert "update geth and adjust tests"
magicxyyz Dec 18, 2023
32df394
update expected error in TestRecreateStateForRPCBlockNotFoundWhileRec…
magicxyyz Dec 18, 2023
a9a0772
update geth
magicxyyz Dec 18, 2023
1234559
Merge branch 'master' into state-release
amsanghi Dec 19, 2023
ea05f0a
add test for getting state for rpc
magicxyyz Dec 19, 2023
dc936ea
Merge branch 'state-release-test' into state-release
magicxyyz Dec 19, 2023
7659d68
add missing error check in recreate state test
magicxyyz Dec 19, 2023
c1bdefd
update geth
magicxyyz Dec 19, 2023
923bc4c
add test for getting state for rpc on hybrid archive node
magicxyyz Dec 19, 2023
ac9d63b
add missing error check in recreate state test
magicxyyz Dec 19, 2023
42b6c83
add missing error check
magicxyyz Dec 19, 2023
bb5c908
Merge branch 'state-release-test' into state-release
magicxyyz Dec 19, 2023
b776a68
Merge branch 'master' into state-release
amsanghi Dec 20, 2023
8e2ede8
update geth
magicxyyz Jan 12, 2024
d1f244f
update geth
magicxyyz Jan 26, 2024
25bd9eb
Merge branch 'master' into state-release
magicxyyz Jan 26, 2024
f69b53e
update go.mod
magicxyyz Jan 26, 2024
fdc42ba
update recreate state tests to account for states saved on shutdown
magicxyyz Feb 5, 2024
e12dd8a
update geth
magicxyyz Feb 5, 2024
811d4fa
Merge branch 'master' into state-release
magicxyyz Feb 5, 2024
2e3d313
update geth
magicxyyz Feb 6, 2024
e415501
Merge branch 'master' into state-release
magicxyyz Feb 6, 2024
a781faf
fix recreation after restart test
magicxyyz Feb 6, 2024
72d678d
update geth
magicxyyz Feb 6, 2024
9bff2b2
remove commited by mistake files
magicxyyz Feb 8, 2024
60e4ff4
update geth
magicxyyz Feb 9, 2024
c341182
system_tests: fix initialization of default value of MaxRecreateState…
magicxyyz Feb 16, 2024
5559118
update geth
magicxyyz Feb 22, 2024
ab310ac
Merge branch 'master' into state-release
magicxyyz Feb 22, 2024
251abe0
update blocks reexecutor
magicxyyz Feb 23, 2024
41ebf43
update geth
magicxyyz Feb 23, 2024
22fa881
uncomment testing defaults in recreate state tests
magicxyyz Feb 23, 2024
49ec18c
Merge branch 'master' into state-release
magicxyyz Feb 27, 2024
6890439
update geth
magicxyyz Mar 6, 2024
48d0b9d
update geth
magicxyyz Mar 6, 2024
7296df7
Merge branch 'master' into state-release
magicxyyz Mar 6, 2024
2a53d99
Merge branch 'master' into state-release
magicxyyz Mar 7, 2024
2d449ae
add StateAndHeader test
magicxyyz Mar 12, 2024
8f4bf75
Merge branch 'master' into state-release
magicxyyz Mar 12, 2024
8c24484
update StateAndHeader test
magicxyyz Mar 12, 2024
b64198a
update error check in StateAndHeader test
magicxyyz Mar 12, 2024
7718918
update geth
magicxyyz Mar 12, 2024
25624db
update geth
magicxyyz Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions blocks_reexecutor/blocks_reexecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type BlocksReExecutor struct {
stopwaiter.StopWaiter
config *Config
blockchain *core.BlockChain
stateFor func(header *types.Header) (*state.StateDB, error)
stateFor arbitrum.StateForHeaderFunction
done chan struct{}
fatalErrChan chan error
startBlock uint64
Expand Down Expand Up @@ -110,7 +110,10 @@ func New(c *Config, blockchain *core.BlockChain, fatalErrChan chan error) *Block
startBlock: start,
done: make(chan struct{}, c.Room),
fatalErrChan: fatalErrChan,
stateFor: func(header *types.Header) (*state.StateDB, error) { return blockchain.StateAt(header.Root) },
stateFor: func(header *types.Header) (*state.StateDB, arbitrum.StateReleaseFunc, error) {
state, err := blockchain.StateAt(header.Root)
return state, arbitrum.NoopStateRelease, err
},
}
}

Expand All @@ -120,7 +123,9 @@ func (s *BlocksReExecutor) LaunchBlocksReExecution(ctx context.Context, currentB
if start < s.startBlock {
start = s.startBlock
}
startState, startHeader, err := arbitrum.FindLastAvailableState(ctx, s.blockchain, s.stateFor, s.blockchain.GetHeaderByNumber(start), nil, -1)
// we don't use state release pattern here
// TODO do we want to use release pattern here?
startState, startHeader, _, err := arbitrum.FindLastAvailableState(ctx, s.blockchain, s.stateFor, s.blockchain.GetHeaderByNumber(start), nil, -1)
if err != nil {
s.fatalErrChan <- fmt.Errorf("blocksReExecutor failed to get last available state while searching for state at %d, err: %w", start, err)
return s.startBlock
Expand Down
15 changes: 15 additions & 0 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -183,6 +184,13 @@ func (b *NodeBuilder) DefaultConfig(t *testing.T, withL1 bool) *NodeBuilder {
}

func (b *NodeBuilder) Build(t *testing.T) func() {
if b.execConfig.RPC.MaxRecreateStateDepth == arbitrum.UninitializedMaxRecreateStateDepth {
if b.execConfig.Caching.Archive {
b.execConfig.RPC.MaxRecreateStateDepth = arbitrum.DefaultArchiveNodeMaxRecreateStateDepth
} else {
b.execConfig.RPC.MaxRecreateStateDepth = arbitrum.DefaultNonArchiveNodeMaxRecreateStateDepth
}
}
if b.withL1 {
l1, l2 := NewTestClient(b.ctx), NewTestClient(b.ctx)
b.L2Info, l2.ConsensusNode, l2.Client, l2.Stack, b.L1Info, l1.L1Backend, l1.Client, l1.Stack =
Expand Down Expand Up @@ -229,6 +237,13 @@ func (b *NodeBuilder) Build2ndNode(t *testing.T, params *SecondNodeParams) (*Tes
if params.execConfig == nil {
params.execConfig = b.execConfig
}
if params.execConfig.RPC.MaxRecreateStateDepth == arbitrum.UninitializedMaxRecreateStateDepth {
if params.execConfig.Caching.Archive {
params.execConfig.RPC.MaxRecreateStateDepth = arbitrum.DefaultArchiveNodeMaxRecreateStateDepth
} else {
params.execConfig.RPC.MaxRecreateStateDepth = arbitrum.DefaultNonArchiveNodeMaxRecreateStateDepth
}
}

l2 := NewTestClient(b.ctx)
l2.Client, l2.ConsensusNode =
Expand Down
Loading
Loading