-
Notifications
You must be signed in to change notification settings - Fork 21.3k
Closed
Labels
Description
Bug
$ geth --dev dumpgenesis > genesis.json
$ geth --dev --datadir=data init genesis.json
$ geth --dev --datadir=data console
> eth.estimateGas({from: "0xd67dC7d443C902bd6ABfBc91C9E2E6906f55Ca46", data: "0x5959f3"})
Error: invalid opcode: PUSH0
at web3.js:6382:9(39)
at send (web3.js:5116:62(29))
at <eval>:1:16(7)
Culprit
We determine random
value based on if difficulty
is set:
Lines 62 to 64 in a382917
if header.Difficulty.Cmp(common.Big0) == 0 { | |
random = &header.MixDigest | |
} |
But then here we use it as isMerge
for creating the chain rules.
Line 148 in a382917
chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time), |
The chain rules then dictate the instruction set, so we choose London instructions instead of Shanghai.
Resolution
I guess the main question is should we support this behavior. Is the genesis block technically considered post-merge? A simple fix would be to change the value that goes into Rules(..)
to be blockCtx.Random != nil || chainConfig.TerminalTotalDifficultyPassed
. But this doesn't feel too great either.