From cce187a806f47420d6d9ac4756ee98ba597ef59f Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 11 May 2021 12:37:34 -0700 Subject: [PATCH 1/2] l2geth: allow for the configured max tx gaslimit to be set in the contracts --- l2geth/core/genesis.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/l2geth/core/genesis.go b/l2geth/core/genesis.go index 4787fd6794e5..61e37b0f4464 100644 --- a/l2geth/core/genesis.go +++ b/l2geth/core/genesis.go @@ -266,7 +266,7 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { } // ApplyOvmStateToState applies the initial OVM state to a state object. -func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, chainID *big.Int) { +func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDomainMessengerAddress common.Address, l1ETHGatewayAddress common.Address, addrManagerOwnerAddress common.Address, chainID *big.Int, gasLimit uint64) { if len(stateDump.Accounts) == 0 { return } @@ -325,6 +325,10 @@ func ApplyOvmStateToState(statedb *state.StateDB, stateDump *dump.OvmDump, l1XDo chainIdSlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000007") chainIdValue := common.BytesToHash(chainID.Bytes()) statedb.SetState(ExecutionManager.Address, chainIdSlot, chainIdValue) + log.Info("Setting maxTransactionGasLimit in ExecutionManager", "gas-limit", gasLimit) + maxTxGasLimitSlot := common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000004") + maxTxGasLimitValue := common.BytesToHash(new(big.Int).SetUint64(gasLimit).Bytes()) + statedb.SetState(ExecutionManager.Address, maxTxGasLimitSlot, maxTxGasLimitValue) } } @@ -338,7 +342,7 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { if vm.UsingOVM { // OVM_ENABLED - ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1ETHGatewayAddress, g.AddressManagerOwnerAddress, g.ChainID) + ApplyOvmStateToState(statedb, g.Config.StateDump, g.L1CrossDomainMessengerAddress, g.L1ETHGatewayAddress, g.AddressManagerOwnerAddress, g.ChainID, g.GasLimit) } for addr, account := range g.Alloc { From 19e1602d07ecf25eec2184f19a011756660aec40 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 11 May 2021 22:41:21 -0700 Subject: [PATCH 2/2] chore: add changeset --- .changeset/shaggy-news-glow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/shaggy-news-glow.md diff --git a/.changeset/shaggy-news-glow.md b/.changeset/shaggy-news-glow.md new file mode 100644 index 000000000000..8bcab326b0e1 --- /dev/null +++ b/.changeset/shaggy-news-glow.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Allow for dynamically set configuration of the gasLimit in the contracts by setting the storage slot at runtime