From f1e0b1d9261977725b8437946cf5ee46590620eb Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Tue, 23 Jan 2024 10:52:00 +0530 Subject: [PATCH] Changed parallel universe HF to Cancun HF and some important fixes (#1132) * changed parallel universe HF to napoli HF * integration-tests: update ipc path on ci tests (#1127) * integration-tests: update ipc path on ci tests * added devnetBorFlags in matic-cli-config.yml --------- Co-authored-by: Pratik Patil * Revert "integration-tests: update ipc path on ci tests (#1127)" This reverts commit 0660fac39b5d5a31cd4da54e48b4ca8eda4d7cb4. * using cancun for block-stm metadata instead of napoli * added a check to verify tx dependencies and test cases * fix in snapshot.chainConfig * removed snapshot.*params.BorConfig using snapshot.chainConfig.Bor instead * removed unnecessary if statement in ParallelStateProcessor.Process * addressed comment * small fix in commitTransactions * dependency calculation bug fix in miner/worker.go --------- Co-authored-by: Manav Darji Co-authored-by: Arpit Temani --- builder/files/genesis-mainnet-v1.json | 1 - builder/files/genesis-testnet-v4.json | 1 - consensus/bor/bor.go | 16 ++-- consensus/bor/snapshot.go | 25 ++--- core/parallel_state_processor.go | 96 +++++++++---------- core/parallel_state_processor_test.go | 30 ++++++ core/types/block.go | 4 +- core/types/block_test.go | 1 - internal/cli/server/chains/mainnet.go | 7 +- internal/cli/server/chains/mumbai.go | 7 +- .../chains/test_files/chain_legacy_test.json | 1 - .../server/chains/test_files/chain_test.json | 1 - miner/worker.go | 60 ++++++------ miner/worker_test.go | 2 +- params/config.go | 34 +++---- 15 files changed, 148 insertions(+), 138 deletions(-) create mode 100644 core/parallel_state_processor_test.go diff --git a/builder/files/genesis-mainnet-v1.json b/builder/files/genesis-mainnet-v1.json index f4b2e4a6b4..11d64cabab 100644 --- a/builder/files/genesis-mainnet-v1.json +++ b/builder/files/genesis-mainnet-v1.json @@ -17,7 +17,6 @@ "bor": { "jaipurBlock": 23850000, "delhiBlock": 38189056, - "parallelUniverseBlock": 0, "indoreBlock": 44934656, "stateSyncConfirmationDelay": { "44934656": 128 diff --git a/builder/files/genesis-testnet-v4.json b/builder/files/genesis-testnet-v4.json index c848d5dce0..afad138492 100644 --- a/builder/files/genesis-testnet-v4.json +++ b/builder/files/genesis-testnet-v4.json @@ -17,7 +17,6 @@ "bor": { "jaipurBlock": 22770000, "delhiBlock": 29638656, - "parallelUniverseBlock": 0, "indoreBlock": 37075456, "stateSyncConfirmationDelay": { "37075456": 128 diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 24590ea516..40999f73c4 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -353,7 +353,7 @@ func (c *Bor) verifyHeader(chain consensus.ChainHeaderReader, header *types.Head isSprintEnd := IsSprintStart(number+1, c.config.CalculateSprint(number)) // Ensure that the extra-data contains a signer list on checkpoint, but none otherwise - signersBytes := len(header.GetValidatorBytes(c.config)) + signersBytes := len(header.GetValidatorBytes(c.chainConfig)) if !isSprintEnd && signersBytes != 0 { return errExtraValidators @@ -472,7 +472,7 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t sort.Sort(valset.ValidatorsByAddress(newValidators)) - headerVals, err := valset.ParseValidators(header.GetValidatorBytes(c.config)) + headerVals, err := valset.ParseValidators(header.GetValidatorBytes(c.chainConfig)) if err != nil { return err } @@ -490,7 +490,7 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t // verify the validator list in the last sprint block if IsSprintStart(number, c.config.CalculateSprint(number)) { - parentValidatorBytes := parent.GetValidatorBytes(c.config) + parentValidatorBytes := parent.GetValidatorBytes(c.chainConfig) validatorsBytes := make([]byte, len(snap.ValidatorSet.Validators)*validatorHeaderBytesLength) currentValidators := snap.ValidatorSet.Copy().Validators @@ -521,7 +521,7 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash co val := valset.NewValidator(signer, 1000) validatorset := valset.NewValidatorSet([]*valset.Validator{val}) - snapshot := newSnapshot(c.config, c.signatures, number, hash, validatorset.Validators) + snapshot := newSnapshot(c.chainConfig, c.signatures, number, hash, validatorset.Validators) return snapshot, nil } @@ -541,7 +541,7 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash co // If an on-disk checkpoint snapshot can be found, use that if number%checkpointInterval == 0 { - if s, err := loadSnapshot(c.config, c.signatures, c.db, hash); err == nil { + if s, err := loadSnapshot(c.chainConfig, c.config, c.signatures, c.db, hash); err == nil { log.Trace("Loaded snapshot from disk", "number", number, "hash", hash) snap = s @@ -570,7 +570,7 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash co } // new snap shot - snap = newSnapshot(c.config, c.signatures, number, hash, validators) + snap = newSnapshot(c.chainConfig, c.signatures, number, hash, validators) if err := snap.store(c.db); err != nil { return nil, err } @@ -742,7 +742,7 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e // sort validator by address sort.Sort(valset.ValidatorsByAddress(newValidators)) - if c.config.IsParallelUniverse(header.Number) { + if c.chainConfig.IsCancun(header.Number) { var tempValidatorBytes []byte for _, validator := range newValidators { @@ -766,7 +766,7 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e header.Extra = append(header.Extra, validator.HeaderBytes()...) } } - } else if c.config.IsParallelUniverse(header.Number) { + } else if c.chainConfig.IsCancun(header.Number) { blockExtraData := &types.BlockExtraData{ ValidatorBytes: nil, TxDependency: nil, diff --git a/consensus/bor/snapshot.go b/consensus/bor/snapshot.go index 7ced09c3b8..87e3fb163c 100644 --- a/consensus/bor/snapshot.go +++ b/consensus/bor/snapshot.go @@ -15,8 +15,9 @@ import ( // Snapshot is the state of the authorization voting at a given point in time. type Snapshot struct { - config *params.BorConfig // Consensus engine parameters to fine tune behavior - sigcache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover + chainConfig *params.ChainConfig + + sigcache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover Number uint64 `json:"number"` // Block number where the snapshot was created Hash common.Hash `json:"hash"` // Block hash where the snapshot was created @@ -28,14 +29,14 @@ type Snapshot struct { // method does not initialize the set of recent signers, so only ever use if for // the genesis block. func newSnapshot( - config *params.BorConfig, + chainConfig *params.ChainConfig, sigcache *lru.ARCCache, number uint64, hash common.Hash, validators []*valset.Validator, ) *Snapshot { snap := &Snapshot{ - config: config, + chainConfig: chainConfig, sigcache: sigcache, Number: number, Hash: hash, @@ -47,7 +48,7 @@ func newSnapshot( } // loadSnapshot loads an existing snapshot from the database. -func loadSnapshot(config *params.BorConfig, sigcache *lru.ARCCache, db ethdb.Database, hash common.Hash) (*Snapshot, error) { +func loadSnapshot(chainConfig *params.ChainConfig, config *params.BorConfig, sigcache *lru.ARCCache, db ethdb.Database, hash common.Hash) (*Snapshot, error) { blob, err := db.Get(append([]byte("bor-"), hash[:]...)) if err != nil { return nil, err @@ -61,7 +62,7 @@ func loadSnapshot(config *params.BorConfig, sigcache *lru.ARCCache, db ethdb.Dat snap.ValidatorSet.UpdateValidatorMap() - snap.config = config + snap.chainConfig = chainConfig snap.sigcache = sigcache // update total voting power @@ -85,7 +86,7 @@ func (s *Snapshot) store(db ethdb.Database) error { // copy creates a deep copy of the snapshot, though not the individual votes. func (s *Snapshot) copy() *Snapshot { cpy := &Snapshot{ - config: s.config, + chainConfig: s.chainConfig, sigcache: s.sigcache, Number: s.Number, Hash: s.Hash, @@ -122,12 +123,12 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) { number := header.Number.Uint64() // Delete the oldest signer from the recent list to allow it signing again - if number >= s.config.CalculateSprint(number) { - delete(snap.Recents, number-s.config.CalculateSprint(number)) + if number >= s.chainConfig.Bor.CalculateSprint(number) { + delete(snap.Recents, number-s.chainConfig.Bor.CalculateSprint(number)) } // Resolve the authorization key and check against signers - signer, err := ecrecover(header, s.sigcache, s.config) + signer, err := ecrecover(header, s.sigcache, s.chainConfig.Bor) if err != nil { return nil, err } @@ -145,12 +146,12 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) { snap.Recents[number] = signer // change validator set and change proposer - if number > 0 && (number+1)%s.config.CalculateSprint(number) == 0 { + if number > 0 && (number+1)%s.chainConfig.Bor.CalculateSprint(number) == 0 { if err := validateHeaderExtraField(header.Extra); err != nil { return nil, err } - validatorBytes := header.GetValidatorBytes(s.config) + validatorBytes := header.GetValidatorBytes(s.chainConfig) // get validators from headers and use that for new validator set newVals, _ := valset.ParseValidators(validatorBytes) diff --git a/core/parallel_state_processor.go b/core/parallel_state_processor.go index 2dfff35349..2074c9727b 100644 --- a/core/parallel_state_processor.go +++ b/core/parallel_state_processor.go @@ -288,6 +288,11 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat deps := GetDeps(blockTxDependency) + if !VerifyDeps(deps) || len(blockTxDependency) != len(block.Transactions()) { + blockTxDependency = nil + deps = make(map[int][]int) + } + if blockTxDependency != nil { metadata = true } @@ -308,57 +313,30 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat shouldDelayFeeCal = false } - if len(blockTxDependency) != len(block.Transactions()) { - task := &ExecutionTask{ - msg: *msg, - config: p.config, - gasLimit: block.GasLimit(), - blockNumber: blockNumber, - blockHash: blockHash, - tx: tx, - index: i, - cleanStateDB: cleansdb, - finalStateDB: statedb, - blockChain: p.bc, - header: header, - evmConfig: cfg, - shouldDelayFeeCal: &shouldDelayFeeCal, - sender: msg.From, - totalUsedGas: usedGas, - receipts: &receipts, - allLogs: &allLogs, - dependencies: deps[i], - coinbase: coinbase, - blockContext: blockContext, - } - - tasks = append(tasks, task) - } else { - task := &ExecutionTask{ - msg: *msg, - config: p.config, - gasLimit: block.GasLimit(), - blockNumber: blockNumber, - blockHash: blockHash, - tx: tx, - index: i, - cleanStateDB: cleansdb, - finalStateDB: statedb, - blockChain: p.bc, - header: header, - evmConfig: cfg, - shouldDelayFeeCal: &shouldDelayFeeCal, - sender: msg.From, - totalUsedGas: usedGas, - receipts: &receipts, - allLogs: &allLogs, - dependencies: nil, - coinbase: coinbase, - blockContext: blockContext, - } - - tasks = append(tasks, task) + task := &ExecutionTask{ + msg: *msg, + config: p.config, + gasLimit: block.GasLimit(), + blockNumber: blockNumber, + blockHash: blockHash, + tx: tx, + index: i, + cleanStateDB: cleansdb, + finalStateDB: statedb, + blockChain: p.bc, + header: header, + evmConfig: cfg, + shouldDelayFeeCal: &shouldDelayFeeCal, + sender: msg.From, + totalUsedGas: usedGas, + receipts: &receipts, + allLogs: &allLogs, + dependencies: deps[i], + coinbase: coinbase, + blockContext: blockContext, } + + tasks = append(tasks, task) } backupStateDB := statedb.Copy() @@ -427,3 +405,21 @@ func GetDeps(txDependency [][]uint64) map[int][]int { return deps } + +// returns true if dependencies are correct +func VerifyDeps(deps map[int][]int) bool { + // number of transactions in the block + n := len(deps) + + // Handle out-of-range and circular dependency problem + for i := 0; i <= n-1; i++ { + val := deps[i] + for _, depTx := range val { + if depTx >= n || depTx >= i { + return false + } + } + } + + return true +} diff --git a/core/parallel_state_processor_test.go b/core/parallel_state_processor_test.go new file mode 100644 index 0000000000..424ea4282a --- /dev/null +++ b/core/parallel_state_processor_test.go @@ -0,0 +1,30 @@ +package core + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestMetadata(t *testing.T) { + t.Parallel() + + correctTxDependency := [][]uint64{{}, {0}, {}, {1}, {3}, {}, {0, 2}, {5}, {}, {8}} + wrongTxDependency := [][]uint64{{0}} + wrongTxDependencyCircular := [][]uint64{{}, {2}, {1}} + wrongTxDependencyOutOfRange := [][]uint64{{}, {}, {3}} + + var temp map[int][]int + + temp = GetDeps(correctTxDependency) + assert.Equal(t, true, VerifyDeps(temp)) + + temp = GetDeps(wrongTxDependency) + assert.Equal(t, false, VerifyDeps(temp)) + + temp = GetDeps(wrongTxDependencyCircular) + assert.Equal(t, false, VerifyDeps(temp)) + + temp = GetDeps(wrongTxDependencyOutOfRange) + assert.Equal(t, false, VerifyDeps(temp)) +} diff --git a/core/types/block.go b/core/types/block.go index 1ffaea554c..1cebb65b24 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -456,8 +456,8 @@ func (b *Block) GetTxDependency() [][]uint64 { return blockExtraData.TxDependency } -func (h *Header) GetValidatorBytes(config *params.BorConfig) []byte { - if !config.IsParallelUniverse(h.Number) { +func (h *Header) GetValidatorBytes(chainConfig *params.ChainConfig) []byte { + if !chainConfig.IsCancun(h.Number) { return h.Extra[ExtraVanityLength : len(h.Extra)-ExtraSealLength] } diff --git a/core/types/block_test.go b/core/types/block_test.go index 218205e564..a42d578f33 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -74,7 +74,6 @@ func TestBlockEncoding(t *testing.T) { } // This is a replica of `(h *Header) GetValidatorBytes` function -// This was needed because currently, `IsParallelUniverse` will always return false. func GetValidatorBytesTest(h *Header) []byte { if len(h.Extra) < ExtraVanityLength+ExtraSealLength { log.Error("length of extra less is than vanity and seal") diff --git a/internal/cli/server/chains/mainnet.go b/internal/cli/server/chains/mainnet.go index b9efd9a4e2..5548f8edba 100644 --- a/internal/cli/server/chains/mainnet.go +++ b/internal/cli/server/chains/mainnet.go @@ -29,10 +29,9 @@ var mainnetBor = &Chain{ LondonBlock: big.NewInt(23850000), ShanghaiBlock: big.NewInt(50523000), Bor: ¶ms.BorConfig{ - JaipurBlock: big.NewInt(23850000), - DelhiBlock: big.NewInt(38189056), - ParallelUniverseBlock: big.NewInt(0), - IndoreBlock: big.NewInt(44934656), + JaipurBlock: big.NewInt(23850000), + DelhiBlock: big.NewInt(38189056), + IndoreBlock: big.NewInt(44934656), StateSyncConfirmationDelay: map[string]uint64{ "44934656": 128, }, diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index 45f36fbe89..7fe25554c5 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -29,10 +29,9 @@ var mumbaiTestnet = &Chain{ LondonBlock: big.NewInt(22640000), ShanghaiBlock: big.NewInt(41874000), Bor: ¶ms.BorConfig{ - JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29638656), - ParallelUniverseBlock: big.NewInt(0), - IndoreBlock: big.NewInt(37075456), + JaipurBlock: big.NewInt(22770000), + DelhiBlock: big.NewInt(29638656), + IndoreBlock: big.NewInt(37075456), StateSyncConfirmationDelay: map[string]uint64{ "37075456": 128, }, 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 a64fbf3e23..c3e9b3c7bf 100644 --- a/internal/cli/server/chains/test_files/chain_legacy_test.json +++ b/internal/cli/server/chains/test_files/chain_legacy_test.json @@ -57,7 +57,6 @@ }, "jaipurBlock": 22770000, "delhiBlock": 29638656, - "parallelUniverseBlock": 0, "indoreBlock": 37075456, "stateSyncConfirmationDelay": { "37075456": 128 diff --git a/internal/cli/server/chains/test_files/chain_test.json b/internal/cli/server/chains/test_files/chain_test.json index ba207bf770..8555833321 100644 --- a/internal/cli/server/chains/test_files/chain_test.json +++ b/internal/cli/server/chains/test_files/chain_test.json @@ -59,7 +59,6 @@ }, "jaipurBlock":22770000, "delhiBlock": 29638656, - "parallelUniverseBlock": 0, "indoreBlock": 37075456, "stateSyncConfirmationDelay": { "37075456": 128 diff --git a/miner/worker.go b/miner/worker.go index 4a92776f56..3573eccfee 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -109,17 +109,22 @@ type environment struct { header *types.Header txs []*types.Transaction receipts []*types.Receipt + + depsMVFullWriteList [][]blockstm.WriteDescriptor + mvReadMapList []map[blockstm.Key]blockstm.ReadDescriptor } // copy creates a deep copy of environment. func (env *environment) copy() *environment { cpy := &environment{ - signer: env.signer, - state: env.state.Copy(), - tcount: env.tcount, - coinbase: env.coinbase, - header: types.CopyHeader(env.header), - receipts: copyReceipts(env.receipts), + signer: env.signer, + state: env.state.Copy(), + tcount: env.tcount, + coinbase: env.coinbase, + header: types.CopyHeader(env.header), + receipts: copyReceipts(env.receipts), + depsMVFullWriteList: env.depsMVFullWriteList, + mvReadMapList: env.mvReadMapList, } if env.gasPool != nil { @@ -854,6 +859,9 @@ func (w *worker) makeEnv(parent *types.Header, header *types.Header, coinbase co // Keep track of transactions which return errors so they can be removed env.tcount = 0 + env.depsMVFullWriteList = [][]blockstm.WriteDescriptor{} + env.mvReadMapList = []map[blockstm.Key]blockstm.ReadDescriptor{} + return env, nil } @@ -903,36 +911,20 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn var coalescedLogs []*types.Log - var depsMVReadList [][]blockstm.ReadDescriptor - - var depsMVFullWriteList [][]blockstm.WriteDescriptor - - var mvReadMapList []map[blockstm.Key]blockstm.ReadDescriptor - var deps map[int]map[int]bool chDeps := make(chan blockstm.TxDep) - var count int - var depsWg sync.WaitGroup - EnableMVHashMap := w.chainConfig.Bor.IsParallelUniverse(env.header.Number) + EnableMVHashMap := w.chainConfig.IsCancun(env.header.Number) // create and add empty mvHashMap in statedb if EnableMVHashMap { - depsMVReadList = [][]blockstm.ReadDescriptor{} - - depsMVFullWriteList = [][]blockstm.WriteDescriptor{} - - mvReadMapList = []map[blockstm.Key]blockstm.ReadDescriptor{} - deps = map[int]map[int]bool{} chDeps = make(chan blockstm.TxDep) - count = 0 - depsWg.Add(1) go func(chDeps chan blockstm.TxDep) { @@ -1064,18 +1056,20 @@ mainloop: env.tcount++ if EnableMVHashMap { - depsMVReadList = append(depsMVReadList, env.state.MVReadList()) - depsMVFullWriteList = append(depsMVFullWriteList, env.state.MVFullWriteList()) - mvReadMapList = append(mvReadMapList, env.state.MVReadMap()) + env.depsMVFullWriteList = append(env.depsMVFullWriteList, env.state.MVFullWriteList()) + env.mvReadMapList = append(env.mvReadMapList, env.state.MVReadMap()) + + if env.tcount > len(env.depsMVFullWriteList) { + log.Warn("blockstm - env.tcount > len(env.depsMVFullWriteList)", "env.tcount", env.tcount, "len(depsMVFullWriteList)", len(env.depsMVFullWriteList)) + } temp := blockstm.TxDep{ Index: env.tcount - 1, - ReadList: depsMVReadList[count], - FullWriteList: depsMVFullWriteList, + ReadList: env.state.MVReadList(), + FullWriteList: env.depsMVFullWriteList, } chDeps <- temp - count++ } txs.Shift() @@ -1107,8 +1101,8 @@ mainloop: tempVanity := env.header.Extra[:types.ExtraVanityLength] tempSeal := env.header.Extra[len(env.header.Extra)-types.ExtraSealLength:] - if len(mvReadMapList) > 0 { - tempDeps := make([][]uint64, len(mvReadMapList)) + if len(env.mvReadMapList) > 0 { + tempDeps := make([][]uint64, len(env.mvReadMapList)) for j := range deps[0] { tempDeps[0] = append(tempDeps[0], uint64(j)) @@ -1116,8 +1110,8 @@ mainloop: delayFlag := true - for i := 1; i <= len(mvReadMapList)-1; i++ { - reads := mvReadMapList[i-1] + for i := 1; i <= len(env.mvReadMapList)-1; i++ { + reads := env.mvReadMapList[i-1] _, ok1 := reads[blockstm.NewSubpathKey(env.coinbase, state.BalancePath)] _, ok2 := reads[blockstm.NewSubpathKey(common.HexToAddress(w.chainConfig.Bor.CalculateBurntContract(env.header.Number.Uint64())), state.BalancePath)] diff --git a/miner/worker_test.go b/miner/worker_test.go index 88f7924b00..57bb26511c 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -909,7 +909,7 @@ func BenchmarkBorMining(b *testing.B) { } // uses core.NewParallelBlockChain to use the dependencies present in the block header -// params.BorUnittestChainConfig contains the ParallelUniverseBlock ad big.NewInt(5), so the first 4 blocks will not have metadata. +// params.BorUnittestChainConfig contains the NapoliBlock as big.NewInt(5), so the first 4 blocks will not have metadata. // nolint: gocognit func BenchmarkBorMiningBlockSTMMetadata(b *testing.B) { chainConfig := params.BorUnittestChainConfig diff --git a/params/config.go b/params/config.go index ea00979850..e724a02747 100644 --- a/params/config.go +++ b/params/config.go @@ -159,7 +159,6 @@ var ( BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), Bor: &BorConfig{ - ParallelUniverseBlock: big.NewInt(5), Period: map[string]uint64{ "0": 1, }, @@ -198,10 +197,9 @@ var ( LondonBlock: big.NewInt(22640000), ShanghaiBlock: big.NewInt(41874000), Bor: &BorConfig{ - JaipurBlock: big.NewInt(22770000), - DelhiBlock: big.NewInt(29638656), - ParallelUniverseBlock: big.NewInt(0), - IndoreBlock: big.NewInt(37075456), + JaipurBlock: big.NewInt(22770000), + DelhiBlock: big.NewInt(29638656), + IndoreBlock: big.NewInt(37075456), StateSyncConfirmationDelay: map[string]uint64{ "37075456": 128, }, @@ -264,10 +262,9 @@ var ( LondonBlock: big.NewInt(23850000), ShanghaiBlock: big.NewInt(50523000), Bor: &BorConfig{ - JaipurBlock: big.NewInt(23850000), - DelhiBlock: big.NewInt(38189056), - ParallelUniverseBlock: big.NewInt(0), - IndoreBlock: big.NewInt(44934656), + JaipurBlock: big.NewInt(23850000), + DelhiBlock: big.NewInt(38189056), + IndoreBlock: big.NewInt(44934656), StateSyncConfirmationDelay: map[string]uint64{ "44934656": 128, }, @@ -567,7 +564,6 @@ type BorConfig struct { BurntContract map[string]string `json:"burntContract"` // governance contract where the token will be sent to and burnt in london fork 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) - ParallelUniverseBlock *big.Int `json:"parallelUniverseBlock"` // TODO: update all occurrence, change name and finalize number (hardfork for block-stm related changes) IndoreBlock *big.Int `json:"indoreBlock"` // Indore switch block (nil = no fork, 0 = already on indore) StateSyncConfirmationDelay map[string]uint64 `json:"stateSyncConfirmationDelay"` // StateSync Confirmation Delay, in seconds, to calculate `to` } @@ -609,16 +605,16 @@ func (c *BorConfig) CalculateStateSyncDelay(number uint64) uint64 { return borKeyValueConfigHelper(c.StateSyncConfirmationDelay, number) } -// TODO: modify this function once the block number is finalized -func (c *BorConfig) IsParallelUniverse(number *big.Int) bool { - if c.ParallelUniverseBlock != nil { - if c.ParallelUniverseBlock.Cmp(big.NewInt(0)) == 0 { - return false - } - } +// // TODO: modify this function once the block number is finalized +// func (c *BorConfig) IsNapoli(number *big.Int) bool { +// if c.NapoliBlock != nil { +// if c.NapoliBlock.Cmp(big.NewInt(0)) == 0 { +// return false +// } +// } - return isBlockForked(c.ParallelUniverseBlock, number) -} +// return isBlockForked(c.NapoliBlock, number) +// } func (c *BorConfig) IsSprintStart(number uint64) bool { return number%c.CalculateSprint(number) == 0