Skip to content

Skip calling ProcessParentBlockHash in geth for arbitrum chain #445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
if beaconRoot := pre.Env.ParentBeaconBlockRoot; beaconRoot != nil {
core.ProcessBeaconBlockRoot(*beaconRoot, evm)
}
if pre.Env.BlockHashes != nil && chainConfig.IsPrague(new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp, vmContext.ArbOSVersion) {
if !chainConfig.IsArbitrum() && pre.Env.BlockHashes != nil && chainConfig.IsPrague(new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp, vmContext.ArbOSVersion) {
var (
prevNumber = pre.Env.Number - 1
prevHash = pre.Env.BlockHashes[math.HexOrDecimal64(prevNumber)]
Expand Down
2 changes: 1 addition & 1 deletion core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
}

blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
if config.IsPrague(b.header.Number, b.header.Time, blockContext.ArbOSVersion) || config.IsVerkle(b.header.Number, b.header.Time) {
if !config.IsArbitrum() && config.IsPrague(b.header.Number, b.header.Time, blockContext.ArbOSVersion) || config.IsVerkle(b.header.Number, b.header.Time) {
// EIP-2935
blockContext.Random = &common.Hash{} // enable post-merge instruction set
evm := vm.NewEVM(blockContext, statedb, cm.config, vm.Config{})
Expand Down
2 changes: 1 addition & 1 deletion eth/state_accessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block,
core.ProcessBeaconBlockRoot(*beaconRoot, evm)
}
// If prague hardfork, insert parent block hash in the state as per EIP-2935.
if eth.blockchain.Config().IsPrague(block.Number(), block.Time(), context.ArbOSVersion) {
if !eth.blockchain.Config().IsArbitrum() && eth.blockchain.Config().IsPrague(block.Number(), block.Time(), context.ArbOSVersion) {
core.ProcessParentBlockHash(block.ParentHash(), evm)
}
if txIndex == 0 && len(block.Transactions()) == 0 {
Expand Down
8 changes: 4 additions & 4 deletions eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed
core.ProcessBeaconBlockRoot(*beaconRoot, evm)
}
// Insert parent hash in history contract.
if api.backend.ChainConfig().IsPrague(next.Number(), next.Time(), context.ArbOSVersion) {
if !api.backend.ChainConfig().IsArbitrum() && api.backend.ChainConfig().IsPrague(next.Number(), next.Time(), context.ArbOSVersion) {
core.ProcessParentBlockHash(next.ParentHash(), evm)
}
// Clean out any pending release functions of trace state. Note this
Expand Down Expand Up @@ -544,7 +544,7 @@ func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
core.ProcessBeaconBlockRoot(*beaconRoot, evm)
}
if chainConfig.IsPrague(block.Number(), block.Time(), vmctx.ArbOSVersion) {
if !chainConfig.IsArbitrum() && chainConfig.IsPrague(block.Number(), block.Time(), vmctx.ArbOSVersion) {
core.ProcessParentBlockHash(block.ParentHash(), evm)
}
for i, tx := range block.Transactions() {
Expand Down Expand Up @@ -608,7 +608,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
core.ProcessBeaconBlockRoot(*beaconRoot, evm)
}
if api.backend.ChainConfig().IsPrague(block.Number(), block.Time(), blockCtx.ArbOSVersion) {
if !api.backend.ChainConfig().IsArbitrum() && api.backend.ChainConfig().IsPrague(block.Number(), block.Time(), blockCtx.ArbOSVersion) {
core.ProcessParentBlockHash(block.ParentHash(), evm)
}

Expand Down Expand Up @@ -787,7 +787,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
core.ProcessBeaconBlockRoot(*beaconRoot, evm)
}
if chainConfig.IsPrague(block.Number(), block.Time(), vmctx.ArbOSVersion) {
if !chainConfig.IsArbitrum() && chainConfig.IsPrague(block.Number(), block.Time(), vmctx.ArbOSVersion) {
core.ProcessParentBlockHash(block.ParentHash(), evm)
}
for i, tx := range block.Transactions() {
Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
if precompiles != nil {
evm.SetPrecompiles(precompiles)
}
if sim.chainConfig.IsPrague(header.Number, header.Time, parentArbOSVersion) || sim.chainConfig.IsVerkle(header.Number, header.Time) {
if !sim.chainConfig.IsArbitrum() && sim.chainConfig.IsPrague(header.Number, header.Time, parentArbOSVersion) || sim.chainConfig.IsVerkle(header.Number, header.Time) {
core.ProcessParentBlockHash(header.ParentHash, evm)
}
var allLogs []*types.Log
Expand Down
2 changes: 1 addition & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir
if header.ParentBeaconRoot != nil {
core.ProcessBeaconBlockRoot(*header.ParentBeaconRoot, env.evm)
}
if miner.chainConfig.IsPrague(header.Number, header.Time, prevArbosVersion) {
if !miner.chainConfig.IsArbitrum() && miner.chainConfig.IsPrague(header.Number, header.Time, prevArbosVersion) {
core.ProcessParentBlockHash(header.ParentHash, env.evm)
}
return env, nil
Expand Down
Loading