Merge tag 'v0.5.0-beta-6' of github.com:maticnetwork/bor into arpit/merge-latest-branch

This commit is contained in:
Arpit Temani 2023-08-29 17:44:54 +05:30
commit f10517918e
14 changed files with 48 additions and 31 deletions

View file

@ -103,11 +103,6 @@ nfpms:
scripts: scripts:
postinstall: builder/files/bor-post-install.sh postinstall: builder/files/bor-post-install.sh
overrides:
rpm:
replacements:
amd64: x86_64
snapshot: snapshot:
name_template: "{{ .Tag }}.next" name_template: "{{ .Tag }}.next"

View file

@ -213,7 +213,7 @@ release-dry-run:
-v `pwd`:/go/src/$(PACKAGE_NAME) \ -v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \ -w /go/src/$(PACKAGE_NAME) \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--rm-dist --skip-validate --skip-publish --clean --skip-validate --skip-publish
.PHONY: release .PHONY: release
release: release:
@ -230,4 +230,4 @@ release:
-v `pwd`:/go/src/$(PACKAGE_NAME) \ -v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \ -w /go/src/$(PACKAGE_NAME) \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--rm-dist --skip-validate --clean --skip-validate

View file

@ -2170,11 +2170,15 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
LogCacheSize: ethcfg.FilterLogCacheSize, LogCacheSize: ethcfg.FilterLogCacheSize,
}) })
filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethconfig.Defaults.BorLogs)
stack.RegisterAPIs([]rpc.API{{ stack.RegisterAPIs([]rpc.API{{
Namespace: "eth", 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 return filterSystem
} }

View file

@ -279,9 +279,10 @@ type TxPool struct {
eip1559 atomic.Bool // Fork indicator whether we are using EIP-1559 type transactions. 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. shanghai atomic.Bool // Fork indicator whether we are in the Shanghai stage.
currentState *state.StateDB // Current state in the blockchain head currentState *state.StateDB // Current state in the blockchain head
pendingNonces *noncer // Pending state tracking virtual nonces currentStateMutex sync.Mutex // Mutex to protect currentState
currentMaxGas atomic.Uint64 // Current gas limit for transaction caps 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 locals *accountSet // Set of local transaction to exempt from eviction rules
journal *journal // Journal of local transaction to back up to disk 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. // and does not require the pool mutex to be held.
// nolint:gocognit // nolint:gocognit
func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error { 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. // Accept only legacy transactions until EIP-2718/2930 activates.
if !pool.eip2718.Load() && tx.Type() != types.LegacyTxType { if !pool.eip2718.Load() && tx.Type() != types.LegacyTxType {
return core.ErrTxTypeNotSupported 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 // 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). // rules and adheres to some heuristic limits of the local node (price and size).
func (pool *TxPool) validateTx(tx *types.Transaction, _ bool) error { func (pool *TxPool) validateTx(tx *types.Transaction, _ bool) error {
pool.currentStateMutex.Lock()
defer pool.currentStateMutex.Unlock()
// Signature has been checked already, this cannot error. // Signature has been checked already, this cannot error.
from, _ := types.Sender(pool.signer, tx) from, _ := types.Sender(pool.signer, tx)
// Ensure the transaction adheres to nonce ordering // Ensure the transaction adheres to nonce ordering
@ -1915,6 +1922,9 @@ func (pool *TxPool) promoteExecutables(accounts []common.Address) []*types.Trans
balance := uint256.NewInt(0) balance := uint256.NewInt(0)
pool.currentStateMutex.Lock()
defer pool.currentStateMutex.Unlock()
// Iterate over all accounts and promote any executable transactions // Iterate over all accounts and promote any executable transactions
for _, addr := range accounts { for _, addr := range accounts {
list = pool.queue[addr] list = pool.queue[addr]
@ -2252,6 +2262,9 @@ func (pool *TxPool) demoteUnexecutables() {
// Iterate over all accounts and demote any non-executable transactions // Iterate over all accounts and demote any non-executable transactions
pool.pendingMu.RLock() pool.pendingMu.RLock()
pool.currentStateMutex.Lock()
defer pool.currentStateMutex.Unlock()
for addr, list := range pool.pending { for addr, list := range pool.pending {
nonce := pool.currentState.GetNonce(addr) nonce := pool.currentState.GetNonce(addr)

View file

@ -491,6 +491,8 @@ func TestInvalidGetLogsRequest(t *testing.T) {
blockHash = common.HexToHash("0x1111111111111111111111111111111111111111111111111111111111111111") blockHash = common.HexToHash("0x1111111111111111111111111111111111111111111111111111111111111111")
) )
api.SetChainConfig(params.BorUnittestChainConfig)
// Reason: Cannot specify both BlockHash and FromBlock/ToBlock) // Reason: Cannot specify both BlockHash and FromBlock/ToBlock)
testCases := []FilterCriteria{ testCases := []FilterCriteria{
0: {BlockHash: &blockHash, FromBlock: big.NewInt(100)}, 0: {BlockHash: &blockHash, FromBlock: big.NewInt(100)},
@ -808,6 +810,7 @@ func TestPendingLogsSubscription(t *testing.T) {
<-testCases[i].sub.Err() <-testCases[i].sub.Err()
} }
} }
// nolint:gocognit // nolint:gocognit
func TestLightFilterLogs(t *testing.T) { func TestLightFilterLogs(t *testing.T) {
t.Parallel() t.Parallel()

View file

@ -76,7 +76,7 @@ func (c *collector) addHistogram(name string, m metrics.Histogram) {
} }
c.writeSummarySum(name, fmt.Sprintf("%f", sum)) c.writeSummarySum(name, fmt.Sprintf("%f", sum))
c.writeSummaryCounter(name, len(ps)) c.writeSummaryCounter(name, m.Count())
c.buff.WriteRune('\n') 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.writeSummarySum(name, fmt.Sprintf("%f", sum))
c.writeSummaryCounter(name, len(ps)) c.writeSummaryCounter(name, m.Count())
c.buff.WriteRune('\n') c.buff.WriteRune('\n')
} }

View file

@ -49,6 +49,7 @@ func TestCollector(t *testing.T) {
timer.Update(120 * time.Millisecond) timer.Update(120 * time.Millisecond)
timer.Update(23 * time.Millisecond) timer.Update(23 * time.Millisecond)
timer.Update(24 * time.Millisecond) timer.Update(24 * time.Millisecond)
timer.Update(30 * time.Millisecond)
c.addTimer("test/timer", timer) c.addTimer("test/timer", timer)
resettingTimer := metrics.NewResettingTimer() resettingTimer := metrics.NewResettingTimer()
@ -58,6 +59,7 @@ func TestCollector(t *testing.T) {
resettingTimer.Update(120 * time.Millisecond) resettingTimer.Update(120 * time.Millisecond)
resettingTimer.Update(13 * time.Millisecond) resettingTimer.Update(13 * time.Millisecond)
resettingTimer.Update(14 * time.Millisecond) resettingTimer.Update(14 * time.Millisecond)
resettingTimer.Update(30 * time.Millisecond)
c.addResettingTimer("test/resetting_timer", resettingTimer.Snapshot()) c.addResettingTimer("test/resetting_timer", resettingTimer.Snapshot())
emptyResettingTimer := metrics.NewResettingTimer().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.999"} 0
test_histogram {quantile="0.9999"} 0 test_histogram {quantile="0.9999"} 0
test_histogram_sum 0.000000 test_histogram_sum 0.000000
test_histogram_count 6 test_histogram_count 0
# TYPE test_meter gauge # TYPE test_meter gauge
test_meter 9999999 test_meter 9999999
# TYPE test_timer summary # TYPE test_timer summary
test_timer {quantile="0.5"} 2.25e+07 test_timer {quantile="0.5"} 2.3e+07
test_timer {quantile="0.75"} 4.8e+07 test_timer {quantile="0.75"} 3e+07
test_timer {quantile="0.95"} 1.2e+08 test_timer {quantile="0.95"} 1.2e+08
test_timer {quantile="0.99"} 1.2e+08 test_timer {quantile="0.99"} 1.2e+08
test_timer {quantile="0.999"} 1.2e+08 test_timer {quantile="0.999"} 1.2e+08
test_timer {quantile="0.9999"} 1.2e+08 test_timer {quantile="0.9999"} 1.2e+08
test_timer_sum 550500000.000000 test_timer_sum 533000000.000000
test_timer_count 6 test_timer_count 7
# TYPE test_resetting_timer summary # 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.95"} 120000000
test_resetting_timer {quantile="0.99"} 120000000 test_resetting_timer {quantile="0.99"} 120000000
test_resetting_timer_sum 180000000 test_resetting_timer_sum 210000000
test_resetting_timer_count 6 test_resetting_timer_count 7
` `

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 0.4.0 Version: 0.5.0-beta-6
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 0.4.0 Version: 0.5.0-beta-6
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 0.4.0 Version: 0.5.0-beta-6
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 0.4.0 Version: 0.5.0-beta-6
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 0.4.0 Version: 0.5.0-beta-6
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 0.4.0 Version: 0.5.0-beta-6
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -21,10 +21,10 @@ import (
) )
const ( const (
VersionMajor = 0 // Major version component of the current release VersionMajor = 0 // Major version component of the current release
VersionMinor = 4 // Minor version component of the current release VersionMinor = 5 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release VersionPatch = 0 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string VersionMeta = "beta-6" // Version metadata to append to the version string
) )
var GitCommit string var GitCommit string