params: use the same variable name as EIP-4788 (#29195)

In https://eips.ethereum.org/EIPS/eip-4788 the name `BEACON_ROOTS_ADDRESS` is used. This change makes geth use the same variable name to avoid confusion.
pull/29275/head
Haotian 8 months ago committed by GitHub
parent d28adb61bf
commit cffb7c8604
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      core/chain_makers_test.go
  2. 4
      core/state_processor.go
  3. 8
      eth/catalyst/api_test.go
  4. 6
      params/protocol_params.go

@ -47,8 +47,8 @@ func TestGeneratePOSChain(t *testing.T) {
gspec = &Genesis{ gspec = &Genesis{
Config: &config, Config: &config,
Alloc: types.GenesisAlloc{ Alloc: types.GenesisAlloc{
address: {Balance: funds}, address: {Balance: funds},
params.BeaconRootsStorageAddress: {Balance: common.Big0, Code: asm4788}, params.BeaconRootsAddress: {Balance: common.Big0, Code: asm4788},
}, },
BaseFee: big.NewInt(params.InitialBaseFee), BaseFee: big.NewInt(params.InitialBaseFee),
Difficulty: common.Big1, Difficulty: common.Big1,
@ -180,7 +180,7 @@ func TestGeneratePOSChain(t *testing.T) {
} }
state, _ := blockchain.State() state, _ := blockchain.State()
idx := block.Time()%8191 + 8191 idx := block.Time()%8191 + 8191
got := state.GetState(params.BeaconRootsStorageAddress, common.BigToHash(new(big.Int).SetUint64(idx))) got := state.GetState(params.BeaconRootsAddress, common.BigToHash(new(big.Int).SetUint64(idx)))
if got != want { if got != want {
t.Fatalf("block %d, wrong parent beacon root in state: got %s, want %s", i, got, want) t.Fatalf("block %d, wrong parent beacon root in state: got %s, want %s", i, got, want)
} }

@ -181,11 +181,11 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *stat
GasPrice: common.Big0, GasPrice: common.Big0,
GasFeeCap: common.Big0, GasFeeCap: common.Big0,
GasTipCap: common.Big0, GasTipCap: common.Big0,
To: &params.BeaconRootsStorageAddress, To: &params.BeaconRootsAddress,
Data: beaconRoot[:], Data: beaconRoot[:],
} }
vmenv.Reset(NewEVMTxContext(msg), statedb) vmenv.Reset(NewEVMTxContext(msg), statedb)
statedb.AddAddressToAccessList(params.BeaconRootsStorageAddress) statedb.AddAddressToAccessList(params.BeaconRootsAddress)
_, _, _ = vmenv.Call(vm.AccountRef(msg.From), *msg.To, msg.Data, 30_000_000, common.U2560) _, _, _ = vmenv.Call(vm.AccountRef(msg.From), *msg.To, msg.Data, 30_000_000, common.U2560)
statedb.Finalise(true) statedb.Finalise(true)
} }

@ -72,8 +72,8 @@ func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block) {
genesis := &core.Genesis{ genesis := &core.Genesis{
Config: &config, Config: &config,
Alloc: types.GenesisAlloc{ Alloc: types.GenesisAlloc{
testAddr: {Balance: testBalance}, testAddr: {Balance: testBalance},
params.BeaconRootsStorageAddress: {Balance: common.Big0, Code: common.Hex2Bytes("3373fffffffffffffffffffffffffffffffffffffffe14604457602036146024575f5ffd5b620180005f350680545f35146037575f5ffd5b6201800001545f5260205ff35b6201800042064281555f359062018000015500")}, params.BeaconRootsAddress: {Balance: common.Big0, Code: common.Hex2Bytes("3373fffffffffffffffffffffffffffffffffffffffe14604457602036146024575f5ffd5b620180005f350680545f35146037575f5ffd5b6201800001545f5260205ff35b6201800042064281555f359062018000015500")},
}, },
ExtraData: []byte("test genesis"), ExtraData: []byte("test genesis"),
Timestamp: 9000, Timestamp: 9000,
@ -1650,10 +1650,10 @@ func TestParentBeaconBlockRoot(t *testing.T) {
rootIdx = common.BigToHash(big.NewInt(int64((execData.ExecutionPayload.Timestamp % 98304) + 98304))) rootIdx = common.BigToHash(big.NewInt(int64((execData.ExecutionPayload.Timestamp % 98304) + 98304)))
) )
if num := db.GetState(params.BeaconRootsStorageAddress, timeIdx); num != timeIdx { if num := db.GetState(params.BeaconRootsAddress, timeIdx); num != timeIdx {
t.Fatalf("incorrect number stored: want %s, got %s", timeIdx, num) t.Fatalf("incorrect number stored: want %s, got %s", timeIdx, num)
} }
if root := db.GetState(params.BeaconRootsStorageAddress, rootIdx); root != *blockParams.BeaconRoot { if root := db.GetState(params.BeaconRootsAddress, rootIdx); root != *blockParams.BeaconRoot {
t.Fatalf("incorrect root stored: want %s, got %s", *blockParams.BeaconRoot, root) t.Fatalf("incorrect root stored: want %s, got %s", *blockParams.BeaconRoot, root)
} }
} }

@ -184,8 +184,8 @@ var (
MinimumDifficulty = big.NewInt(131072) // The minimum that the difficulty may ever be. MinimumDifficulty = big.NewInt(131072) // The minimum that the difficulty may ever be.
DurationLimit = big.NewInt(13) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. DurationLimit = big.NewInt(13) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
// BeaconRootsStorageAddress is the address where historical beacon roots are stored as per EIP-4788 // BeaconRootsAddress is the address where historical beacon roots are stored as per EIP-4788
BeaconRootsStorageAddress = common.HexToAddress("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02") BeaconRootsAddress = common.HexToAddress("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02")
// SystemAddress is where the system-transaction is sent from as per EIP-4788 // SystemAddress is where the system-transaction is sent from as per EIP-4788
SystemAddress common.Address = common.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe") SystemAddress = common.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")
) )

Loading…
Cancel
Save