mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
Merge pull request #1013 from maticnetwork/master-to-develop
Backport master to develop after v1.0.4
This commit is contained in:
commit
ef38194156
13 changed files with 71 additions and 22 deletions
|
|
@ -2195,7 +2195,7 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
|
||||||
LogCacheSize: ethcfg.FilterLogCacheSize,
|
LogCacheSize: ethcfg.FilterLogCacheSize,
|
||||||
})
|
})
|
||||||
|
|
||||||
filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethconfig.Defaults.BorLogs)
|
filterAPI := filters.NewFilterAPI(filterSystem, isLightClient, ethcfg.BorLogs)
|
||||||
stack.RegisterAPIs([]rpc.API{{
|
stack.RegisterAPIs([]rpc.API{{
|
||||||
Namespace: "eth",
|
Namespace: "eth",
|
||||||
Service: filterAPI,
|
Service: filterAPI,
|
||||||
|
|
|
||||||
|
|
@ -825,6 +825,9 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error {
|
||||||
// return core.ErrInsufficientFunds
|
// return core.ErrInsufficientFunds
|
||||||
// }
|
// }
|
||||||
// Verify that replacing transactions will not result in overdraft
|
// Verify that replacing transactions will not result in overdraft
|
||||||
|
pool.pendingMu.RLock()
|
||||||
|
defer pool.pendingMu.RUnlock()
|
||||||
|
|
||||||
list := pool.pending[from]
|
list := pool.pending[from]
|
||||||
if list != nil { // Sender already has pending txs
|
if list != nil { // Sender already has pending txs
|
||||||
sum := new(big.Int).Add(tx.Cost(), list.totalcost)
|
sum := new(big.Int).Add(tx.Cost(), list.totalcost)
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,21 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/internal/cli/flagset"
|
"github.com/ethereum/go-ethereum/internal/cli/flagset"
|
||||||
"github.com/ethereum/go-ethereum/internal/cli/server"
|
"github.com/ethereum/go-ethereum/internal/cli/server"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"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/discover"
|
||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||||
|
|
@ -27,6 +31,8 @@ type BootnodeCommand struct {
|
||||||
UI cli.Ui
|
UI cli.Ui
|
||||||
|
|
||||||
listenAddr string
|
listenAddr string
|
||||||
|
enableMetrics bool
|
||||||
|
prometheusAddr string
|
||||||
v5 bool
|
v5 bool
|
||||||
verbosity int
|
verbosity int
|
||||||
logLevel string
|
logLevel string
|
||||||
|
|
@ -60,6 +66,18 @@ func (b *BootnodeCommand) Flags() *flagset.Flagset {
|
||||||
Usage: "listening address of bootnode (<ip>:<port>)",
|
Usage: "listening address of bootnode (<ip>:<port>)",
|
||||||
Value: &b.listenAddr,
|
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{
|
flags.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "v5",
|
Name: "v5",
|
||||||
Default: false,
|
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)
|
signalCh := make(chan os.Signal, 4)
|
||||||
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
|
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor
|
Source: bor
|
||||||
Version: 1.0.0-beta
|
Version: 1.0.4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor
|
Source: bor
|
||||||
Version: 1.0.0-beta
|
Version: 1.0.4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.0.0-beta
|
Version: 1.0.4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.0.0-beta
|
Version: 1.0.4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.0.0-beta
|
Version: 1.0.4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.0.0-beta
|
Version: 1.0.4
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 1 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 0 // Minor version component of the current release
|
VersionMinor = 0 // Minor version component of the current release
|
||||||
VersionPatch = 0 // Patch version component of the current release
|
VersionPatch = 4 // Patch version component of the current release
|
||||||
VersionMeta = "beta" // Version metadata to append to the version string
|
VersionMeta = "" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
var GitCommit string
|
var GitCommit string
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ type SafePool struct {
|
||||||
processed atomic.Int64 // keeps count of total processed requests
|
processed atomic.Int64 // keeps count of total processed requests
|
||||||
|
|
||||||
close chan struct{}
|
close chan struct{}
|
||||||
|
closeOnce sync.Once
|
||||||
|
|
||||||
// Skip sending task to execution pool
|
// Skip sending task to execution pool
|
||||||
fastPath bool
|
fastPath bool
|
||||||
|
|
@ -103,7 +104,9 @@ func (s *SafePool) Size() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SafePool) Stop() {
|
func (s *SafePool) Stop() {
|
||||||
|
s.closeOnce.Do(func() {
|
||||||
close(s.close)
|
close(s.close)
|
||||||
|
})
|
||||||
|
|
||||||
if s.executionPool.Load() != nil {
|
if s.executionPool.Load() != nil {
|
||||||
s.executionPool.Load().Stop()
|
s.executionPool.Load().Stop()
|
||||||
|
|
|
||||||
|
|
@ -302,6 +302,7 @@ func (h *handler) close(err error, inflightReq *requestOp) {
|
||||||
h.callWG.Wait()
|
h.callWG.Wait()
|
||||||
h.cancelRoot()
|
h.cancelRoot()
|
||||||
h.cancelServerSubscriptions(err)
|
h.cancelServerSubscriptions(err)
|
||||||
|
h.executionPool.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// addRequestOp registers a request operation.
|
// addRequestOp registers a request operation.
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
|
@ -49,6 +50,7 @@ type Trie struct {
|
||||||
// tracer is the tool to track the trie changes.
|
// tracer is the tool to track the trie changes.
|
||||||
// It will be reset after each commit operation.
|
// It will be reset after each commit operation.
|
||||||
tracer *tracer
|
tracer *tracer
|
||||||
|
tracerMutex sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// newFlag returns the cache flag value for a newly created node.
|
// 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
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.tracerMutex.Lock()
|
||||||
t.tracer.onRead(prefix, blob)
|
t.tracer.onRead(prefix, blob)
|
||||||
|
t.tracerMutex.Unlock()
|
||||||
|
|
||||||
return mustDecodeNode(n, blob), nil
|
return mustDecodeNode(n, blob), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue