Skip to content

Commit

Permalink
el-consensus: Add 2935 condition to fail silently if no code in Histo…
Browse files Browse the repository at this point in the history
…ryStorageAddress (#11780)

Few points:
- Of the two options for inserting the parent block hash , we go for
option 2, that is `Avoid EVM processing and directly write to the state
trie.` .
- Although option 1 is preferred "till verkle", there is no benefit in
adding the EVM overhead. Furthermore, verkle-related changes will be
there afterwards.
- Now this necessitates additional checking - `if no code exists at
HISTORY_STORAGE_ADDRESS, the call must fail silently`.
- We include this check and add a debug log for the fail

Ref:
https://github.com/ethereum/EIPs/blob/117933b21665ca7c0d040835a9d19b4a02392f47/EIPS/eip-2935.md
  • Loading branch information
somnathb1 authored Aug 28, 2024
1 parent bcc8850 commit d08ed74
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions consensus/misc/eip2935.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/erigontech/erigon-lib/chain"
libcommon "github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/log/v3"

"github.com/erigontech/erigon/consensus"
"github.com/erigontech/erigon/core/state"
Expand All @@ -29,6 +30,10 @@ import (
)

func StoreBlockHashesEip2935(header *types.Header, state *state.IntraBlockState, config *chain.Config, headerReader consensus.ChainHeaderReader) {
if state.GetCodeSize(params.HistoryStorageAddress) == 0 {
log.Debug("[EIP-2935] No code deployed to HistoryStorageAddress before call to store EIP-2935 history")
return
}
headerNum := header.Number.Uint64()
if headerNum == 0 { // Activation of fork at Genesis
return
Expand Down

0 comments on commit d08ed74

Please sign in to comment.