Skip to content

Commit

Permalink
upstream: pectra devnet 5 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 committed Jan 17, 2025
1 parent ca2fde4 commit a39b6e5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (b *BlockGen) collectRequests(readonly bool) (requests [][]byte) {
statedb = statedb.Copy()
}

if b.cm.config.IsPrague(b.header.Number, b.header.Time) {
if b.cm.config.IsPrague(b.header.Number, b.header.Time) && b.cm.config.Parlia == nil {
requests = [][]byte{}
// EIP-6110 deposits
var blockLogs []*types.Log
Expand Down
30 changes: 23 additions & 7 deletions core/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,29 @@ func testSetupGenesis(t *testing.T, scheme string) {
{
name: "mainnet block in DB, genesis == nil",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
DefaultGenesisBlock().MustCommit(db, triedb.NewDatabase(db, newDbConfig(scheme)))
DefaultBSCGenesisBlock().MustCommit(db, triedb.NewDatabase(db, newDbConfig(scheme)))
return SetupGenesisBlock(db, triedb.NewDatabase(db, newDbConfig(scheme)), nil)
},
wantHash: params.MainnetGenesisHash,
wantConfig: params.MainnetChainConfig,
wantHash: params.BSCGenesisHash,
wantConfig: params.BSCChainConfig,
},
{
name: "chapel block in DB, genesis == nil",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
DefaultChapelGenesisBlock().MustCommit(db, triedb.NewDatabase(db, newDbConfig(scheme)))
return SetupGenesisBlock(db, triedb.NewDatabase(db, newDbConfig(scheme)), nil)
},
wantHash: params.ChapelGenesisHash,
wantConfig: params.ChapelChainConfig,
},
{
name: "chapel block in DB, genesis == chapel",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
DefaultChapelGenesisBlock().MustCommit(db, triedb.NewDatabase(db, newDbConfig(scheme)))
return SetupGenesisBlock(db, triedb.NewDatabase(db, newDbConfig(scheme)), DefaultChapelGenesisBlock())
},
wantHash: params.ChapelGenesisHash,
wantConfig: params.ChapelChainConfig,
},
{
name: "custom block in DB, genesis == nil",
Expand All @@ -102,9 +120,7 @@ func testSetupGenesis(t *testing.T, scheme string) {
customg.Commit(db, tdb)
return SetupGenesisBlock(db, tdb, DefaultChapelGenesisBlock())
},
wantErr: &GenesisMismatchError{Stored: customghash, New: params.ChapelGenesisHash},
wantHash: params.ChapelGenesisHash,
wantConfig: params.ChapelChainConfig,
wantErr: &GenesisMismatchError{Stored: customghash, New: params.ChapelGenesisHash},
},
{
name: "compatible config in DB",
Expand Down Expand Up @@ -256,7 +272,7 @@ func TestConfigOrDefault(t *testing.T) {
t.Errorf("initial config should have PlanckBlock = nil, but instead PlanckBlock = %v", defaultGenesis.Config.PlanckBlock)
}
gHash := params.BSCGenesisHash
config := defaultGenesis.configOrDefault(gHash)
config := defaultGenesis.chainConfigOrDefault(gHash, nil)

if config.ChainID.Cmp(params.BSCChainConfig.ChainID) != 0 {
t.Errorf("ChainID of resulting config should be %v, but is %v instead", params.BSCChainConfig.ChainID, config.ChainID)
Expand Down
7 changes: 4 additions & 3 deletions core/state_prefetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func TestPrefetchLeaking(t *testing.T) {
Alloc: GenesisAlloc{address: {Balance: funds}},
BaseFee: big.NewInt(params.InitialBaseFee),
}
triedb = triedb.NewDatabase(gendb, nil)
genesis = gspec.MustCommit(gendb, triedb)
triedb1 = triedb.NewDatabase(gendb, nil)
genesis = gspec.MustCommit(gendb, triedb1)
signer = types.LatestSigner(gspec.Config)
)
blocks, _ := GenerateChain(gspec.Config, genesis, ethash.NewFaker(), gendb, 1, func(i int, block *BlockGen) {
Expand All @@ -52,7 +52,8 @@ func TestPrefetchLeaking(t *testing.T) {
}
})
archiveDb := rawdb.NewMemoryDatabase()
gspec.MustCommit(archiveDb, triedb)
triedb2 := triedb.NewDatabase(archiveDb, nil)
gspec.MustCommit(archiveDb, triedb2)
archive, _ := NewBlockChain(archiveDb, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
defer archive.Stop()

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1597,8 +1597,6 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down

0 comments on commit a39b6e5

Please sign in to comment.