diff --git a/cicd/devnet/genesis.json b/cicd/devnet/genesis.json index b92159f330..cdaf282409 100644 --- a/cicd/devnet/genesis.json +++ b/cicd/devnet/genesis.json @@ -7,6 +7,7 @@ "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, + "eip1559Block": 0, "XDPoS": { "period": 2, "epoch": 900, @@ -275,4 +276,4 @@ "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "baseFeePerGas": null -} \ No newline at end of file +} diff --git a/cicd/testnet/genesis.json b/cicd/testnet/genesis.json index 7a49caca5a..6f643f78e9 100644 --- a/cicd/testnet/genesis.json +++ b/cicd/testnet/genesis.json @@ -7,6 +7,7 @@ "eip155Block": 3, "eip158Block": 3, "byzantiumBlock": 4, + "eip1559Block": 71550000, "XDPoS": { "period": 2, "epoch": 900, @@ -138,4 +139,4 @@ "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" -} \ No newline at end of file +} diff --git a/cmd/XDC/chaincmd.go b/cmd/XDC/chaincmd.go index e936d460d2..7485071d99 100644 --- a/cmd/XDC/chaincmd.go +++ b/cmd/XDC/chaincmd.go @@ -184,6 +184,10 @@ func initGenesis(ctx *cli.Context) error { utils.Fatalf("invalid genesis json: %v", err) } + if genesis.Config.ChainId != nil { + common.CopyConstans(genesis.Config.ChainId.Uint64()) + } + // Open an initialise both full and light databases stack, _ := makeFullNode(ctx) defer stack.Close() @@ -198,7 +202,7 @@ func initGenesis(ctx *cli.Context) error { utils.Fatalf("Failed to write genesis block: %v", err) } chaindb.Close() - log.Info("Successfully wrote genesis state", "database", name, "hash", hash) + log.Info("Successfully wrote genesis state", "database", name, "hash", hash.String()) return nil } diff --git a/core/genesis.go b/core/genesis.go index d9f3b3da60..8352f11d72 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -213,6 +213,10 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { if g.Difficulty == nil { head.Difficulty = params.GenesisDifficulty } + + // Notice: Eip1559Block affects the block hash, we must set: + // 1. g.Config.Eip1559Block + // 2. or common.Eip1559Block if g.Config != nil && g.Config.IsEIP1559(common.Big0) { if g.BaseFee != nil { head.BaseFee = g.BaseFee @@ -220,6 +224,7 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block { head.BaseFee = new(big.Int).SetUint64(params.InitialBaseFee) } } + statedb.Commit(false) statedb.Database().TrieDB().Commit(root, true) diff --git a/genesis/devnet.json b/genesis/devnet.json index b92159f330..cdaf282409 100644 --- a/genesis/devnet.json +++ b/genesis/devnet.json @@ -7,6 +7,7 @@ "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, + "eip1559Block": 0, "XDPoS": { "period": 2, "epoch": 900, @@ -275,4 +276,4 @@ "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "baseFeePerGas": null -} \ No newline at end of file +} diff --git a/genesis/testnet.json b/genesis/testnet.json index 7a49caca5a..6f643f78e9 100644 --- a/genesis/testnet.json +++ b/genesis/testnet.json @@ -7,6 +7,7 @@ "eip155Block": 3, "eip158Block": 3, "byzantiumBlock": 4, + "eip1559Block": 71550000, "XDPoS": { "period": 2, "epoch": 900, @@ -138,4 +139,4 @@ "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" -} \ No newline at end of file +}