mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
Merge 'master' into 'v0.2.16-candidate'
This commit is contained in:
commit
0525715949
9 changed files with 65 additions and 30 deletions
|
|
@ -146,7 +146,7 @@ func remoteConsole(ctx *cli.Context) error {
|
||||||
path = filepath.Join(path, "sepolia")
|
path = filepath.Join(path, "sepolia")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endpoint = fmt.Sprintf("%s/geth.ipc", path)
|
endpoint = fmt.Sprintf("%s/bor.ipc", path)
|
||||||
}
|
}
|
||||||
client, err := dialRPC(endpoint)
|
client, err := dialRPC(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ var (
|
||||||
}
|
}
|
||||||
TxLookupLimitFlag = cli.Uint64Flag{
|
TxLookupLimitFlag = cli.Uint64Flag{
|
||||||
Name: "txlookuplimit",
|
Name: "txlookuplimit",
|
||||||
Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)",
|
Usage: "Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain)",
|
||||||
Value: ethconfig.Defaults.TxLookupLimit,
|
Value: ethconfig.Defaults.TxLookupLimit,
|
||||||
}
|
}
|
||||||
LightKDFFlag = cli.BoolFlag{
|
LightKDFFlag = cli.BoolFlag{
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ func (h *HeimdallClient) FetchWithRetry(rawPath string, rawQuery string) (*Respo
|
||||||
if err == nil && res != nil {
|
if err == nil && res != nil {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
log.Info("Retrying again in 5 seconds for next Heimdall data", "path", u.Path)
|
log.Info("Retrying again in 5 seconds to fetch data from Heimdall", "path", u.Path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1381,12 +1381,6 @@ func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types
|
||||||
for _, data := range bc.stateSyncData {
|
for _, data := range bc.stateSyncData {
|
||||||
bc.stateSyncFeed.Send(StateSyncEvent{Data: data})
|
bc.stateSyncFeed.Send(StateSyncEvent{Data: data})
|
||||||
}
|
}
|
||||||
|
|
||||||
bc.chain2HeadFeed.Send(Chain2HeadEvent{
|
|
||||||
Type: Chain2HeadCanonicalEvent,
|
|
||||||
NewChain: []*types.Block{block},
|
|
||||||
})
|
|
||||||
|
|
||||||
// BOR
|
// BOR
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1479,11 +1473,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
|
||||||
defer func() {
|
defer func() {
|
||||||
if lastCanon != nil && bc.CurrentBlock().Hash() == lastCanon.Hash() {
|
if lastCanon != nil && bc.CurrentBlock().Hash() == lastCanon.Hash() {
|
||||||
bc.chainHeadFeed.Send(ChainHeadEvent{lastCanon})
|
bc.chainHeadFeed.Send(ChainHeadEvent{lastCanon})
|
||||||
|
|
||||||
bc.chain2HeadFeed.Send(Chain2HeadEvent{
|
|
||||||
Type: Chain2HeadCanonicalEvent,
|
|
||||||
NewChain: []*types.Block{lastCanon},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// Start the parallel header verifier
|
// Start the parallel header verifier
|
||||||
|
|
@ -1599,6 +1588,22 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// accumulator for canonical blocks
|
||||||
|
var canonAccum []*types.Block
|
||||||
|
|
||||||
|
emitAccum := func() {
|
||||||
|
size := len(canonAccum)
|
||||||
|
if size == 0 || size > 5 {
|
||||||
|
// avoid reporting events for large sync events
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bc.chain2HeadFeed.Send(Chain2HeadEvent{
|
||||||
|
Type: Chain2HeadCanonicalEvent,
|
||||||
|
NewChain: canonAccum,
|
||||||
|
})
|
||||||
|
canonAccum = canonAccum[:0]
|
||||||
|
}
|
||||||
|
|
||||||
for ; block != nil && err == nil || errors.Is(err, ErrKnownBlock); block, err = it.next() {
|
for ; block != nil && err == nil || errors.Is(err, ErrKnownBlock); block, err = it.next() {
|
||||||
// If the chain is terminating, stop processing blocks
|
// If the chain is terminating, stop processing blocks
|
||||||
if bc.insertStopped() {
|
if bc.insertStopped() {
|
||||||
|
|
@ -1755,6 +1760,15 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
|
||||||
if !setHead {
|
if !setHead {
|
||||||
return it.index, nil // Direct block insertion of a single block
|
return it.index, nil // Direct block insertion of a single block
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BOR
|
||||||
|
if status == CanonStatTy {
|
||||||
|
canonAccum = append(canonAccum, block)
|
||||||
|
} else {
|
||||||
|
emitAccum()
|
||||||
|
}
|
||||||
|
// BOR
|
||||||
|
|
||||||
switch status {
|
switch status {
|
||||||
case CanonStatTy:
|
case CanonStatTy:
|
||||||
log.Debug("Inserted new block", "number", block.Number(), "hash", block.Hash(),
|
log.Debug("Inserted new block", "number", block.Number(), "hash", block.Hash(),
|
||||||
|
|
@ -1783,6 +1797,10 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BOR
|
||||||
|
emitAccum()
|
||||||
|
// BOR
|
||||||
|
|
||||||
// Any blocks remaining here? The only ones we care about are the future ones
|
// Any blocks remaining here? The only ones we care about are the future ones
|
||||||
if block != nil && errors.Is(err, consensus.ErrFutureBlock) {
|
if block != nil && errors.Is(err, consensus.ErrFutureBlock) {
|
||||||
if err := bc.addFutureBlock(block); err != nil {
|
if err := bc.addFutureBlock(block); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ func TestChain2HeadEvent(t *testing.T) {
|
||||||
}
|
}
|
||||||
for j := 0; j < len(ev.NewChain); j++ {
|
for j := 0; j < len(ev.NewChain); j++ {
|
||||||
if ev.NewChain[j].Hash() != expect.Added[j] {
|
if ev.NewChain[j].Hash() != expect.Added[j] {
|
||||||
t.Fatal("Newchain hashes Do Not Match")
|
t.Fatalf("Newchain hashes Do Not Match %s %s", ev.NewChain[j].Hash(), expect.Added[j])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case <-time.After(2 * time.Second):
|
case <-time.After(2 * time.Second):
|
||||||
|
|
@ -92,6 +92,8 @@ func TestChain2HeadEvent(t *testing.T) {
|
||||||
readEvent(&eventTest{
|
readEvent(&eventTest{
|
||||||
Type: Chain2HeadCanonicalEvent,
|
Type: Chain2HeadCanonicalEvent,
|
||||||
Added: []common.Hash{
|
Added: []common.Hash{
|
||||||
|
chain[0].Hash(),
|
||||||
|
chain[1].Hash(),
|
||||||
chain[2].Hash(),
|
chain[2].Hash(),
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
|
@ -129,6 +131,8 @@ func TestChain2HeadEvent(t *testing.T) {
|
||||||
readEvent(&eventTest{
|
readEvent(&eventTest{
|
||||||
Type: Chain2HeadCanonicalEvent,
|
Type: Chain2HeadCanonicalEvent,
|
||||||
Added: []common.Hash{
|
Added: []common.Hash{
|
||||||
|
replacementBlocks[2].Hash(),
|
||||||
replacementBlocks[3].Hash(),
|
replacementBlocks[3].Hash(),
|
||||||
}})
|
}})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```cache.preimages```: Enable recording the SHA3/keccak preimages of trie keys.
|
- ```cache.preimages```: Enable recording the SHA3/keccak preimages of trie keys.
|
||||||
|
|
||||||
- ```txlookuplimit```: Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain).
|
- ```txlookuplimit```: Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain).
|
||||||
|
|
||||||
### JsonRPC Options
|
### JsonRPC Options
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,9 +133,6 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface
|
||||||
if head.UncleHash != types.EmptyUncleHash && len(body.UncleHashes) == 0 {
|
if head.UncleHash != types.EmptyUncleHash && len(body.UncleHashes) == 0 {
|
||||||
return nil, fmt.Errorf("server returned empty uncle list but block header indicates uncles")
|
return nil, fmt.Errorf("server returned empty uncle list but block header indicates uncles")
|
||||||
}
|
}
|
||||||
if head.TxHash == types.EmptyRootHash && len(body.Transactions) > 0 {
|
|
||||||
return nil, fmt.Errorf("server returned non-empty transaction list but block header indicates no transactions")
|
|
||||||
}
|
|
||||||
if head.TxHash != types.EmptyRootHash && len(body.Transactions) == 0 {
|
if head.TxHash != types.EmptyRootHash && len(body.Transactions) == 0 {
|
||||||
return nil, fmt.Errorf("server returned empty transaction list but block header indicates transactions")
|
return nil, fmt.Errorf("server returned empty transaction list but block header indicates transactions")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,20 @@ type fullNodeBackend interface {
|
||||||
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
|
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EthstatsDataType struct {
|
||||||
|
kv map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to add data to EthstatsData
|
||||||
|
func (e *EthstatsDataType) AddKV(key, val string) {
|
||||||
|
e.kv[key] = val
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arbitrary Data that can be included
|
||||||
|
var EthstatsData = &EthstatsDataType{
|
||||||
|
kv: make(map[string]string),
|
||||||
|
}
|
||||||
|
|
||||||
// Service implements an Ethereum netstats reporting daemon that pushes local
|
// Service implements an Ethereum netstats reporting daemon that pushes local
|
||||||
// chain statistics up to a monitoring server.
|
// chain statistics up to a monitoring server.
|
||||||
type Service struct {
|
type Service struct {
|
||||||
|
|
@ -466,16 +480,17 @@ func (s *Service) readLoop(conn *connWrapper) {
|
||||||
// nodeInfo is the collection of meta information about a node that is displayed
|
// nodeInfo is the collection of meta information about a node that is displayed
|
||||||
// on the monitoring page.
|
// on the monitoring page.
|
||||||
type nodeInfo struct {
|
type nodeInfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Node string `json:"node"`
|
Node string `json:"node"`
|
||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
Network string `json:"net"`
|
Network string `json:"net"`
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
API string `json:"api"`
|
API string `json:"api"`
|
||||||
Os string `json:"os"`
|
Os string `json:"os"`
|
||||||
OsVer string `json:"os_v"`
|
OsVer string `json:"os_v"`
|
||||||
Client string `json:"client"`
|
Client string `json:"client"`
|
||||||
History bool `json:"canUpdateHistory"`
|
History bool `json:"canUpdateHistory"`
|
||||||
|
Data map[string]string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// authMsg is the authentication infos needed to login to a monitoring server.
|
// authMsg is the authentication infos needed to login to a monitoring server.
|
||||||
|
|
@ -513,6 +528,7 @@ func (s *Service) login(conn *connWrapper) error {
|
||||||
OsVer: runtime.GOARCH,
|
OsVer: runtime.GOARCH,
|
||||||
Client: "0.1.1",
|
Client: "0.1.1",
|
||||||
History: true,
|
History: true,
|
||||||
|
Data: EthstatsData.kv,
|
||||||
},
|
},
|
||||||
Secret: s.pass,
|
Secret: s.pass,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txlookuplimit",
|
Name: "txlookuplimit",
|
||||||
Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)",
|
Usage: "Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain)",
|
||||||
Value: &c.cliConfig.Cache.TxLookupLimit,
|
Value: &c.cliConfig.Cache.TxLookupLimit,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue