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 4bf2934
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
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
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 4bf2934

Please sign in to comment.