mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
fix nil state-sync issue, increase grpc limit (#695)
* Increase grpc message size limit in pprof * consensus/bor/bor.go : stateSyncs init fixed [Fix #686] * eth/filters: handle nil state-sync before notify * eth/filters: update check Co-authored-by: Jerry <jerrycgh@gmail.com> Co-authored-by: Daniil <daniil.melnik@chainstack.com>
This commit is contained in:
parent
168ec6e8b0
commit
cbbc27c27a
3 changed files with 6 additions and 6 deletions
|
|
@ -1161,7 +1161,7 @@ func (c *Bor) CommitStates(
|
||||||
processStart := time.Now()
|
processStart := time.Now()
|
||||||
totalGas := 0 /// limit on gas for state sync per block
|
totalGas := 0 /// limit on gas for state sync per block
|
||||||
chainID := c.chainConfig.ChainID.String()
|
chainID := c.chainConfig.ChainID.String()
|
||||||
stateSyncs := make([]*types.StateSyncData, len(eventRecords))
|
stateSyncs := make([]*types.StateSyncData, 0, len(eventRecords))
|
||||||
|
|
||||||
var gasUsed uint64
|
var gasUsed uint64
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package filters
|
package filters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
|
@ -19,7 +18,7 @@ func (api *PublicFilterAPI) SetChainConfig(chainConfig *params.ChainConfig) {
|
||||||
|
|
||||||
func (api *PublicFilterAPI) GetBorBlockLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error) {
|
func (api *PublicFilterAPI) GetBorBlockLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error) {
|
||||||
if api.chainConfig == nil {
|
if api.chainConfig == nil {
|
||||||
return nil, errors.New("No chain config found. Proper PublicFilterAPI initialization required")
|
return nil, errors.New("no chain config found. Proper PublicFilterAPI initialization required")
|
||||||
}
|
}
|
||||||
|
|
||||||
// get sprint from bor config
|
// get sprint from bor config
|
||||||
|
|
@ -67,8 +66,8 @@ func (api *PublicFilterAPI) NewDeposits(ctx context.Context, crit ethereum.State
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case h := <-stateSyncData:
|
case h := <-stateSyncData:
|
||||||
if crit.ID == h.ID || bytes.Compare(crit.Contract.Bytes(), h.Contract.Bytes()) == 0 ||
|
if h != nil && (crit.ID == h.ID || crit.Contract == h.Contract ||
|
||||||
(crit.ID == 0 && crit.Contract == common.Address{}) {
|
(crit.ID == 0 && crit.Contract == common.Address{})) {
|
||||||
notifier.Notify(rpcSub.ID, h)
|
notifier.Notify(rpcSub.ID, h)
|
||||||
}
|
}
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"google.golang.org/grpc"
|
||||||
empty "google.golang.org/protobuf/types/known/emptypb"
|
empty "google.golang.org/protobuf/types/known/emptypb"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/internal/cli/flagset"
|
"github.com/ethereum/go-ethereum/internal/cli/flagset"
|
||||||
|
|
@ -103,7 +104,7 @@ func (d *DebugPprofCommand) Run(args []string) int {
|
||||||
req.Profile = profile
|
req.Profile = profile
|
||||||
}
|
}
|
||||||
|
|
||||||
stream, err := clt.DebugPprof(ctx, req)
|
stream, err := clt.DebugPprof(ctx, req, grpc.MaxCallRecvMsgSize(1024*1024*1024))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue