Skip to content

Commit

Permalink
fix nil state-sync issue, increase grpc limit (#695)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Jan 25, 2023
1 parent 168ec6e commit cbbc27c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ func (c *Bor) CommitStates(
processStart := time.Now()
totalGas := 0 /// limit on gas for state sync per block
chainID := c.chainConfig.ChainID.String()
stateSyncs := make([]*types.StateSyncData, len(eventRecords))
stateSyncs := make([]*types.StateSyncData, 0, len(eventRecords))

var gasUsed uint64

Expand Down
7 changes: 3 additions & 4 deletions eth/filters/bor_api.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package filters

import (
"bytes"
"context"
"errors"

Expand All @@ -19,7 +18,7 @@ func (api *PublicFilterAPI) SetChainConfig(chainConfig *params.ChainConfig) {

func (api *PublicFilterAPI) GetBorBlockLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error) {
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
Expand Down Expand Up @@ -67,8 +66,8 @@ func (api *PublicFilterAPI) NewDeposits(ctx context.Context, crit ethereum.State
for {
select {
case h := <-stateSyncData:
if crit.ID == h.ID || bytes.Compare(crit.Contract.Bytes(), h.Contract.Bytes()) == 0 ||
(crit.ID == 0 && crit.Contract == common.Address{}) {
if h != nil && (crit.ID == h.ID || crit.Contract == h.Contract ||
(crit.ID == 0 && crit.Contract == common.Address{})) {
notifier.Notify(rpcSub.ID, h)
}
case <-rpcSub.Err():
Expand Down
3 changes: 2 additions & 1 deletion internal/cli/debug_pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"strings"

"google.golang.org/grpc"
empty "google.golang.org/protobuf/types/known/emptypb"

"github.com/ethereum/go-ethereum/internal/cli/flagset"
Expand Down Expand Up @@ -103,7 +104,7 @@ func (d *DebugPprofCommand) Run(args []string) int {
req.Profile = profile
}

stream, err := clt.DebugPprof(ctx, req)
stream, err := clt.DebugPprof(ctx, req, grpc.MaxCallRecvMsgSize(1024*1024*1024))

if err != nil {
return err
Expand Down

0 comments on commit cbbc27c

Please sign in to comment.