Skip to content
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
9 changes: 5 additions & 4 deletions simulators/ethereum/engine/suites/cancun/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ func (bs *CancunBaseSpec) GetGenesis() *core.Genesis {
}
}

// Add 1 wei to the 4788 stateful precompile so its account is not deleted at the end of
// block execution.
genesis.Alloc[common.BigToAddress(new(big.Int).SetUint64(uint64(HISTORY_STORAGE_ADDRESS)))] = core.GenesisAccount{
Balance: big.NewInt(1),
// Add bytecode pre deploy to the EIP-4788 address.
genesis.Alloc[HISTORY_STORAGE_ADDRESS] = core.GenesisAccount{
Balance: common.Big0,
Nonce: 1,
Code: common.Hex2Bytes("0x3373fffffffffffffffffffffffffffffffffffffffe14604457602036146024575f5ffd5b620180005f350680545f35146037575f5ffd5b6201800001545f5260205ff35b42620180004206555f3562018000420662018000015500"),
}

return genesis
Expand Down
2 changes: 1 addition & 1 deletion simulators/ethereum/engine/suites/cancun/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func VerifyBeaconRootStorage(ctx context.Context, testEngine *test.TestEngineCli
// Read the storage keys from the stateful precompile that stores the beacon roots and verify
// that the beacon root is the same as the one in the payload
blockNumber := new(big.Int).SetUint64(payload.Number)
precompileAddress := common.BytesToAddress([]byte{HISTORY_STORAGE_ADDRESS})
precompileAddress := HISTORY_STORAGE_ADDRESS

timestampKey, beaconRootKey := BeaconRootStorageIndexes(payload.Timestamp)

Expand Down
2 changes: 1 addition & 1 deletion simulators/ethereum/engine/suites/cancun/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
BLOB_COMMITMENT_VERSION_KZG = byte(0x01)

// EIP 4788 specific constants
HISTORY_STORAGE_ADDRESS = uint8(0x0B)
HISTORY_STORAGE_ADDRESS = common.HexToAddress("0x000000000000000000000000000000000000000b")
HISTORICAL_ROOTS_MODULUS = uint64(98304)

// Engine API errors
Expand Down