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:
postinstall: builder/files/bor-post-install.sh
overrides:
rpm:
replacements:
amd64: x86_64
snapshot:
name_template: "{{ .Tag }}.next"

View file

@ -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

View file

@ -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
}

View file

@ -280,6 +280,7 @@ type TxPool struct {
shanghai atomic.Bool // Fork indicator whether we are in the Shanghai stage.
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
@ -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)

View file

@ -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()

View file

@ -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')
}

View file

@ -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
`

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,9 +22,9 @@ import (
const (
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
VersionMeta = "" // Version metadata to append to the version string
VersionMeta = "beta-6" // Version metadata to append to the version string
)
var GitCommit string