diff --git a/.goreleaser.yml b/.goreleaser.yml index 6f770ba739..7cf76d388d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -103,11 +103,6 @@ nfpms: scripts: postinstall: builder/files/bor-post-install.sh - overrides: - rpm: - replacements: - amd64: x86_64 - snapshot: name_template: "{{ .Tag }}.next" diff --git a/Makefile b/Makefile index 666126b7de..c14d0dc9f8 100644 --- a/Makefile +++ b/Makefile @@ -213,7 +213,7 @@ release-dry-run: -v `pwd`:/go/src/$(PACKAGE_NAME) \ -w /go/src/$(PACKAGE_NAME) \ goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ - --rm-dist --skip-validate --skip-publish + --clean --skip-validate --skip-publish .PHONY: release release: @@ -230,4 +230,4 @@ release: -v `pwd`:/go/src/$(PACKAGE_NAME) \ -w /go/src/$(PACKAGE_NAME) \ goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ - --rm-dist --skip-validate + --clean --skip-validate diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index d41bd77b79..0313149341 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -2170,11 +2170,15 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf LogCacheSize: ethcfg.FilterLogCacheSize, }) + filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethconfig.Defaults.BorLogs) stack.RegisterAPIs([]rpc.API{{ Namespace: "eth", - Service: filters.NewFilterAPI(filterSystem, isLightClient, ethconfig.Defaults.BorLogs), + Service: filterAPI, }}) + // avoiding constructor changed by introducing new method to set genesis + filterAPI.SetChainConfig(ethcfg.Genesis.Config) + return filterSystem } diff --git a/core/triecache/data.0.bin b/core/triecache/data.0.bin new file mode 100644 index 0000000000..e69de29bb2 diff --git a/core/triecache/data.1.bin b/core/triecache/data.1.bin new file mode 100644 index 0000000000..28c0310085 Binary files /dev/null and b/core/triecache/data.1.bin differ diff --git a/core/triecache/data.2.bin b/core/triecache/data.2.bin new file mode 100644 index 0000000000..e69de29bb2 diff --git a/core/triecache/data.3.bin b/core/triecache/data.3.bin new file mode 100644 index 0000000000..e20c4885dc Binary files /dev/null and b/core/triecache/data.3.bin differ diff --git a/core/triecache/data.4.bin b/core/triecache/data.4.bin new file mode 100644 index 0000000000..37665a1afe Binary files /dev/null and b/core/triecache/data.4.bin differ diff --git a/core/triecache/data.5.bin b/core/triecache/data.5.bin new file mode 100644 index 0000000000..9f6fe71291 Binary files /dev/null and b/core/triecache/data.5.bin differ diff --git a/core/triecache/data.6.bin b/core/triecache/data.6.bin new file mode 100644 index 0000000000..e69de29bb2 diff --git a/core/triecache/data.7.bin b/core/triecache/data.7.bin new file mode 100644 index 0000000000..411a677ce9 Binary files /dev/null and b/core/triecache/data.7.bin differ diff --git a/core/triecache/metadata.bin b/core/triecache/metadata.bin new file mode 100644 index 0000000000..8f9d128a87 Binary files /dev/null and b/core/triecache/metadata.bin differ diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index c739b6d15b..9ced7c630d 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -279,9 +279,10 @@ type TxPool struct { eip1559 atomic.Bool // Fork indicator whether we are using EIP-1559 type transactions. shanghai atomic.Bool // Fork indicator whether we are in the Shanghai stage. - currentState *state.StateDB // Current state in the blockchain head - pendingNonces *noncer // Pending state tracking virtual nonces - currentMaxGas atomic.Uint64 // Current gas limit for transaction caps + currentState *state.StateDB // Current state in the blockchain head + currentStateMutex sync.Mutex // Mutex to protect currentState + pendingNonces *noncer // Pending state tracking virtual nonces + currentMaxGas atomic.Uint64 // Current gas limit for transaction caps locals *accountSet // Set of local transaction to exempt from eviction rules journal *journal // Journal of local transaction to back up to disk @@ -745,6 +746,9 @@ func (pool *TxPool) local() map[common.Address]types.Transactions { // and does not require the pool mutex to be held. // nolint:gocognit func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error { + pool.currentStateMutex.Lock() + defer pool.currentStateMutex.Unlock() + // Accept only legacy transactions until EIP-2718/2930 activates. if !pool.eip2718.Load() && tx.Type() != types.LegacyTxType { return core.ErrTxTypeNotSupported @@ -850,6 +854,9 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error { // validateTx checks whether a transaction is valid according to the consensus // rules and adheres to some heuristic limits of the local node (price and size). func (pool *TxPool) validateTx(tx *types.Transaction, _ bool) error { + pool.currentStateMutex.Lock() + defer pool.currentStateMutex.Unlock() + // Signature has been checked already, this cannot error. from, _ := types.Sender(pool.signer, tx) // Ensure the transaction adheres to nonce ordering @@ -1915,6 +1922,9 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans balance := uint256.NewInt(0) + pool.currentStateMutex.Lock() + defer pool.currentStateMutex.Unlock() + // Iterate over all accounts and promote any executable transactions for _, addr := range accounts { list = pool.queue[addr] @@ -2252,6 +2262,9 @@ func (pool *TxPool) demoteUnexecutables() { // Iterate over all accounts and demote any non-executable transactions pool.pendingMu.RLock() + pool.currentStateMutex.Lock() + defer pool.currentStateMutex.Unlock() + for addr, list := range pool.pending { nonce := pool.currentState.GetNonce(addr) diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go index dc88b1ba68..43d79f3723 100644 --- a/eth/filters/filter_system_test.go +++ b/eth/filters/filter_system_test.go @@ -491,6 +491,8 @@ func TestInvalidGetLogsRequest(t *testing.T) { blockHash = common.HexToHash("0x1111111111111111111111111111111111111111111111111111111111111111") ) + api.SetChainConfig(params.BorUnittestChainConfig) + // Reason: Cannot specify both BlockHash and FromBlock/ToBlock) testCases := []FilterCriteria{ 0: {BlockHash: &blockHash, FromBlock: big.NewInt(100)}, @@ -808,6 +810,7 @@ func TestPendingLogsSubscription(t *testing.T) { <-testCases[i].sub.Err() } } + // nolint:gocognit func TestLightFilterLogs(t *testing.T) { t.Parallel() diff --git a/metrics/prometheus/collector.go b/metrics/prometheus/collector.go index ecd90e72d6..3f041aa1c2 100644 --- a/metrics/prometheus/collector.go +++ b/metrics/prometheus/collector.go @@ -76,7 +76,7 @@ func (c *collector) addHistogram(name string, m metrics.Histogram) { } c.writeSummarySum(name, fmt.Sprintf("%f", sum)) - c.writeSummaryCounter(name, len(ps)) + c.writeSummaryCounter(name, m.Count()) c.buff.WriteRune('\n') } @@ -97,7 +97,7 @@ func (c *collector) addTimer(name string, m metrics.Timer) { } c.writeSummarySum(name, fmt.Sprintf("%f", sum)) - c.writeSummaryCounter(name, len(ps)) + c.writeSummaryCounter(name, m.Count()) c.buff.WriteRune('\n') } diff --git a/metrics/prometheus/collector_test.go b/metrics/prometheus/collector_test.go index 1321aec383..ba3c829f1d 100644 --- a/metrics/prometheus/collector_test.go +++ b/metrics/prometheus/collector_test.go @@ -49,6 +49,7 @@ func TestCollector(t *testing.T) { timer.Update(120 * time.Millisecond) timer.Update(23 * time.Millisecond) timer.Update(24 * time.Millisecond) + timer.Update(30 * time.Millisecond) c.addTimer("test/timer", timer) resettingTimer := metrics.NewResettingTimer() @@ -58,6 +59,7 @@ func TestCollector(t *testing.T) { resettingTimer.Update(120 * time.Millisecond) resettingTimer.Update(13 * time.Millisecond) resettingTimer.Update(14 * time.Millisecond) + resettingTimer.Update(30 * time.Millisecond) c.addResettingTimer("test/resetting_timer", resettingTimer.Snapshot()) emptyResettingTimer := metrics.NewResettingTimer().Snapshot() @@ -83,27 +85,27 @@ test_histogram {quantile="0.99"} 0 test_histogram {quantile="0.999"} 0 test_histogram {quantile="0.9999"} 0 test_histogram_sum 0.000000 -test_histogram_count 6 +test_histogram_count 0 # TYPE test_meter gauge test_meter 9999999 # TYPE test_timer summary -test_timer {quantile="0.5"} 2.25e+07 -test_timer {quantile="0.75"} 4.8e+07 +test_timer {quantile="0.5"} 2.3e+07 +test_timer {quantile="0.75"} 3e+07 test_timer {quantile="0.95"} 1.2e+08 test_timer {quantile="0.99"} 1.2e+08 test_timer {quantile="0.999"} 1.2e+08 test_timer {quantile="0.9999"} 1.2e+08 -test_timer_sum 550500000.000000 -test_timer_count 6 +test_timer_sum 533000000.000000 +test_timer_count 7 # TYPE test_resetting_timer summary -test_resetting_timer {quantile="0.50"} 12000000 +test_resetting_timer {quantile="0.50"} 13000000 test_resetting_timer {quantile="0.95"} 120000000 test_resetting_timer {quantile="0.99"} 120000000 -test_resetting_timer_sum 180000000 -test_resetting_timer_count 6 +test_resetting_timer_sum 210000000 +test_resetting_timer_count 7 ` diff --git a/packaging/templates/package_scripts/control b/packaging/templates/package_scripts/control index 4000915de1..679699c18a 100644 --- a/packaging/templates/package_scripts/control +++ b/packaging/templates/package_scripts/control @@ -1,5 +1,5 @@ Source: bor -Version: 0.4.0 +Version: 1.0.0-beta Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.arm64 b/packaging/templates/package_scripts/control.arm64 index 94c5bf09c0..2f8c3bd8a1 100644 --- a/packaging/templates/package_scripts/control.arm64 +++ b/packaging/templates/package_scripts/control.arm64 @@ -1,5 +1,5 @@ Source: bor -Version: 0.4.0 +Version: 1.0.0-beta Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.amd64 b/packaging/templates/package_scripts/control.profile.amd64 index 1a285a6af0..3692578885 100644 --- a/packaging/templates/package_scripts/control.profile.amd64 +++ b/packaging/templates/package_scripts/control.profile.amd64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 0.4.0 +Version: 1.0.0-beta Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.arm64 b/packaging/templates/package_scripts/control.profile.arm64 index f1658add4c..347129e197 100644 --- a/packaging/templates/package_scripts/control.profile.arm64 +++ b/packaging/templates/package_scripts/control.profile.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 0.4.0 +Version: 1.0.0-beta Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator b/packaging/templates/package_scripts/control.validator index 97fc1adcbd..e1bd6e1673 100644 --- a/packaging/templates/package_scripts/control.validator +++ b/packaging/templates/package_scripts/control.validator @@ -1,5 +1,5 @@ Source: bor-profile -Version: 0.4.0 +Version: 1.0.0-beta Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator.arm64 b/packaging/templates/package_scripts/control.validator.arm64 index f88dd5836d..97b287371f 100644 --- a/packaging/templates/package_scripts/control.validator.arm64 +++ b/packaging/templates/package_scripts/control.validator.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 0.4.0 +Version: 1.0.0-beta Section: develop Priority: standard Maintainer: Polygon diff --git a/params/version.go b/params/version.go index 79e9f0453f..82097fbcde 100644 --- a/params/version.go +++ b/params/version.go @@ -21,10 +21,10 @@ import ( ) const ( - VersionMajor = 0 // Major version component of the current release - VersionMinor = 4 // Minor version component of the current release - VersionPatch = 0 // Patch version component of the current release - VersionMeta = "" // Version metadata to append to the version string + VersionMajor = 1 // Major version component of the current release + VersionMinor = 0 // Minor version component of the current release + VersionPatch = 0 // Patch version component of the current release + VersionMeta = "beta" // Version metadata to append to the version string ) var GitCommit string