Skip to content

Commit 76d1bf2

Browse files
0xbenyfjl
authored andcommitted
core: deploy EIP-4788 contract in dev mode genesis (ethereum#29655)
Co-authored-by: Felix Lange <fjl@twurst.com>
1 parent 68db668 commit 76d1bf2

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

core/chain_makers_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ func TestGeneratePOSChain(t *testing.T) {
4343
bb = common.Address{0xbb}
4444
funds = big.NewInt(0).Mul(big.NewInt(1337), big.NewInt(params.Ether))
4545
config = *params.AllEthashProtocolChanges
46-
asm4788 = common.Hex2Bytes("3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500")
4746
gspec = &Genesis{
4847
Config: &config,
4948
Alloc: types.GenesisAlloc{
5049
address: {Balance: funds},
51-
params.BeaconRootsAddress: {Balance: common.Big0, Code: asm4788},
50+
params.BeaconRootsAddress: {Code: params.BeaconRootsCode},
5251
},
5352
BaseFee: big.NewInt(params.InitialBaseFee),
5453
Difficulty: common.Big1,

core/genesis.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ func DeveloperGenesisBlock(gasLimit uint64, faucet *common.Address) *Genesis {
593593
common.BytesToAddress([]byte{7}): {Balance: big.NewInt(1)}, // ECScalarMul
594594
common.BytesToAddress([]byte{8}): {Balance: big.NewInt(1)}, // ECPairing
595595
common.BytesToAddress([]byte{9}): {Balance: big.NewInt(1)}, // BLAKE2b
596+
// Pre-deploy EIP-4788 system contract
597+
params.BeaconRootsAddress: types.Account{Nonce: 1, Code: params.BeaconRootsCode},
596598
},
597599
}
598600
if faucet != nil {

params/protocol_params.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ var (
187187

188188
// BeaconRootsAddress is the address where historical beacon roots are stored as per EIP-4788
189189
BeaconRootsAddress = common.HexToAddress("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02")
190+
191+
// BeaconRootsCode is the code where historical beacon roots are stored as per EIP-4788
192+
BeaconRootsCode = common.FromHex("3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500")
193+
190194
// SystemAddress is where the system-transaction is sent from as per EIP-4788
191195
SystemAddress = common.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")
192196
)

0 commit comments

Comments
 (0)