From 6d9067acef4e0add5105cb952be3a04d73ddad4e Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Wed, 23 Oct 2024 11:39:51 +0530 Subject: [PATCH 1/5] Add flags and other info for nitro --dev --- arbnode/inbox_test.go | 2 +- arbos/arbosState/initialization_test.go | 2 +- arbos/arbosState/initialize.go | 5 ++++- cmd/conf/init.go | 3 +++ cmd/nitro/init.go | 9 ++++++++- cmd/util/confighelpers/configuration.go | 3 ++- execution/gethexec/blockchain.go | 8 ++++---- system_tests/common_test.go | 4 ++-- system_tests/state_fuzz_test.go | 1 + 9 files changed, 26 insertions(+), 11 deletions(-) diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go index e588ef399b..78c50f9de7 100644 --- a/arbnode/inbox_test.go +++ b/arbnode/inbox_test.go @@ -61,7 +61,7 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (* initReader := statetransfer.NewMemoryInitDataReader(&initData) cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) - bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefault.TxLookupLimit, 0) + bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefault.TxLookupLimit, 0, common.Address{}) if err != nil { Fail(t, err) diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index 5e605b8bd2..608ccfd194 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -64,7 +64,7 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin chainConfig := params.ArbitrumDevTestChainConfig() cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) - stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) + stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0, common.Address{}) Require(t, err) triedbConfig := cacheConfig.TriedbConfig() diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 427bdc3087..3045df47d2 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -54,7 +54,7 @@ func MakeGenesisBlock(parentHash common.Hash, blockNumber uint64, timestamp uint return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)) } -func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (root common.Hash, err error) { +func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint, chainOwner common.Address) (root common.Hash, err error) { triedbConfig := cacheConfig.TriedbConfig() triedbConfig.Preimages = false stateDatabase := state.NewDatabaseWithConfig(db, triedbConfig) @@ -96,6 +96,9 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, log.Crit("failed to open the ArbOS state", "error", err) } + if chainOwner != (common.Address{}) { + arbosState.ChainOwners().Add(chainOwner) + } addrTable := arbosState.AddressTable() addrTableSize, err := addrTable.Size() if err != nil { diff --git a/cmd/conf/init.go b/cmd/conf/init.go index f01d99f8b7..0e624e8f61 100644 --- a/cmd/conf/init.go +++ b/cmd/conf/init.go @@ -20,6 +20,7 @@ type InitConfig struct { DownloadPoll time.Duration `koanf:"download-poll"` DevInit bool `koanf:"dev-init"` DevInitAddress string `koanf:"dev-init-address"` + DevMaxCodeSize uint64 `koanf:"MaxCodeSize"` DevInitBlockNum uint64 `koanf:"dev-init-blocknum"` Empty bool `koanf:"empty"` ImportWasm bool `koanf:"import-wasm"` @@ -47,6 +48,7 @@ var InitConfigDefault = InitConfig{ DownloadPoll: time.Minute, DevInit: false, DevInitAddress: "", + DevMaxCodeSize: 0, DevInitBlockNum: 0, Empty: false, ImportWasm: false, @@ -75,6 +77,7 @@ func InitConfigAddOptions(prefix string, f *pflag.FlagSet) { f.Bool(prefix+".dev-init", InitConfigDefault.DevInit, "init with dev data (1 account with balance) instead of file import") f.String(prefix+".dev-init-address", InitConfigDefault.DevInitAddress, "Address of dev-account. Leave empty to use the dev-wallet.") f.Uint64(prefix+".dev-init-blocknum", InitConfigDefault.DevInitBlockNum, "Number of preinit blocks. Must exist in ancient database.") + f.Uint64(prefix+".dev-max-code-size", InitConfigDefault.DevMaxCodeSize, "Max code size for dev accounts") f.Bool(prefix+".empty", InitConfigDefault.Empty, "init with empty state") f.Bool(prefix+".import-wasm", InitConfigDefault.ImportWasm, "if set, import the wasm directory when downloading a database (contains executable code - only use with highly trusted source)") f.Bool(prefix+".then-quit", InitConfigDefault.ThenQuit, "quit after init is done") diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index f0b303817c..9ff5431e2c 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -716,6 +716,9 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo if err != nil { return chainDb, nil, err } + if config.Init.DevInit && config.Init.DevMaxCodeSize != 0 { + chainConfig.ArbitrumChainParams.MaxCodeSize = config.Init.DevMaxCodeSize + } testUpdateTxIndex(chainDb, chainConfig, &txIndexWg) ancients, err := chainDb.Ancients() if err != nil { @@ -788,7 +791,11 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo if !emptyBlockChain && (cacheConfig.StateScheme == rawdb.PathScheme) && config.Init.Force { return chainDb, nil, errors.New("It is not possible to force init with non-empty blockchain when using path scheme") } - l2BlockChain, err = gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initDataReader, chainConfig, parsedInitMessage, config.Execution.TxLookupLimit, config.Init.AccountsPerSync) + var chainOwner common.Address + if config.Init.DevInit { + chainOwner = common.HexToAddress(config.Init.DevInitAddress) + } + l2BlockChain, err = gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initDataReader, chainConfig, parsedInitMessage, config.Execution.TxLookupLimit, config.Init.AccountsPerSync, chainOwner) if err != nil { return chainDb, nil, err } diff --git a/cmd/util/confighelpers/configuration.go b/cmd/util/confighelpers/configuration.go index 19b5b1a24c..c60eef961a 100644 --- a/cmd/util/confighelpers/configuration.go +++ b/cmd/util/confighelpers/configuration.go @@ -209,7 +209,8 @@ func devFlagArgs() []string { "--init.empty=false", "--http.port", "8547", "--http.addr", "127.0.0.1", - } + "--http.api=net,web3,eth,arb,arbdebug,debug", +, } return args } diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index fda8f49093..7ecf2e0e2b 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -125,7 +125,7 @@ func (c *CachingConfig) Validate() error { return c.validateStateScheme() } -func WriteOrTestGenblock(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, accountsPerSync uint) error { +func WriteOrTestGenblock(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, accountsPerSync uint, chainOwner common.Address) error { EmptyHash := common.Hash{} prevHash := EmptyHash prevDifficulty := big.NewInt(0) @@ -146,7 +146,7 @@ func WriteOrTestGenblock(chainDb ethdb.Database, cacheConfig *core.CacheConfig, } timestamp = prevHeader.Time } - stateRoot, err := arbosState.InitializeArbosInDatabase(chainDb, cacheConfig, initData, chainConfig, initMessage, timestamp, accountsPerSync) + stateRoot, err := arbosState.InitializeArbosInDatabase(chainDb, cacheConfig, initData, chainConfig, initMessage, timestamp, accountsPerSync, chainOwner) if err != nil { return err } @@ -213,7 +213,7 @@ func GetBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, chainC return core.NewBlockChain(chainDb, cacheConfig, chainConfig, nil, nil, engine, vmConfig, shouldPreserveFalse, &txLookupLimit) } -func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, txLookupLimit uint64, accountsPerSync uint) (*core.BlockChain, error) { +func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, txLookupLimit uint64, accountsPerSync uint, chainOwner common.Address) (*core.BlockChain, error) { emptyBlockChain := rawdb.ReadHeadHeader(chainDb) == nil if !emptyBlockChain && (cacheConfig.StateScheme == rawdb.PathScheme) { // When using path scheme, and the stored state trie is not empty, @@ -222,7 +222,7 @@ func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig return GetBlockChain(chainDb, cacheConfig, chainConfig, txLookupLimit) } - err := WriteOrTestGenblock(chainDb, cacheConfig, initData, chainConfig, initMessage, accountsPerSync) + err := WriteOrTestGenblock(chainDb, cacheConfig, initData, chainConfig, initMessage, accountsPerSync, chainOwner) if err != nil { return nil, err } diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 027a41d875..44c0e8f740 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -1346,7 +1346,7 @@ func createNonL1BlockChainWithStackConfig( } } coreCacheConfig := gethexec.DefaultCacheConfigFor(stack, &execConfig.Caching) - blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0) + blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0, common.Address{}) Require(t, err) return info, stack, chainDb, arbDb, blockchain @@ -1437,7 +1437,7 @@ func Create2ndNodeWithConfig( chainConfig := firstExec.ArbInterface.BlockChain().Config() coreCacheConfig := gethexec.DefaultCacheConfigFor(chainStack, &execConfig.Caching) - blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0) + blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0, common.Address{}) Require(t, err) AddValNodeIfNeeded(t, ctx, nodeConfig, true, "", valnodeConfig.Wasm.RootPath) diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go index c8312350e6..7e1fc57e63 100644 --- a/system_tests/state_fuzz_test.go +++ b/system_tests/state_fuzz_test.go @@ -155,6 +155,7 @@ func FuzzStateTransition(f *testing.F) { initMessage, 0, 0, + common.Address{}, ) if err != nil { panic(err) From 8ad0182cc7af4ebda48ba0feefab609e81a7ba13 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Wed, 23 Oct 2024 11:48:23 +0530 Subject: [PATCH 2/5] minor fix --- cmd/util/confighelpers/configuration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/util/confighelpers/configuration.go b/cmd/util/confighelpers/configuration.go index c60eef961a..8c4ef2a70b 100644 --- a/cmd/util/confighelpers/configuration.go +++ b/cmd/util/confighelpers/configuration.go @@ -210,7 +210,7 @@ func devFlagArgs() []string { "--http.port", "8547", "--http.addr", "127.0.0.1", "--http.api=net,web3,eth,arb,arbdebug,debug", -, } + } return args } From ff4ba9fc196240c3f25d8c9063656276d7309537 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Wed, 23 Oct 2024 12:06:58 +0530 Subject: [PATCH 3/5] fix lint --- arbos/arbosState/initialize.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 3045df47d2..0144390663 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -97,7 +97,10 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, } if chainOwner != (common.Address{}) { - arbosState.ChainOwners().Add(chainOwner) + err := arbosState.ChainOwners().Add(chainOwner) + if err != nil { + return common.Hash{}, err + } } addrTable := arbosState.AddressTable() addrTableSize, err := addrTable.Size() From b0f4728c9b74638728da04ed83ef0108a8cb8714 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Wed, 23 Oct 2024 12:08:37 +0530 Subject: [PATCH 4/5] fix lint --- cmd/conf/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/conf/init.go b/cmd/conf/init.go index 0e624e8f61..8e4e9a8892 100644 --- a/cmd/conf/init.go +++ b/cmd/conf/init.go @@ -20,7 +20,7 @@ type InitConfig struct { DownloadPoll time.Duration `koanf:"download-poll"` DevInit bool `koanf:"dev-init"` DevInitAddress string `koanf:"dev-init-address"` - DevMaxCodeSize uint64 `koanf:"MaxCodeSize"` + DevMaxCodeSize uint64 `koanf:"dev-max-code-size"` DevInitBlockNum uint64 `koanf:"dev-init-blocknum"` Empty bool `koanf:"empty"` ImportWasm bool `koanf:"import-wasm"` From 07d7ec40218b957bcdeb640ea4b0eb29dff887f8 Mon Sep 17 00:00:00 2001 From: Aman Sanghi Date: Tue, 5 Nov 2024 17:24:56 +0530 Subject: [PATCH 5/5] Changes based on PR comments --- arbnode/inbox_test.go | 2 +- arbos/arbosState/initialization_test.go | 2 +- arbos/arbosState/initialize.go | 8 ++++++-- cmd/nitro/init.go | 7 ++----- execution/gethexec/blockchain.go | 8 ++++---- statetransfer/data.go | 1 + statetransfer/interface.go | 1 + statetransfer/jsondatareader.go | 4 ++++ statetransfer/memdatareader.go | 4 ++++ system_tests/common_test.go | 4 ++-- system_tests/state_fuzz_test.go | 1 - 11 files changed, 26 insertions(+), 16 deletions(-) diff --git a/arbnode/inbox_test.go b/arbnode/inbox_test.go index 78c50f9de7..e588ef399b 100644 --- a/arbnode/inbox_test.go +++ b/arbnode/inbox_test.go @@ -61,7 +61,7 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (* initReader := statetransfer.NewMemoryInitDataReader(&initData) cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) - bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefault.TxLookupLimit, 0, common.Address{}) + bc, err := gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, gethexec.ConfigDefault.TxLookupLimit, 0) if err != nil { Fail(t, err) diff --git a/arbos/arbosState/initialization_test.go b/arbos/arbosState/initialization_test.go index 608ccfd194..5e605b8bd2 100644 --- a/arbos/arbosState/initialization_test.go +++ b/arbos/arbosState/initialization_test.go @@ -64,7 +64,7 @@ func tryMarshalUnmarshal(input *statetransfer.ArbosInitializationInfo, t *testin chainConfig := params.ArbitrumDevTestChainConfig() cacheConfig := core.DefaultCacheConfigWithScheme(env.GetTestStateScheme()) - stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0, common.Address{}) + stateroot, err := InitializeArbosInDatabase(raw, cacheConfig, initReader, chainConfig, arbostypes.TestInitMessage, 0, 0) Require(t, err) triedbConfig := cacheConfig.TriedbConfig() diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 0144390663..33ae5f8f1d 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -54,7 +54,7 @@ func MakeGenesisBlock(parentHash common.Hash, blockNumber uint64, timestamp uint return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)) } -func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint, chainOwner common.Address) (root common.Hash, err error) { +func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, timestamp uint64, accountsPerSync uint) (root common.Hash, err error) { triedbConfig := cacheConfig.TriedbConfig() triedbConfig.Preimages = false stateDatabase := state.NewDatabaseWithConfig(db, triedbConfig) @@ -96,8 +96,12 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, log.Crit("failed to open the ArbOS state", "error", err) } + chainOwner, err := initData.GetChainOwner() + if err != nil { + return common.Hash{}, err + } if chainOwner != (common.Address{}) { - err := arbosState.ChainOwners().Add(chainOwner) + err = arbosState.ChainOwners().Add(chainOwner) if err != nil { return common.Hash{}, err } diff --git a/cmd/nitro/init.go b/cmd/nitro/init.go index 9ff5431e2c..d4794f9fee 100644 --- a/cmd/nitro/init.go +++ b/cmd/nitro/init.go @@ -681,6 +681,7 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo Nonce: 0, }, }, + ChainOwner: common.HexToAddress(config.Init.DevInitAddress), } initDataReader = statetransfer.NewMemoryInitDataReader(&initData) } @@ -791,11 +792,7 @@ func openInitializeChainDb(ctx context.Context, stack *node.Node, config *NodeCo if !emptyBlockChain && (cacheConfig.StateScheme == rawdb.PathScheme) && config.Init.Force { return chainDb, nil, errors.New("It is not possible to force init with non-empty blockchain when using path scheme") } - var chainOwner common.Address - if config.Init.DevInit { - chainOwner = common.HexToAddress(config.Init.DevInitAddress) - } - l2BlockChain, err = gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initDataReader, chainConfig, parsedInitMessage, config.Execution.TxLookupLimit, config.Init.AccountsPerSync, chainOwner) + l2BlockChain, err = gethexec.WriteOrTestBlockChain(chainDb, cacheConfig, initDataReader, chainConfig, parsedInitMessage, config.Execution.TxLookupLimit, config.Init.AccountsPerSync) if err != nil { return chainDb, nil, err } diff --git a/execution/gethexec/blockchain.go b/execution/gethexec/blockchain.go index 7ecf2e0e2b..fda8f49093 100644 --- a/execution/gethexec/blockchain.go +++ b/execution/gethexec/blockchain.go @@ -125,7 +125,7 @@ func (c *CachingConfig) Validate() error { return c.validateStateScheme() } -func WriteOrTestGenblock(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, accountsPerSync uint, chainOwner common.Address) error { +func WriteOrTestGenblock(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, accountsPerSync uint) error { EmptyHash := common.Hash{} prevHash := EmptyHash prevDifficulty := big.NewInt(0) @@ -146,7 +146,7 @@ func WriteOrTestGenblock(chainDb ethdb.Database, cacheConfig *core.CacheConfig, } timestamp = prevHeader.Time } - stateRoot, err := arbosState.InitializeArbosInDatabase(chainDb, cacheConfig, initData, chainConfig, initMessage, timestamp, accountsPerSync, chainOwner) + stateRoot, err := arbosState.InitializeArbosInDatabase(chainDb, cacheConfig, initData, chainConfig, initMessage, timestamp, accountsPerSync) if err != nil { return err } @@ -213,7 +213,7 @@ func GetBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, chainC return core.NewBlockChain(chainDb, cacheConfig, chainConfig, nil, nil, engine, vmConfig, shouldPreserveFalse, &txLookupLimit) } -func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, txLookupLimit uint64, accountsPerSync uint, chainOwner common.Address) (*core.BlockChain, error) { +func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, initData statetransfer.InitDataReader, chainConfig *params.ChainConfig, initMessage *arbostypes.ParsedInitMessage, txLookupLimit uint64, accountsPerSync uint) (*core.BlockChain, error) { emptyBlockChain := rawdb.ReadHeadHeader(chainDb) == nil if !emptyBlockChain && (cacheConfig.StateScheme == rawdb.PathScheme) { // When using path scheme, and the stored state trie is not empty, @@ -222,7 +222,7 @@ func WriteOrTestBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig return GetBlockChain(chainDb, cacheConfig, chainConfig, txLookupLimit) } - err := WriteOrTestGenblock(chainDb, cacheConfig, initData, chainConfig, initMessage, accountsPerSync, chainOwner) + err := WriteOrTestGenblock(chainDb, cacheConfig, initData, chainConfig, initMessage, accountsPerSync) if err != nil { return nil, err } diff --git a/statetransfer/data.go b/statetransfer/data.go index df4694aa17..21268a443a 100644 --- a/statetransfer/data.go +++ b/statetransfer/data.go @@ -14,6 +14,7 @@ type ArbosInitializationInfo struct { AddressTableContents []common.Address RetryableData []InitializationDataForRetryable Accounts []AccountInitializationInfo + ChainOwner common.Address } type InitializationDataForRetryable struct { diff --git a/statetransfer/interface.go b/statetransfer/interface.go index 7d592b4430..cb70fdd14d 100644 --- a/statetransfer/interface.go +++ b/statetransfer/interface.go @@ -17,6 +17,7 @@ type InitDataReader interface { GetNextBlockNumber() (uint64, error) GetRetryableDataReader() (RetryableDataReader, error) GetAccountDataReader() (AccountDataReader, error) + GetChainOwner() (common.Address, error) } type ListReader interface { diff --git a/statetransfer/jsondatareader.go b/statetransfer/jsondatareader.go index c36061c0b0..5e992df3f0 100644 --- a/statetransfer/jsondatareader.go +++ b/statetransfer/jsondatareader.go @@ -210,3 +210,7 @@ func (r *JsonInitDataReader) GetAccountDataReader() (AccountDataReader, error) { JsonListReader: listreader, }, nil } + +func (r *JsonInitDataReader) GetChainOwner() (common.Address, error) { + return common.Address{}, nil +} diff --git a/statetransfer/memdatareader.go b/statetransfer/memdatareader.go index 1d60888937..3d6b68343c 100644 --- a/statetransfer/memdatareader.go +++ b/statetransfer/memdatareader.go @@ -99,6 +99,10 @@ func (r *MemoryInitDataReader) GetAccountDataReader() (AccountDataReader, error) }, nil } +func (r *MemoryInitDataReader) GetChainOwner() (common.Address, error) { + return r.d.ChainOwner, nil +} + func (r *MemoryInitDataReader) Close() error { return nil } diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 44c0e8f740..027a41d875 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -1346,7 +1346,7 @@ func createNonL1BlockChainWithStackConfig( } } coreCacheConfig := gethexec.DefaultCacheConfigFor(stack, &execConfig.Caching) - blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0, common.Address{}) + blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0) Require(t, err) return info, stack, chainDb, arbDb, blockchain @@ -1437,7 +1437,7 @@ func Create2ndNodeWithConfig( chainConfig := firstExec.ArbInterface.BlockChain().Config() coreCacheConfig := gethexec.DefaultCacheConfigFor(chainStack, &execConfig.Caching) - blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0, common.Address{}) + blockchain, err := gethexec.WriteOrTestBlockChain(chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest(t).TxLookupLimit, 0) Require(t, err) AddValNodeIfNeeded(t, ctx, nodeConfig, true, "", valnodeConfig.Wasm.RootPath) diff --git a/system_tests/state_fuzz_test.go b/system_tests/state_fuzz_test.go index 7e1fc57e63..c8312350e6 100644 --- a/system_tests/state_fuzz_test.go +++ b/system_tests/state_fuzz_test.go @@ -155,7 +155,6 @@ func FuzzStateTransition(f *testing.F) { initMessage, 0, 0, - common.Address{}, ) if err != nil { panic(err)