Skip to content

Commit

Permalink
Move ArbOS upgrade handling to a bit later in block production
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Nov 15, 2024
1 parent ee13024 commit 176b04d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
}
Expand Down

0 comments on commit 176b04d

Please sign in to comment.