From 3a3e619d4cd1bf8a0735c40cdb35e16dfb8256db Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Fri, 24 Jan 2025 16:12:26 +0530 Subject: [PATCH 1/5] Merge pull request #1411 from maticnetwork/manav/indexer-graceful-shutdown core/rawdb: prevent ungraceful shutdown in tx indexing --- core/rawdb/chain_iterator.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/core/rawdb/chain_iterator.go b/core/rawdb/chain_iterator.go index 6989e480b5..92d1c2e918 100644 --- a/core/rawdb/chain_iterator.go +++ b/core/rawdb/chain_iterator.go @@ -92,6 +92,16 @@ func InitDatabaseFromFreezer(db ethdb.Database) { log.Info("Initialized database from freezer", "blocks", frozen, "elapsed", common.PrettyDuration(time.Since(start))) } +// adjustRangeForBor updates the range to index transactions if the ancient data was pruned before. This is +// to avoid indexing/unindexing data which is already pruned (i.e. before the `offset` block number). +func adjustRangeForBor(db ethdb.Database, from uint64) uint64 { + if offset := db.AncientOffSet(); offset > from { + from = offset + } + + return from +} + type blockTxHashes struct { number uint64 hashes []common.Hash @@ -108,10 +118,6 @@ func iterateTransactions(db ethdb.Database, from uint64, to uint64, reverse bool rlp rlp.RawValue } - if offset := db.AncientOffSet(); offset > from { - from = offset - } - if to <= from { return nil } @@ -206,6 +212,9 @@ func iterateTransactions(db ethdb.Database, from uint64, to uint64, reverse bool // There is a passed channel, the whole procedure will be interrupted if any // signal received. func indexTransactions(db ethdb.Database, from uint64, to uint64, interrupt chan struct{}, hook func(uint64) bool, report bool) { + // Adjust range if needed + from = adjustRangeForBor(db, from) + // short circuit for invalid range if from >= to { return @@ -309,6 +318,9 @@ func indexTransactionsForTesting(db ethdb.Database, from uint64, to uint64, inte // There is a passed channel, the whole procedure will be interrupted if any // signal received. func unindexTransactions(db ethdb.Database, from uint64, to uint64, interrupt chan struct{}, hook func(uint64) bool, report bool) { + // Adjust range if needed + from = adjustRangeForBor(db, from) + // short circuit for invalid range if from >= to { return From 4ef49519f03e9e0e203c543b2333a09ef2dcbd62 Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Mon, 27 Jan 2025 16:45:42 +0530 Subject: [PATCH 2/5] consensus/bor: log err when commit span fails (#1413) * consensus/bor: log err in commit span * consensus/bor: fix lint --- consensus/bor/statefull/processor.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/consensus/bor/statefull/processor.go b/consensus/bor/statefull/processor.go index 88f4ade709..b2c61b89e7 100644 --- a/consensus/bor/statefull/processor.go +++ b/consensus/bor/statefull/processor.go @@ -100,6 +100,11 @@ func ApplyMessage( log.Error("message execution failed on contract", "msgData", msg.Data) } + // If there's error committing span, log it here. It won't be reported before because the return value is empty. + if bytes.Equal(msg.To().Bytes(), validatorContract.Bytes()) && err != nil { + log.Error("message execution failed on contract", "err", err) + } + // Update the state with pending changes if err != nil { state.Finalise(true) From 4c6169a604a904d343444f00efc145f84141cf5f Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 27 Jan 2025 10:45:33 -0800 Subject: [PATCH 3/5] Use PBSS and pebble by default (#1412) * Use pebble db and PBSS by default * Address CR comments * Fix failed test --- builder/files/config.toml | 3 ++- docs/cli/example_config.toml | 3 ++- docs/cli/server.md | 4 ++-- internal/cli/debug_test.go | 1 + internal/cli/server/config.go | 7 +++++-- internal/cli/server/config_test.go | 14 ++++++++++++++ internal/cli/server/testdata/default.toml | 3 ++- packaging/templates/mainnet-v1/archive/config.toml | 3 ++- .../mainnet-v1/sentry/sentry/bor/config.toml | 2 +- .../mainnet-v1/sentry/validator/bor/config.toml | 2 +- .../mainnet-v1/without-sentry/bor/config.toml | 2 +- .../templates/testnet-amoy/archive/config.toml | 3 ++- .../testnet-amoy/sentry/sentry/bor/config.toml | 2 +- .../testnet-amoy/sentry/validator/bor/config.toml | 2 +- .../testnet-amoy/without-sentry/bor/config.toml | 2 +- 15 files changed, 38 insertions(+), 15 deletions(-) diff --git a/builder/files/config.toml b/builder/files/config.toml index df34031979..e68910f123 100644 --- a/builder/files/config.toml +++ b/builder/files/config.toml @@ -8,7 +8,8 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# "db.engine" = "leveldb" +# "db.engine" = "pebble" +# "state.scheme" = "path" # keystore = "/var/lib/bor/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/docs/cli/example_config.toml b/docs/cli/example_config.toml index ea869925c4..b656a6dc3f 100644 --- a/docs/cli/example_config.toml +++ b/docs/cli/example_config.toml @@ -8,7 +8,8 @@ verbosity = 3 # Logging verbosity for the server (5=trace|4=de vmdebug = false # Record information useful for VM and contract debugging datadir = "var/lib/bor" # Path of the data directory to store information ancient = "" # Data directory for ancient chain segments (default = inside chaindata) -"db.engine" = "leveldb" # Used to select leveldb or pebble as database (default = leveldb) +"db.engine" = "pebble" # Used to select leveldb or pebble as database (default = pebble) +"state.scheme" = "path" # Used to select the state scheme (default = path) keystore = "" # Path of the directory where keystores are located "rpc.batchlimit" = 100 # Maximum number of messages in a batch (default=100, use 0 for no limits) "rpc.returndatalimit" = 100000 # Maximum size (in bytes) a result of an rpc request could have (default=100000, use 0 for no limits) diff --git a/docs/cli/server.md b/docs/cli/server.md index 243e83406d..3bfeab9d5b 100644 --- a/docs/cli/server.md +++ b/docs/cli/server.md @@ -28,7 +28,7 @@ The ```bor server``` command runs the Bor client. - ```datadir.ancient```: Data directory for ancient chain segments (default = inside chaindata) -- ```db.engine```: Backing database implementation to use ('leveldb' or 'pebble') (default: leveldb) +- ```db.engine```: Backing database implementation to use ('leveldb' or 'pebble') (default: pebble) - ```dev```: Enable developer mode with ephemeral proof-of-authority network and a pre-funded developer account, mining enabled (default: false) @@ -84,7 +84,7 @@ The ```bor server``` command runs the Bor client. - ```snapshot```: Enables the snapshot-database mode (default: true) -- ```state.scheme```: Scheme to use for storing ethereum state ('hash' or 'path') (default: hash) +- ```state.scheme```: Scheme to use for storing ethereum state ('hash' or 'path') (default: path) - ```syncmode```: Blockchain sync mode (only "full" sync supported) (default: full) diff --git a/internal/cli/debug_test.go b/internal/cli/debug_test.go index aa1e4a8bf1..1be7219c0c 100644 --- a/internal/cli/debug_test.go +++ b/internal/cli/debug_test.go @@ -28,6 +28,7 @@ func TestCommand_DebugBlock(t *testing.T) { // enable archive mode for getting traces of ancient blocks config.GcMode = "archive" + config.StateScheme = "hash" // start the mock server srv, err := server.CreateMockServer(config) diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 5960fdeab0..93c8871bf3 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -609,7 +609,7 @@ func DefaultConfig() *Config { EnablePreimageRecording: false, DataDir: DefaultDataDir(), Ancient: "", - DBEngine: "leveldb", + DBEngine: "pebble", KeyStoreDir: "", Logging: &LoggingConfig{ Vmodule: "", @@ -647,7 +647,7 @@ func DefaultConfig() *Config { }, SyncMode: "full", GcMode: "full", - StateScheme: "hash", + StateScheme: "path", Snapshot: true, BorLogs: false, TxPool: &TxPoolConfig{ @@ -1168,6 +1168,9 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* log.Info("Enabling recording of key preimages since archive mode is used") } + if c.StateScheme == "path" { + return nil, fmt.Errorf("path storage scheme is not supported in archive mode, please use hash instead") + } default: return nil, fmt.Errorf("gcmode '%s' not found", c.GcMode) } diff --git a/internal/cli/server/config_test.go b/internal/cli/server/config_test.go index abb8ca39fb..b140789e94 100644 --- a/internal/cli/server/config_test.go +++ b/internal/cli/server/config_test.go @@ -144,3 +144,17 @@ func TestMakePasswordListFromFile(t *testing.T) { assert.Equal(t, []string{"test1", "test2"}, result) }) } + +func TestConfigStateScheme(t *testing.T) { + config := DefaultConfig() + config.StateScheme = "path" + config.GcMode = "archive" + + assert.NoError(t, config.loadChain()) + + _, err := config.buildNode() + assert.NoError(t, err) + + _, err = config.buildEth(nil, nil) + assert.Error(t, err) +} diff --git a/internal/cli/server/testdata/default.toml b/internal/cli/server/testdata/default.toml index 0df37d610c..e321b052aa 100644 --- a/internal/cli/server/testdata/default.toml +++ b/internal/cli/server/testdata/default.toml @@ -5,7 +5,8 @@ log-level = "" vmdebug = false datadir = "/var/lib/bor" ancient = "" -"db.engine" = "leveldb" +"db.engine" = "pebble" +"db.scheme" = "path" keystore = "" "rpc.batchlimit" = 100 "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/mainnet-v1/archive/config.toml b/packaging/templates/mainnet-v1/archive/config.toml index a62dda85b1..e200b47fcb 100644 --- a/packaging/templates/mainnet-v1/archive/config.toml +++ b/packaging/templates/mainnet-v1/archive/config.toml @@ -4,7 +4,8 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# "db.engine" = "leveldb" +# "db.engine" = "pebble" +state.scheme = "hash" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml index 0ee56f339c..df29c21c48 100644 --- a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml @@ -4,7 +4,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# db.engine = "pebble" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml index bcf19bbcbe..41c439841f 100644 --- a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml @@ -6,7 +6,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# db.engine = "pebble" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml index 24d25b4406..77bfe63f3c 100644 --- a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml @@ -6,7 +6,7 @@ chain = "mainnet" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# db.engine = "pebble" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/testnet-amoy/archive/config.toml b/packaging/templates/testnet-amoy/archive/config.toml index d7f19551e5..7fb2f21476 100644 --- a/packaging/templates/testnet-amoy/archive/config.toml +++ b/packaging/templates/testnet-amoy/archive/config.toml @@ -4,7 +4,8 @@ chain = "amoy" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# db.engine = "pebble" +state.scheme = "hash" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/testnet-amoy/sentry/sentry/bor/config.toml b/packaging/templates/testnet-amoy/sentry/sentry/bor/config.toml index e0d976ed57..0007e22955 100644 --- a/packaging/templates/testnet-amoy/sentry/sentry/bor/config.toml +++ b/packaging/templates/testnet-amoy/sentry/sentry/bor/config.toml @@ -4,7 +4,7 @@ chain = "amoy" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# db.engine = "pebble" # keystore = "" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/testnet-amoy/sentry/validator/bor/config.toml b/packaging/templates/testnet-amoy/sentry/validator/bor/config.toml index 7180b4e422..9e0eec562a 100644 --- a/packaging/templates/testnet-amoy/sentry/validator/bor/config.toml +++ b/packaging/templates/testnet-amoy/sentry/validator/bor/config.toml @@ -6,7 +6,7 @@ chain = "amoy" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# db.engine = "pebble" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 diff --git a/packaging/templates/testnet-amoy/without-sentry/bor/config.toml b/packaging/templates/testnet-amoy/without-sentry/bor/config.toml index 91bd871c94..fa9f1970e8 100644 --- a/packaging/templates/testnet-amoy/without-sentry/bor/config.toml +++ b/packaging/templates/testnet-amoy/without-sentry/bor/config.toml @@ -6,7 +6,7 @@ chain = "amoy" # vmdebug = false datadir = "/var/lib/bor/data" # ancient = "" -# db.engine = "leveldb" +# db.engine = "pebble" # keystore = "$BOR_DIR/keystore" # "rpc.batchlimit" = 100 # "rpc.returndatalimit" = 100000 From c038dd26ceb41fc930753f24ac34568d322c62d2 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 28 Jan 2025 08:49:30 -0800 Subject: [PATCH 4/5] Remove redundant locks from txpool (#1420) --- core/txpool/legacypool/legacypool.go | 8 +- core/txpool/legacypool/list.go | 142 +++------------------------ 2 files changed, 16 insertions(+), 134 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 3808a2bb7f..13e3d453e7 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -100,12 +100,8 @@ var ( localGauge = metrics.NewRegisteredGauge("txpool/local", nil) slotsGauge = metrics.NewRegisteredGauge("txpool/slots", nil) - resetCacheGauge = metrics.NewRegisteredGauge("txpool/resetcache", nil) - reinitCacheGauge = metrics.NewRegisteredGauge("txpool/reinittcache", nil) - hitCacheCounter = metrics.NewRegisteredCounter("txpool/cachehit", nil) - missCacheCounter = metrics.NewRegisteredCounter("txpool/cachemiss", nil) - - reheapTimer = metrics.NewRegisteredTimer("txpool/reheap", nil) + resetCacheGauge = metrics.NewRegisteredGauge("txpool/resetcache", nil) + reheapTimer = metrics.NewRegisteredTimer("txpool/reheap", nil) ) // BlockChain defines the minimal set of methods needed to back a tx pool with diff --git a/core/txpool/legacypool/list.go b/core/txpool/legacypool/list.go index 031b657862..37dd7c6354 100644 --- a/core/txpool/legacypool/list.go +++ b/core/txpool/legacypool/list.go @@ -58,29 +58,22 @@ func (h *nonceHeap) Pop() interface{} { // sortedMap is a nonce->transaction hash map with a heap based index to allow // iterating over the contents in a nonce-incrementing way. type sortedMap struct { - items map[uint64]*types.Transaction // Hash map storing the transaction data - index *nonceHeap // Heap of nonces of all the stored transactions (non-strict mode) - m sync.RWMutex - - cache types.Transactions // Cache of the transactions already sorted - isEmpty bool + items map[uint64]*types.Transaction // Hash map storing the transaction data + index *nonceHeap // Heap of nonces of all the stored transactions (non-strict mode) + cache types.Transactions // Cache of the transactions already sorted cacheMu sync.RWMutex } // newSortedMap creates a new nonce-sorted transaction map. func newSortedMap() *sortedMap { return &sortedMap{ - items: make(map[uint64]*types.Transaction), - index: new(nonceHeap), - isEmpty: true, + items: make(map[uint64]*types.Transaction), + index: new(nonceHeap), } } // Get retrieves the current transactions associated with the given nonce. func (m *sortedMap) Get(nonce uint64) *types.Transaction { - m.m.RLock() - defer m.m.RUnlock() - return m.items[nonce] } @@ -89,28 +82,18 @@ func (m *sortedMap) Has(nonce uint64) bool { return false } - m.m.RLock() - defer m.m.RUnlock() - return m.items[nonce] != nil } // Put inserts a new transaction into the map, also updating the map's nonce // index. If a transaction already exists with the same nonce, it's overwritten. func (m *sortedMap) Put(tx *types.Transaction) { - m.m.Lock() - defer m.m.Unlock() - nonce := tx.Nonce() if m.items[nonce] == nil { heap.Push(m.index, nonce) } - - m.items[nonce] = tx - m.cacheMu.Lock() - m.isEmpty = true - m.cache = nil + m.items[nonce], m.cache = tx, nil m.cacheMu.Unlock() } @@ -118,9 +101,6 @@ func (m *sortedMap) Put(tx *types.Transaction) { // provided threshold. Every removed transaction is returned for any post-removal // maintenance. func (m *sortedMap) Forward(threshold uint64) types.Transactions { - m.m.Lock() - defer m.m.Unlock() - var removed types.Transactions // Pop off heap items until the threshold is reached @@ -133,8 +113,6 @@ func (m *sortedMap) Forward(threshold uint64) types.Transactions { // If we had a cached order, shift the front m.cacheMu.Lock() if m.cache != nil { - hitCacheCounter.Inc(1) - m.cache = m.cache[len(removed):] } m.cacheMu.Unlock() @@ -147,9 +125,6 @@ func (m *sortedMap) Forward(threshold uint64) types.Transactions { // If you want to do several consecutive filterings, it's therefore better to first // do a .filter(func1) followed by .Filter(func2) or reheap() func (m *sortedMap) Filter(filter func(*types.Transaction) bool) types.Transactions { - m.m.Lock() - defer m.m.Unlock() - removed := m.filter(filter) // If transactions were removed, the heap and cache are ruined if len(removed) > 0 { @@ -187,10 +162,7 @@ func (m *sortedMap) filter(filter func(*types.Transaction) bool) types.Transacti if len(removed) > 0 { m.cacheMu.Lock() m.cache = nil - m.isEmpty = true m.cacheMu.Unlock() - - resetCacheGauge.Inc(1) } return removed @@ -199,9 +171,6 @@ func (m *sortedMap) filter(filter func(*types.Transaction) bool) types.Transacti // Cap places a hard limit on the number of items, returning all transactions // exceeding that limit. func (m *sortedMap) Cap(threshold int) types.Transactions { - m.m.Lock() - defer m.m.Unlock() - // Short circuit if the number of items is under the limit if len(m.items) <= threshold { return nil @@ -233,15 +202,11 @@ func (m *sortedMap) Cap(threshold int) types.Transactions { // Remove deletes a transaction from the maintained map, returning whether the // transaction was found. func (m *sortedMap) Remove(nonce uint64) bool { - m.m.Lock() - defer m.m.Unlock() - // Short circuit if no transaction is present _, ok := m.items[nonce] if !ok { return false } - // Otherwise delete the transaction and fix the heap index for i := 0; i < m.index.Len(); i++ { if (*m.index)[i] == nonce { @@ -250,16 +215,11 @@ func (m *sortedMap) Remove(nonce uint64) bool { break } } - delete(m.items, nonce) - m.cacheMu.Lock() m.cache = nil - m.isEmpty = true m.cacheMu.Unlock() - resetCacheGauge.Inc(1) - return true } @@ -271,9 +231,6 @@ func (m *sortedMap) Remove(nonce uint64) bool { // prevent getting into an invalid state. This is not something that should ever // happen but better to be self correcting than failing! func (m *sortedMap) Ready(start uint64) types.Transactions { - m.m.Lock() - defer m.m.Unlock() - // Short circuit if no transactions are available if m.index.Len() == 0 || (*m.index)[0] > start { return nil @@ -290,7 +247,6 @@ func (m *sortedMap) Ready(start uint64) types.Transactions { m.cacheMu.Lock() m.cache = nil - m.isEmpty = true m.cacheMu.Unlock() resetCacheGauge.Inc(1) @@ -300,85 +256,25 @@ func (m *sortedMap) Ready(start uint64) types.Transactions { // Len returns the length of the transaction map. func (m *sortedMap) Len() int { - m.m.RLock() - defer m.m.RUnlock() - return len(m.items) } func (m *sortedMap) flatten() types.Transactions { - // If the sorting was not cached yet, create and cache it m.cacheMu.Lock() defer m.cacheMu.Unlock() - - if m.isEmpty { - m.isEmpty = false // to simulate sync.Once - - m.cacheMu.Unlock() - - m.m.RLock() - - cache := make(types.Transactions, 0, len(m.items)) - + // If the sorting was not cached yet, create and cache it + if m.cache == nil { + m.cache = make(types.Transactions, 0, len(m.items)) for _, tx := range m.items { - cache = append(cache, tx) + m.cache = append(m.cache, tx) } - - m.m.RUnlock() - - // exclude sorting from locks - sort.Sort(types.TxByNonce(cache)) - - m.cacheMu.Lock() - m.cache = cache - - reinitCacheGauge.Inc(1) - missCacheCounter.Inc(1) - } else { - hitCacheCounter.Inc(1) + sort.Sort(types.TxByNonce(m.cache)) } - return m.cache } func (m *sortedMap) lastElement() *types.Transaction { - // If the sorting was not cached yet, create and cache it - m.cacheMu.Lock() - defer m.cacheMu.Unlock() - - cache := m.cache - - if m.isEmpty { - m.isEmpty = false // to simulate sync.Once - - m.cacheMu.Unlock() - - m.m.RLock() - cache = make(types.Transactions, 0, len(m.items)) - - for _, tx := range m.items { - cache = append(cache, tx) - } - - m.m.RUnlock() - - // exclude sorting from locks - sort.Sort(types.TxByNonce(cache)) - - m.cacheMu.Lock() - m.cache = cache - - reinitCacheGauge.Inc(1) - missCacheCounter.Inc(1) - } else { - hitCacheCounter.Inc(1) - } - - ln := len(cache) - if ln == 0 { - return nil - } - + cache := m.flatten() return cache[len(cache)-1] } @@ -657,9 +553,8 @@ func (l *list) subTotalCost(txs []*types.Transaction) { // then the heap is sorted based on the effective tip based on the given base fee. // If baseFee is nil then the sorting is based on gasFeeCap. type priceHeap struct { - baseFee *big.Int // heap should always be re-sorted after baseFee is changed - list []*types.Transaction - baseFeeMu sync.RWMutex + baseFee *big.Int // heap should always be re-sorted after baseFee is changed + list []*types.Transaction } func (h *priceHeap) Len() int { return len(h.list) } @@ -677,19 +572,13 @@ func (h *priceHeap) Less(i, j int) bool { } func (h *priceHeap) cmp(a, b *types.Transaction) int { - h.baseFeeMu.RLock() - if h.baseFee != nil { // Compare effective tips if baseFee is specified if c := a.EffectiveGasTipCmp(b, h.baseFee); c != 0 { - h.baseFeeMu.RUnlock() - return c } } - h.baseFeeMu.RUnlock() - // Compare fee caps if baseFee is not specified or effective tips are equal if c := a.GasFeeCapCmp(b); c != 0 { return c @@ -882,9 +771,6 @@ func (l *pricedList) Reheap() { // SetBaseFee updates the base fee and triggers a re-heap. Note that Removed is not // necessary to call right before SetBaseFee when processing a new block. func (l *pricedList) SetBaseFee(baseFee *big.Int) { - l.urgent.baseFeeMu.Lock() l.urgent.baseFee = baseFee - l.urgent.baseFeeMu.Unlock() - l.Reheap() } From ce4af042a3446c3b7fd41825c419ea0befc1069f Mon Sep 17 00:00:00 2001 From: Krishang Shah <109511742+kamuikatsurgi@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:30:27 +0530 Subject: [PATCH 5/5] Simplify e2e-tests CI by using the consolidated script (#1423) * use the consolidated script for e2e-tests * minor nit --- .github/workflows/ci.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1ec6f39c6..f9a63f83f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -236,15 +236,9 @@ jobs: - name: Launch devnet run: | cd matic-cli/devnet - bash docker-ganache-start.sh - bash docker-heimdall-start-all.sh - bash docker-bor-setup.sh - bash docker-bor-start-all.sh + bash ../docker_devnet.sh cd - timeout 2m bash bor/integration-tests/bor_health.sh - cd - - bash ganache-deployment-bor.sh - bash ganache-deployment-sync.sh - name: Run smoke tests run: |