diff --git a/arbos/block_processor.go b/arbos/block_processor.go index 731f6a3357..9f208c4404 100644 --- a/arbos/block_processor.go +++ b/arbos/block_processor.go @@ -54,7 +54,7 @@ func (info *L1Info) L1BlockNumber() uint64 { return info.l1BlockNumber } -func createNewHeader(prevHeader *types.Header, l1info *L1Info, state *arbosState.ArbosState, chainConfig *params.ChainConfig, updateHeaderWithInfo bool) *types.Header { +func createNewHeader(prevHeader *types.Header, l1info *L1Info, state *arbosState.ArbosState, chainConfig *params.ChainConfig) *types.Header { l2Pricing := state.L2PricingState() baseFee, err := l2Pricing.BaseFeeWei() state.Restrict(err) @@ -96,30 +96,6 @@ func createNewHeader(prevHeader *types.Header, l1info *L1Info, state *arbosState Nonce: [8]byte{}, // Filled in later; post-merge Ethereum will require this to be zero BaseFee: baseFee, } - - if updateHeaderWithInfo { - var sendRoot common.Hash - var sendCount uint64 - var nextL1BlockNumber uint64 - var arbosVersion uint64 - - if blockNumber.Uint64() == chainConfig.ArbitrumChainParams.GenesisBlockNum { - arbosVersion = chainConfig.ArbitrumChainParams.InitialArbOSVersion - } else { - acc := state.SendMerkleAccumulator() - sendRoot, _ = acc.Root() - sendCount, _ = acc.Size() - nextL1BlockNumber, _ = state.Blockhashes().L1BlockNumber() - arbosVersion = state.ArbOSVersion() - } - arbitrumHeader := types.HeaderInfo{ - SendRoot: sendRoot, - SendCount: sendCount, - L1BlockNumber: nextL1BlockNumber, - ArbOSFormatVersion: arbosVersion, - } - arbitrumHeader.UpdateHeaderWithInfo(header) - } return header } @@ -213,7 +189,7 @@ func ProduceBlockAdvanced( l1Timestamp: l1Header.Timestamp, } - header := createNewHeader(lastBlockHeader, l1Info, state, chainConfig, false) + header := createNewHeader(lastBlockHeader, l1Info, state, chainConfig) signer := types.MakeSigner(chainConfig, header.Number) // Note: blockGasLeft will diverge from the actual gas left during execution in the event of invalid txs, // but it's only used as block-local representation limiting the amount of work done in a block. @@ -349,11 +325,15 @@ func ProduceBlockAdvanced( })() if tx.Type() == types.ArbitrumInternalTxType { + // ArbOS might have upgraded to a new version, so we need to refresh our state state, err = arbosState.OpenSystemArbosState(statedb, nil, true) if err != nil { return nil, nil, err } - header = createNewHeader(lastBlockHeader, l1Info, state, chainConfig, true) + // Update the ArbOS version in the header (if it changed) + extraInfo := types.DeserializeHeaderExtraInformation(header) + extraInfo.ArbOSFormatVersion = state.ArbOSVersion() + extraInfo.UpdateHeaderWithInfo(header) } // append the err, even if it is nil