Skip to content

Commit bd48a2b

Browse files
spencer-tbEikix
authored andcommitted
simulators/ethereum/engine: Beacon root pre-deploy address update (ethereum#839)
simulators/ethereum/engine: Update beacon root to latest spec.
1 parent a323ae7 commit bd48a2b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

simulators/ethereum/engine/config/cancun/constants.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ var (
2222
BLOB_COMMITMENT_VERSION_KZG = byte(0x01)
2323

2424
// EIP 4788
25-
HISTORY_STORAGE_ADDRESS = common.HexToAddress("0x000000000000000000000000000000000000000b")
26-
HISTORICAL_ROOTS_MODULUS = uint64(98304)
25+
BEACON_ROOTS_ADDRESS = common.HexToAddress("0xbEac00dDB15f3B6d645C48263dC93862413A222D")
26+
HISTORY_BUFFER_LENGTH = uint64(98304)
2727

2828
// Test constants
2929
DATAHASH_START_ADDRESS = big.NewInt(0x20000)

simulators/ethereum/engine/config/cancun/genesis.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ func ConfigGenesis(genesis *core.Genesis, forkTimestamp uint64) error {
2727
}
2828

2929
// Add bytecode pre deploy to the EIP-4788 address.
30-
genesis.Alloc[HISTORY_STORAGE_ADDRESS] = core.GenesisAccount{
30+
genesis.Alloc[BEACON_ROOTS_ADDRESS] = core.GenesisAccount{
3131
Balance: common.Big0,
3232
Nonce: 1,
33-
Code: common.Hex2Bytes("3373fffffffffffffffffffffffffffffffffffffffe14604457602036146024575f5ffd5b620180005f350680545f35146037575f5ffd5b6201800001545f5260205ff35b42620180004206555f3562018000420662018000015500"),
33+
Code: common.Hex2Bytes("3373fffffffffffffffffffffffffffffffffffffffe14604457602036146024575f5ffd5b620180005f350680545f35146037575f5ffd5b6201800001545f5260205ff35b6201800042064281555f359062018000015500"),
3434
}
3535

3636
return nil

simulators/ethereum/engine/suites/cancun/helpers.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ func VerifyTransactionFromNode(ctx context.Context, eth client.Eth, tx typ.Trans
132132

133133
func BeaconRootStorageIndexes(timestamp uint64) (common.Hash, common.Hash) {
134134
// Calculate keys
135-
timestampReduced := timestamp % cancun.HISTORICAL_ROOTS_MODULUS
136-
timestampExtended := timestampReduced + cancun.HISTORICAL_ROOTS_MODULUS
135+
timestampReduced := timestamp % cancun.HISTORY_BUFFER_LENGTH
136+
timestampExtended := timestampReduced + cancun.HISTORY_BUFFER_LENGTH
137137

138138
return common.BigToHash(new(big.Int).SetUint64(timestampReduced)), common.BigToHash(new(big.Int).SetUint64(timestampExtended))
139139
}

simulators/ethereum/engine/suites/cancun/steps.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func VerifyBeaconRootStorage(ctx context.Context, testEngine *test.TestEngineCli
261261
// Read the storage keys from the stateful precompile that stores the beacon roots and verify
262262
// that the beacon root is the same as the one in the payload
263263
blockNumber := new(big.Int).SetUint64(payload.Number)
264-
precompileAddress := cancun.HISTORY_STORAGE_ADDRESS
264+
precompileAddress := cancun.BEACON_ROOTS_ADDRESS
265265

266266
timestampKey, beaconRootKey := BeaconRootStorageIndexes(payload.Timestamp)
267267

0 commit comments

Comments
 (0)