From 176b04de4f8b636a65c9e36f3d7746e768370b4b Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Fri, 15 Nov 2024 10:58:19 -0600 Subject: [PATCH] Move ArbOS upgrade handling to a bit later in block production --- arbos/block_processor.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arbos/block_processor.go b/arbos/block_processor.go index e654531880..fe0a39d230 100644 --- a/arbos/block_processor.go +++ b/arbos/block_processor.go @@ -340,18 +340,6 @@ func ProduceBlockAdvanced( return receipt, result, nil })() - 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 - } - // 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 hooks.TxErrors = append(hooks.TxErrors, err) @@ -373,6 +361,18 @@ func ProduceBlockAdvanced( continue } + 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 + } + // Update the ArbOS version in the header (if it changed) + extraInfo := types.DeserializeHeaderExtraInformation(header) + extraInfo.ArbOSFormatVersion = state.ArbOSVersion() + extraInfo.UpdateHeaderWithInfo(header) + } + if tx.Type() == types.ArbitrumInternalTxType && result.Err != nil { return nil, nil, fmt.Errorf("failed to apply internal transaction: %w", result.Err) }