Merge pull request #1013 from maticnetwork/master-to-develop

Backport master to develop after v1.0.4
This commit is contained in:
Pratik Patil 2023-09-21 11:05:14 +05:30 committed by GitHub
commit ef38194156
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 71 additions and 22 deletions

View file

@ -2195,7 +2195,7 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
LogCacheSize: ethcfg.FilterLogCacheSize,
})
filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethconfig.Defaults.BorLogs)
filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethcfg.BorLogs)
stack.RegisterAPIs([]rpc.API{{
Namespace: "eth",
Service: filterAPI,

View file

@ -825,6 +825,9 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error {
// return core.ErrInsufficientFunds
// }
// Verify that replacing transactions will not result in overdraft
pool.pendingMu.RLock()
defer pool.pendingMu.RUnlock()
list := pool.pending[from]
if list != nil { // Sender already has pending txs
sum := new(big.Int).Add(tx.Cost(), list.totalcost)

View file

@ -5,17 +5,21 @@ import (
"errors"
"fmt"
"net"
"net/http"
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/internal/cli/flagset"
"github.com/ethereum/go-ethereum/internal/cli/server"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/prometheus"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/nat"
@ -27,6 +31,8 @@ type BootnodeCommand struct {
UI cli.Ui
listenAddr string
enableMetrics bool
prometheusAddr string
v5 bool
verbosity int
logLevel string
@ -60,6 +66,18 @@ func (b *BootnodeCommand) Flags() *flagset.Flagset {
Usage: "listening address of bootnode (<ip>:<port>)",
Value: &b.listenAddr,
})
flags.BoolFlag(&flagset.BoolFlag{
Name: "metrics",
Usage: "Enable metrics collection and reporting",
Value: &b.enableMetrics,
Default: true,
})
flags.StringFlag(&flagset.StringFlag{
Name: "prometheus-addr",
Default: "127.0.0.1:7071",
Usage: "listening address of bootnode (<ip>:<port>)",
Value: &b.prometheusAddr,
})
flags.BoolFlag(&flagset.BoolFlag{
Name: "v5",
Default: false,
@ -237,6 +255,26 @@ func (b *BootnodeCommand) Run(args []string) int {
}
}
if b.enableMetrics {
prometheusMux := http.NewServeMux()
prometheusMux.Handle("/debug/metrics/prometheus", prometheus.Handler(metrics.DefaultRegistry))
promServer := &http.Server{
Addr: b.prometheusAddr,
Handler: prometheusMux,
ReadHeaderTimeout: 30 * time.Second,
}
go func() {
if err := promServer.ListenAndServe(); err != nil {
log.Error("Failure in running Prometheus server", "err", err)
}
}()
log.Info("Enabling metrics export to prometheus", "path", fmt.Sprintf("http://%s/debug/metrics/prometheus", b.prometheusAddr))
}
signalCh := make(chan os.Signal, 4)
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -23,8 +23,8 @@ import (
const (
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
VersionPatch = 4 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string
)
var GitCommit string

View file

@ -22,6 +22,7 @@ type SafePool struct {
processed atomic.Int64 // keeps count of total processed requests
close chan struct{}
closeOnce sync.Once
// Skip sending task to execution pool
fastPath bool
@ -103,7 +104,9 @@ func (s *SafePool) Size() int {
}
func (s *SafePool) Stop() {
s.closeOnce.Do(func() {
close(s.close)
})
if s.executionPool.Load() != nil {
s.executionPool.Load().Stop()

View file

@ -302,6 +302,7 @@ func (h *handler) close(err error, inflightReq *requestOp) {
h.callWG.Wait()
h.cancelRoot()
h.cancelServerSubscriptions(err)
h.executionPool.Stop()
}
// addRequestOp registers a request operation.

View file

@ -21,6 +21,7 @@ import (
"bytes"
"errors"
"fmt"
"sync"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@ -49,6 +50,7 @@ type Trie struct {
// tracer is the tool to track the trie changes.
// It will be reset after each commit operation.
tracer *tracer
tracerMutex sync.Mutex
}
// newFlag returns the cache flag value for a newly created node.
@ -605,7 +607,9 @@ func (t *Trie) resolveAndTrack(n hashNode, prefix []byte) (node, error) {
return nil, err
}
t.tracerMutex.Lock()
t.tracer.onRead(prefix, blob)
t.tracerMutex.Unlock()
return mustDecodeNode(n, blob), nil
}