From f768136102df58d6442d87eca4a28a07183fdd09 Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Mon, 14 Nov 2022 17:38:12 +0530 Subject: [PATCH 1/8] init : baseFeeChangeDenom HardFork Changes --- builder/files/genesis-mainnet-v1.json | 1 + builder/files/genesis-testnet-v4.json | 1 + consensus/misc/eip1559.go | 7 ++-- consensus/misc/eip1559_test.go | 42 ++++++++++++++++++- internal/cli/server/chains/mainnet.go | 1 + internal/cli/server/chains/mumbai.go | 1 + params/config.go | 7 ++++ params/protocol_params.go | 16 +++++-- tests/bor/testdata/genesis.json | 1 + tests/bor/testdata/genesis_21val.json | 1 + tests/bor/testdata/genesis_2val.json | 1 + tests/bor/testdata/genesis_7val.json | 1 + .../genesis_sprint_length_change.json | 1 + 13 files changed, 73 insertions(+), 8 deletions(-) diff --git a/builder/files/genesis-mainnet-v1.json b/builder/files/genesis-mainnet-v1.json index d3f0d02206..e6ed7c8efc 100644 --- a/builder/files/genesis-mainnet-v1.json +++ b/builder/files/genesis-mainnet-v1.json @@ -15,6 +15,7 @@ "londonBlock": 23850000, "bor": { "jaipurBlock": 23850000, + "delhiBlock": 36507200, "period": { "0": 2 }, diff --git a/builder/files/genesis-testnet-v4.json b/builder/files/genesis-testnet-v4.json index 8a0af45088..c7efb7ef63 100644 --- a/builder/files/genesis-testnet-v4.json +++ b/builder/files/genesis-testnet-v4.json @@ -15,6 +15,7 @@ "londonBlock": 22640000, "bor": { "jaipurBlock": 22770000, + "delhiBlock": 29392500, "period": { "0": 2, "25275000": 5 diff --git a/consensus/misc/eip1559.go b/consensus/misc/eip1559.go index 8fca0fdc70..f620f9504e 100644 --- a/consensus/misc/eip1559.go +++ b/consensus/misc/eip1559.go @@ -59,9 +59,10 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int { } var ( - parentGasTarget = parent.GasLimit / params.ElasticityMultiplier - parentGasTargetBig = new(big.Int).SetUint64(parentGasTarget) - baseFeeChangeDenominator = new(big.Int).SetUint64(params.BaseFeeChangeDenominator) + parentGasTarget = parent.GasLimit / params.ElasticityMultiplier + parentGasTargetBig = new(big.Int).SetUint64(parentGasTarget) + baseFeeChangeDenominatorUint64 = params.BaseFeeChangeDenominator(config.Bor, parent.Number.Uint64()) + baseFeeChangeDenominator = new(big.Int).SetUint64(baseFeeChangeDenominatorUint64) ) // If the parent gasUsed is the same as the target, the baseFee remains unchanged. if parent.GasUsed == parentGasTarget { diff --git a/consensus/misc/eip1559_test.go b/consensus/misc/eip1559_test.go index 23cd9023de..0d757105c7 100644 --- a/consensus/misc/eip1559_test.go +++ b/consensus/misc/eip1559_test.go @@ -20,7 +20,6 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" ) @@ -47,12 +46,14 @@ func copyConfig(original *params.ChainConfig) *params.ChainConfig { TerminalTotalDifficulty: original.TerminalTotalDifficulty, Ethash: original.Ethash, Clique: original.Clique, + Bor: original.Bor, } } func config() *params.ChainConfig { config := copyConfig(params.TestChainConfig) config.LondonBlock = big.NewInt(5) + config.Bor.DelhiBlock = 8 return config } @@ -117,10 +118,12 @@ func TestCalcBaseFee(t *testing.T) { {params.InitialBaseFee, 20000000, 10000000, params.InitialBaseFee}, // usage == target {params.InitialBaseFee, 20000000, 9000000, 987500000}, // usage below target {params.InitialBaseFee, 20000000, 11000000, 1012500000}, // usage above target + {params.InitialBaseFee, 20000000, 20000000, 1125000000}, // usage full + {params.InitialBaseFee, 20000000, 0, 875000000}, // usage 0 } for i, test := range tests { parent := &types.Header{ - Number: common.Big32, + Number: big.NewInt(6), GasLimit: test.parentGasLimit, GasUsed: test.parentGasUsed, BaseFee: big.NewInt(test.parentBaseFee), @@ -130,3 +133,38 @@ func TestCalcBaseFee(t *testing.T) { } } } + +// TestCalcBaseFee assumes all blocks are 1559-blocks post Delhi Hard Fork +func TestCalcBaseFeeDelhi(t *testing.T) { + + testConfig := copyConfig(config()) + + // Test Delhi Hard Fork + // Hard fork kicks in at block 8 + + tests := []struct { + parentBaseFee int64 + parentGasLimit uint64 + parentGasUsed uint64 + expectedBaseFee int64 + }{ + {params.InitialBaseFee, 20000000, 10000000, params.InitialBaseFee}, // usage == target + {params.InitialBaseFee, 20000000, 9000000, 993750000}, // usage below target + {params.InitialBaseFee, 20000000, 11000000, 1006250000}, // usage above target + {params.InitialBaseFee, 20000000, 20000000, 1062500000}, // usage full + {params.InitialBaseFee, 20000000, 0, 937500000}, // usage 0 + + } + for i, test := range tests { + parent := &types.Header{ + Number: big.NewInt(8), + GasLimit: test.parentGasLimit, + GasUsed: test.parentGasUsed, + BaseFee: big.NewInt(test.parentBaseFee), + } + if have, want := CalcBaseFee(testConfig, parent), big.NewInt(test.expectedBaseFee); have.Cmp(want) != 0 { + t.Errorf("test %d: have %d want %d, ", i, have, want) + } + } + +} diff --git a/internal/cli/server/chains/mainnet.go b/internal/cli/server/chains/mainnet.go index 20ff8bc9f2..bd41733704 100644 --- a/internal/cli/server/chains/mainnet.go +++ b/internal/cli/server/chains/mainnet.go @@ -30,6 +30,7 @@ var mainnetBor = &Chain{ LondonBlock: big.NewInt(23850000), Bor: ¶ms.BorConfig{ JaipurBlock: 23850000, + DelhiBlock: 36507200, Period: map[string]uint64{ "0": 2, }, diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index 9015e1b82b..29e33a283a 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -30,6 +30,7 @@ var mumbaiTestnet = &Chain{ LondonBlock: big.NewInt(22640000), Bor: ¶ms.BorConfig{ JaipurBlock: 22770000, + DelhiBlock: 29392500, Period: map[string]uint64{ "0": 2, "25275000": 5, diff --git a/params/config.go b/params/config.go index fe17f31bb0..2c99c4fb4c 100644 --- a/params/config.go +++ b/params/config.go @@ -350,6 +350,7 @@ var ( LondonBlock: big.NewInt(22640000), Bor: &BorConfig{ JaipurBlock: 22770000, + DelhiBlock: 29392500, Period: map[string]uint64{ "0": 2, "25275000": 5, @@ -399,6 +400,7 @@ var ( LondonBlock: big.NewInt(23850000), Bor: &BorConfig{ JaipurBlock: 23850000, + DelhiBlock: 36507200, Period: map[string]uint64{ "0": 2, }, @@ -577,6 +579,7 @@ type BorConfig struct { BlockAlloc map[string]interface{} `json:"blockAlloc"` BurntContract map[string]string `json:"burntContract"` // governance contract where the token will be sent to and burnt in london fork JaipurBlock uint64 `json:"jaipurBlock"` // Jaipur switch block (nil = no fork, 0 = already on jaipur) + DelhiBlock uint64 `json:"delhiBlock"` // Delhi switch block (nil = no fork, 0 = already on delhi) } // String implements the stringer interface, returning the consensus engine details. @@ -604,6 +607,10 @@ func (c *BorConfig) IsJaipur(number uint64) bool { return number >= c.JaipurBlock } +func (c *BorConfig) IsDelhi(number uint64) bool { + return number >= c.DelhiBlock +} + func (c *BorConfig) calculateBorConfigHelper(field map[string]uint64, number uint64) uint64 { keys := make([]string, 0, len(field)) for k := range field { diff --git a/params/protocol_params.go b/params/protocol_params.go index 5f154597a7..d65f9420a8 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -119,9 +119,11 @@ const ( // Introduced in Tangerine Whistle (Eip 150) CreateBySelfdestructGas uint64 = 25000 - BaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. - ElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. - InitialBaseFee = 1000000000 // Initial base fee for EIP-1559 blocks. + BaseFeeChangeDenominatorPreDelhi = 8 // Bounds the amount the base fee can change between blocks before Delhi Hard Fork. + BaseFeeChangeDenominatorPostDelhi = 16 // Bounds the amount the base fee can change between blocks after Delhi Hard Fork. + + ElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. + InitialBaseFee = 1000000000 // Initial base fee for EIP-1559 blocks. MaxCodeSize = 24576 // Maximum bytecode to permit for a contract @@ -168,3 +170,11 @@ var ( 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. ) + +func BaseFeeChangeDenominator(borConfig *BorConfig, number uint64) uint64 { + if borConfig.IsDelhi(number) { + return BaseFeeChangeDenominatorPostDelhi + } else { + return BaseFeeChangeDenominatorPreDelhi + } +} diff --git a/tests/bor/testdata/genesis.json b/tests/bor/testdata/genesis.json index 87a7ea0b98..cbae055a0a 100644 --- a/tests/bor/testdata/genesis.json +++ b/tests/bor/testdata/genesis.json @@ -15,6 +15,7 @@ "londonBlock": 1, "bor": { "jaipurBlock": 2, + "delhiBlock" :3, "period": { "0": 1 }, diff --git a/tests/bor/testdata/genesis_21val.json b/tests/bor/testdata/genesis_21val.json index 2f67e56073..e2c604b1dc 100644 --- a/tests/bor/testdata/genesis_21val.json +++ b/tests/bor/testdata/genesis_21val.json @@ -15,6 +15,7 @@ "londonBlock": 0, "bor": { "jaipurBlock": 0, + "delhiBlock" :0, "period": { "0": 1 }, diff --git a/tests/bor/testdata/genesis_2val.json b/tests/bor/testdata/genesis_2val.json index 4ff647dde4..5ce5fbcd4e 100644 --- a/tests/bor/testdata/genesis_2val.json +++ b/tests/bor/testdata/genesis_2val.json @@ -15,6 +15,7 @@ "londonBlock": 1, "bor": { "jaipurBlock": 2, + "delhiBlock" :3, "period": { "0": 1 }, diff --git a/tests/bor/testdata/genesis_7val.json b/tests/bor/testdata/genesis_7val.json index 7fd5d08057..97982a3deb 100644 --- a/tests/bor/testdata/genesis_7val.json +++ b/tests/bor/testdata/genesis_7val.json @@ -15,6 +15,7 @@ "londonBlock": 0, "bor": { "jaipurBlock": 0, + "delhiBlock" :0, "period": { "0": 1 }, diff --git a/tests/bor/testdata/genesis_sprint_length_change.json b/tests/bor/testdata/genesis_sprint_length_change.json index ce6a2cb5f4..cb6eb2a729 100644 --- a/tests/bor/testdata/genesis_sprint_length_change.json +++ b/tests/bor/testdata/genesis_sprint_length_change.json @@ -15,6 +15,7 @@ "londonBlock": 1, "bor": { "jaipurBlock": 2, + "delhiBlock" :3, "period": { "0": 1 }, From 7d92be2f176f5ee0196ae8f68357225ffdbd58ad Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Mon, 14 Nov 2022 17:52:55 +0530 Subject: [PATCH 2/8] fix : jaipurFork & baseFeeChangeDenom hardfork num to bigInt --- consensus/bor/bor.go | 2 +- consensus/bor/bor_test.go | 8 ++++---- consensus/misc/eip1559.go | 2 +- consensus/misc/eip1559_test.go | 2 +- internal/cli/server/chains/mainnet.go | 4 ++-- internal/cli/server/chains/mumbai.go | 4 ++-- params/config.go | 20 ++++++++++---------- params/protocol_params.go | 2 +- tests/bor/bor_test.go | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 3cc8c68ec2..1b4ddec45d 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -169,7 +169,7 @@ func encodeSigHeader(w io.Writer, header *types.Header, c *params.BorConfig) { header.Nonce, } - if c.IsJaipur(header.Number.Uint64()) { + if c.IsJaipur(header.Number) { if header.BaseFee != nil { enc = append(enc, header.BaseFee) } diff --git a/consensus/bor/bor_test.go b/consensus/bor/bor_test.go index fc2d59520d..9ca361a18d 100644 --- a/consensus/bor/bor_test.go +++ b/consensus/bor/bor_test.go @@ -125,20 +125,20 @@ func TestEncodeSigHeaderJaipur(t *testing.T) { ) // Jaipur NOT enabled and BaseFee not set - hash := SealHash(h, ¶ms.BorConfig{JaipurBlock: 10}) + hash := SealHash(h, ¶ms.BorConfig{JaipurBlock: big.NewInt(10)}) require.Equal(t, hash, hashWithoutBaseFee) // Jaipur enabled (Jaipur=0) and BaseFee not set - hash = SealHash(h, ¶ms.BorConfig{JaipurBlock: 0}) + hash = SealHash(h, ¶ms.BorConfig{JaipurBlock: common.Big0}) require.Equal(t, hash, hashWithoutBaseFee) h.BaseFee = big.NewInt(2) // Jaipur enabled (Jaipur=Header block) and BaseFee set - hash = SealHash(h, ¶ms.BorConfig{JaipurBlock: 1}) + hash = SealHash(h, ¶ms.BorConfig{JaipurBlock: common.Big1}) require.Equal(t, hash, hashWithBaseFee) // Jaipur NOT enabled and BaseFee set - hash = SealHash(h, ¶ms.BorConfig{JaipurBlock: 10}) + hash = SealHash(h, ¶ms.BorConfig{JaipurBlock: big.NewInt(10)}) require.Equal(t, hash, hashWithoutBaseFee) } diff --git a/consensus/misc/eip1559.go b/consensus/misc/eip1559.go index f620f9504e..193a5b84e2 100644 --- a/consensus/misc/eip1559.go +++ b/consensus/misc/eip1559.go @@ -61,7 +61,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int { var ( parentGasTarget = parent.GasLimit / params.ElasticityMultiplier parentGasTargetBig = new(big.Int).SetUint64(parentGasTarget) - baseFeeChangeDenominatorUint64 = params.BaseFeeChangeDenominator(config.Bor, parent.Number.Uint64()) + baseFeeChangeDenominatorUint64 = params.BaseFeeChangeDenominator(config.Bor, parent.Number) baseFeeChangeDenominator = new(big.Int).SetUint64(baseFeeChangeDenominatorUint64) ) // If the parent gasUsed is the same as the target, the baseFee remains unchanged. diff --git a/consensus/misc/eip1559_test.go b/consensus/misc/eip1559_test.go index 0d757105c7..2509105306 100644 --- a/consensus/misc/eip1559_test.go +++ b/consensus/misc/eip1559_test.go @@ -53,7 +53,7 @@ func copyConfig(original *params.ChainConfig) *params.ChainConfig { func config() *params.ChainConfig { config := copyConfig(params.TestChainConfig) config.LondonBlock = big.NewInt(5) - config.Bor.DelhiBlock = 8 + config.Bor.DelhiBlock = big.NewInt(8) return config } diff --git a/internal/cli/server/chains/mainnet.go b/internal/cli/server/chains/mainnet.go index bd41733704..485188983e 100644 --- a/internal/cli/server/chains/mainnet.go +++ b/internal/cli/server/chains/mainnet.go @@ -29,8 +29,8 @@ var mainnetBor = &Chain{ BerlinBlock: big.NewInt(14750000), LondonBlock: big.NewInt(23850000), Bor: ¶ms.BorConfig{ - JaipurBlock: 23850000, - DelhiBlock: 36507200, + JaipurBlock: big.NewInt(23850000), + DelhiBlock: big.NewInt(36507200), Period: map[string]uint64{ "0": 2, }, diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index 29e33a283a..efed582061 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -29,8 +29,8 @@ var mumbaiTestnet = &Chain{ BerlinBlock: big.NewInt(13996000), LondonBlock: big.NewInt(22640000), Bor: ¶ms.BorConfig{ - JaipurBlock: 22770000, - DelhiBlock: 29392500, + JaipurBlock: big.NewInt(22770000), + DelhiBlock: big.NewInt(29392500), Period: map[string]uint64{ "0": 2, "25275000": 5, diff --git a/params/config.go b/params/config.go index 2c99c4fb4c..4786053f6a 100644 --- a/params/config.go +++ b/params/config.go @@ -349,8 +349,8 @@ var ( BerlinBlock: big.NewInt(13996000), LondonBlock: big.NewInt(22640000), Bor: &BorConfig{ - JaipurBlock: 22770000, - DelhiBlock: 29392500, + JaipurBlock: big.NewInt(22770000), + DelhiBlock: big.NewInt(29392500), Period: map[string]uint64{ "0": 2, "25275000": 5, @@ -399,8 +399,8 @@ var ( BerlinBlock: big.NewInt(14750000), LondonBlock: big.NewInt(23850000), Bor: &BorConfig{ - JaipurBlock: 23850000, - DelhiBlock: 36507200, + JaipurBlock: big.NewInt(23850000), + DelhiBlock: big.NewInt(36507200), Period: map[string]uint64{ "0": 2, }, @@ -578,8 +578,8 @@ type BorConfig struct { OverrideStateSyncRecords map[string]int `json:"overrideStateSyncRecords"` // override state records count BlockAlloc map[string]interface{} `json:"blockAlloc"` BurntContract map[string]string `json:"burntContract"` // governance contract where the token will be sent to and burnt in london fork - JaipurBlock uint64 `json:"jaipurBlock"` // Jaipur switch block (nil = no fork, 0 = already on jaipur) - DelhiBlock uint64 `json:"delhiBlock"` // Delhi switch block (nil = no fork, 0 = already on delhi) + JaipurBlock *big.Int `json:"jaipurBlock"` // Jaipur switch block (nil = no fork, 0 = already on jaipur) + DelhiBlock *big.Int `json:"delhiBlock"` // Delhi switch block (nil = no fork, 0 = already on delhi) } // String implements the stringer interface, returning the consensus engine details. @@ -603,12 +603,12 @@ func (c *BorConfig) CalculatePeriod(number uint64) uint64 { return c.calculateBorConfigHelper(c.Period, number) } -func (c *BorConfig) IsJaipur(number uint64) bool { - return number >= c.JaipurBlock +func (c *BorConfig) IsJaipur(number *big.Int) bool { + return isForked(c.JaipurBlock, number) } -func (c *BorConfig) IsDelhi(number uint64) bool { - return number >= c.DelhiBlock +func (c *BorConfig) IsDelhi(number *big.Int) bool { + return isForked(c.DelhiBlock, number) } func (c *BorConfig) calculateBorConfigHelper(field map[string]uint64, number uint64) uint64 { diff --git a/params/protocol_params.go b/params/protocol_params.go index d65f9420a8..d468af5d3c 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -171,7 +171,7 @@ var ( DurationLimit = big.NewInt(13) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. ) -func BaseFeeChangeDenominator(borConfig *BorConfig, number uint64) uint64 { +func BaseFeeChangeDenominator(borConfig *BorConfig, number *big.Int) uint64 { if borConfig.IsDelhi(number) { return BaseFeeChangeDenominatorPostDelhi } else { diff --git a/tests/bor/bor_test.go b/tests/bor/bor_test.go index 0b339b04d1..0e8129d0b3 100644 --- a/tests/bor/bor_test.go +++ b/tests/bor/bor_test.go @@ -1109,7 +1109,7 @@ func testEncodeSigHeader(w io.Writer, header *types.Header, c *params.BorConfig) header.MixDigest, header.Nonce, } - if c.IsJaipur(header.Number.Uint64()) { + if c.IsJaipur(header.Number) { if header.BaseFee != nil { enc = append(enc, header.BaseFee) } From 2e3924ddea5064bdcb7ac02724be458469b59a7f Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Tue, 15 Nov 2022 10:47:46 +0530 Subject: [PATCH 3/8] lint --- consensus/misc/eip1559_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/consensus/misc/eip1559_test.go b/consensus/misc/eip1559_test.go index 2509105306..aba95d8005 100644 --- a/consensus/misc/eip1559_test.go +++ b/consensus/misc/eip1559_test.go @@ -109,6 +109,8 @@ func TestBlockGasLimits(t *testing.T) { // TestCalcBaseFee assumes all blocks are 1559-blocks func TestCalcBaseFee(t *testing.T) { + t.Parallel() + tests := []struct { parentBaseFee int64 parentGasLimit uint64 @@ -136,6 +138,7 @@ func TestCalcBaseFee(t *testing.T) { // TestCalcBaseFee assumes all blocks are 1559-blocks post Delhi Hard Fork func TestCalcBaseFeeDelhi(t *testing.T) { + t.Parallel() testConfig := copyConfig(config()) @@ -166,5 +169,4 @@ func TestCalcBaseFeeDelhi(t *testing.T) { t.Errorf("test %d: have %d want %d, ", i, have, want) } } - } From 846abac77255e58dee6e2ac6d41b32a572776952 Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Tue, 15 Nov 2022 11:30:50 +0530 Subject: [PATCH 4/8] fix : failing TestJaipurFork --- tests/bor/bor_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bor/bor_test.go b/tests/bor/bor_test.go index 0e8129d0b3..d059956e6a 100644 --- a/tests/bor/bor_test.go +++ b/tests/bor/bor_test.go @@ -1073,11 +1073,11 @@ func TestJaipurFork(t *testing.T) { block = buildNextBlock(t, _bor, chain, block, nil, init.genesis.Config.Bor, nil, res.Result.ValidatorSet.Validators) insertNewBlock(t, chain, block) - if block.Number().Uint64() == init.genesis.Config.Bor.JaipurBlock-1 { + if block.Number().Uint64() == init.genesis.Config.Bor.JaipurBlock.Uint64()-1 { require.Equal(t, testSealHash(block.Header(), init.genesis.Config.Bor), bor.SealHash(block.Header(), init.genesis.Config.Bor)) } - if block.Number().Uint64() == init.genesis.Config.Bor.JaipurBlock { + if block.Number().Uint64() == init.genesis.Config.Bor.JaipurBlock.Uint64() { require.Equal(t, testSealHash(block.Header(), init.genesis.Config.Bor), bor.SealHash(block.Header(), init.genesis.Config.Bor)) } } From 4a1653f7e3de64e229b9dcc25c96b7cfb7f84697 Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Tue, 15 Nov 2022 15:06:49 +0530 Subject: [PATCH 5/8] change sprintlength for --- builder/files/genesis-mainnet-v1.json | 6 ++++-- builder/files/genesis-testnet-v4.json | 6 ++++-- internal/cli/server/chains/mainnet.go | 6 ++++-- internal/cli/server/chains/mumbai.go | 6 ++++-- .../server/chains/test_files/chain_legacy_test.json | 9 ++++++--- .../cli/server/chains/test_files/chain_test.json | 9 ++++++--- params/config.go | 12 ++++++++---- 7 files changed, 36 insertions(+), 18 deletions(-) diff --git a/builder/files/genesis-mainnet-v1.json b/builder/files/genesis-mainnet-v1.json index e6ed7c8efc..506c161f90 100644 --- a/builder/files/genesis-mainnet-v1.json +++ b/builder/files/genesis-mainnet-v1.json @@ -20,10 +20,12 @@ "0": 2 }, "producerDelay": { - "0": 6 + "0": 6, + "36507200": 4 }, "sprint": { - "0": 64 + "0": 64, + "36507200": 16 }, "backupMultiplier": { "0": 2 diff --git a/builder/files/genesis-testnet-v4.json b/builder/files/genesis-testnet-v4.json index c7efb7ef63..c97d1878b0 100644 --- a/builder/files/genesis-testnet-v4.json +++ b/builder/files/genesis-testnet-v4.json @@ -21,10 +21,12 @@ "25275000": 5 }, "producerDelay": { - "0": 6 + "0": 6, + "29392500": 4 }, "sprint": { - "0": 64 + "0": 64, + "29392500": 16 }, "backupMultiplier": { "0": 2, diff --git a/internal/cli/server/chains/mainnet.go b/internal/cli/server/chains/mainnet.go index 485188983e..e0a5c4578f 100644 --- a/internal/cli/server/chains/mainnet.go +++ b/internal/cli/server/chains/mainnet.go @@ -35,10 +35,12 @@ var mainnetBor = &Chain{ "0": 2, }, ProducerDelay: map[string]uint64{ - "0": 6, + "0": 6, + "36507200": 4, }, Sprint: map[string]uint64{ - "0": 64, + "0": 64, + "36507200": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index efed582061..bcbf899da4 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -36,10 +36,12 @@ var mumbaiTestnet = &Chain{ "25275000": 5, }, ProducerDelay: map[string]uint64{ - "0": 6, + "0": 6, + "29392500": 4, }, Sprint: map[string]uint64{ - "0": 64, + "0": 64, + "29392500": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, diff --git a/internal/cli/server/chains/test_files/chain_legacy_test.json b/internal/cli/server/chains/test_files/chain_legacy_test.json index 69702c6ad6..70f972eea4 100644 --- a/internal/cli/server/chains/test_files/chain_legacy_test.json +++ b/internal/cli/server/chains/test_files/chain_legacy_test.json @@ -19,10 +19,12 @@ "0": 2 }, "producerDelay": { - "0": 6 + "0": 6, + "29392500": 4 }, "sprint": { - "0": 64 + "0": 64, + "29392500": 16 }, "backupMultiplier": { "0": 2 @@ -41,7 +43,8 @@ "burntContract": { "22640000": "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, - "jaipurBlock": 22770000 + "jaipurBlock": 22770000, + "delhiBlock": 29392500 } }, "nonce": "0x0", diff --git a/internal/cli/server/chains/test_files/chain_test.json b/internal/cli/server/chains/test_files/chain_test.json index c8d9f6f4f8..b8771505fa 100644 --- a/internal/cli/server/chains/test_files/chain_test.json +++ b/internal/cli/server/chains/test_files/chain_test.json @@ -21,10 +21,12 @@ "0":2 }, "producerDelay":{ - "0": 6 + "0": 6, + "29392500": 4 }, "sprint":{ - "0": 64 + "0": 64, + "29392500": 16 }, "backupMultiplier":{ "0":2 @@ -43,7 +45,8 @@ "burntContract":{ "22640000":"0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, - "jaipurBlock":22770000 + "jaipurBlock":22770000, + "delhiBlock": 29392500 } }, "nonce":"0x0", diff --git a/params/config.go b/params/config.go index 4786053f6a..c65ff24f30 100644 --- a/params/config.go +++ b/params/config.go @@ -356,10 +356,12 @@ var ( "25275000": 5, }, ProducerDelay: map[string]uint64{ - "0": 6, + "0": 6, + "29392500": 4, }, Sprint: map[string]uint64{ - "0": 64, + "0": 64, + "29392500": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, @@ -405,10 +407,12 @@ var ( "0": 2, }, ProducerDelay: map[string]uint64{ - "0": 6, + "0": 6, + "36507200": 4, }, Sprint: map[string]uint64{ - "0": 64, + "0": 64, + "36507200": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, From 54934761bfc5c71d6a78bf0602d0333febc793d9 Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Tue, 15 Nov 2022 16:28:06 +0530 Subject: [PATCH 6/8] change mumbai block number --- builder/files/genesis-testnet-v4.json | 6 +++--- internal/cli/server/chains/mumbai.go | 6 +++--- .../cli/server/chains/test_files/chain_legacy_test.json | 6 +++--- internal/cli/server/chains/test_files/chain_test.json | 6 +++--- params/config.go | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/builder/files/genesis-testnet-v4.json b/builder/files/genesis-testnet-v4.json index c97d1878b0..39b9fe5eff 100644 --- a/builder/files/genesis-testnet-v4.json +++ b/builder/files/genesis-testnet-v4.json @@ -15,18 +15,18 @@ "londonBlock": 22640000, "bor": { "jaipurBlock": 22770000, - "delhiBlock": 29392500, + "delhiBlock": 29392128, "period": { "0": 2, "25275000": 5 }, "producerDelay": { "0": 6, - "29392500": 4 + "29392128": 4 }, "sprint": { "0": 64, - "29392500": 16 + "29392128": 16 }, "backupMultiplier": { "0": 2, diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index bcbf899da4..16f74e597d 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -30,18 +30,18 @@ var mumbaiTestnet = &Chain{ LondonBlock: big.NewInt(22640000), Bor: ¶ms.BorConfig{ JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29392500), + DelhiBlock: big.NewInt(29392128), Period: map[string]uint64{ "0": 2, "25275000": 5, }, ProducerDelay: map[string]uint64{ "0": 6, - "29392500": 4, + "29392128": 4, }, Sprint: map[string]uint64{ "0": 64, - "29392500": 16, + "29392128": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, diff --git a/internal/cli/server/chains/test_files/chain_legacy_test.json b/internal/cli/server/chains/test_files/chain_legacy_test.json index 70f972eea4..fdbe2f2165 100644 --- a/internal/cli/server/chains/test_files/chain_legacy_test.json +++ b/internal/cli/server/chains/test_files/chain_legacy_test.json @@ -20,11 +20,11 @@ }, "producerDelay": { "0": 6, - "29392500": 4 + "29392128": 4 }, "sprint": { "0": 64, - "29392500": 16 + "29392128": 16 }, "backupMultiplier": { "0": 2 @@ -44,7 +44,7 @@ "22640000": "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, "jaipurBlock": 22770000, - "delhiBlock": 29392500 + "delhiBlock": 29392128 } }, "nonce": "0x0", diff --git a/internal/cli/server/chains/test_files/chain_test.json b/internal/cli/server/chains/test_files/chain_test.json index b8771505fa..60cef797cd 100644 --- a/internal/cli/server/chains/test_files/chain_test.json +++ b/internal/cli/server/chains/test_files/chain_test.json @@ -22,11 +22,11 @@ }, "producerDelay":{ "0": 6, - "29392500": 4 + "29392128": 4 }, "sprint":{ "0": 64, - "29392500": 16 + "29392128": 16 }, "backupMultiplier":{ "0":2 @@ -46,7 +46,7 @@ "22640000":"0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, "jaipurBlock":22770000, - "delhiBlock": 29392500 + "delhiBlock": 29392128 } }, "nonce":"0x0", diff --git a/params/config.go b/params/config.go index c65ff24f30..4653f9f0db 100644 --- a/params/config.go +++ b/params/config.go @@ -350,18 +350,18 @@ var ( LondonBlock: big.NewInt(22640000), Bor: &BorConfig{ JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29392500), + DelhiBlock: big.NewInt(29392128), Period: map[string]uint64{ "0": 2, "25275000": 5, }, ProducerDelay: map[string]uint64{ "0": 6, - "29392500": 4, + "29392128": 4, }, Sprint: map[string]uint64{ "0": 64, - "29392500": 16, + "29392128": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, From 5a9a8c5804308f1766da4dda220b617b88ca5761 Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Tue, 15 Nov 2022 16:44:28 +0530 Subject: [PATCH 7/8] change hardfork to span start --- builder/files/genesis-mainnet-v1.json | 6 +++--- builder/files/genesis-testnet-v4.json | 6 +++--- internal/cli/server/chains/mainnet.go | 6 +++--- internal/cli/server/chains/mumbai.go | 6 +++--- .../server/chains/test_files/chain_legacy_test.json | 6 +++--- .../cli/server/chains/test_files/chain_test.json | 6 +++--- params/config.go | 12 ++++++------ 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/builder/files/genesis-mainnet-v1.json b/builder/files/genesis-mainnet-v1.json index 506c161f90..78ac7effbf 100644 --- a/builder/files/genesis-mainnet-v1.json +++ b/builder/files/genesis-mainnet-v1.json @@ -15,17 +15,17 @@ "londonBlock": 23850000, "bor": { "jaipurBlock": 23850000, - "delhiBlock": 36507200, + "delhiBlock": 36499200, "period": { "0": 2 }, "producerDelay": { "0": 6, - "36507200": 4 + "36499200": 4 }, "sprint": { "0": 64, - "36507200": 16 + "36499200": 16 }, "backupMultiplier": { "0": 2 diff --git a/builder/files/genesis-testnet-v4.json b/builder/files/genesis-testnet-v4.json index 39b9fe5eff..cd1c31ca1b 100644 --- a/builder/files/genesis-testnet-v4.json +++ b/builder/files/genesis-testnet-v4.json @@ -15,18 +15,18 @@ "londonBlock": 22640000, "bor": { "jaipurBlock": 22770000, - "delhiBlock": 29392128, + "delhiBlock": 29388800, "period": { "0": 2, "25275000": 5 }, "producerDelay": { "0": 6, - "29392128": 4 + "29388800": 4 }, "sprint": { "0": 64, - "29392128": 16 + "29388800": 16 }, "backupMultiplier": { "0": 2, diff --git a/internal/cli/server/chains/mainnet.go b/internal/cli/server/chains/mainnet.go index e0a5c4578f..1819c5d49a 100644 --- a/internal/cli/server/chains/mainnet.go +++ b/internal/cli/server/chains/mainnet.go @@ -30,17 +30,17 @@ var mainnetBor = &Chain{ LondonBlock: big.NewInt(23850000), Bor: ¶ms.BorConfig{ JaipurBlock: big.NewInt(23850000), - DelhiBlock: big.NewInt(36507200), + DelhiBlock: big.NewInt(36499200), Period: map[string]uint64{ "0": 2, }, ProducerDelay: map[string]uint64{ "0": 6, - "36507200": 4, + "36499200": 4, }, Sprint: map[string]uint64{ "0": 64, - "36507200": 16, + "36499200": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index 16f74e597d..ded47e4832 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -30,18 +30,18 @@ var mumbaiTestnet = &Chain{ LondonBlock: big.NewInt(22640000), Bor: ¶ms.BorConfig{ JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29392128), + DelhiBlock: big.NewInt(29388800), Period: map[string]uint64{ "0": 2, "25275000": 5, }, ProducerDelay: map[string]uint64{ "0": 6, - "29392128": 4, + "29388800": 4, }, Sprint: map[string]uint64{ "0": 64, - "29392128": 16, + "29388800": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, diff --git a/internal/cli/server/chains/test_files/chain_legacy_test.json b/internal/cli/server/chains/test_files/chain_legacy_test.json index fdbe2f2165..a924fe03f4 100644 --- a/internal/cli/server/chains/test_files/chain_legacy_test.json +++ b/internal/cli/server/chains/test_files/chain_legacy_test.json @@ -20,11 +20,11 @@ }, "producerDelay": { "0": 6, - "29392128": 4 + "29388800": 4 }, "sprint": { "0": 64, - "29392128": 16 + "29388800": 16 }, "backupMultiplier": { "0": 2 @@ -44,7 +44,7 @@ "22640000": "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, "jaipurBlock": 22770000, - "delhiBlock": 29392128 + "delhiBlock": 29388800 } }, "nonce": "0x0", diff --git a/internal/cli/server/chains/test_files/chain_test.json b/internal/cli/server/chains/test_files/chain_test.json index 60cef797cd..2dda25219f 100644 --- a/internal/cli/server/chains/test_files/chain_test.json +++ b/internal/cli/server/chains/test_files/chain_test.json @@ -22,11 +22,11 @@ }, "producerDelay":{ "0": 6, - "29392128": 4 + "29388800": 4 }, "sprint":{ "0": 64, - "29392128": 16 + "29388800": 16 }, "backupMultiplier":{ "0":2 @@ -46,7 +46,7 @@ "22640000":"0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, "jaipurBlock":22770000, - "delhiBlock": 29392128 + "delhiBlock": 29388800 } }, "nonce":"0x0", diff --git a/params/config.go b/params/config.go index 4653f9f0db..7e92c7b8af 100644 --- a/params/config.go +++ b/params/config.go @@ -350,18 +350,18 @@ var ( LondonBlock: big.NewInt(22640000), Bor: &BorConfig{ JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29392128), + DelhiBlock: big.NewInt(29388800), Period: map[string]uint64{ "0": 2, "25275000": 5, }, ProducerDelay: map[string]uint64{ "0": 6, - "29392128": 4, + "29388800": 4, }, Sprint: map[string]uint64{ "0": 64, - "29392128": 16, + "29388800": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, @@ -402,17 +402,17 @@ var ( LondonBlock: big.NewInt(23850000), Bor: &BorConfig{ JaipurBlock: big.NewInt(23850000), - DelhiBlock: big.NewInt(36507200), + DelhiBlock: big.NewInt(36499200), Period: map[string]uint64{ "0": 2, }, ProducerDelay: map[string]uint64{ "0": 6, - "36507200": 4, + "36499200": 4, }, Sprint: map[string]uint64{ "0": 64, - "36507200": 16, + "36499200": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, From 709bbc8a3eb4e4a5cb44d901a1397073e15558ef Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Tue, 15 Nov 2022 19:41:41 +0530 Subject: [PATCH 8/8] change mumbai and mainnet blocks --- builder/files/genesis-mainnet-v1.json | 6 +++--- builder/files/genesis-testnet-v4.json | 6 +++--- internal/cli/server/chains/mainnet.go | 6 +++--- internal/cli/server/chains/mumbai.go | 6 +++--- .../server/chains/test_files/chain_legacy_test.json | 6 +++--- .../cli/server/chains/test_files/chain_test.json | 6 +++--- params/config.go | 12 ++++++------ 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/builder/files/genesis-mainnet-v1.json b/builder/files/genesis-mainnet-v1.json index 78ac7effbf..a5b96140ca 100644 --- a/builder/files/genesis-mainnet-v1.json +++ b/builder/files/genesis-mainnet-v1.json @@ -15,17 +15,17 @@ "londonBlock": 23850000, "bor": { "jaipurBlock": 23850000, - "delhiBlock": 36499200, + "delhiBlock": 36499456, "period": { "0": 2 }, "producerDelay": { "0": 6, - "36499200": 4 + "36499456": 4 }, "sprint": { "0": 64, - "36499200": 16 + "36499456": 16 }, "backupMultiplier": { "0": 2 diff --git a/builder/files/genesis-testnet-v4.json b/builder/files/genesis-testnet-v4.json index cd1c31ca1b..52ac2645f7 100644 --- a/builder/files/genesis-testnet-v4.json +++ b/builder/files/genesis-testnet-v4.json @@ -15,18 +15,18 @@ "londonBlock": 22640000, "bor": { "jaipurBlock": 22770000, - "delhiBlock": 29388800, + "delhiBlock": 29389056, "period": { "0": 2, "25275000": 5 }, "producerDelay": { "0": 6, - "29388800": 4 + "29389056": 4 }, "sprint": { "0": 64, - "29388800": 16 + "29389056": 16 }, "backupMultiplier": { "0": 2, diff --git a/internal/cli/server/chains/mainnet.go b/internal/cli/server/chains/mainnet.go index 1819c5d49a..8b75039f1a 100644 --- a/internal/cli/server/chains/mainnet.go +++ b/internal/cli/server/chains/mainnet.go @@ -30,17 +30,17 @@ var mainnetBor = &Chain{ LondonBlock: big.NewInt(23850000), Bor: ¶ms.BorConfig{ JaipurBlock: big.NewInt(23850000), - DelhiBlock: big.NewInt(36499200), + DelhiBlock: big.NewInt(36499456), Period: map[string]uint64{ "0": 2, }, ProducerDelay: map[string]uint64{ "0": 6, - "36499200": 4, + "36499456": 4, }, Sprint: map[string]uint64{ "0": 64, - "36499200": 16, + "36499456": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index ded47e4832..e195f5e584 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -30,18 +30,18 @@ var mumbaiTestnet = &Chain{ LondonBlock: big.NewInt(22640000), Bor: ¶ms.BorConfig{ JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29388800), + DelhiBlock: big.NewInt(29389056), Period: map[string]uint64{ "0": 2, "25275000": 5, }, ProducerDelay: map[string]uint64{ "0": 6, - "29388800": 4, + "29389056": 4, }, Sprint: map[string]uint64{ "0": 64, - "29388800": 16, + "29389056": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, diff --git a/internal/cli/server/chains/test_files/chain_legacy_test.json b/internal/cli/server/chains/test_files/chain_legacy_test.json index a924fe03f4..bdea670388 100644 --- a/internal/cli/server/chains/test_files/chain_legacy_test.json +++ b/internal/cli/server/chains/test_files/chain_legacy_test.json @@ -20,11 +20,11 @@ }, "producerDelay": { "0": 6, - "29388800": 4 + "29389056": 4 }, "sprint": { "0": 64, - "29388800": 16 + "29389056": 16 }, "backupMultiplier": { "0": 2 @@ -44,7 +44,7 @@ "22640000": "0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, "jaipurBlock": 22770000, - "delhiBlock": 29388800 + "delhiBlock": 29389056 } }, "nonce": "0x0", diff --git a/internal/cli/server/chains/test_files/chain_test.json b/internal/cli/server/chains/test_files/chain_test.json index 2dda25219f..8f61363a9b 100644 --- a/internal/cli/server/chains/test_files/chain_test.json +++ b/internal/cli/server/chains/test_files/chain_test.json @@ -22,11 +22,11 @@ }, "producerDelay":{ "0": 6, - "29388800": 4 + "29389056": 4 }, "sprint":{ "0": 64, - "29388800": 16 + "29389056": 16 }, "backupMultiplier":{ "0":2 @@ -46,7 +46,7 @@ "22640000":"0x70bcA57F4579f58670aB2d18Ef16e02C17553C38" }, "jaipurBlock":22770000, - "delhiBlock": 29388800 + "delhiBlock": 29389056 } }, "nonce":"0x0", diff --git a/params/config.go b/params/config.go index 7e92c7b8af..6fac0e5a07 100644 --- a/params/config.go +++ b/params/config.go @@ -350,18 +350,18 @@ var ( LondonBlock: big.NewInt(22640000), Bor: &BorConfig{ JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29388800), + DelhiBlock: big.NewInt(29389056), Period: map[string]uint64{ "0": 2, "25275000": 5, }, ProducerDelay: map[string]uint64{ "0": 6, - "29388800": 4, + "29389056": 4, }, Sprint: map[string]uint64{ "0": 64, - "29388800": 16, + "29389056": 16, }, BackupMultiplier: map[string]uint64{ "0": 2, @@ -402,17 +402,17 @@ var ( LondonBlock: big.NewInt(23850000), Bor: &BorConfig{ JaipurBlock: big.NewInt(23850000), - DelhiBlock: big.NewInt(36499200), + DelhiBlock: big.NewInt(36499456), Period: map[string]uint64{ "0": 2, }, ProducerDelay: map[string]uint64{ "0": 6, - "36499200": 4, + "36499456": 4, }, Sprint: map[string]uint64{ "0": 64, - "36499200": 16, + "36499456": 16, }, BackupMultiplier: map[string]uint64{ "0": 2,