mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
merged in the current develop branch
This commit is contained in:
commit
1e926cfad9
80 changed files with 2938 additions and 490 deletions
2
.github/ISSUE_TEMPLATE/bug.md
vendored
2
.github/ISSUE_TEMPLATE/bug.md
vendored
|
|
@ -6,7 +6,7 @@ labels: 'type:bug'
|
|||
assignees: ''
|
||||
---
|
||||
|
||||
Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://docs.polygon.technology/docs/faq/technical-faqs) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/zdwkdvMNY2) server
|
||||
Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://wiki.polygon.technology/docs/faq/technical-faqs/) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/zdwkdvMNY2) server
|
||||
|
||||
<!--
|
||||
NOTE: Please make sure to check of any addresses / private keys / rpc url's / IP's before sharing the logs or anything from the additional information section (start.sh or heimdall config).
|
||||
|
|
|
|||
29
.github/workflows/security-ci.yml
vendored
29
.github/workflows/security-ci.yml
vendored
|
|
@ -13,10 +13,12 @@ jobs:
|
|||
continue-on-error: true
|
||||
env:
|
||||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
||||
GOFLAGS: "-buildvcs=false"
|
||||
with:
|
||||
args: --org=${{ secrets.SNYK_ORG }} --severity-threshold=medium --sarif-file-output=snyk.sarif
|
||||
- name: Upload result to GitHub Code Scanning
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
sarif_file: snyk.sarif
|
||||
|
||||
|
|
@ -37,6 +39,7 @@ jobs:
|
|||
command: code test
|
||||
- name: Upload result to GitHub Code Scanning
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
sarif_file: snyk.sarif
|
||||
|
||||
|
|
@ -62,29 +65,3 @@ jobs:
|
|||
with:
|
||||
name: raw-report
|
||||
path: raw-report.json
|
||||
|
||||
sonarqube:
|
||||
name: SonarQube
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# Disabling shallow clone is recommended for improving relevancy of reporting.
|
||||
fetch-depth: 0
|
||||
|
||||
# Triggering SonarQube analysis as results of it are required by Quality Gate check.
|
||||
- name: SonarQube Scan
|
||||
uses: sonarsource/sonarqube-scan-action@master
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||
|
||||
# Check the Quality Gate status.
|
||||
- name: SonarQube Quality Gate check
|
||||
id: sonarqube-quality-gate-check
|
||||
uses: sonarsource/sonarqube-quality-gate-action@master
|
||||
# Force to fail step after specific time.
|
||||
timeout-minutes: 5
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||
|
|
|
|||
32
.github/workflows/security-sonarqube-ci.yml
vendored
Normal file
32
.github/workflows/security-sonarqube-ci.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
name: SonarQube CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
sonarqube:
|
||||
name: SonarQube
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# Disabling shallow clone is recommended for improving relevancy of reporting.
|
||||
fetch-depth: 0
|
||||
|
||||
# Triggering SonarQube analysis as results of it are required by Quality Gate check.
|
||||
- name: SonarQube Scan
|
||||
uses: sonarsource/sonarqube-scan-action@master
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||
|
||||
# Check the Quality Gate status.
|
||||
- name: SonarQube Quality Gate check
|
||||
id: sonarqube-quality-gate-check
|
||||
uses: sonarsource/sonarqube-quality-gate-action@master
|
||||
# Force to fail step after specific time.
|
||||
timeout-minutes: 5
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||
8
Makefile
8
Makefile
|
|
@ -14,20 +14,18 @@ GORUN = env GO111MODULE=on go run
|
|||
GOPATH = $(shell go env GOPATH)
|
||||
|
||||
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
|
||||
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
GIT_TAG ?= $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`)
|
||||
|
||||
PACKAGE = github.com/ethereum/go-ethereum
|
||||
GO_FLAGS += -buildvcs=false
|
||||
GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}"
|
||||
GO_LDFLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} "
|
||||
|
||||
TESTALL = $$(go list ./... | grep -v go-ethereum/cmd/)
|
||||
TESTE2E = ./tests/...
|
||||
GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) -p 1
|
||||
GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) $(GO_LDFLAGS) -p 1
|
||||
|
||||
bor:
|
||||
mkdir -p $(GOPATH)/bin/
|
||||
go build -o $(GOBIN)/bor ./cmd/cli/main.go
|
||||
go build -o $(GOBIN)/bor $(GO_LDFLAGS) ./cmd/cli/main.go
|
||||
cp $(GOBIN)/bor $(GOPATH)/bin/
|
||||
@echo "Done building."
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ them using your favourite package manager. Once the dependencies are installed,
|
|||
2. Commit and prepare for pull request (PR). In your PR commit message, reference the issue it resolves (see [how to link a commit message to an issue using a keyword](https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).
|
||||
|
||||
|
||||
Checkout our [Git-Rules](https://docs.polygon.technology/docs/contribute/orientation#git-rules)
|
||||
Checkout our [Git-Rules](https://wiki.polygon.technology/docs/contribute/orientation/#git-rules)
|
||||
|
||||
```
|
||||
$ git commit -m "brief description of changes [Fixes #1234]"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
chain = "mainnet"
|
||||
# chain = "mumbai"
|
||||
# identity = "Pratiks-MacBook-Pro.local"
|
||||
# log-level = "INFO"
|
||||
# identity = "Annon-Identity"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "/var/lib/bor/keystore"
|
||||
|
|
@ -13,9 +14,15 @@ syncmode = "full"
|
|||
# snapshot = true
|
||||
# "bor.logs" = false
|
||||
# ethstats = ""
|
||||
|
||||
# devfakeauthor = false
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
# maxpeers = 1
|
||||
# nodiscover = true
|
||||
|
|
@ -23,6 +30,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# port = 30303
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
[p2p.discovery]
|
||||
# v5disc = false
|
||||
bootnodes = ["enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303", "enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303"]
|
||||
|
|
@ -58,13 +68,16 @@ syncmode = "full"
|
|||
# mine = true
|
||||
# etherbase = "VALIDATOR ADDRESS"
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
|
||||
# [jsonrpc]
|
||||
# ipcdisable = false
|
||||
# ipcpath = ""
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
# [jsonrpc.http]
|
||||
# enabled = false
|
||||
# port = 8545
|
||||
|
|
@ -87,6 +100,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -95,6 +113,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -128,6 +148,7 @@ syncmode = "full"
|
|||
# txlookuplimit = 2350000
|
||||
# triesinmemory = 128
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
# allow-insecure-unlock = true
|
||||
|
|
@ -142,3 +163,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to
|
|||
utils.HeimdallgRPCAddressFlag,
|
||||
utils.RunHeimdallFlag,
|
||||
utils.RunHeimdallArgsFlag,
|
||||
utils.UseHeimdallAppFlag,
|
||||
},
|
||||
Category: "BLOCKCHAIN COMMANDS",
|
||||
Description: `
|
||||
|
|
|
|||
|
|
@ -347,10 +347,6 @@ func geth(ctx *cli.Context) error {
|
|||
return fmt.Errorf("invalid command: %q", args[0])
|
||||
}
|
||||
|
||||
prepare(ctx)
|
||||
stack, backend := makeFullNode(ctx)
|
||||
defer stack.Close()
|
||||
|
||||
if ctx.GlobalBool(utils.RunHeimdallFlag.Name) {
|
||||
shutdownCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
|
@ -360,6 +356,10 @@ func geth(ctx *cli.Context) error {
|
|||
}()
|
||||
}
|
||||
|
||||
prepare(ctx)
|
||||
stack, backend := makeFullNode(ctx)
|
||||
defer stack.Close()
|
||||
|
||||
startNode(ctx, stack, backend, false)
|
||||
stack.Wait()
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -50,6 +50,12 @@ var (
|
|||
Value: "",
|
||||
}
|
||||
|
||||
// UseHeimdallApp flag for using internall heimdall app to fetch data
|
||||
UseHeimdallAppFlag = cli.BoolFlag{
|
||||
Name: "bor.useheimdallapp",
|
||||
Usage: "Use child heimdall process to fetch data, Only works when bor.runheimdall is true",
|
||||
}
|
||||
|
||||
// BorFlags all bor related flags
|
||||
BorFlags = []cli.Flag{
|
||||
HeimdallURLFlag,
|
||||
|
|
@ -57,6 +63,7 @@ var (
|
|||
HeimdallgRPCAddressFlag,
|
||||
RunHeimdallFlag,
|
||||
RunHeimdallArgsFlag,
|
||||
UseHeimdallAppFlag,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -82,6 +89,7 @@ func SetBorConfig(ctx *cli.Context, cfg *eth.Config) {
|
|||
cfg.HeimdallgRPCAddress = ctx.GlobalString(HeimdallgRPCAddressFlag.Name)
|
||||
cfg.RunHeimdall = ctx.GlobalBool(RunHeimdallFlag.Name)
|
||||
cfg.RunHeimdallArgs = ctx.GlobalString(RunHeimdallArgsFlag.Name)
|
||||
cfg.UseHeimdallApp = ctx.GlobalBool(UseHeimdallAppFlag.Name)
|
||||
}
|
||||
|
||||
// CreateBorEthereum Creates bor ethereum object from eth.Config
|
||||
|
|
|
|||
|
|
@ -2048,6 +2048,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
|
|||
HeimdallgRPCAddress: ctx.GlobalString(HeimdallgRPCAddressFlag.Name),
|
||||
RunHeimdall: ctx.GlobalBool(RunHeimdallFlag.Name),
|
||||
RunHeimdallArgs: ctx.GlobalString(RunHeimdallArgsFlag.Name),
|
||||
UseHeimdallApp: ctx.GlobalBool(UseHeimdallAppFlag.Name),
|
||||
})
|
||||
engine = ethereum.Engine()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -227,7 +227,8 @@ type Bor struct {
|
|||
HeimdallClient IHeimdallClient
|
||||
|
||||
// The fields below are for testing only
|
||||
fakeDiff bool // Skip difficulty verifications
|
||||
fakeDiff bool // Skip difficulty verifications
|
||||
devFakeAuthor bool
|
||||
|
||||
closeOnce sync.Once
|
||||
}
|
||||
|
|
@ -245,6 +246,7 @@ func New(
|
|||
spanner Spanner,
|
||||
heimdallClient IHeimdallClient,
|
||||
genesisContracts GenesisContract,
|
||||
devFakeAuthor bool,
|
||||
) *Bor {
|
||||
// get bor config
|
||||
borConfig := chainConfig.Bor
|
||||
|
|
@ -267,6 +269,7 @@ func New(
|
|||
spanner: spanner,
|
||||
GenesisContractsClient: genesisContracts,
|
||||
HeimdallClient: heimdallClient,
|
||||
devFakeAuthor: devFakeAuthor,
|
||||
}
|
||||
|
||||
c.authorizedSigner.Store(&signer{
|
||||
|
|
@ -480,6 +483,19 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
|
|||
// nolint: gocognit
|
||||
func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) {
|
||||
// Search for a snapshot in memory or on disk for checkpoints
|
||||
|
||||
signer := common.BytesToAddress(c.authorizedSigner.Load().signer.Bytes())
|
||||
if c.devFakeAuthor && signer.String() != "0x0000000000000000000000000000000000000000" {
|
||||
log.Info("👨💻Using DevFakeAuthor", "signer", signer)
|
||||
|
||||
val := valset.NewValidator(signer, 1000)
|
||||
validatorset := valset.NewValidatorSet([]*valset.Validator{val})
|
||||
|
||||
snapshot := newSnapshot(c.config, c.signatures, number, hash, validatorset.Validators)
|
||||
|
||||
return snapshot, nil
|
||||
}
|
||||
|
||||
var snap *Snapshot
|
||||
|
||||
headers := make([]*types.Header, 0, 16)
|
||||
|
|
|
|||
52
consensus/bor/heimdallapp/checkpoint.go
Normal file
52
consensus/bor/heimdallapp/checkpoint.go
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
|
||||
hmTypes "github.com/maticnetwork/heimdall/types"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func (h *HeimdallAppClient) FetchCheckpointCount(_ context.Context) (int64, error) {
|
||||
log.Info("Fetching checkpoint count")
|
||||
|
||||
res := h.hApp.CheckpointKeeper.GetACKCount(h.NewContext())
|
||||
|
||||
log.Info("Fetched checkpoint count")
|
||||
|
||||
return int64(res), nil
|
||||
}
|
||||
|
||||
func (h *HeimdallAppClient) FetchCheckpoint(_ context.Context, number int64) (*checkpoint.Checkpoint, error) {
|
||||
log.Info("Fetching checkpoint", "number", number)
|
||||
|
||||
res, err := h.hApp.CheckpointKeeper.GetCheckpointByNumber(h.NewContext(), uint64(number))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Info("Fetched checkpoint", "number", number)
|
||||
|
||||
return toBorCheckpoint(res), nil
|
||||
}
|
||||
|
||||
func (h *HeimdallAppClient) NewContext() types.Context {
|
||||
return h.hApp.NewContext(true, abci.Header{Height: h.hApp.LastBlockHeight()})
|
||||
}
|
||||
|
||||
func toBorCheckpoint(hdCheckpoint hmTypes.Checkpoint) *checkpoint.Checkpoint {
|
||||
return &checkpoint.Checkpoint{
|
||||
Proposer: hdCheckpoint.Proposer.EthAddress(),
|
||||
StartBlock: big.NewInt(int64(hdCheckpoint.StartBlock)),
|
||||
EndBlock: big.NewInt(int64(hdCheckpoint.EndBlock)),
|
||||
RootHash: hdCheckpoint.RootHash.EthHash(),
|
||||
BorChainID: hdCheckpoint.BorChainID,
|
||||
Timestamp: hdCheckpoint.TimeStamp,
|
||||
}
|
||||
}
|
||||
27
consensus/bor/heimdallapp/client.go
Normal file
27
consensus/bor/heimdallapp/client.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
|
||||
"github.com/maticnetwork/heimdall/app"
|
||||
"github.com/maticnetwork/heimdall/cmd/heimdalld/service"
|
||||
)
|
||||
|
||||
const (
|
||||
stateFetchLimit = 50
|
||||
)
|
||||
|
||||
type HeimdallAppClient struct {
|
||||
hApp *app.HeimdallApp
|
||||
}
|
||||
|
||||
func NewHeimdallAppClient() *HeimdallAppClient {
|
||||
return &HeimdallAppClient{
|
||||
hApp: service.GetHeimdallApp(),
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HeimdallAppClient) Close() {
|
||||
// Nothing to close as of now
|
||||
log.Warn("Shutdown detected, Closing Heimdall App conn")
|
||||
}
|
||||
86
consensus/bor/heimdallapp/span.go
Normal file
86
consensus/bor/heimdallapp/span.go
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
hmTypes "github.com/maticnetwork/heimdall/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/span"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/valset"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
func (h *HeimdallAppClient) Span(ctx context.Context, spanID uint64) (*span.HeimdallSpan, error) {
|
||||
log.Info("Fetching span", "spanID", spanID)
|
||||
|
||||
res, err := h.hApp.BorKeeper.GetSpan(h.NewContext(), spanID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Info("Fetched span", "spanID", spanID)
|
||||
|
||||
return toSpan(res), nil
|
||||
}
|
||||
|
||||
func toSpan(hdSpan *hmTypes.Span) *span.HeimdallSpan {
|
||||
return &span.HeimdallSpan{
|
||||
Span: span.Span{
|
||||
ID: hdSpan.ID,
|
||||
StartBlock: hdSpan.StartBlock,
|
||||
EndBlock: hdSpan.EndBlock,
|
||||
},
|
||||
ValidatorSet: toValidatorSet(hdSpan.ValidatorSet),
|
||||
SelectedProducers: toValidators(hdSpan.SelectedProducers),
|
||||
ChainID: hdSpan.ChainID,
|
||||
}
|
||||
}
|
||||
|
||||
func toValidatorSet(vs hmTypes.ValidatorSet) valset.ValidatorSet {
|
||||
return valset.ValidatorSet{
|
||||
Validators: toValidatorsRef(vs.Validators),
|
||||
Proposer: toValidatorRef(vs.Proposer),
|
||||
}
|
||||
}
|
||||
|
||||
func toValidators(vs []hmTypes.Validator) []valset.Validator {
|
||||
newVS := make([]valset.Validator, len(vs))
|
||||
|
||||
for i, v := range vs {
|
||||
newVS[i] = toValidator(v)
|
||||
}
|
||||
|
||||
return newVS
|
||||
}
|
||||
|
||||
func toValidatorsRef(vs []*hmTypes.Validator) []*valset.Validator {
|
||||
newVS := make([]*valset.Validator, len(vs))
|
||||
|
||||
for i, v := range vs {
|
||||
if v == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
newVS[i] = toValidatorRef(v)
|
||||
}
|
||||
|
||||
return newVS
|
||||
}
|
||||
|
||||
func toValidatorRef(v *hmTypes.Validator) *valset.Validator {
|
||||
return &valset.Validator{
|
||||
ID: v.ID.Uint64(),
|
||||
Address: v.Signer.EthAddress(),
|
||||
VotingPower: v.VotingPower,
|
||||
ProposerPriority: v.ProposerPriority,
|
||||
}
|
||||
}
|
||||
|
||||
func toValidator(v hmTypes.Validator) valset.Validator {
|
||||
return valset.Validator{
|
||||
ID: v.ID.Uint64(),
|
||||
Address: v.Signer.EthAddress(),
|
||||
VotingPower: v.VotingPower,
|
||||
ProposerPriority: v.ProposerPriority,
|
||||
}
|
||||
}
|
||||
64
consensus/bor/heimdallapp/state_sync.go
Normal file
64
consensus/bor/heimdallapp/state_sync.go
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/maticnetwork/heimdall/clerk/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/clerk"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func (h *HeimdallAppClient) StateSyncEvents(ctx context.Context, fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) {
|
||||
totalRecords := make([]*clerk.EventRecordWithTime, 0)
|
||||
|
||||
hCtx := h.hApp.NewContext(true, abci.Header{Height: h.hApp.LastBlockHeight()})
|
||||
|
||||
for {
|
||||
fromRecord, err := h.hApp.ClerkKeeper.GetEventRecord(hCtx, fromID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
events, err := h.hApp.ClerkKeeper.GetEventRecordListWithTime(hCtx, fromRecord.RecordTime, time.Unix(to, 0), 1, stateFetchLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
totalRecords = append(totalRecords, toEvents(events)...)
|
||||
|
||||
if len(events) < stateFetchLimit {
|
||||
break
|
||||
}
|
||||
|
||||
fromID += uint64(stateFetchLimit)
|
||||
}
|
||||
|
||||
return totalRecords, nil
|
||||
}
|
||||
|
||||
func toEvents(hdEvents []types.EventRecord) []*clerk.EventRecordWithTime {
|
||||
events := make([]*clerk.EventRecordWithTime, len(hdEvents))
|
||||
|
||||
for i, ev := range hdEvents {
|
||||
events[i] = toEvent(ev)
|
||||
}
|
||||
|
||||
return events
|
||||
}
|
||||
|
||||
func toEvent(hdEvent types.EventRecord) *clerk.EventRecordWithTime {
|
||||
return &clerk.EventRecordWithTime{
|
||||
EventRecord: clerk.EventRecord{
|
||||
ID: hdEvent.ID,
|
||||
Contract: hdEvent.Contract.EthAddress(),
|
||||
Data: hdEvent.Data.Bytes(),
|
||||
TxHash: hdEvent.TxHash.EthHash(),
|
||||
LogIndex: hdEvent.LogIndex,
|
||||
ChainID: hdEvent.ChainID,
|
||||
},
|
||||
Time: hdEvent.RecordTime,
|
||||
}
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ func (vals *ValidatorSet) UpdateTotalVotingPower() error {
|
|||
// It recomputes the total voting power if required.
|
||||
func (vals *ValidatorSet) TotalVotingPower() int64 {
|
||||
if vals.totalVotingPower == 0 {
|
||||
log.Info("invoking updateTotalVotingPower before returning it")
|
||||
log.Debug("invoking updateTotalVotingPower before returning it")
|
||||
|
||||
if err := vals.UpdateTotalVotingPower(); err != nil {
|
||||
// Can/should we do better?
|
||||
|
|
@ -641,14 +641,15 @@ func (vals *ValidatorSet) UpdateValidatorMap() {
|
|||
|
||||
// UpdateWithChangeSet attempts to update the validator set with 'changes'.
|
||||
// It performs the following steps:
|
||||
// - validates the changes making sure there are no duplicates and splits them in updates and deletes
|
||||
// - verifies that applying the changes will not result in errors
|
||||
// - computes the total voting power BEFORE removals to ensure that in the next steps the priorities
|
||||
// across old and newly added validators are fair
|
||||
// - computes the priorities of new validators against the final set
|
||||
// - applies the updates against the validator set
|
||||
// - applies the removals against the validator set
|
||||
// - performs scaling and centering of priority values
|
||||
// - validates the changes making sure there are no duplicates and splits them in updates and deletes
|
||||
// - verifies that applying the changes will not result in errors
|
||||
// - computes the total voting power BEFORE removals to ensure that in the next steps the priorities
|
||||
// across old and newly added validators are fair
|
||||
// - computes the priorities of new validators against the final set
|
||||
// - applies the updates against the validator set
|
||||
// - applies the removals against the validator set
|
||||
// - performs scaling and centering of priority values
|
||||
//
|
||||
// If an error is detected during verification steps, it is returned and the validator set
|
||||
// is not changed.
|
||||
func (vals *ValidatorSet) UpdateWithChangeSet(changes []*Validator) error {
|
||||
|
|
@ -705,6 +706,14 @@ func (vals *ValidatorSet) StringIndented(indent string) string {
|
|||
indent)
|
||||
}
|
||||
|
||||
func (vals *ValidatorSet) SetTotalVotingPower(totalVotingPower int64) {
|
||||
vals.totalVotingPower = totalVotingPower
|
||||
}
|
||||
|
||||
func (vals *ValidatorSet) SetMap(validatorsMap map[common.Address]int) {
|
||||
vals.validatorsMap = validatorsMap
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
// Implements sort for sorting validators by address.
|
||||
|
||||
|
|
|
|||
|
|
@ -1363,14 +1363,17 @@ func (bc *BlockChain) WriteBlockAndSetHead(block *types.Block, receipts []*types
|
|||
// the chain mutex to be held.
|
||||
func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types.Receipt, logs []*types.Log, state *state.StateDB, emitHeadEvent bool) (status WriteStatus, err error) {
|
||||
var stateSyncLogs []*types.Log
|
||||
|
||||
if stateSyncLogs, err = bc.writeBlockWithState(block, receipts, logs, state); err != nil {
|
||||
return NonStatTy, err
|
||||
}
|
||||
|
||||
currentBlock := bc.CurrentBlock()
|
||||
reorg, err := bc.forker.ReorgNeeded(currentBlock.Header(), block.Header())
|
||||
if err != nil {
|
||||
return NonStatTy, err
|
||||
}
|
||||
|
||||
if reorg {
|
||||
// Reorganise the chain if the parent is not the head block
|
||||
if block.ParentHash() != currentBlock.Hash() {
|
||||
|
|
@ -1378,6 +1381,7 @@ func (bc *BlockChain) writeBlockAndSetHead(block *types.Block, receipts []*types
|
|||
return NonStatTy, err
|
||||
}
|
||||
}
|
||||
|
||||
status = CanonStatTy
|
||||
} else {
|
||||
status = SideStatTy
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ func ReadBorReceiptRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.Raw
|
|||
return data
|
||||
}
|
||||
}
|
||||
|
||||
return nil // Can't find the data anywhere.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1815,7 +1815,7 @@ func testRepair(t *testing.T, tt *rewindTest, snapshots bool) {
|
|||
|
||||
chainConfig.LondonBlock = big.NewInt(0)
|
||||
|
||||
_, back, closeFn := miner.NewTestWorker(t, chainConfig, engine, db, 0)
|
||||
_, back, closeFn := miner.NewTestWorker(t, chainConfig, engine, db, 0, 0, 0)
|
||||
defer closeFn()
|
||||
|
||||
genesis := back.BlockChain().Genesis()
|
||||
|
|
|
|||
|
|
@ -351,9 +351,8 @@ func (m *txSortedMap) lastElement() *types.Transaction {
|
|||
|
||||
m.cacheMu.Unlock()
|
||||
|
||||
cache = make(types.Transactions, 0, len(m.items))
|
||||
|
||||
m.m.RLock()
|
||||
cache = make(types.Transactions, 0, len(m.items))
|
||||
|
||||
for _, tx := range m.items {
|
||||
cache = append(cache, tx)
|
||||
|
|
@ -373,6 +372,11 @@ func (m *txSortedMap) lastElement() *types.Transaction {
|
|||
hitCacheCounter.Inc(1)
|
||||
}
|
||||
|
||||
ln := len(cache)
|
||||
if ln == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return cache[len(cache)-1]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ type TxPoolConfig struct {
|
|||
AccountQueue uint64 // Maximum number of non-executable transaction slots permitted per account
|
||||
GlobalQueue uint64 // Maximum number of non-executable transaction slots for all accounts
|
||||
|
||||
Lifetime time.Duration // Maximum amount of time non-executable transaction are queued
|
||||
Lifetime time.Duration // Maximum amount of time non-executable transaction are queued
|
||||
AllowUnprotectedTxs bool // Allow non-EIP-155 transactions
|
||||
}
|
||||
|
||||
// DefaultTxPoolConfig contains the default configurations for the transaction
|
||||
|
|
@ -191,7 +192,8 @@ var DefaultTxPoolConfig = TxPoolConfig{
|
|||
AccountQueue: 64,
|
||||
GlobalQueue: 1024,
|
||||
|
||||
Lifetime: 3 * time.Hour,
|
||||
Lifetime: 3 * time.Hour,
|
||||
AllowUnprotectedTxs: false,
|
||||
}
|
||||
|
||||
// sanitize checks the provided user configurations and changes anything that's
|
||||
|
|
@ -759,7 +761,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
|
|||
|
||||
// Make sure the transaction is signed properly.
|
||||
from, err := types.Sender(pool.signer, tx)
|
||||
if err != nil {
|
||||
if err != nil && !pool.config.AllowUnprotectedTxs {
|
||||
return ErrInvalidSender
|
||||
}
|
||||
|
||||
|
|
@ -1096,6 +1098,11 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
|
|||
// Exclude transactions with invalid signatures as soon as
|
||||
// possible and cache senders in transactions before
|
||||
// obtaining lock
|
||||
|
||||
if pool.config.AllowUnprotectedTxs {
|
||||
pool.signer = types.NewFakeSigner(tx.ChainId())
|
||||
}
|
||||
|
||||
_, err = types.Sender(pool.signer, tx)
|
||||
if err != nil {
|
||||
errs = append(errs, ErrInvalidSender)
|
||||
|
|
@ -1149,11 +1156,16 @@ func (pool *TxPool) addTx(tx *types.Transaction, local, sync bool) error {
|
|||
// Exclude transactions with invalid signatures as soon as
|
||||
// possible and cache senders in transactions before
|
||||
// obtaining lock
|
||||
if pool.config.AllowUnprotectedTxs {
|
||||
pool.signer = types.NewFakeSigner(tx.ChainId())
|
||||
}
|
||||
|
||||
_, err = types.Sender(pool.signer, tx)
|
||||
if err != nil {
|
||||
invalidTxMeter.Mark(1)
|
||||
|
||||
return
|
||||
} else {
|
||||
err = nil
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
@ -1539,6 +1551,7 @@ func (pool *TxPool) runReorg(ctx context.Context, done chan struct{}, reset *txp
|
|||
// remove any transaction that has been included in the block or was invalidated
|
||||
// because of another transaction (e.g. higher gas price).
|
||||
|
||||
//nolint:nestif
|
||||
if reset != nil {
|
||||
tracing.ElapsedTime(ctx, span, "new block", func(_ context.Context, innerSpan trace.Span) {
|
||||
|
||||
|
|
@ -1573,7 +1586,9 @@ func (pool *TxPool) runReorg(ctx context.Context, done chan struct{}, reset *txp
|
|||
tracing.ElapsedTime(ctx, innerSpan, "09 fill nonces", func(_ context.Context, innerSpan trace.Span) {
|
||||
for addr, list := range pool.pending {
|
||||
highestPending = list.LastElement()
|
||||
nonces[addr] = highestPending.Nonce() + 1
|
||||
if highestPending != nil {
|
||||
nonces[addr] = highestPending.Nonce() + 1
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ import (
|
|||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
|
||||
"github.com/JekaMas/crand"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -890,6 +892,7 @@ func TestTransactionGapFilling(t *testing.T) {
|
|||
if queued != 1 {
|
||||
t.Fatalf("queued transactions mismatched: have %d, want %d", queued, 1)
|
||||
}
|
||||
|
||||
if err := validateEvents(events, 1); err != nil {
|
||||
t.Fatalf("original event firing failed: %v", err)
|
||||
}
|
||||
|
|
@ -954,6 +957,53 @@ func TestTransactionQueueAccountLimiting(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// Test that txpool rejects unprotected txs by default
|
||||
// FIXME: The below test causes some tests to fail randomly (probably due to parallel execution)
|
||||
//
|
||||
//nolint:paralleltest
|
||||
func TestRejectUnprotectedTransaction(t *testing.T) {
|
||||
//nolint:paralleltest
|
||||
t.Skip()
|
||||
|
||||
pool, key := setupTxPool()
|
||||
defer pool.Stop()
|
||||
|
||||
tx := dynamicFeeTx(0, 22000, big.NewInt(5), big.NewInt(2), key)
|
||||
from := crypto.PubkeyToAddress(key.PublicKey)
|
||||
|
||||
pool.chainconfig.ChainID = big.NewInt(5)
|
||||
pool.signer = types.LatestSignerForChainID(pool.chainconfig.ChainID)
|
||||
testAddBalance(pool, from, big.NewInt(0xffffffffffffff))
|
||||
|
||||
if err := pool.AddRemote(tx); !errors.Is(err, types.ErrInvalidChainId) {
|
||||
t.Error("expected", types.ErrInvalidChainId, "got", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Test that txpool allows unprotected txs when AllowUnprotectedTxs flag is set
|
||||
// FIXME: The below test causes some tests to fail randomly (probably due to parallel execution)
|
||||
//
|
||||
//nolint:paralleltest
|
||||
func TestAllowUnprotectedTransactionWhenSet(t *testing.T) {
|
||||
t.Skip()
|
||||
|
||||
pool, key := setupTxPool()
|
||||
defer pool.Stop()
|
||||
|
||||
tx := dynamicFeeTx(0, 22000, big.NewInt(5), big.NewInt(2), key)
|
||||
from := crypto.PubkeyToAddress(key.PublicKey)
|
||||
|
||||
// Allow unprotected txs
|
||||
pool.config.AllowUnprotectedTxs = true
|
||||
pool.chainconfig.ChainID = big.NewInt(5)
|
||||
pool.signer = types.LatestSignerForChainID(pool.chainconfig.ChainID)
|
||||
testAddBalance(pool, from, big.NewInt(0xffffffffffffff))
|
||||
|
||||
if err := pool.AddRemote(tx); err != nil {
|
||||
t.Error("expected", nil, "got", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Tests that if the transaction count belonging to multiple accounts go above
|
||||
// some threshold, the higher transactions are dropped to prevent DOS attacks.
|
||||
//
|
||||
|
|
@ -1884,9 +1934,11 @@ func TestTransactionPoolUnderpricing(t *testing.T) {
|
|||
if queued != 2 {
|
||||
t.Fatalf("queued transactions mismatched: have %d, want %d", queued, 2)
|
||||
}
|
||||
|
||||
if err := validateEvents(events, 1); err != nil {
|
||||
t.Fatalf("additional event firing failed: %v", err)
|
||||
}
|
||||
|
||||
if err := validateTxPoolInternals(pool); err != nil {
|
||||
t.Fatalf("pool internal state corrupted: %v", err)
|
||||
}
|
||||
|
|
@ -2050,6 +2102,7 @@ func TestTransactionPoolUnderpricingDynamicFee(t *testing.T) {
|
|||
if err := pool.AddRemote(tx); err != nil { // +K1:2, -K0:1 => Pend K0:0 K1:0, K2:0; Que K1:2
|
||||
t.Fatalf("failed to add well priced transaction: %v", err)
|
||||
}
|
||||
|
||||
tx = dynamicFeeTx(3, 100000, big.NewInt(4), big.NewInt(1), keys[1])
|
||||
if err := pool.AddRemote(tx); err != nil { // +K1:3, -K1:0 => Pend K0:0 K2:0; Que K1:2 K1:3
|
||||
t.Fatalf("failed to add well priced transaction: %v", err)
|
||||
|
|
@ -2061,9 +2114,11 @@ func TestTransactionPoolUnderpricingDynamicFee(t *testing.T) {
|
|||
if queued != 2 {
|
||||
t.Fatalf("queued transactions mismatched: have %d, want %d", queued, 2)
|
||||
}
|
||||
|
||||
if err := validateEvents(events, 1); err != nil {
|
||||
t.Fatalf("additional event firing failed: %v", err)
|
||||
}
|
||||
|
||||
if err := validateTxPoolInternals(pool); err != nil {
|
||||
t.Fatalf("pool internal state corrupted: %v", err)
|
||||
}
|
||||
|
|
@ -3692,6 +3747,45 @@ func MakeWithPromoteTxCh(ch chan struct{}) func(*TxPool) {
|
|||
}
|
||||
}
|
||||
|
||||
func BenchmarkBigs(b *testing.B) {
|
||||
// max 256-bit
|
||||
max := new(big.Int)
|
||||
max.Exp(big.NewInt(2), big.NewInt(256), nil).Sub(max, big.NewInt(1))
|
||||
|
||||
ints := make([]*big.Int, 1000000)
|
||||
intUs := make([]*uint256.Int, 1000000)
|
||||
|
||||
var over bool
|
||||
|
||||
for i := 0; i < len(ints); i++ {
|
||||
ints[i] = crand.BigInt(max)
|
||||
intUs[i], over = uint256.FromBig(ints[i])
|
||||
|
||||
if over {
|
||||
b.Fatal(ints[i], over)
|
||||
}
|
||||
}
|
||||
|
||||
b.Run("*big.Int", func(b *testing.B) {
|
||||
var r int
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r = ints[i%len(ints)%b.N].Cmp(ints[(i+1)%len(ints)%b.N])
|
||||
}
|
||||
|
||||
fmt.Fprintln(io.Discard, r)
|
||||
})
|
||||
b.Run("*uint256.Int", func(b *testing.B) {
|
||||
var r int
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r = intUs[i%len(intUs)%b.N].Cmp(intUs[(i+1)%len(intUs)%b.N])
|
||||
}
|
||||
|
||||
fmt.Fprintln(io.Discard, r)
|
||||
})
|
||||
}
|
||||
|
||||
//nolint:thelper
|
||||
func mining(tb testing.TB, pool *TxPool, signer types.Signer, baseFee *uint256.Int, blockGasLimit uint64, totalBlocks int) (int, time.Duration, time.Duration) {
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -470,6 +470,42 @@ func (fs FrontierSigner) Hash(tx *Transaction) common.Hash {
|
|||
})
|
||||
}
|
||||
|
||||
// FakeSigner implements the Signer interface and accepts unprotected transactions
|
||||
type FakeSigner struct{ londonSigner }
|
||||
|
||||
var _ Signer = FakeSigner{}
|
||||
|
||||
func NewFakeSigner(chainId *big.Int) Signer {
|
||||
signer := NewLondonSigner(chainId)
|
||||
ls, _ := signer.(londonSigner)
|
||||
|
||||
return FakeSigner{londonSigner: ls}
|
||||
}
|
||||
|
||||
func (f FakeSigner) Sender(tx *Transaction) (common.Address, error) {
|
||||
return f.londonSigner.Sender(tx)
|
||||
}
|
||||
|
||||
func (f FakeSigner) SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error) {
|
||||
return f.londonSigner.SignatureValues(tx, sig)
|
||||
}
|
||||
|
||||
func (f FakeSigner) ChainID() *big.Int {
|
||||
return f.londonSigner.ChainID()
|
||||
}
|
||||
|
||||
// Hash returns 'signature hash', i.e. the transaction hash that is signed by the
|
||||
// private key. This hash does not uniquely identify the transaction.
|
||||
func (f FakeSigner) Hash(tx *Transaction) common.Hash {
|
||||
return f.londonSigner.Hash(tx)
|
||||
}
|
||||
|
||||
// Equal returns true if the given signer is the same as the receiver.
|
||||
func (f FakeSigner) Equal(Signer) bool {
|
||||
// Always return true
|
||||
return true
|
||||
}
|
||||
|
||||
func decodeSignature(sig []byte) (r, s, v *big.Int) {
|
||||
if len(sig) != crypto.SignatureLength {
|
||||
panic(fmt.Sprintf("wrong size for signature: got %d, want %d", len(sig), crypto.SignatureLength))
|
||||
|
|
|
|||
|
|
@ -263,12 +263,14 @@ var (
|
|||
big199680 = big.NewInt(199680)
|
||||
)
|
||||
|
||||
// nolint: gofmt
|
||||
// modexpMultComplexity implements bigModexp multComplexity formula, as defined in EIP-198
|
||||
//
|
||||
// def mult_complexity(x):
|
||||
// if x <= 64: return x ** 2
|
||||
// elif x <= 1024: return x ** 2 // 4 + 96 * x - 3072
|
||||
// else: return x ** 2 // 16 + 480 * x - 199680
|
||||
//
|
||||
// if x <= 64: return x ** 2
|
||||
// elif x <= 1024: return x ** 2 // 4 + 96 * x - 3072
|
||||
// else: return x ** 2 // 16 + 480 * x - 199680
|
||||
//
|
||||
// where is x is max(length_of_MODULUS, length_of_BASE)
|
||||
func modexpMultComplexity(x *big.Int) *big.Int {
|
||||
|
|
@ -383,10 +385,12 @@ func (c *bigModExp) Run(input []byte) ([]byte, error) {
|
|||
exp = new(big.Int).SetBytes(getData(input, baseLen, expLen))
|
||||
mod = new(big.Int).SetBytes(getData(input, baseLen+expLen, modLen))
|
||||
)
|
||||
|
||||
if mod.BitLen() == 0 {
|
||||
// Modulo 0 is undefined, return zero
|
||||
return common.LeftPadBytes([]byte{}, int(modLen)), nil
|
||||
}
|
||||
|
||||
return common.LeftPadBytes(base.Exp(base, exp, mod).Bytes(), int(modLen)), nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
- ```v5```: Enable UDP v5 (default: false)
|
||||
|
||||
- ```log-level```: Log level (trace|debug|info|warn|error|crit) (default: info)
|
||||
- ```verbosity```: Logging verbosity (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (default: 3)
|
||||
|
||||
- ```log-level```: log level (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead (default: info)
|
||||
|
||||
- ```nat```: port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: none)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
chain = "mainnet" # Name of the chain to sync ("mumbai", "mainnet") or path to a genesis file
|
||||
identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname)
|
||||
log-level = "INFO" # Set log level for the server
|
||||
verbosity = 3 # Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (`log-level` was replaced by `verbosity`, and thus will be deprecated soon)
|
||||
vmdebug = false # Record information useful for VM and contract debugging
|
||||
datadir = "var/lib/bor" # Path of the data directory to store information
|
||||
ancient = "" # Data directory for ancient chain segments (default = inside chaindata)
|
||||
keystore = "" # Path of the directory where keystores are located
|
||||
|
|
@ -13,11 +14,18 @@ gcmode = "full" # Blockchain garbage collection mode ("full", "arch
|
|||
snapshot = true # Enables the snapshot-database mode
|
||||
"bor.logs" = false # Enables bor log retrieval
|
||||
ethstats = "" # Reporting URL of a ethstats service (nodename:secret@host:port)
|
||||
devfakeauthor = false # Run miner without validator set authorization [dev mode] : Use with '--bor.withoutheimdall' (default: false)
|
||||
|
||||
["eth.requiredblocks"] # Comma separated block number-to-hash mappings to require for peering (<number>=<hash>) (default = empty map)
|
||||
"31000000" = "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e"
|
||||
"32000000" = "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68"
|
||||
|
||||
[log]
|
||||
vmodule = "" # Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
|
||||
json = false # Format logs with JSON
|
||||
backtrace = "" # Request a stack trace at a specific logging statement (e.g. "block.go:271")
|
||||
debug = true # Prepends log messages with call-site location (file and line number) - {requires some effort}
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50 # Maximum number of network peers (network disabled if set to 0)
|
||||
maxpendpeers = 50 # Maximum number of pending connection attempts
|
||||
|
|
@ -25,6 +33,9 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
|
|||
port = 30303 # Network listening port
|
||||
nodiscover = false # Disables the peer discovery mechanism (manual peer addition)
|
||||
nat = "any" # NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)
|
||||
netrestrict = "" # Restricts network communication to the given IP networks (CIDR masks)
|
||||
nodekey = "" # P2P node key file
|
||||
nodekeyhex = "" # P2P node key as hex
|
||||
txarrivalwait = "500ms" # Maximum duration to wait before requesting an announced transaction
|
||||
[p2p.discovery]
|
||||
v5disc = false # Enables the experimental RLPx V5 (Topic Discovery) mechanism
|
||||
|
|
@ -59,12 +70,15 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
|
|||
extradata = "" # Block extra data set by the miner (default = client version)
|
||||
gaslimit = 30000000 # Target gas ceiling for mined blocks
|
||||
gasprice = "1000000000" # Minimum gas price for mining a transaction (recommended for mainnet = 30000000000, default suitable for mumbai/devnet)
|
||||
recommit = "2m5s" # The time interval for miner to re-create mining work
|
||||
|
||||
[jsonrpc]
|
||||
ipcdisable = false # Disable the IPC-RPC server
|
||||
ipcpath = "" # Filename for IPC socket/pipe within the datadir (explicit paths escape it)
|
||||
gascap = 50000000 # Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)
|
||||
evmtimeout = "5s" # Sets a timeout used for eth_call (0=infinite)
|
||||
txfeecap = 5.0 # Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)
|
||||
allow-unprotected-txs = false # Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC (default: false)
|
||||
[jsonrpc.http]
|
||||
enabled = false # Enable the HTTP-RPC server
|
||||
port = 8545 # http.port
|
||||
|
|
@ -87,6 +101,11 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
|
|||
host = "" #
|
||||
vhosts = ["localhost"] # Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.
|
||||
corsdomain = ["localhost"] # Comma separated list of domains from which to accept cross origin requests (browser enforced)
|
||||
[jsonrpc.auth]
|
||||
jwtsecret = "" # Path to a JWT secret to use for authenticated RPC endpoints
|
||||
addr = "localhost" # Listening address for authenticated APIs
|
||||
port = 8551 # Listening port for authenticated APIs
|
||||
vhosts = ["localhost"] # Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.
|
||||
[jsonrpc.timeouts]
|
||||
read = "30s"
|
||||
write = "30s"
|
||||
|
|
@ -95,6 +114,8 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
|
|||
[gpo]
|
||||
blocks = 20 # Number of recent blocks to check for gas prices
|
||||
percentile = 60 # Suggested gas price is the given percentile of a set of recent transaction gas prices
|
||||
maxheaderhistory = 1024 # Maximum header history of gasprice oracle
|
||||
maxblockhistory = 1024 # Maximum block history of gasprice oracle
|
||||
maxprice = "5000000000000" # Maximum gas price will be recommended by gpo
|
||||
ignoreprice = "2" # Gas price below which gpo will ignore transactions (recommended for mainnet = 30000000000, default suitable for mumbai/devnet)
|
||||
|
||||
|
|
@ -132,6 +153,7 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
|
|||
txlookuplimit = 2350000 # Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain)
|
||||
triesinmemory = 128 # Number of block states (tries) to keep in memory
|
||||
timeout = "1h0m0s" # Time after which the Merkle Patricia Trie is stored to disc from memory
|
||||
fdlimit = 0 # Raise the open file descriptor resource limit (default = system fd limit)
|
||||
|
||||
[accounts]
|
||||
unlock = [] # Comma separated list of accounts to unlock
|
||||
|
|
@ -144,5 +166,13 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
|
|||
addr = ":3131" # Address and port to bind the GRPC server
|
||||
|
||||
[developer]
|
||||
dev = false # Enable developer mode with ephemeral proof-of-authority network and a pre-funded developer account, mining enabled
|
||||
period = 0 # Block period to use in developer mode (0 = mine only if transaction pending)
|
||||
dev = false # Enable developer mode with ephemeral proof-of-authority network and a pre-funded developer account, mining enabled
|
||||
period = 0 # Block period to use in developer mode (0 = mine only if transaction pending)
|
||||
gaslimit = 11500000 # Initial block gas limit
|
||||
|
||||
[pprof]
|
||||
pprof = false # Enable the pprof HTTP server
|
||||
port = 6060 # pprof HTTP server listening port
|
||||
addr = "127.0.0.1" # pprof HTTP server listening interface
|
||||
memprofilerate = 524288 # Turn on memory profiling with the given rate
|
||||
blockprofilerate = 0 # Turn on block profiling with the given rate
|
||||
|
|
|
|||
|
|
@ -8,15 +8,19 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```identity```: Name/Identity of the node
|
||||
|
||||
- ```log-level```: Set log level for the server (default: INFO)
|
||||
- ```verbosity```: Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit), default = 3 (default: 3)
|
||||
|
||||
- ```log-level```: Log level for the server (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead
|
||||
|
||||
- ```datadir```: Path of the data directory to store information
|
||||
|
||||
- ```vmdebug```: Record information useful for VM and contract debugging (default: false)
|
||||
|
||||
- ```datadir.ancient```: Data directory for ancient chain segments (default = inside chaindata)
|
||||
|
||||
- ```keystore```: Path of the directory where keystores are located
|
||||
|
||||
- ```config```: File for the config file
|
||||
- ```config```: Path to the TOML configuration file
|
||||
|
||||
- ```syncmode```: Blockchain sync mode (only "full" sync supported) (default: full)
|
||||
|
||||
|
|
@ -32,14 +36,24 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```bor.withoutheimdall```: Run without Heimdall service (for testing purpose) (default: false)
|
||||
|
||||
- ```bor.devfakeauthor```: Run miner without validator set authorization [dev mode] : Use with '--bor.withoutheimdall' (default: false)
|
||||
|
||||
- ```bor.heimdallgRPC```: Address of Heimdall gRPC service
|
||||
|
||||
- ```bor.runheimdall```: Run Heimdall service as a child process (default: false)
|
||||
|
||||
- ```bor.runheimdallargs```: Arguments to pass to Heimdall service
|
||||
|
||||
- ```ethstats```: Reporting URL of a ethstats service (nodename:secret@host:port)
|
||||
|
||||
- ```gpo.blocks```: Number of recent blocks to check for gas prices (default: 20)
|
||||
|
||||
- ```gpo.percentile```: Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60)
|
||||
|
||||
- ```gpo.maxheaderhistory```: Maximum header history of gasprice oracle (default: 1024)
|
||||
|
||||
- ```gpo.maxblockhistory```: Maximum block history of gasprice oracle (default: 1024)
|
||||
|
||||
- ```gpo.maxprice```: Maximum gas price will be recommended by gpo (default: 5000000000000)
|
||||
|
||||
- ```gpo.ignoreprice```: Gas price below which gpo will ignore transactions (default: 2)
|
||||
|
|
@ -52,6 +66,18 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```dev.period```: Block period to use in developer mode (0 = mine only if transaction pending) (default: 0)
|
||||
|
||||
- ```dev.gaslimit```: Initial block gas limit (default: 11500000)
|
||||
|
||||
- ```pprof```: Enable the pprof HTTP server (default: false)
|
||||
|
||||
- ```pprof.port```: pprof HTTP server listening port (default: 6060)
|
||||
|
||||
- ```pprof.addr```: pprof HTTP server listening interface (default: 127.0.0.1)
|
||||
|
||||
- ```pprof.memprofilerate```: Turn on memory profiling with the given rate (default: 524288)
|
||||
|
||||
- ```pprof.blockprofilerate```: Turn on block profiling with the given rate (default: 0)
|
||||
|
||||
### Account Management Options
|
||||
|
||||
- ```unlock```: Comma separated list of accounts to unlock
|
||||
|
|
@ -86,16 +112,30 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```txlookuplimit```: Number of recent blocks to maintain transactions index for (default: 2350000)
|
||||
|
||||
- ```fdlimit```: Raise the open file descriptor resource limit (default = system fd limit) (default: 0)
|
||||
|
||||
### JsonRPC Options
|
||||
|
||||
- ```rpc.gascap```: Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 50000000)
|
||||
|
||||
- ```rpc.evmtimeout```: Sets a timeout used for eth_call (0=infinite) (default: 5s)
|
||||
|
||||
- ```rpc.txfeecap```: Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 5)
|
||||
|
||||
- ```rpc.allow-unprotected-txs```: Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC (default: false)
|
||||
|
||||
- ```ipcdisable```: Disable the IPC-RPC server (default: false)
|
||||
|
||||
- ```ipcpath```: Filename for IPC socket/pipe within the datadir (explicit paths escape it)
|
||||
|
||||
- ```authrpc.jwtsecret```: Path to a JWT secret to use for authenticated RPC endpoints
|
||||
|
||||
- ```authrpc.addr```: Listening address for authenticated APIs (default: localhost)
|
||||
|
||||
- ```authrpc.port```: Listening port for authenticated APIs (default: 8551)
|
||||
|
||||
- ```authrpc.vhosts```: Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: localhost)
|
||||
|
||||
- ```http.corsdomain```: Comma separated list of domains from which to accept cross origin requests (browser enforced) (default: localhost)
|
||||
|
||||
- ```http.vhosts```: Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: localhost)
|
||||
|
|
@ -128,6 +168,16 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```graphql```: Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. (default: false)
|
||||
|
||||
### Logging Options
|
||||
|
||||
- ```vmodule```: Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
|
||||
|
||||
- ```log.json```: Format logs with JSON (default: false)
|
||||
|
||||
- ```log.backtrace```: Request a stack trace at a specific logging statement (e.g. 'block.go:271')
|
||||
|
||||
- ```log.debug```: Prepends log messages with call-site location (file and line number) (default: false)
|
||||
|
||||
### P2P Options
|
||||
|
||||
- ```bind```: Network binding address (default: 0.0.0.0)
|
||||
|
|
@ -142,6 +192,12 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```nat```: NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: any)
|
||||
|
||||
- ```netrestrict```: Restricts network communication to the given IP networks (CIDR masks)
|
||||
|
||||
- ```nodekey```: P2P node key file
|
||||
|
||||
- ```nodekeyhex```: P2P node key as hex
|
||||
|
||||
- ```nodiscover```: Disables the peer discovery mechanism (manual peer addition) (default: false)
|
||||
|
||||
- ```v5disc```: Enables the experimental RLPx V5 (Topic Discovery) mechanism (default: false)
|
||||
|
|
@ -160,6 +216,8 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```miner.gasprice```: Minimum gas price for mining a transaction (default: 1000000000)
|
||||
|
||||
- ```miner.recommit```: The time interval for miner to re-create mining work (default: 2m5s)
|
||||
|
||||
### Telemetry Options
|
||||
|
||||
- ```metrics```: Enable metrics collection and reporting (default: false)
|
||||
|
|
|
|||
|
|
@ -174,7 +174,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
// START: Bor changes
|
||||
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
|
||||
if eth.APIBackend.allowUnprotectedTxs {
|
||||
log.Info("Unprotected transactions allowed")
|
||||
log.Debug(" ###########", "Unprotected transactions allowed")
|
||||
|
||||
config.TxPool.AllowUnprotectedTxs = true
|
||||
}
|
||||
gpoParams := config.GPO
|
||||
if gpoParams.Default == nil {
|
||||
|
|
|
|||
|
|
@ -100,18 +100,20 @@ func (w *Service) IsValidChain(currentHeader *types.Header, chain []*types.Heade
|
|||
}
|
||||
|
||||
// Split the chain into past and future chain
|
||||
pastChain, futureChain := splitChain(current, chain)
|
||||
pastChain, _ := splitChain(current, chain)
|
||||
|
||||
// Note: Do not act on future chain and allow importing all kinds of future chains.
|
||||
|
||||
// Add an offset to future chain if it's not in continuity
|
||||
offset := 0
|
||||
if len(futureChain) != 0 {
|
||||
offset += int(futureChain[0].Number.Uint64()-currentHeader.Number.Uint64()) - 1
|
||||
}
|
||||
// offset := 0
|
||||
// if len(futureChain) != 0 {
|
||||
// offset += int(futureChain[0].Number.Uint64()-currentHeader.Number.Uint64()) - 1
|
||||
// }
|
||||
|
||||
// Don't accept future chain of unacceptable length (from current block)
|
||||
if len(futureChain)+offset > int(w.checkpointInterval) {
|
||||
return false, ErrLongFutureChain
|
||||
}
|
||||
// if len(futureChain)+offset > int(w.checkpointInterval) {
|
||||
// return false, ErrLongFutureChain
|
||||
// }
|
||||
|
||||
// Iterate over the chain and validate against the last checkpoint
|
||||
// It will handle all cases where the incoming chain has atleast one checkpoint
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ func TestIsValidChain(t *testing.T) {
|
|||
// create a future chain to be imported of length <= `checkpointInterval`
|
||||
chainB := createMockChain(21, 30) // B21->B22...B29->B30
|
||||
|
||||
// case5: Try importing a future chain of acceptable length
|
||||
// case5: Try importing a future chain (1)
|
||||
res, err = s.IsValidChain(chainA[len(chainA)-1], chainB)
|
||||
require.Equal(t, res, true, "expected chain to be valid")
|
||||
require.Equal(t, err, nil, "expected error to be nil")
|
||||
|
|
@ -174,10 +174,13 @@ func TestIsValidChain(t *testing.T) {
|
|||
// create a future chain to be imported of length > `checkpointInterval`
|
||||
chainB = createMockChain(21, 40) // C21->C22...C39->C40
|
||||
|
||||
// case5: Try importing a future chain of unacceptable length
|
||||
// Note: Earlier, it used to reject future chains longer than some threshold.
|
||||
// That check is removed for now.
|
||||
|
||||
// case6: Try importing a future chain (2)
|
||||
res, err = s.IsValidChain(chainA[len(chainA)-1], chainB)
|
||||
require.Equal(t, res, false, "expected chain to be invalid")
|
||||
require.Equal(t, err, ErrLongFutureChain, "expected error")
|
||||
require.Equal(t, res, true, "expected chain to be valid")
|
||||
require.Equal(t, err, nil, "expected error to be nil")
|
||||
}
|
||||
|
||||
func TestSplitChain(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/consensus/bor/contract"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall" //nolint:typecheck
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/span"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdallapp"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdallgrpc"
|
||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
|
|
@ -227,6 +228,9 @@ type Config struct {
|
|||
// Arguments to pass to heimdall service
|
||||
RunHeimdallArgs string
|
||||
|
||||
// Use child heimdall process to fetch data, Only works when RunHeimdall is true
|
||||
UseHeimdallApp bool
|
||||
|
||||
// Bor logs flag
|
||||
BorLogs bool
|
||||
|
||||
|
|
@ -235,6 +239,9 @@ type Config struct {
|
|||
|
||||
// OverrideTerminalTotalDifficulty (TODO: remove after the fork)
|
||||
OverrideTerminalTotalDifficulty *big.Int `toml:",omitempty"`
|
||||
|
||||
// Develop Fake Author mode to produce blocks without authorisation
|
||||
DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"`
|
||||
}
|
||||
|
||||
// CreateConsensusEngine creates a consensus engine for the given chain configuration.
|
||||
|
|
@ -255,16 +262,21 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et
|
|||
spanner := span.NewChainSpanner(blockchainAPI, contract.ValidatorSet(), chainConfig, common.HexToAddress(chainConfig.Bor.ValidatorContract))
|
||||
|
||||
if ethConfig.WithoutHeimdall {
|
||||
return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient)
|
||||
return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient, ethConfig.DevFakeAuthor)
|
||||
} else {
|
||||
if ethConfig.DevFakeAuthor {
|
||||
log.Warn("Sanitizing DevFakeAuthor", "Use DevFakeAuthor with", "--bor.withoutheimdall")
|
||||
}
|
||||
var heimdallClient bor.IHeimdallClient
|
||||
if ethConfig.HeimdallgRPCAddress != "" {
|
||||
if ethConfig.RunHeimdall && ethConfig.UseHeimdallApp {
|
||||
heimdallClient = heimdallapp.NewHeimdallAppClient()
|
||||
} else if ethConfig.HeimdallgRPCAddress != "" {
|
||||
heimdallClient = heimdallgrpc.NewHeimdallGRPCClient(ethConfig.HeimdallgRPCAddress)
|
||||
} else {
|
||||
heimdallClient = heimdall.NewHeimdallClient(ethConfig.HeimdallURL)
|
||||
}
|
||||
|
||||
return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient)
|
||||
return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient, false)
|
||||
}
|
||||
} else {
|
||||
switch config.PowMode {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const (
|
|||
|
||||
// txGatherSlack is the interval used to collate almost-expired announces
|
||||
// with network fetches.
|
||||
txGatherSlack = 20 * time.Millisecond
|
||||
txGatherSlack = 100 * time.Millisecond
|
||||
|
||||
// maxTxArrivalWait is the longest acceptable duration for the txArrivalWait
|
||||
// configuration value. Longer config values will default to this.
|
||||
|
|
|
|||
|
|
@ -64,9 +64,11 @@ func (api *PublicFilterAPI) NewDeposits(ctx context.Context, crit ethereum.State
|
|||
stateSyncData := make(chan *types.StateSyncData, 10)
|
||||
stateSyncSub := api.events.SubscribeNewDeposits(stateSyncData)
|
||||
|
||||
// nolint: gosimple
|
||||
for {
|
||||
select {
|
||||
case h := <-stateSyncData:
|
||||
// nolint : gosimple
|
||||
if crit.ID == h.ID || bytes.Compare(crit.Contract.Bytes(), h.Contract.Bytes()) == 0 ||
|
||||
(crit.ID == 0 && crit.Contract == common.Address{}) {
|
||||
notifier.Notify(rpcSub.ID, h)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/eth/ethconfig"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
|
@ -211,31 +208,31 @@ var testTx2 = types.MustSignNewTx(testKey, types.LatestSigner(genesis.Config), &
|
|||
To: &common.Address{2},
|
||||
})
|
||||
|
||||
func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
||||
// Generate test chain.
|
||||
blocks := generateTestChain()
|
||||
// func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
||||
// // Generate test chain.
|
||||
// blocks := generateTestChain()
|
||||
|
||||
// Create node
|
||||
n, err := node.New(&node.Config{})
|
||||
if err != nil {
|
||||
t.Fatalf("can't create new node: %v", err)
|
||||
}
|
||||
// Create Ethereum Service
|
||||
config := ðconfig.Config{Genesis: genesis}
|
||||
config.Ethash.PowMode = ethash.ModeFake
|
||||
ethservice, err := eth.New(n, config)
|
||||
if err != nil {
|
||||
t.Fatalf("can't create new ethereum service: %v", err)
|
||||
}
|
||||
// Import the test chain.
|
||||
if err := n.Start(); err != nil {
|
||||
t.Fatalf("can't start test node: %v", err)
|
||||
}
|
||||
if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil {
|
||||
t.Fatalf("can't import test blocks: %v", err)
|
||||
}
|
||||
return n, blocks
|
||||
}
|
||||
// // Create node
|
||||
// n, err := node.New(&node.Config{})
|
||||
// if err != nil {
|
||||
// t.Fatalf("can't create new node: %v", err)
|
||||
// }
|
||||
// // Create Ethereum Service
|
||||
// config := ðconfig.Config{Genesis: genesis}
|
||||
// config.Ethash.PowMode = ethash.ModeFake
|
||||
// ethservice, err := eth.New(n, config)
|
||||
// if err != nil {
|
||||
// t.Fatalf("can't create new ethereum service: %v", err)
|
||||
// }
|
||||
// // Import the test chain.
|
||||
// if err := n.Start(); err != nil {
|
||||
// t.Fatalf("can't start test node: %v", err)
|
||||
// }
|
||||
// if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil {
|
||||
// t.Fatalf("can't import test blocks: %v", err)
|
||||
// }
|
||||
// return n, blocks
|
||||
// }
|
||||
|
||||
func generateTestChain() []*types.Block {
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
|
|
@ -258,50 +255,50 @@ func generateTestChain() []*types.Block {
|
|||
func TestEthClient(t *testing.T) {
|
||||
t.Skip("bor due to burn contract")
|
||||
|
||||
backend, chain := newTestBackend(t)
|
||||
client, _ := backend.Attach()
|
||||
defer backend.Close()
|
||||
defer client.Close()
|
||||
// backend, chain := newTestBackend(t)
|
||||
// client, _ := backend.Attach()
|
||||
// defer backend.Close()
|
||||
// defer client.Close()
|
||||
|
||||
tests := map[string]struct {
|
||||
test func(t *testing.T)
|
||||
}{
|
||||
"Header": {
|
||||
func(t *testing.T) { testHeader(t, chain, client) },
|
||||
},
|
||||
"BalanceAt": {
|
||||
func(t *testing.T) { testBalanceAt(t, client) },
|
||||
},
|
||||
"TxInBlockInterrupted": {
|
||||
func(t *testing.T) { testTransactionInBlockInterrupted(t, client) },
|
||||
},
|
||||
"ChainID": {
|
||||
func(t *testing.T) { testChainID(t, client) },
|
||||
},
|
||||
"GetBlock": {
|
||||
func(t *testing.T) { testGetBlock(t, client) },
|
||||
},
|
||||
"StatusFunctions": {
|
||||
func(t *testing.T) { testStatusFunctions(t, client) },
|
||||
},
|
||||
"CallContract": {
|
||||
func(t *testing.T) { testCallContract(t, client) },
|
||||
},
|
||||
"CallContractAtHash": {
|
||||
func(t *testing.T) { testCallContractAtHash(t, client) },
|
||||
},
|
||||
"AtFunctions": {
|
||||
func(t *testing.T) { testAtFunctions(t, client) },
|
||||
},
|
||||
"TransactionSender": {
|
||||
func(t *testing.T) { testTransactionSender(t, client) },
|
||||
},
|
||||
}
|
||||
// tests := map[string]struct {
|
||||
// test func(t *testing.T)
|
||||
// }{
|
||||
// "Header": {
|
||||
// func(t *testing.T) { testHeader(t, chain, client) },
|
||||
// },
|
||||
// "BalanceAt": {
|
||||
// func(t *testing.T) { testBalanceAt(t, client) },
|
||||
// },
|
||||
// "TxInBlockInterrupted": {
|
||||
// func(t *testing.T) { testTransactionInBlockInterrupted(t, client) },
|
||||
// },
|
||||
// "ChainID": {
|
||||
// func(t *testing.T) { testChainID(t, client) },
|
||||
// },
|
||||
// "GetBlock": {
|
||||
// func(t *testing.T) { testGetBlock(t, client) },
|
||||
// },
|
||||
// "StatusFunctions": {
|
||||
// func(t *testing.T) { testStatusFunctions(t, client) },
|
||||
// },
|
||||
// "CallContract": {
|
||||
// func(t *testing.T) { testCallContract(t, client) },
|
||||
// },
|
||||
// "CallContractAtHash": {
|
||||
// func(t *testing.T) { testCallContractAtHash(t, client) },
|
||||
// },
|
||||
// "AtFunctions": {
|
||||
// func(t *testing.T) { testAtFunctions(t, client) },
|
||||
// },
|
||||
// "TransactionSender": {
|
||||
// func(t *testing.T) { testTransactionSender(t, client) },
|
||||
// },
|
||||
// }
|
||||
|
||||
t.Parallel()
|
||||
for name, tt := range tests {
|
||||
t.Run(name, tt.test)
|
||||
}
|
||||
// t.Parallel()
|
||||
// for name, tt := range tests {
|
||||
// t.Run(name, tt.test)
|
||||
// }
|
||||
}
|
||||
|
||||
func testHeader(t *testing.T, chain []*types.Block, client *rpc.Client) {
|
||||
|
|
|
|||
10
go.mod
10
go.mod
|
|
@ -5,12 +5,14 @@ go 1.19
|
|||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0
|
||||
github.com/BurntSushi/toml v1.1.0
|
||||
github.com/JekaMas/crand v1.0.1
|
||||
github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d
|
||||
github.com/VictoriaMetrics/fastcache v1.6.0
|
||||
github.com/aws/aws-sdk-go-v2 v1.2.0
|
||||
github.com/aws/aws-sdk-go-v2/config v1.1.1
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.1.1
|
||||
github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1
|
||||
github.com/btcsuite/btcd v0.22.0-beta // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.2
|
||||
github.com/cespare/cp v1.1.1
|
||||
github.com/cloudflare/cloudflare-go v0.14.0
|
||||
|
|
@ -47,7 +49,7 @@ require (
|
|||
github.com/julienschmidt/httprouter v1.3.0
|
||||
github.com/karalabe/usb v0.0.2
|
||||
github.com/maticnetwork/crand v1.0.2
|
||||
github.com/maticnetwork/heimdall v0.3.0-beta1.0.20221123180730-457028136461
|
||||
github.com/maticnetwork/heimdall v0.3.1-0.20230105132832-d0063f71e3f0
|
||||
github.com/maticnetwork/polyproto v0.0.2
|
||||
github.com/mattn/go-colorable v0.1.8
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
|
|
@ -85,8 +87,6 @@ require (
|
|||
pgregory.net/rapid v0.4.8
|
||||
)
|
||||
|
||||
require github.com/btcsuite/btcd v0.22.0-beta // indirect
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.65.0 // indirect
|
||||
cloud.google.com/go/pubsub v1.3.1 // indirect
|
||||
|
|
@ -145,7 +145,7 @@ require (
|
|||
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/jmhodges/levigo v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/jstemmer/go-junit-report v0.9.1 // indirect
|
||||
github.com/kelseyhightower/envconfig v1.4.0 // indirect
|
||||
github.com/klauspost/compress v1.13.6 // indirect
|
||||
|
|
@ -183,7 +183,7 @@ require (
|
|||
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
|
||||
github.com/tendermint/go-amino v0.15.0 // indirect
|
||||
github.com/tendermint/iavl v0.12.4 // indirect
|
||||
github.com/tendermint/tendermint v0.32.7 // indirect
|
||||
github.com/tendermint/tendermint v0.32.7
|
||||
github.com/tendermint/tm-db v0.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.5 // indirect
|
||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||
|
|
|
|||
7
go.sum
7
go.sum
|
|
@ -48,6 +48,8 @@ github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I
|
|||
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
|
||||
github.com/JekaMas/crand v1.0.1 h1:FMPxkUQqH/hExl0aUXsr0UCGYZ4lJH9IJ5H/KbM6Y9A=
|
||||
github.com/JekaMas/crand v1.0.1/go.mod h1:GGzGpMCht/tbaNQ5A4kSiKSqEoNAhhyTfSDQyIENBQU=
|
||||
github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d h1:RO27lgfZF8s9lZ3pWyzc0gCE0RZC+6/PXbRjAa0CNp8=
|
||||
github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d/go.mod h1:romz7UPgSYhfJkKOalzEEyV6sWtt/eAEm0nX2aOrod0=
|
||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||
|
|
@ -144,7 +146,6 @@ github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN
|
|||
github.com/btcsuite/btcd/btcec/v2 v2.1.2 h1:YoYoC9J0jwfukodSBMzZYUVQ8PTiYg4BnOWiJVzTmLs=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
|
|
@ -611,8 +612,8 @@ github.com/maticnetwork/cosmos-sdk v0.37.5-0.20220311095845-81690c6a53e7 h1:8NoE
|
|||
github.com/maticnetwork/cosmos-sdk v0.37.5-0.20220311095845-81690c6a53e7/go.mod h1:uW55Ru86N5o3L8SVkVL1TPE+mV/WRM2la8sC3TR/Ajc=
|
||||
github.com/maticnetwork/crand v1.0.2 h1:Af0tAivC8zrxXDpGWNWVT/0s1fOz8w0eRbahZgURS8I=
|
||||
github.com/maticnetwork/crand v1.0.2/go.mod h1:/NRNL3bj2eYdqpWmoIP5puxndTpi0XRxpj5ZKxfHjyg=
|
||||
github.com/maticnetwork/heimdall v0.3.0-beta1.0.20221123180730-457028136461 h1:XMznEUVoJVzrZjGzh252yNrmsEKLFgiXefWbhKRabJQ=
|
||||
github.com/maticnetwork/heimdall v0.3.0-beta1.0.20221123180730-457028136461/go.mod h1:IHC6KRjp1c9DLUXLB0+65Fdn+T55OV9y4VViCwYv4lk=
|
||||
github.com/maticnetwork/heimdall v0.3.1-0.20230105132832-d0063f71e3f0 h1:MYTAcBs4y88GEzesT8eAU472ZfQSLluW0qgkZTzNgwM=
|
||||
github.com/maticnetwork/heimdall v0.3.1-0.20230105132832-d0063f71e3f0/go.mod h1:A3bUSe9jjMQHEPPOUW1JytM3x2g3t+jvsbPY66KBPIs=
|
||||
github.com/maticnetwork/polyproto v0.0.2 h1:cPxuxbIDItdwGnucc3lZB58U8Zfe1mH73PWTGd15554=
|
||||
github.com/maticnetwork/polyproto v0.0.2/go.mod h1:e1mU2EXSwEpn5jM7GfNwu3AupsV6WAGoPFFfswXOF0o=
|
||||
github.com/maticnetwork/tendermint v0.26.0-dev0.0.20220923185258-3e7c7f86ce9f h1:iV69PJUEdwJJFXQvbADYVEMxDrkKAsPdHTg4U3F510I=
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
"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/p2p/discover"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
|
|
@ -27,6 +28,7 @@ type BootnodeCommand struct {
|
|||
|
||||
listenAddr string
|
||||
v5 bool
|
||||
verbosity int
|
||||
logLevel string
|
||||
nat string
|
||||
nodeKey string
|
||||
|
|
@ -64,10 +66,16 @@ func (b *BootnodeCommand) Flags() *flagset.Flagset {
|
|||
Usage: "Enable UDP v5",
|
||||
Value: &b.v5,
|
||||
})
|
||||
flags.IntFlag(&flagset.IntFlag{
|
||||
Name: "verbosity",
|
||||
Default: 3,
|
||||
Usage: "Logging verbosity (5=trace|4=debug|3=info|2=warn|1=error|0=crit)",
|
||||
Value: &b.verbosity,
|
||||
})
|
||||
flags.StringFlag(&flagset.StringFlag{
|
||||
Name: "log-level",
|
||||
Default: "info",
|
||||
Usage: "Log level (trace|debug|info|warn|error|crit)",
|
||||
Usage: "log level (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead",
|
||||
Value: &b.logLevel,
|
||||
})
|
||||
flags.StringFlag(&flagset.StringFlag{
|
||||
|
|
@ -114,7 +122,18 @@ func (b *BootnodeCommand) Run(args []string) int {
|
|||
|
||||
glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
|
||||
|
||||
lvl, err := log.LvlFromString(strings.ToLower(b.logLevel))
|
||||
var logInfo string
|
||||
|
||||
if b.verbosity != 0 && b.logLevel != "" {
|
||||
b.UI.Warn(fmt.Sprintf("Both verbosity and log-level provided, using verbosity: %v", b.verbosity))
|
||||
logInfo = server.VerbosityIntToString(b.verbosity)
|
||||
} else if b.verbosity != 0 {
|
||||
logInfo = server.VerbosityIntToString(b.verbosity)
|
||||
} else {
|
||||
logInfo = b.logLevel
|
||||
}
|
||||
|
||||
lvl, err := log.LvlFromString(strings.ToLower(logInfo))
|
||||
if err == nil {
|
||||
glogger.Verbosity(lvl)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
empty "google.golang.org/protobuf/types/known/emptypb"
|
||||
|
||||
"github.com/ethereum/go-ethereum/internal/cli/flagset"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server/proto"
|
||||
)
|
||||
|
|
@ -131,8 +129,9 @@ func (d *DebugPprofCommand) Run(args []string) int {
|
|||
|
||||
// Only take cpu and heap profiles by default
|
||||
profiles := map[string]string{
|
||||
"heap": "heap",
|
||||
"cpu": "cpu",
|
||||
"heap": "heap",
|
||||
"cpu": "cpu",
|
||||
"mutex": "mutex",
|
||||
}
|
||||
|
||||
if !d.skiptrace {
|
||||
|
|
@ -148,7 +147,7 @@ func (d *DebugPprofCommand) Run(args []string) int {
|
|||
|
||||
// append the status
|
||||
{
|
||||
statusResp, err := clt.Status(ctx, &empty.Empty{})
|
||||
statusResp, err := clt.Status(ctx, &proto.StatusRequest{})
|
||||
if err != nil {
|
||||
d.UI.Output(fmt.Sprintf("Failed to get status: %v", err))
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ func TestCommand_DebugBlock(t *testing.T) {
|
|||
|
||||
// enable developer mode
|
||||
config.Developer.Enabled = true
|
||||
config.Developer.Period = 2 // block time
|
||||
config.Developer.Period = 2 // block time
|
||||
config.Developer.GasLimit = 11500000 // initial block gaslimit
|
||||
|
||||
// enable archive mode for getting traces of ancient blocks
|
||||
config.GcMode = "archive"
|
||||
|
|
|
|||
|
|
@ -52,12 +52,14 @@ func (c *DumpconfigCommand) Run(args []string) int {
|
|||
userConfig := command.GetConfig()
|
||||
|
||||
// convert the big.Int and time.Duration fields to their corresponding Raw fields
|
||||
userConfig.JsonRPC.RPCEVMTimeoutRaw = userConfig.JsonRPC.RPCEVMTimeout.String()
|
||||
userConfig.JsonRPC.HttpTimeout.ReadTimeoutRaw = userConfig.JsonRPC.HttpTimeout.ReadTimeout.String()
|
||||
userConfig.JsonRPC.HttpTimeout.WriteTimeoutRaw = userConfig.JsonRPC.HttpTimeout.WriteTimeout.String()
|
||||
userConfig.JsonRPC.HttpTimeout.IdleTimeoutRaw = userConfig.JsonRPC.HttpTimeout.IdleTimeout.String()
|
||||
userConfig.TxPool.RejournalRaw = userConfig.TxPool.Rejournal.String()
|
||||
userConfig.TxPool.LifeTimeRaw = userConfig.TxPool.LifeTime.String()
|
||||
userConfig.Sealer.GasPriceRaw = userConfig.Sealer.GasPrice.String()
|
||||
userConfig.Sealer.RecommitRaw = userConfig.Sealer.Recommit.String()
|
||||
userConfig.Gpo.MaxPriceRaw = userConfig.Gpo.MaxPrice.String()
|
||||
userConfig.Gpo.IgnorePriceRaw = userConfig.Gpo.IgnorePrice.String()
|
||||
userConfig.Cache.RejournalRaw = userConfig.Cache.Rejournal.String()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
// GetDeveloperChain returns the developer mode configs.
|
||||
func GetDeveloperChain(period uint64, faucet common.Address) *Chain {
|
||||
func GetDeveloperChain(period uint64, gasLimitt uint64, faucet common.Address) *Chain {
|
||||
// Override the default period to the user requested one
|
||||
config := *params.AllCliqueProtocolChanges
|
||||
config.Clique = ¶ms.CliqueConfig{
|
||||
|
|
@ -26,7 +26,7 @@ func GetDeveloperChain(period uint64, faucet common.Address) *Chain {
|
|||
Genesis: &core.Genesis{
|
||||
Config: &config,
|
||||
ExtraData: append(append(make([]byte, 32), faucet[:]...), make([]byte, crypto.SignatureLength)...),
|
||||
GasLimit: 11500000,
|
||||
GasLimit: gasLimitt,
|
||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||
Difficulty: big.NewInt(1),
|
||||
Alloc: map[common.Address]core.GenesisAccount{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
"github.com/maticnetwork/heimdall/cmd/heimdalld/service"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/pelletier/go-toml"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
|
@ -90,6 +91,32 @@ func (c *Command) extractFlags(args []string) error {
|
|||
}
|
||||
}
|
||||
|
||||
// nolint: nestif
|
||||
// check for log-level and verbosity here
|
||||
if c.configFile != "" {
|
||||
data, _ := toml.LoadFile(c.configFile)
|
||||
if data.Has("verbosity") && data.Has("log-level") {
|
||||
log.Warn("Config contains both, verbosity and log-level, log-level will be deprecated soon. Use verbosity only.", "using", data.Get("verbosity"))
|
||||
} else if !data.Has("verbosity") && data.Has("log-level") {
|
||||
log.Warn("Config contains log-level only, note that log-level will be deprecated soon. Use verbosity instead.", "using", data.Get("log-level"))
|
||||
config.Verbosity = VerbosityStringToInt(strings.ToLower(data.Get("log-level").(string)))
|
||||
}
|
||||
} else {
|
||||
tempFlag := 0
|
||||
for _, val := range args {
|
||||
if (strings.HasPrefix(val, "-verbosity") || strings.HasPrefix(val, "--verbosity")) && config.LogLevel != "" {
|
||||
tempFlag = 1
|
||||
break
|
||||
}
|
||||
}
|
||||
if tempFlag == 1 {
|
||||
log.Warn("Both, verbosity and log-level flags are provided, log-level will be deprecated soon. Use verbosity only.", "using", config.Verbosity)
|
||||
} else if tempFlag == 0 && config.LogLevel != "" {
|
||||
log.Warn("Only log-level flag is provided, note that log-level will be deprecated soon. Use verbosity instead.", "using", config.LogLevel)
|
||||
config.Verbosity = VerbosityStringToInt(strings.ToLower(config.LogLevel))
|
||||
}
|
||||
}
|
||||
|
||||
c.config = &config
|
||||
|
||||
return nil
|
||||
|
|
@ -103,13 +130,6 @@ func (c *Command) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
srv, err := NewServer(c.config, WithGRPCAddress())
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
c.srv = srv
|
||||
|
||||
if c.config.Heimdall.RunHeimdall {
|
||||
shutdownCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
|
@ -119,6 +139,13 @@ func (c *Command) Run(args []string) int {
|
|||
}()
|
||||
}
|
||||
|
||||
srv, err := NewServer(c.config, WithGRPCAddress())
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
c.srv = srv
|
||||
|
||||
return c.handleSignals()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
|
|
@ -24,6 +25,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/fdlimit"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/eth/downloader"
|
||||
"github.com/ethereum/go-ethereum/eth/ethconfig"
|
||||
"github.com/ethereum/go-ethereum/eth/gasprice"
|
||||
|
|
@ -33,6 +35,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
|
@ -49,9 +52,15 @@ type Config struct {
|
|||
// RequiredBlocks is a list of required (block number, hash) pairs to accept
|
||||
RequiredBlocks map[string]string `hcl:"eth.requiredblocks,optional" toml:"eth.requiredblocks,optional"`
|
||||
|
||||
// Verbosity is the level of the logs to put out
|
||||
Verbosity int `hcl:"verbosity,optional" toml:"verbosity,optional"`
|
||||
|
||||
// LogLevel is the level of the logs to put out
|
||||
LogLevel string `hcl:"log-level,optional" toml:"log-level,optional"`
|
||||
|
||||
// Record information useful for VM and contract debugging
|
||||
EnablePreimageRecording bool `hcl:"vmdebug,optional" toml:"vmdebug,optional"`
|
||||
|
||||
// DataDir is the directory to store the state in
|
||||
DataDir string `hcl:"datadir,optional" toml:"datadir,optional"`
|
||||
|
||||
|
|
@ -76,6 +85,9 @@ type Config struct {
|
|||
// Ethstats is the address of the ethstats server to send telemetry
|
||||
Ethstats string `hcl:"ethstats,optional" toml:"ethstats,optional"`
|
||||
|
||||
// Logging has the logging related settings
|
||||
Logging *LoggingConfig `hcl:"log,block" toml:"log,block"`
|
||||
|
||||
// P2P has the p2p network related settings
|
||||
P2P *P2PConfig `hcl:"p2p,block" toml:"p2p,block"`
|
||||
|
||||
|
|
@ -108,6 +120,50 @@ type Config struct {
|
|||
|
||||
// Developer has the developer mode related settings
|
||||
Developer *DeveloperConfig `hcl:"developer,block" toml:"developer,block"`
|
||||
|
||||
// Develop Fake Author mode to produce blocks without authorisation
|
||||
DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"`
|
||||
|
||||
// Pprof has the pprof related settings
|
||||
Pprof *PprofConfig `hcl:"pprof,block" toml:"pprof,block"`
|
||||
}
|
||||
|
||||
type LoggingConfig struct {
|
||||
// Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
|
||||
Vmodule string `hcl:"vmodule,optional" toml:"vmodule,optional"`
|
||||
|
||||
// Format logs with JSON
|
||||
Json bool `hcl:"json,optional" toml:"json,optional"`
|
||||
|
||||
// Request a stack trace at a specific logging statement (e.g. "block.go:271")
|
||||
Backtrace string `hcl:"backtrace,optional" toml:"backtrace,optional"`
|
||||
|
||||
// Prepends log messages with call-site location (file and line number)
|
||||
Debug bool `hcl:"debug,optional" toml:"debug,optional"`
|
||||
|
||||
// TODO - implement this
|
||||
// // Write execution trace to the given file
|
||||
// Trace string `hcl:"trace,optional" toml:"trace,optional"`
|
||||
}
|
||||
|
||||
type PprofConfig struct {
|
||||
// Enableed enable the pprof HTTP server
|
||||
Enabled bool `hcl:"pprof,optional" toml:"pprof,optional"`
|
||||
|
||||
// pprof HTTP server listening port
|
||||
Port int `hcl:"port,optional" toml:"port,optional"`
|
||||
|
||||
// pprof HTTP server listening interface
|
||||
Addr string `hcl:"addr,optional" toml:"addr,optional"`
|
||||
|
||||
// Turn on memory profiling with the given rate
|
||||
MemProfileRate int `hcl:"memprofilerate,optional" toml:"memprofilerate,optional"`
|
||||
|
||||
// Turn on block profiling with the given rate
|
||||
BlockProfileRate int `hcl:"blockprofilerate,optional" toml:"blockprofilerate,optional"`
|
||||
|
||||
// // Write CPU profile to the given file
|
||||
// CPUProfile string `hcl:"cpuprofile,optional" toml:"cpuprofile,optional"`
|
||||
}
|
||||
|
||||
type P2PConfig struct {
|
||||
|
|
@ -129,6 +185,17 @@ type P2PConfig struct {
|
|||
// NAT it used to set NAT options
|
||||
NAT string `hcl:"nat,optional" toml:"nat,optional"`
|
||||
|
||||
// Connectivity can be restricted to certain IP networks.
|
||||
// If this option is set to a non-nil value, only hosts which match one of the
|
||||
// IP networks contained in the list are considered.
|
||||
NetRestrict string `hcl:"netrestrict,optional" toml:"netrestrict,optional"`
|
||||
|
||||
// P2P node key file
|
||||
NodeKey string `hcl:"nodekey,optional" toml:"nodekey,optional"`
|
||||
|
||||
// P2P node key as hex
|
||||
NodeKeyHex string `hcl:"nodekeyhex,optional" toml:"nodekeyhex,optional"`
|
||||
|
||||
// Discovery has the p2p discovery related settings
|
||||
Discovery *P2PDiscovery `hcl:"discovery,block" toml:"discovery,block"`
|
||||
|
||||
|
|
@ -176,6 +243,9 @@ type HeimdallConfig struct {
|
|||
|
||||
// RunHeimdal args are the arguments to run heimdall with
|
||||
RunHeimdallArgs string `hcl:"bor.runheimdallargs,optional" toml:"bor.runheimdallargs,optional"`
|
||||
|
||||
// UseHeimdallApp is used to fetch data from heimdall app when running heimdall as a child process
|
||||
UseHeimdallApp bool `hcl:"bor.useheimdallapp,optional" toml:"bor.useheimdallapp,optional"`
|
||||
}
|
||||
|
||||
type TxPoolConfig struct {
|
||||
|
|
@ -231,6 +301,10 @@ type SealerConfig struct {
|
|||
// GasPrice is the minimum gas price for mining a transaction
|
||||
GasPrice *big.Int `hcl:"-,optional" toml:"-"`
|
||||
GasPriceRaw string `hcl:"gasprice,optional" toml:"gasprice,optional"`
|
||||
|
||||
// The time interval for miner to re-create mining work.
|
||||
Recommit time.Duration `hcl:"-,optional" toml:"-"`
|
||||
RecommitRaw string `hcl:"recommit,optional" toml:"recommit,optional"`
|
||||
}
|
||||
|
||||
type JsonRPCConfig struct {
|
||||
|
|
@ -243,6 +317,10 @@ type JsonRPCConfig struct {
|
|||
// GasCap is the global gas cap for eth-call variants.
|
||||
GasCap uint64 `hcl:"gascap,optional" toml:"gascap,optional"`
|
||||
|
||||
// Sets a timeout used for eth_call (0=infinite)
|
||||
RPCEVMTimeout time.Duration `hcl:"-,optional" toml:"-"`
|
||||
RPCEVMTimeoutRaw string `hcl:"evmtimeout,optional" toml:"evmtimeout,optional"`
|
||||
|
||||
// TxFeeCap is the global transaction fee cap for send-transaction variants
|
||||
TxFeeCap float64 `hcl:"txfeecap,optional" toml:"txfeecap,optional"`
|
||||
|
||||
|
|
@ -255,7 +333,27 @@ type JsonRPCConfig struct {
|
|||
// Graphql has the json-rpc graphql related settings
|
||||
Graphql *APIConfig `hcl:"graphql,block" toml:"graphql,block"`
|
||||
|
||||
// AUTH RPC related settings
|
||||
Auth *AUTHConfig `hcl:"auth,block" toml:"auth,block"`
|
||||
|
||||
HttpTimeout *HttpTimeouts `hcl:"timeouts,block" toml:"timeouts,block"`
|
||||
|
||||
AllowUnprotectedTxs bool `hcl:"allow-unprotected-txs,optional" toml:"allow-unprotected-txs,optional"`
|
||||
}
|
||||
|
||||
type AUTHConfig struct {
|
||||
// JWTSecret is the hex-encoded jwt secret.
|
||||
JWTSecret string `hcl:"jwtsecret,optional" toml:"jwtsecret,optional"`
|
||||
|
||||
// Addr is the listening address on which authenticated APIs are provided.
|
||||
Addr string `hcl:"addr,optional" toml:"addr,optional"`
|
||||
|
||||
// Port is the port number on which authenticated APIs are provided.
|
||||
Port uint64 `hcl:"port,optional" toml:"port,optional"`
|
||||
|
||||
// VHosts is the list of virtual hostnames which are allowed on incoming requests
|
||||
// for the authenticated api. This is by default {'localhost'}.
|
||||
VHosts []string `hcl:"vhosts,optional" toml:"vhosts,optional"`
|
||||
}
|
||||
|
||||
type GRPCConfig struct {
|
||||
|
|
@ -323,6 +421,12 @@ type GpoConfig struct {
|
|||
// Percentile sets the weights to new blocks
|
||||
Percentile uint64 `hcl:"percentile,optional" toml:"percentile,optional"`
|
||||
|
||||
// Maximum header history of gasprice oracle
|
||||
MaxHeaderHistory int `hcl:"maxheaderhistory,optional" toml:"maxheaderhistory,optional"`
|
||||
|
||||
// Maximum block history of gasprice oracle
|
||||
MaxBlockHistory int `hcl:"maxblockhistory,optional" toml:"maxblockhistory,optional"`
|
||||
|
||||
// MaxPrice is an upper bound gas price
|
||||
MaxPrice *big.Int `hcl:"-,optional" toml:"-"`
|
||||
MaxPriceRaw string `hcl:"maxprice,optional" toml:"maxprice,optional"`
|
||||
|
|
@ -418,6 +522,9 @@ type CacheConfig struct {
|
|||
// Time after which the Merkle Patricia Trie is stored to disc from memory
|
||||
TrieTimeout time.Duration `hcl:"-,optional" toml:"-"`
|
||||
TrieTimeoutRaw string `hcl:"timeout,optional" toml:"timeout,optional"`
|
||||
|
||||
// Raise the open file descriptor resource limit (default = system fd limit)
|
||||
FDLimit int `hcl:"fdlimit,optional" toml:"fdlimit,optional"`
|
||||
}
|
||||
|
||||
type AccountsConfig struct {
|
||||
|
|
@ -443,16 +550,27 @@ type DeveloperConfig struct {
|
|||
|
||||
// Period is the block period to use in developer mode
|
||||
Period uint64 `hcl:"period,optional" toml:"period,optional"`
|
||||
|
||||
// Initial block gas limit
|
||||
GasLimit uint64 `hcl:"gaslimit,optional" toml:"gaslimit,optional"`
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Chain: "mainnet",
|
||||
Identity: Hostname(),
|
||||
RequiredBlocks: map[string]string{},
|
||||
LogLevel: "INFO",
|
||||
DataDir: DefaultDataDir(),
|
||||
Ancient: "",
|
||||
Chain: "mainnet",
|
||||
Identity: Hostname(),
|
||||
RequiredBlocks: map[string]string{},
|
||||
Verbosity: 3,
|
||||
LogLevel: "",
|
||||
EnablePreimageRecording: false,
|
||||
DataDir: DefaultDataDir(),
|
||||
Ancient: "",
|
||||
Logging: &LoggingConfig{
|
||||
Vmodule: "",
|
||||
Json: false,
|
||||
Backtrace: "",
|
||||
Debug: false,
|
||||
},
|
||||
P2P: &P2PConfig{
|
||||
MaxPeers: 50,
|
||||
MaxPendPeers: 50,
|
||||
|
|
@ -460,6 +578,7 @@ func DefaultConfig() *Config {
|
|||
Port: 30303,
|
||||
NoDiscover: false,
|
||||
NAT: "any",
|
||||
NetRestrict: "",
|
||||
TxArrivalWait: 500 * time.Millisecond,
|
||||
Discovery: &P2PDiscovery{
|
||||
V5Enabled: false,
|
||||
|
|
@ -499,18 +618,23 @@ func DefaultConfig() *Config {
|
|||
GasCeil: 30_000_000, // geth's default
|
||||
GasPrice: big.NewInt(1 * params.GWei), // geth's default
|
||||
ExtraData: "",
|
||||
Recommit: 125 * time.Second,
|
||||
},
|
||||
Gpo: &GpoConfig{
|
||||
Blocks: 20,
|
||||
Percentile: 60,
|
||||
MaxPrice: gasprice.DefaultMaxPrice,
|
||||
IgnorePrice: gasprice.DefaultIgnorePrice,
|
||||
Blocks: 20,
|
||||
Percentile: 60,
|
||||
MaxHeaderHistory: 1024,
|
||||
MaxBlockHistory: 1024,
|
||||
MaxPrice: gasprice.DefaultMaxPrice,
|
||||
IgnorePrice: gasprice.DefaultIgnorePrice,
|
||||
},
|
||||
JsonRPC: &JsonRPCConfig{
|
||||
IPCDisable: false,
|
||||
IPCPath: "",
|
||||
GasCap: ethconfig.Defaults.RPCGasCap,
|
||||
TxFeeCap: ethconfig.Defaults.RPCTxFeeCap,
|
||||
IPCDisable: false,
|
||||
IPCPath: "",
|
||||
GasCap: ethconfig.Defaults.RPCGasCap,
|
||||
TxFeeCap: ethconfig.Defaults.RPCTxFeeCap,
|
||||
RPCEVMTimeout: ethconfig.Defaults.RPCEVMTimeout,
|
||||
AllowUnprotectedTxs: false,
|
||||
Http: &APIConfig{
|
||||
Enabled: false,
|
||||
Port: 8545,
|
||||
|
|
@ -538,6 +662,12 @@ func DefaultConfig() *Config {
|
|||
WriteTimeout: 30 * time.Second,
|
||||
IdleTimeout: 120 * time.Second,
|
||||
},
|
||||
Auth: &AUTHConfig{
|
||||
JWTSecret: "",
|
||||
Port: node.DefaultAuthPort,
|
||||
Addr: node.DefaultAuthHost,
|
||||
VHosts: node.DefaultAuthVhosts,
|
||||
},
|
||||
},
|
||||
Ethstats: "",
|
||||
Telemetry: &TelemetryConfig{
|
||||
|
|
@ -571,6 +701,7 @@ func DefaultConfig() *Config {
|
|||
TxLookupLimit: 2350000,
|
||||
TriesInMemory: 128,
|
||||
TrieTimeout: 60 * time.Minute,
|
||||
FDLimit: 0,
|
||||
},
|
||||
Accounts: &AccountsConfig{
|
||||
Unlock: []string{},
|
||||
|
|
@ -583,8 +714,18 @@ func DefaultConfig() *Config {
|
|||
Addr: ":3131",
|
||||
},
|
||||
Developer: &DeveloperConfig{
|
||||
Enabled: false,
|
||||
Period: 0,
|
||||
Enabled: false,
|
||||
Period: 0,
|
||||
GasLimit: 11500000,
|
||||
},
|
||||
DevFakeAuthor: false,
|
||||
Pprof: &PprofConfig{
|
||||
Enabled: false,
|
||||
Port: 6060,
|
||||
Addr: "127.0.0.1",
|
||||
MemProfileRate: 512 * 1024,
|
||||
BlockProfileRate: 0,
|
||||
// CPUProfile: "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -630,6 +771,8 @@ func (c *Config) fillTimeDurations() error {
|
|||
td *time.Duration
|
||||
str *string
|
||||
}{
|
||||
{"jsonrpc.evmtimeout", &c.JsonRPC.RPCEVMTimeout, &c.JsonRPC.RPCEVMTimeoutRaw},
|
||||
{"miner.recommit", &c.Sealer.Recommit, &c.Sealer.RecommitRaw},
|
||||
{"jsonrpc.timeouts.read", &c.JsonRPC.HttpTimeout.ReadTimeout, &c.JsonRPC.HttpTimeout.ReadTimeoutRaw},
|
||||
{"jsonrpc.timeouts.write", &c.JsonRPC.HttpTimeout.WriteTimeout, &c.JsonRPC.HttpTimeout.WriteTimeoutRaw},
|
||||
{"jsonrpc.timeouts.idle", &c.JsonRPC.HttpTimeout.IdleTimeout, &c.JsonRPC.HttpTimeout.IdleTimeoutRaw},
|
||||
|
|
@ -700,7 +843,7 @@ func (c *Config) loadChain() error {
|
|||
|
||||
//nolint:gocognit
|
||||
func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*ethconfig.Config, error) {
|
||||
dbHandles, err := MakeDatabaseHandles()
|
||||
dbHandles, err := MakeDatabaseHandles(c.Cache.FDLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -719,15 +862,26 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
n.HeimdallgRPCAddress = c.Heimdall.GRPCAddress
|
||||
n.RunHeimdall = c.Heimdall.RunHeimdall
|
||||
n.RunHeimdallArgs = c.Heimdall.RunHeimdallArgs
|
||||
n.UseHeimdallApp = c.Heimdall.UseHeimdallApp
|
||||
|
||||
// Developer Fake Author for producing blocks without authorisation on bor consensus
|
||||
n.DevFakeAuthor = c.DevFakeAuthor
|
||||
|
||||
// Developer Fake Author for producing blocks without authorisation on bor consensus
|
||||
n.DevFakeAuthor = c.DevFakeAuthor
|
||||
|
||||
// gas price oracle
|
||||
{
|
||||
n.GPO.Blocks = int(c.Gpo.Blocks)
|
||||
n.GPO.Percentile = int(c.Gpo.Percentile)
|
||||
n.GPO.MaxHeaderHistory = c.Gpo.MaxHeaderHistory
|
||||
n.GPO.MaxBlockHistory = c.Gpo.MaxBlockHistory
|
||||
n.GPO.MaxPrice = c.Gpo.MaxPrice
|
||||
n.GPO.IgnorePrice = c.Gpo.IgnorePrice
|
||||
}
|
||||
|
||||
n.EnablePreimageRecording = c.EnablePreimageRecording
|
||||
|
||||
// txpool options
|
||||
{
|
||||
n.TxPool.NoLocals = c.TxPool.NoLocals
|
||||
|
|
@ -744,6 +898,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
|
||||
// miner options
|
||||
{
|
||||
n.Miner.Recommit = c.Sealer.Recommit
|
||||
n.Miner.GasPrice = c.Sealer.GasPrice
|
||||
n.Miner.GasCeil = c.Sealer.GasCeil
|
||||
n.Miner.ExtraData = []byte(c.Sealer.ExtraData)
|
||||
|
|
@ -817,7 +972,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
n.Miner.Etherbase = developer.Address
|
||||
|
||||
// get developer mode chain config
|
||||
c.chain = chains.GetDeveloperChain(c.Developer.Period, developer.Address)
|
||||
c.chain = chains.GetDeveloperChain(c.Developer.Period, c.Developer.GasLimit, developer.Address)
|
||||
|
||||
// update the parameters
|
||||
n.NetworkId = c.chain.NetworkId
|
||||
|
|
@ -906,6 +1061,8 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
log.Info("Global gas cap disabled")
|
||||
}
|
||||
|
||||
n.RPCEVMTimeout = c.JsonRPC.RPCEVMTimeout
|
||||
|
||||
n.RPCTxFeeCap = c.JsonRPC.TxFeeCap
|
||||
|
||||
// sync mode. It can either be "fast", "full" or "snap". We disable
|
||||
|
|
@ -1032,6 +1189,35 @@ func ambiguousAddrRecovery(ks *keystore.KeyStore, err *keystore.AmbiguousAddrErr
|
|||
return *match
|
||||
}
|
||||
|
||||
// setNodeKey creates a node key from set command line flags, either loading it
|
||||
// from a file or as a specified hex value. If neither flags were provided, this
|
||||
// method returns nil and an emphemeral key is to be generated.
|
||||
func getNodeKey(hex string, file string) *ecdsa.PrivateKey {
|
||||
var (
|
||||
key *ecdsa.PrivateKey
|
||||
err error
|
||||
)
|
||||
|
||||
switch {
|
||||
case file != "" && hex != "":
|
||||
utils.Fatalf("Options %q and %q are mutually exclusive", file, hex)
|
||||
case file != "":
|
||||
if key, err = crypto.LoadECDSA(file); err != nil {
|
||||
utils.Fatalf("Option %q: %v", file, err)
|
||||
}
|
||||
|
||||
return key
|
||||
case hex != "":
|
||||
if key, err = crypto.HexToECDSA(hex); err != nil {
|
||||
utils.Fatalf("Option %q: %v", hex, err)
|
||||
}
|
||||
|
||||
return key
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Config) buildNode() (*node.Config, error) {
|
||||
ipcPath := ""
|
||||
if !c.JsonRPC.IPCDisable {
|
||||
|
|
@ -1049,6 +1235,7 @@ func (c *Config) buildNode() (*node.Config, error) {
|
|||
InsecureUnlockAllowed: c.Accounts.AllowInsecureUnlock,
|
||||
Version: params.VersionWithCommit(gitCommit, gitDate),
|
||||
IPCPath: ipcPath,
|
||||
AllowUnprotectedTxs: c.JsonRPC.AllowUnprotectedTxs,
|
||||
P2P: p2p.Config{
|
||||
MaxPeers: int(c.P2P.MaxPeers),
|
||||
MaxPendingPeers: int(c.P2P.MaxPendPeers),
|
||||
|
|
@ -1070,6 +1257,24 @@ func (c *Config) buildNode() (*node.Config, error) {
|
|||
WriteTimeout: c.JsonRPC.HttpTimeout.WriteTimeout,
|
||||
IdleTimeout: c.JsonRPC.HttpTimeout.IdleTimeout,
|
||||
},
|
||||
JWTSecret: c.JsonRPC.Auth.JWTSecret,
|
||||
AuthPort: int(c.JsonRPC.Auth.Port),
|
||||
AuthAddr: c.JsonRPC.Auth.Addr,
|
||||
AuthVirtualHosts: c.JsonRPC.Auth.VHosts,
|
||||
}
|
||||
|
||||
if c.P2P.NetRestrict != "" {
|
||||
list, err := netutil.ParseNetlist(c.P2P.NetRestrict)
|
||||
if err != nil {
|
||||
utils.Fatalf("Option %q: %v", c.P2P.NetRestrict, err)
|
||||
}
|
||||
|
||||
cfg.P2P.NetRestrict = list
|
||||
}
|
||||
|
||||
key := getNodeKey(c.P2P.NodeKeyHex, c.P2P.NodeKey)
|
||||
if key != nil {
|
||||
cfg.P2P.PrivateKey = key
|
||||
}
|
||||
|
||||
// dev mode
|
||||
|
|
@ -1159,18 +1364,32 @@ func (c *Config) Merge(cc ...*Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func MakeDatabaseHandles() (int, error) {
|
||||
func MakeDatabaseHandles(max int) (int, error) {
|
||||
limit, err := fdlimit.Maximum()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
switch {
|
||||
case max == 0:
|
||||
// User didn't specify a meaningful value, use system limits
|
||||
case max < 128:
|
||||
// User specified something unhealthy, just use system defaults
|
||||
log.Error("File descriptor limit invalid (<128)", "had", max, "updated", limit)
|
||||
case max > limit:
|
||||
// User requested more than the OS allows, notify that we can't allocate it
|
||||
log.Warn("Requested file descriptors denied by OS", "req", max, "limit", limit)
|
||||
default:
|
||||
// User limit is meaningful and within allowed range, use that
|
||||
limit = max
|
||||
}
|
||||
|
||||
raised, err := fdlimit.Raise(uint64(limit))
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return int(raised / 2), nil
|
||||
return int(raised / 2), nil // Leave half for networking and other stuff
|
||||
}
|
||||
|
||||
func parseBootnodes(urls []string) ([]*enode.Node, error) {
|
||||
|
|
|
|||
|
|
@ -22,9 +22,15 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.Identity,
|
||||
HideDefaultFromDoc: true,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "verbosity",
|
||||
Usage: "Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit), default = 3",
|
||||
Value: &c.cliConfig.Verbosity,
|
||||
Default: c.cliConfig.Verbosity,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "log-level",
|
||||
Usage: "Set log level for the server",
|
||||
Usage: "Log level for the server (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead",
|
||||
Value: &c.cliConfig.LogLevel,
|
||||
Default: c.cliConfig.LogLevel,
|
||||
})
|
||||
|
|
@ -35,6 +41,12 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.DataDir,
|
||||
HideDefaultFromDoc: true,
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "vmdebug",
|
||||
Usage: "Record information useful for VM and contract debugging",
|
||||
Value: &c.cliConfig.EnablePreimageRecording,
|
||||
Default: c.cliConfig.EnablePreimageRecording,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "datadir.ancient",
|
||||
Usage: "Data directory for ancient chain segments (default = inside chaindata)",
|
||||
|
|
@ -48,7 +60,7 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "config",
|
||||
Usage: "File for the config file",
|
||||
Usage: "Path to the TOML configuration file",
|
||||
Value: &c.configFile,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
|
|
@ -82,6 +94,36 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.BorLogs,
|
||||
})
|
||||
|
||||
// logging related flags (log-level and verbosity is present above, it will be removed soon)
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "vmodule",
|
||||
Usage: "Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)",
|
||||
Value: &c.cliConfig.Logging.Vmodule,
|
||||
Default: c.cliConfig.Logging.Vmodule,
|
||||
Group: "Logging",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "log.json",
|
||||
Usage: "Format logs with JSON",
|
||||
Value: &c.cliConfig.Logging.Json,
|
||||
Default: c.cliConfig.Logging.Json,
|
||||
Group: "Logging",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "log.backtrace",
|
||||
Usage: "Request a stack trace at a specific logging statement (e.g. 'block.go:271')",
|
||||
Value: &c.cliConfig.Logging.Backtrace,
|
||||
Default: c.cliConfig.Logging.Backtrace,
|
||||
Group: "Logging",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "log.debug",
|
||||
Usage: "Prepends log messages with call-site location (file and line number)",
|
||||
Value: &c.cliConfig.Logging.Debug,
|
||||
Default: c.cliConfig.Logging.Debug,
|
||||
Group: "Logging",
|
||||
})
|
||||
|
||||
// heimdall
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "bor.heimdall",
|
||||
|
|
@ -95,6 +137,12 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.Heimdall.Without,
|
||||
Default: c.cliConfig.Heimdall.Without,
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "bor.devfakeauthor",
|
||||
Usage: "Run miner without validator set authorization [dev mode] : Use with '--bor.withoutheimdall'",
|
||||
Value: &c.cliConfig.DevFakeAuthor,
|
||||
Default: c.cliConfig.DevFakeAuthor,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "bor.heimdallgRPC",
|
||||
Usage: "Address of Heimdall gRPC service",
|
||||
|
|
@ -113,6 +161,12 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.Heimdall.RunHeimdallArgs,
|
||||
Default: c.cliConfig.Heimdall.RunHeimdallArgs,
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "bor.useheimdallapp",
|
||||
Usage: "Use child heimdall process to fetch data, Only works when bor.runheimdall is true",
|
||||
Value: &c.cliConfig.Heimdall.UseHeimdallApp,
|
||||
Default: c.cliConfig.Heimdall.UseHeimdallApp,
|
||||
})
|
||||
|
||||
// txpool options
|
||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||
|
|
@ -229,6 +283,13 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Group: "Sealer",
|
||||
Default: c.cliConfig.Sealer.GasPrice,
|
||||
})
|
||||
f.DurationFlag(&flagset.DurationFlag{
|
||||
Name: "miner.recommit",
|
||||
Usage: "The time interval for miner to re-create mining work",
|
||||
Value: &c.cliConfig.Sealer.Recommit,
|
||||
Default: c.cliConfig.Sealer.Recommit,
|
||||
Group: "Sealer",
|
||||
})
|
||||
|
||||
// ethstats
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
|
|
@ -251,6 +312,18 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.Gpo.Percentile,
|
||||
Default: c.cliConfig.Gpo.Percentile,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "gpo.maxheaderhistory",
|
||||
Usage: "Maximum header history of gasprice oracle",
|
||||
Value: &c.cliConfig.Gpo.MaxHeaderHistory,
|
||||
Default: c.cliConfig.Gpo.MaxHeaderHistory,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "gpo.maxblockhistory",
|
||||
Usage: "Maximum block history of gasprice oracle",
|
||||
Value: &c.cliConfig.Gpo.MaxBlockHistory,
|
||||
Default: c.cliConfig.Gpo.MaxBlockHistory,
|
||||
})
|
||||
f.BigIntFlag(&flagset.BigIntFlag{
|
||||
Name: "gpo.maxprice",
|
||||
Usage: "Maximum gas price will be recommended by gpo",
|
||||
|
|
@ -342,6 +415,13 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.Cache.TxLookupLimit,
|
||||
Group: "Cache",
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "fdlimit",
|
||||
Usage: "Raise the open file descriptor resource limit (default = system fd limit)",
|
||||
Value: &c.cliConfig.Cache.FDLimit,
|
||||
Default: c.cliConfig.Cache.FDLimit,
|
||||
Group: "Cache",
|
||||
})
|
||||
|
||||
// rpc options
|
||||
f.Uint64Flag(&flagset.Uint64Flag{
|
||||
|
|
@ -351,6 +431,13 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.JsonRPC.GasCap,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.DurationFlag(&flagset.DurationFlag{
|
||||
Name: "rpc.evmtimeout",
|
||||
Usage: "Sets a timeout used for eth_call (0=infinite)",
|
||||
Value: &c.cliConfig.JsonRPC.RPCEVMTimeout,
|
||||
Default: c.cliConfig.JsonRPC.RPCEVMTimeout,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.Float64Flag(&flagset.Float64Flag{
|
||||
Name: "rpc.txfeecap",
|
||||
Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
|
||||
|
|
@ -358,6 +445,13 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.JsonRPC.TxFeeCap,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "rpc.allow-unprotected-txs",
|
||||
Usage: "Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC",
|
||||
Value: &c.cliConfig.JsonRPC.AllowUnprotectedTxs,
|
||||
Default: c.cliConfig.JsonRPC.AllowUnprotectedTxs,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "ipcdisable",
|
||||
Usage: "Disable the IPC-RPC server",
|
||||
|
|
@ -372,6 +466,34 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.JsonRPC.IPCPath,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "authrpc.jwtsecret",
|
||||
Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.JWTSecret,
|
||||
Default: c.cliConfig.JsonRPC.Auth.JWTSecret,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "authrpc.addr",
|
||||
Usage: "Listening address for authenticated APIs",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.Addr,
|
||||
Default: c.cliConfig.JsonRPC.Auth.Addr,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.Uint64Flag(&flagset.Uint64Flag{
|
||||
Name: "authrpc.port",
|
||||
Usage: "Listening port for authenticated APIs",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.Port,
|
||||
Default: c.cliConfig.JsonRPC.Auth.Port,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||
Name: "authrpc.vhosts",
|
||||
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.VHosts,
|
||||
Default: c.cliConfig.JsonRPC.Auth.VHosts,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||
Name: "http.corsdomain",
|
||||
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
|
||||
|
|
@ -534,6 +656,27 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.P2P.NAT,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "netrestrict",
|
||||
Usage: "Restricts network communication to the given IP networks (CIDR masks)",
|
||||
Value: &c.cliConfig.P2P.NetRestrict,
|
||||
Default: c.cliConfig.P2P.NetRestrict,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "nodekey",
|
||||
Usage: " P2P node key file",
|
||||
Value: &c.cliConfig.P2P.NodeKey,
|
||||
Default: c.cliConfig.P2P.NodeKey,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "nodekeyhex",
|
||||
Usage: "P2P node key as hex",
|
||||
Value: &c.cliConfig.P2P.NodeKeyHex,
|
||||
Default: c.cliConfig.P2P.NodeKeyHex,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "nodiscover",
|
||||
Usage: "Disables the peer discovery mechanism (manual peer addition)",
|
||||
|
|
@ -714,5 +857,50 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.Developer.Period,
|
||||
Default: c.cliConfig.Developer.Period,
|
||||
})
|
||||
f.Uint64Flag(&flagset.Uint64Flag{
|
||||
Name: "dev.gaslimit",
|
||||
Usage: "Initial block gas limit",
|
||||
Value: &c.cliConfig.Developer.GasLimit,
|
||||
Default: c.cliConfig.Developer.GasLimit,
|
||||
})
|
||||
|
||||
// pprof
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "pprof",
|
||||
Usage: "Enable the pprof HTTP server",
|
||||
Value: &c.cliConfig.Pprof.Enabled,
|
||||
Default: c.cliConfig.Pprof.Enabled,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "pprof.port",
|
||||
Usage: "pprof HTTP server listening port",
|
||||
Value: &c.cliConfig.Pprof.Port,
|
||||
Default: c.cliConfig.Pprof.Port,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "pprof.addr",
|
||||
Usage: "pprof HTTP server listening interface",
|
||||
Value: &c.cliConfig.Pprof.Addr,
|
||||
Default: c.cliConfig.Pprof.Addr,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "pprof.memprofilerate",
|
||||
Usage: "Turn on memory profiling with the given rate",
|
||||
Value: &c.cliConfig.Pprof.MemProfileRate,
|
||||
Default: c.cliConfig.Pprof.MemProfileRate,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "pprof.blockprofilerate",
|
||||
Usage: "Turn on block profiling with the given rate",
|
||||
Value: &c.cliConfig.Pprof.BlockProfileRate,
|
||||
Default: c.cliConfig.Pprof.BlockProfileRate,
|
||||
})
|
||||
// f.StringFlag(&flagset.StringFlag{
|
||||
// Name: "pprof.cpuprofile",
|
||||
// Usage: "Write CPU profile to the given file",
|
||||
// Value: &c.cliConfig.Pprof.CPUProfile,
|
||||
// Default: c.cliConfig.Pprof.CPUProfile,
|
||||
// })
|
||||
|
||||
return f
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,13 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"runtime/trace"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// Profile generates a pprof.Profile report for the given profile name.
|
||||
|
|
@ -113,3 +116,22 @@ func sleep(ctx context.Context, d time.Duration) {
|
|||
case <-ctx.Done():
|
||||
}
|
||||
}
|
||||
|
||||
func SetMemProfileRate(rate int) {
|
||||
runtime.MemProfileRate = rate
|
||||
}
|
||||
|
||||
func SetSetBlockProfileRate(rate int) {
|
||||
runtime.SetBlockProfileRate(rate)
|
||||
}
|
||||
|
||||
func StartPProf(address string) {
|
||||
log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address))
|
||||
|
||||
go func() {
|
||||
// nolint: gosec
|
||||
if err := http.ListenAndServe(address, nil); err != nil {
|
||||
log.Error("Failure in running pprof server", "err", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.19.3
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.21.12
|
||||
// source: internal/cli/server/proto/server.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -68,7 +67,7 @@ func (x DebugPprofRequest_Type) Number() protoreflect.EnumNumber {
|
|||
|
||||
// Deprecated: Use DebugPprofRequest_Type.Descriptor instead.
|
||||
func (DebugPprofRequest_Type) EnumDescriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18, 0}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{19, 0}
|
||||
}
|
||||
|
||||
type TraceRequest struct {
|
||||
|
|
@ -857,6 +856,53 @@ func (*ChainSetHeadResponse) Descriptor() ([]byte, []int) {
|
|||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{15}
|
||||
}
|
||||
|
||||
type StatusRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Wait bool `protobuf:"varint,1,opt,name=Wait,proto3" json:"Wait,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StatusRequest) Reset() {
|
||||
*x = StatusRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[16]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StatusRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StatusRequest) ProtoMessage() {}
|
||||
|
||||
func (x *StatusRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[16]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.
|
||||
func (*StatusRequest) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16}
|
||||
}
|
||||
|
||||
func (x *StatusRequest) GetWait() bool {
|
||||
if x != nil {
|
||||
return x.Wait
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type StatusResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
|
@ -873,7 +919,7 @@ type StatusResponse struct {
|
|||
func (x *StatusResponse) Reset() {
|
||||
*x = StatusResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[16]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[17]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -886,7 +932,7 @@ func (x *StatusResponse) String() string {
|
|||
func (*StatusResponse) ProtoMessage() {}
|
||||
|
||||
func (x *StatusResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[16]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[17]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -899,7 +945,7 @@ func (x *StatusResponse) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.
|
||||
func (*StatusResponse) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17}
|
||||
}
|
||||
|
||||
func (x *StatusResponse) GetCurrentBlock() *Header {
|
||||
|
|
@ -956,7 +1002,7 @@ type Header struct {
|
|||
func (x *Header) Reset() {
|
||||
*x = Header{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[17]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[18]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -969,7 +1015,7 @@ func (x *Header) String() string {
|
|||
func (*Header) ProtoMessage() {}
|
||||
|
||||
func (x *Header) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[17]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[18]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -982,7 +1028,7 @@ func (x *Header) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use Header.ProtoReflect.Descriptor instead.
|
||||
func (*Header) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18}
|
||||
}
|
||||
|
||||
func (x *Header) GetHash() string {
|
||||
|
|
@ -1012,7 +1058,7 @@ type DebugPprofRequest struct {
|
|||
func (x *DebugPprofRequest) Reset() {
|
||||
*x = DebugPprofRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[18]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[19]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -1025,7 +1071,7 @@ func (x *DebugPprofRequest) String() string {
|
|||
func (*DebugPprofRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DebugPprofRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[18]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[19]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -1038,7 +1084,7 @@ func (x *DebugPprofRequest) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use DebugPprofRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DebugPprofRequest) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{19}
|
||||
}
|
||||
|
||||
func (x *DebugPprofRequest) GetType() DebugPprofRequest_Type {
|
||||
|
|
@ -1073,7 +1119,7 @@ type DebugBlockRequest struct {
|
|||
func (x *DebugBlockRequest) Reset() {
|
||||
*x = DebugBlockRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[19]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[20]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -1086,7 +1132,7 @@ func (x *DebugBlockRequest) String() string {
|
|||
func (*DebugBlockRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DebugBlockRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[19]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[20]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -1099,7 +1145,7 @@ func (x *DebugBlockRequest) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use DebugBlockRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DebugBlockRequest) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{19}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20}
|
||||
}
|
||||
|
||||
func (x *DebugBlockRequest) GetNumber() int64 {
|
||||
|
|
@ -1115,6 +1161,7 @@ type DebugFileResponse struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to Event:
|
||||
//
|
||||
// *DebugFileResponse_Open_
|
||||
// *DebugFileResponse_Input_
|
||||
// *DebugFileResponse_Eof
|
||||
|
|
@ -1124,7 +1171,7 @@ type DebugFileResponse struct {
|
|||
func (x *DebugFileResponse) Reset() {
|
||||
*x = DebugFileResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[20]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[21]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -1137,7 +1184,7 @@ func (x *DebugFileResponse) String() string {
|
|||
func (*DebugFileResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DebugFileResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[20]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[21]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -1150,7 +1197,7 @@ func (x *DebugFileResponse) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use DebugFileResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DebugFileResponse) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{21}
|
||||
}
|
||||
|
||||
func (m *DebugFileResponse) GetEvent() isDebugFileResponse_Event {
|
||||
|
|
@ -1216,7 +1263,7 @@ type StatusResponse_Fork struct {
|
|||
func (x *StatusResponse_Fork) Reset() {
|
||||
*x = StatusResponse_Fork{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[21]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[22]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -1229,7 +1276,7 @@ func (x *StatusResponse_Fork) String() string {
|
|||
func (*StatusResponse_Fork) ProtoMessage() {}
|
||||
|
||||
func (x *StatusResponse_Fork) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[21]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[22]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -1242,7 +1289,7 @@ func (x *StatusResponse_Fork) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use StatusResponse_Fork.ProtoReflect.Descriptor instead.
|
||||
func (*StatusResponse_Fork) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16, 0}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17, 0}
|
||||
}
|
||||
|
||||
func (x *StatusResponse_Fork) GetName() string {
|
||||
|
|
@ -1279,7 +1326,7 @@ type StatusResponse_Syncing struct {
|
|||
func (x *StatusResponse_Syncing) Reset() {
|
||||
*x = StatusResponse_Syncing{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[22]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[23]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -1292,7 +1339,7 @@ func (x *StatusResponse_Syncing) String() string {
|
|||
func (*StatusResponse_Syncing) ProtoMessage() {}
|
||||
|
||||
func (x *StatusResponse_Syncing) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[22]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[23]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -1305,7 +1352,7 @@ func (x *StatusResponse_Syncing) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use StatusResponse_Syncing.ProtoReflect.Descriptor instead.
|
||||
func (*StatusResponse_Syncing) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16, 1}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17, 1}
|
||||
}
|
||||
|
||||
func (x *StatusResponse_Syncing) GetStartingBlock() int64 {
|
||||
|
|
@ -1340,7 +1387,7 @@ type DebugFileResponse_Open struct {
|
|||
func (x *DebugFileResponse_Open) Reset() {
|
||||
*x = DebugFileResponse_Open{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[23]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[24]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -1353,7 +1400,7 @@ func (x *DebugFileResponse_Open) String() string {
|
|||
func (*DebugFileResponse_Open) ProtoMessage() {}
|
||||
|
||||
func (x *DebugFileResponse_Open) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[23]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[24]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -1366,7 +1413,7 @@ func (x *DebugFileResponse_Open) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use DebugFileResponse_Open.ProtoReflect.Descriptor instead.
|
||||
func (*DebugFileResponse_Open) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20, 0}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{21, 0}
|
||||
}
|
||||
|
||||
func (x *DebugFileResponse_Open) GetHeaders() map[string]string {
|
||||
|
|
@ -1387,7 +1434,7 @@ type DebugFileResponse_Input struct {
|
|||
func (x *DebugFileResponse_Input) Reset() {
|
||||
*x = DebugFileResponse_Input{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[24]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[25]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -1400,7 +1447,7 @@ func (x *DebugFileResponse_Input) String() string {
|
|||
func (*DebugFileResponse_Input) ProtoMessage() {}
|
||||
|
||||
func (x *DebugFileResponse_Input) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[24]
|
||||
mi := &file_internal_cli_server_proto_server_proto_msgTypes[25]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -1413,7 +1460,7 @@ func (x *DebugFileResponse_Input) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use DebugFileResponse_Input.ProtoReflect.Descriptor instead.
|
||||
func (*DebugFileResponse_Input) Descriptor() ([]byte, []int) {
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20, 1}
|
||||
return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{21, 1}
|
||||
}
|
||||
|
||||
func (x *DebugFileResponse_Input) GetData() []byte {
|
||||
|
|
@ -1484,116 +1531,118 @@ var file_internal_cli_server_proto_server_proto_rawDesc = []byte{
|
|||
0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04,
|
||||
0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x69,
|
||||
0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0xe2, 0x03, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e,
|
||||
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e,
|
||||
0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x63, 0x75,
|
||||
0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6e,
|
||||
0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e,
|
||||
0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d,
|
||||
0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d,
|
||||
0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63,
|
||||
0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x05,
|
||||
0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x1a, 0x4c,
|
||||
0x0a, 0x04, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0x77, 0x0a, 0x07,
|
||||
0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74,
|
||||
0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d,
|
||||
0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a,
|
||||
0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63,
|
||||
0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63,
|
||||
0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
|
||||
0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x34, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68,
|
||||
0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xa2, 0x01, 0x0a, 0x11,
|
||||
0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||
0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72,
|
||||
0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04,
|
||||
0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65,
|
||||
0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03,
|
||||
0x43, 0x50, 0x55, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x02,
|
||||
0x22, 0x2b, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xdd, 0x02,
|
||||
0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46,
|
||||
0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e,
|
||||
0x48, 0x00, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x36, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||
0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74,
|
||||
0x12, 0x2a, 0x0a, 0x03, 0x65, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||
0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x03, 0x65, 0x6f, 0x66, 0x1a, 0x88, 0x01, 0x0a,
|
||||
0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x44, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44,
|
||||
0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48,
|
||||
0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x1b, 0x0a, 0x05, 0x49, 0x6e, 0x70, 0x75, 0x74,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04,
|
||||
0x64, 0x61, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x32, 0xdd, 0x04,
|
||||
0x0a, 0x03, 0x42, 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64,
|
||||
0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41,
|
||||
0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76,
|
||||
0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52,
|
||||
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72,
|
||||
0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65,
|
||||
0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72,
|
||||
0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||
0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47,
|
||||
0x0a, 0x0c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1a,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48,
|
||||
0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x22, 0x23, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x12, 0x0a, 0x04, 0x57, 0x61, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x04, 0x57, 0x61, 0x69, 0x74, 0x22, 0xe2, 0x03, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72,
|
||||
0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x63,
|
||||
0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x0a, 0x0d, 0x63,
|
||||
0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65,
|
||||
0x72, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x73, 0x79, 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x73, 0x79, 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x79, 0x6e, 0x63,
|
||||
0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x43, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x18,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63,
|
||||
0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70,
|
||||
0x72, 0x6f, 0x66, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75,
|
||||
0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62,
|
||||
0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||
0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46,
|
||||
0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x1c, 0x5a,
|
||||
0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x2e, 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e,
|
||||
0x67, 0x12, 0x30, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x52, 0x05, 0x66, 0x6f,
|
||||
0x72, 0x6b, 0x73, 0x1a, 0x4c, 0x0a, 0x04, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
|
||||
0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x64, 0x1a, 0x77, 0x0a, 0x07, 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x24, 0x0a, 0x0d,
|
||||
0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73,
|
||||
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e,
|
||||
0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x75,
|
||||
0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x34, 0x0a, 0x06, 0x48, 0x65,
|
||||
0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62,
|
||||
0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72,
|
||||
0x22, 0xa2, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62,
|
||||
0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54,
|
||||
0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f,
|
||||
0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a,
|
||||
0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10,
|
||||
0x00, 0x12, 0x07, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52,
|
||||
0x41, 0x43, 0x45, 0x10, 0x02, 0x22, 0x2b, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75,
|
||||
0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62,
|
||||
0x65, 0x72, 0x22, 0xdd, 0x02, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44,
|
||||
0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x36, 0x0a,
|
||||
0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x48, 0x00, 0x52, 0x05,
|
||||
0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x2a, 0x0a, 0x03, 0x65, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x03, 0x65, 0x6f,
|
||||
0x66, 0x1a, 0x88, 0x01, 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x44, 0x0a, 0x07, 0x68, 0x65,
|
||||
0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65,
|
||||
0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73,
|
||||
0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x1b, 0x0a, 0x05,
|
||||
0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x32, 0xdb, 0x04, 0x0a, 0x03, 0x42, 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x08, 0x50, 0x65,
|
||||
0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50,
|
||||
0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73,
|
||||
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50,
|
||||
0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52,
|
||||
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a,
|
||||
0x09, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72,
|
||||
0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a,
|
||||
0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||
0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48,
|
||||
0x65, 0x61, 0x64, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69,
|
||||
0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74,
|
||||
0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x06,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63,
|
||||
0x68, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57,
|
||||
0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75,
|
||||
0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44,
|
||||
0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69,
|
||||
0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a,
|
||||
0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62,
|
||||
0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01,
|
||||
0x42, 0x1c, 0x5a, 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6c,
|
||||
0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -1609,7 +1658,7 @@ func file_internal_cli_server_proto_server_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_internal_cli_server_proto_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_internal_cli_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
|
||||
var file_internal_cli_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 27)
|
||||
var file_internal_cli_server_proto_server_proto_goTypes = []interface{}{
|
||||
(DebugPprofRequest_Type)(0), // 0: proto.DebugPprofRequest.Type
|
||||
(*TraceRequest)(nil), // 1: proto.TraceRequest
|
||||
|
|
@ -1628,50 +1677,51 @@ var file_internal_cli_server_proto_server_proto_goTypes = []interface{}{
|
|||
(*Peer)(nil), // 14: proto.Peer
|
||||
(*ChainSetHeadRequest)(nil), // 15: proto.ChainSetHeadRequest
|
||||
(*ChainSetHeadResponse)(nil), // 16: proto.ChainSetHeadResponse
|
||||
(*StatusResponse)(nil), // 17: proto.StatusResponse
|
||||
(*Header)(nil), // 18: proto.Header
|
||||
(*DebugPprofRequest)(nil), // 19: proto.DebugPprofRequest
|
||||
(*DebugBlockRequest)(nil), // 20: proto.DebugBlockRequest
|
||||
(*DebugFileResponse)(nil), // 21: proto.DebugFileResponse
|
||||
(*StatusResponse_Fork)(nil), // 22: proto.StatusResponse.Fork
|
||||
(*StatusResponse_Syncing)(nil), // 23: proto.StatusResponse.Syncing
|
||||
(*DebugFileResponse_Open)(nil), // 24: proto.DebugFileResponse.Open
|
||||
(*DebugFileResponse_Input)(nil), // 25: proto.DebugFileResponse.Input
|
||||
nil, // 26: proto.DebugFileResponse.Open.HeadersEntry
|
||||
(*emptypb.Empty)(nil), // 27: google.protobuf.Empty
|
||||
(*StatusRequest)(nil), // 17: proto.StatusRequest
|
||||
(*StatusResponse)(nil), // 18: proto.StatusResponse
|
||||
(*Header)(nil), // 19: proto.Header
|
||||
(*DebugPprofRequest)(nil), // 20: proto.DebugPprofRequest
|
||||
(*DebugBlockRequest)(nil), // 21: proto.DebugBlockRequest
|
||||
(*DebugFileResponse)(nil), // 22: proto.DebugFileResponse
|
||||
(*StatusResponse_Fork)(nil), // 23: proto.StatusResponse.Fork
|
||||
(*StatusResponse_Syncing)(nil), // 24: proto.StatusResponse.Syncing
|
||||
(*DebugFileResponse_Open)(nil), // 25: proto.DebugFileResponse.Open
|
||||
(*DebugFileResponse_Input)(nil), // 26: proto.DebugFileResponse.Input
|
||||
nil, // 27: proto.DebugFileResponse.Open.HeadersEntry
|
||||
(*emptypb.Empty)(nil), // 28: google.protobuf.Empty
|
||||
}
|
||||
var file_internal_cli_server_proto_server_proto_depIdxs = []int32{
|
||||
5, // 0: proto.ChainWatchResponse.oldchain:type_name -> proto.BlockStub
|
||||
5, // 1: proto.ChainWatchResponse.newchain:type_name -> proto.BlockStub
|
||||
14, // 2: proto.PeersListResponse.peers:type_name -> proto.Peer
|
||||
14, // 3: proto.PeersStatusResponse.peer:type_name -> proto.Peer
|
||||
18, // 4: proto.StatusResponse.currentBlock:type_name -> proto.Header
|
||||
18, // 5: proto.StatusResponse.currentHeader:type_name -> proto.Header
|
||||
23, // 6: proto.StatusResponse.syncing:type_name -> proto.StatusResponse.Syncing
|
||||
22, // 7: proto.StatusResponse.forks:type_name -> proto.StatusResponse.Fork
|
||||
19, // 4: proto.StatusResponse.currentBlock:type_name -> proto.Header
|
||||
19, // 5: proto.StatusResponse.currentHeader:type_name -> proto.Header
|
||||
24, // 6: proto.StatusResponse.syncing:type_name -> proto.StatusResponse.Syncing
|
||||
23, // 7: proto.StatusResponse.forks:type_name -> proto.StatusResponse.Fork
|
||||
0, // 8: proto.DebugPprofRequest.type:type_name -> proto.DebugPprofRequest.Type
|
||||
24, // 9: proto.DebugFileResponse.open:type_name -> proto.DebugFileResponse.Open
|
||||
25, // 10: proto.DebugFileResponse.input:type_name -> proto.DebugFileResponse.Input
|
||||
27, // 11: proto.DebugFileResponse.eof:type_name -> google.protobuf.Empty
|
||||
26, // 12: proto.DebugFileResponse.Open.headers:type_name -> proto.DebugFileResponse.Open.HeadersEntry
|
||||
25, // 9: proto.DebugFileResponse.open:type_name -> proto.DebugFileResponse.Open
|
||||
26, // 10: proto.DebugFileResponse.input:type_name -> proto.DebugFileResponse.Input
|
||||
28, // 11: proto.DebugFileResponse.eof:type_name -> google.protobuf.Empty
|
||||
27, // 12: proto.DebugFileResponse.Open.headers:type_name -> proto.DebugFileResponse.Open.HeadersEntry
|
||||
6, // 13: proto.Bor.PeersAdd:input_type -> proto.PeersAddRequest
|
||||
8, // 14: proto.Bor.PeersRemove:input_type -> proto.PeersRemoveRequest
|
||||
10, // 15: proto.Bor.PeersList:input_type -> proto.PeersListRequest
|
||||
12, // 16: proto.Bor.PeersStatus:input_type -> proto.PeersStatusRequest
|
||||
15, // 17: proto.Bor.ChainSetHead:input_type -> proto.ChainSetHeadRequest
|
||||
27, // 18: proto.Bor.Status:input_type -> google.protobuf.Empty
|
||||
17, // 18: proto.Bor.Status:input_type -> proto.StatusRequest
|
||||
3, // 19: proto.Bor.ChainWatch:input_type -> proto.ChainWatchRequest
|
||||
19, // 20: proto.Bor.DebugPprof:input_type -> proto.DebugPprofRequest
|
||||
20, // 21: proto.Bor.DebugBlock:input_type -> proto.DebugBlockRequest
|
||||
20, // 20: proto.Bor.DebugPprof:input_type -> proto.DebugPprofRequest
|
||||
21, // 21: proto.Bor.DebugBlock:input_type -> proto.DebugBlockRequest
|
||||
7, // 22: proto.Bor.PeersAdd:output_type -> proto.PeersAddResponse
|
||||
9, // 23: proto.Bor.PeersRemove:output_type -> proto.PeersRemoveResponse
|
||||
11, // 24: proto.Bor.PeersList:output_type -> proto.PeersListResponse
|
||||
13, // 25: proto.Bor.PeersStatus:output_type -> proto.PeersStatusResponse
|
||||
16, // 26: proto.Bor.ChainSetHead:output_type -> proto.ChainSetHeadResponse
|
||||
17, // 27: proto.Bor.Status:output_type -> proto.StatusResponse
|
||||
18, // 27: proto.Bor.Status:output_type -> proto.StatusResponse
|
||||
4, // 28: proto.Bor.ChainWatch:output_type -> proto.ChainWatchResponse
|
||||
21, // 29: proto.Bor.DebugPprof:output_type -> proto.DebugFileResponse
|
||||
21, // 30: proto.Bor.DebugBlock:output_type -> proto.DebugFileResponse
|
||||
22, // 29: proto.Bor.DebugPprof:output_type -> proto.DebugFileResponse
|
||||
22, // 30: proto.Bor.DebugBlock:output_type -> proto.DebugFileResponse
|
||||
22, // [22:31] is the sub-list for method output_type
|
||||
13, // [13:22] is the sub-list for method input_type
|
||||
13, // [13:13] is the sub-list for extension type_name
|
||||
|
|
@ -1878,7 +1928,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StatusResponse); i {
|
||||
switch v := v.(*StatusRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1890,7 +1940,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Header); i {
|
||||
switch v := v.(*StatusResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1902,7 +1952,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DebugPprofRequest); i {
|
||||
switch v := v.(*Header); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1914,7 +1964,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DebugBlockRequest); i {
|
||||
switch v := v.(*DebugPprofRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1926,7 +1976,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DebugFileResponse); i {
|
||||
switch v := v.(*DebugBlockRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1938,7 +1988,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StatusResponse_Fork); i {
|
||||
switch v := v.(*DebugFileResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1950,7 +2000,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StatusResponse_Syncing); i {
|
||||
switch v := v.(*StatusResponse_Fork); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1962,7 +2012,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DebugFileResponse_Open); i {
|
||||
switch v := v.(*StatusResponse_Syncing); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -1974,6 +2024,18 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DebugFileResponse_Open); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DebugFileResponse_Input); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
|
@ -1986,7 +2048,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
}
|
||||
}
|
||||
}
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[20].OneofWrappers = []interface{}{
|
||||
file_internal_cli_server_proto_server_proto_msgTypes[21].OneofWrappers = []interface{}{
|
||||
(*DebugFileResponse_Open_)(nil),
|
||||
(*DebugFileResponse_Input_)(nil),
|
||||
(*DebugFileResponse_Eof)(nil),
|
||||
|
|
@ -1997,7 +2059,7 @@ func file_internal_cli_server_proto_server_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_internal_cli_server_proto_server_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 26,
|
||||
NumMessages: 27,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ service Bor {
|
|||
|
||||
rpc ChainSetHead(ChainSetHeadRequest) returns (ChainSetHeadResponse);
|
||||
|
||||
rpc Status(google.protobuf.Empty) returns (StatusResponse);
|
||||
rpc Status(StatusRequest) returns (StatusResponse);
|
||||
|
||||
rpc ChainWatch(ChainWatchRequest) returns (stream ChainWatchResponse);
|
||||
|
||||
|
|
@ -97,6 +97,10 @@ message ChainSetHeadRequest {
|
|||
message ChainSetHeadResponse {
|
||||
}
|
||||
|
||||
message StatusRequest {
|
||||
bool Wait = 1;
|
||||
}
|
||||
|
||||
message StatusResponse {
|
||||
Header currentBlock = 1;
|
||||
Header currentHeader = 2;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.19.3
|
||||
// - protoc v3.21.12
|
||||
// source: internal/cli/server/proto/server.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
|
|
@ -29,7 +27,7 @@ type BorClient interface {
|
|||
PeersList(ctx context.Context, in *PeersListRequest, opts ...grpc.CallOption) (*PeersListResponse, error)
|
||||
PeersStatus(ctx context.Context, in *PeersStatusRequest, opts ...grpc.CallOption) (*PeersStatusResponse, error)
|
||||
ChainSetHead(ctx context.Context, in *ChainSetHeadRequest, opts ...grpc.CallOption) (*ChainSetHeadResponse, error)
|
||||
Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error)
|
||||
Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
|
||||
ChainWatch(ctx context.Context, in *ChainWatchRequest, opts ...grpc.CallOption) (Bor_ChainWatchClient, error)
|
||||
DebugPprof(ctx context.Context, in *DebugPprofRequest, opts ...grpc.CallOption) (Bor_DebugPprofClient, error)
|
||||
DebugBlock(ctx context.Context, in *DebugBlockRequest, opts ...grpc.CallOption) (Bor_DebugBlockClient, error)
|
||||
|
|
@ -88,7 +86,7 @@ func (c *borClient) ChainSetHead(ctx context.Context, in *ChainSetHeadRequest, o
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *borClient) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) {
|
||||
func (c *borClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
|
||||
out := new(StatusResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.Bor/Status", in, out, opts...)
|
||||
if err != nil {
|
||||
|
|
@ -202,7 +200,7 @@ type BorServer interface {
|
|||
PeersList(context.Context, *PeersListRequest) (*PeersListResponse, error)
|
||||
PeersStatus(context.Context, *PeersStatusRequest) (*PeersStatusResponse, error)
|
||||
ChainSetHead(context.Context, *ChainSetHeadRequest) (*ChainSetHeadResponse, error)
|
||||
Status(context.Context, *emptypb.Empty) (*StatusResponse, error)
|
||||
Status(context.Context, *StatusRequest) (*StatusResponse, error)
|
||||
ChainWatch(*ChainWatchRequest, Bor_ChainWatchServer) error
|
||||
DebugPprof(*DebugPprofRequest, Bor_DebugPprofServer) error
|
||||
DebugBlock(*DebugBlockRequest, Bor_DebugBlockServer) error
|
||||
|
|
@ -228,7 +226,7 @@ func (UnimplementedBorServer) PeersStatus(context.Context, *PeersStatusRequest)
|
|||
func (UnimplementedBorServer) ChainSetHead(context.Context, *ChainSetHeadRequest) (*ChainSetHeadResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ChainSetHead not implemented")
|
||||
}
|
||||
func (UnimplementedBorServer) Status(context.Context, *emptypb.Empty) (*StatusResponse, error) {
|
||||
func (UnimplementedBorServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Status not implemented")
|
||||
}
|
||||
func (UnimplementedBorServer) ChainWatch(*ChainWatchRequest, Bor_ChainWatchServer) error {
|
||||
|
|
@ -344,7 +342,7 @@ func _Bor_ChainSetHead_Handler(srv interface{}, ctx context.Context, dec func(in
|
|||
}
|
||||
|
||||
func _Bor_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(emptypb.Empty)
|
||||
in := new(StatusRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -356,7 +354,7 @@ func _Bor_Status_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
|||
FullMethod: "/proto.Bor/Status",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BorServer).Status(ctx, req.(*emptypb.Empty))
|
||||
return srv.(BorServer).Status(ctx, req.(*StatusRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/eth/tracers"
|
||||
"github.com/ethereum/go-ethereum/ethstats"
|
||||
"github.com/ethereum/go-ethereum/graphql"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server/pprof"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server/proto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/metrics"
|
||||
|
|
@ -56,6 +58,14 @@ type Server struct {
|
|||
|
||||
type serverOption func(srv *Server, config *Config) error
|
||||
|
||||
var glogger *log.GlogHandler
|
||||
|
||||
func init() {
|
||||
glogger = log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
|
||||
glogger.Verbosity(log.LvlInfo)
|
||||
log.Root().SetHandler(glogger)
|
||||
}
|
||||
|
||||
func WithGRPCAddress() serverOption {
|
||||
return func(srv *Server, config *Config) error {
|
||||
return srv.gRPCServerByAddress(config.GRPC.Addr)
|
||||
|
|
@ -68,14 +78,49 @@ func WithGRPCListener(lis net.Listener) serverOption {
|
|||
}
|
||||
}
|
||||
|
||||
func VerbosityIntToString(verbosity int) string {
|
||||
mapIntToString := map[int]string{
|
||||
5: "trace",
|
||||
4: "debug",
|
||||
3: "info",
|
||||
2: "warn",
|
||||
1: "error",
|
||||
0: "crit",
|
||||
}
|
||||
|
||||
return mapIntToString[verbosity]
|
||||
}
|
||||
|
||||
func VerbosityStringToInt(loglevel string) int {
|
||||
mapStringToInt := map[string]int{
|
||||
"trace": 5,
|
||||
"debug": 4,
|
||||
"info": 3,
|
||||
"warn": 2,
|
||||
"error": 1,
|
||||
"crit": 0,
|
||||
}
|
||||
|
||||
return mapStringToInt[loglevel]
|
||||
}
|
||||
|
||||
//nolint:gocognit
|
||||
func NewServer(config *Config, opts ...serverOption) (*Server, error) {
|
||||
// start pprof
|
||||
if config.Pprof.Enabled {
|
||||
pprof.SetMemProfileRate(config.Pprof.MemProfileRate)
|
||||
pprof.SetSetBlockProfileRate(config.Pprof.BlockProfileRate)
|
||||
pprof.StartPProf(fmt.Sprintf("%s:%d", config.Pprof.Addr, config.Pprof.Port))
|
||||
}
|
||||
|
||||
runtime.SetMutexProfileFraction(5)
|
||||
|
||||
srv := &Server{
|
||||
config: config,
|
||||
}
|
||||
|
||||
// start the logger
|
||||
setupLogger(config.LogLevel)
|
||||
setupLogger(VerbosityIntToString(config.Verbosity), *config.Logging)
|
||||
|
||||
var err error
|
||||
|
||||
|
|
@ -412,16 +457,22 @@ func (s *Server) loggingServerInterceptor(ctx context.Context, req interface{},
|
|||
return h, err
|
||||
}
|
||||
|
||||
func setupLogger(logLevel string) {
|
||||
func setupLogger(logLevel string, loggingInfo LoggingConfig) {
|
||||
var ostream log.Handler
|
||||
|
||||
output := io.Writer(os.Stderr)
|
||||
|
||||
usecolor := (isatty.IsTerminal(os.Stderr.Fd()) || isatty.IsCygwinTerminal(os.Stderr.Fd())) && os.Getenv("TERM") != "dumb"
|
||||
if usecolor {
|
||||
output = colorable.NewColorableStderr()
|
||||
if loggingInfo.Json {
|
||||
ostream = log.StreamHandler(output, log.JSONFormat())
|
||||
} else {
|
||||
usecolor := (isatty.IsTerminal(os.Stderr.Fd()) || isatty.IsCygwinTerminal(os.Stderr.Fd())) && os.Getenv("TERM") != "dumb"
|
||||
if usecolor {
|
||||
output = colorable.NewColorableStderr()
|
||||
}
|
||||
ostream = log.StreamHandler(output, log.TerminalFormat(usecolor))
|
||||
}
|
||||
|
||||
ostream := log.StreamHandler(output, log.TerminalFormat(usecolor))
|
||||
glogger := log.NewGlogHandler(ostream)
|
||||
glogger.SetHandler(ostream)
|
||||
|
||||
// logging
|
||||
lvl, err := log.LvlFromString(strings.ToLower(logLevel))
|
||||
|
|
@ -431,6 +482,20 @@ func setupLogger(logLevel string) {
|
|||
glogger.Verbosity(log.LvlInfo)
|
||||
}
|
||||
|
||||
if loggingInfo.Vmodule != "" {
|
||||
if err := glogger.Vmodule(loggingInfo.Vmodule); err != nil {
|
||||
log.Error("failed to set Vmodule", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
log.PrintOrigins(loggingInfo.Debug)
|
||||
|
||||
if loggingInfo.Backtrace != "" {
|
||||
if err := glogger.BacktraceAt(loggingInfo.Backtrace); err != nil {
|
||||
log.Error("failed to set BacktraceAt", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
log.Root().SetHandler(glogger)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@ package server
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
grpc_net_conn "github.com/JekaMas/go-grpc-net-conn"
|
||||
empty "google.golang.org/protobuf/types/known/emptypb"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
@ -23,6 +24,9 @@ import (
|
|||
|
||||
const chunkSize = 1024 * 1024 * 1024
|
||||
|
||||
var ErrUnavailable = errors.New("bor service is currently unavailable, try again later")
|
||||
var ErrUnavailable2 = errors.New("bor service unavailable even after waiting for 10 seconds, make sure bor is running")
|
||||
|
||||
func sendStreamDebugFile(stream proto.Bor_DebugPprofServer, headers map[string]string, data []byte) error {
|
||||
// open the stream and send the headers
|
||||
err := stream.Send(&proto.DebugFileResponse{
|
||||
|
|
@ -164,7 +168,30 @@ func (s *Server) ChainSetHead(ctx context.Context, req *proto.ChainSetHeadReques
|
|||
return &proto.ChainSetHeadResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *Server) Status(ctx context.Context, _ *empty.Empty) (*proto.StatusResponse, error) {
|
||||
func (s *Server) Status(ctx context.Context, in *proto.StatusRequest) (*proto.StatusResponse, error) {
|
||||
if s.backend == nil && !in.Wait {
|
||||
return nil, ErrUnavailable
|
||||
}
|
||||
|
||||
// check for s.backend at an interval of 2 seconds
|
||||
// wait for a maximum of 10 seconds (5 iterations)
|
||||
if s.backend == nil && in.Wait {
|
||||
i := 1
|
||||
|
||||
for {
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
if s.backend == nil {
|
||||
if i == 5 {
|
||||
return nil, ErrUnavailable2
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
apiBackend := s.backend.APIBackend
|
||||
syncProgress := apiBackend.SyncProgress()
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ func (c *PruneStateCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
dbHandles, err := server.MakeDatabaseHandles()
|
||||
dbHandles, err := server.MakeDatabaseHandles(0)
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -5,14 +5,28 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/internal/cli/flagset"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server/proto"
|
||||
|
||||
empty "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// StatusCommand is the command to output the status of the client
|
||||
type StatusCommand struct {
|
||||
*Meta2
|
||||
|
||||
wait bool
|
||||
}
|
||||
|
||||
func (c *StatusCommand) Flags() *flagset.Flagset {
|
||||
flags := c.NewFlagSet("status")
|
||||
|
||||
flags.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "w",
|
||||
Value: &c.wait,
|
||||
Usage: "wait for Bor node to be available",
|
||||
Default: false,
|
||||
})
|
||||
|
||||
return flags
|
||||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
|
|
@ -39,7 +53,7 @@ func (c *StatusCommand) Synopsis() string {
|
|||
|
||||
// Run implements the cli.Command interface
|
||||
func (c *StatusCommand) Run(args []string) int {
|
||||
flags := c.NewFlagSet("status")
|
||||
flags := c.Flags()
|
||||
if err := flags.Parse(args); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
|
|
@ -51,7 +65,7 @@ func (c *StatusCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
status, err := borClt.Status(context.Background(), &empty.Empty{})
|
||||
status, err := borClt.Status(context.Background(), &proto.StatusRequest{Wait: c.wait})
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
|
|
|
|||
42
internal/cli/status_test.go
Normal file
42
internal/cli/status_test.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package cli
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server"
|
||||
)
|
||||
|
||||
func TestStatusCommand(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Start a blockchain in developer
|
||||
config := server.DefaultConfig()
|
||||
|
||||
// enable developer mode
|
||||
config.Developer.Enabled = true
|
||||
config.Developer.Period = 2
|
||||
|
||||
// start the mock server
|
||||
srv, err := server.CreateMockServer(config)
|
||||
require.NoError(t, err)
|
||||
|
||||
defer server.CloseMockServer(srv)
|
||||
|
||||
// get the grpc port
|
||||
port := srv.GetGrpcAddr()
|
||||
|
||||
command1 := &StatusCommand{
|
||||
Meta2: &Meta2{
|
||||
UI: cli.NewMockUi(),
|
||||
addr: "127.0.0.1:" + port,
|
||||
},
|
||||
wait: true,
|
||||
}
|
||||
|
||||
status := command1.Run([]string{"-w", "--address", command1.Meta2.addr})
|
||||
|
||||
require.Equal(t, 0, status)
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ func (c *VersionCommand) Synopsis() string {
|
|||
|
||||
// Run implements the cli.Command interface
|
||||
func (c *VersionCommand) Run(args []string) int {
|
||||
c.UI.Output(params.VersionWithMeta)
|
||||
c.UI.Output(params.VersionWithMetaCommitDetails)
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -628,6 +628,10 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if block == nil {
|
||||
return nil, errors.New("block not found")
|
||||
}
|
||||
|
||||
receipts, err := s.b.GetReceipts(ctx, block.Hash())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -1520,9 +1524,12 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
|
|||
if db == nil || err != nil {
|
||||
return nil, 0, nil, err
|
||||
}
|
||||
// If the gas amount is not set, extract this as it will depend on access
|
||||
// lists and we'll need to reestimate every time
|
||||
nogas := args.Gas == nil
|
||||
|
||||
// If the gas amount is not set, default to RPC gas cap.
|
||||
if args.Gas == nil {
|
||||
tmp := hexutil.Uint64(b.RPCGasCap())
|
||||
args.Gas = &tmp
|
||||
}
|
||||
|
||||
// Ensure any missing fields are filled, extract the recipient and input data
|
||||
if err := args.setDefaults(ctx, b); err != nil {
|
||||
|
|
@ -1548,15 +1555,6 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
|
|||
accessList := prevTracer.AccessList()
|
||||
log.Trace("Creating access list", "input", accessList)
|
||||
|
||||
// If no gas amount was specified, each unique access list needs it's own
|
||||
// gas calculation. This is quite expensive, but we need to be accurate
|
||||
// and it's convered by the sender only anyway.
|
||||
if nogas {
|
||||
args.Gas = nil
|
||||
if err := args.setDefaults(ctx, b); err != nil {
|
||||
return nil, 0, nil, err // shouldn't happen, just in case
|
||||
}
|
||||
}
|
||||
// Copy the original db so we don't modify it
|
||||
statedb := db.Copy()
|
||||
// Set the accesslist to the last al
|
||||
|
|
@ -1856,7 +1854,8 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
|
|||
// Print a log with full tx details for manual investigations and interventions
|
||||
signer := types.MakeSigner(b.ChainConfig(), b.CurrentBlock().Number())
|
||||
from, err := types.Sender(signer, tx)
|
||||
if err != nil {
|
||||
|
||||
if err != nil && (!b.UnprotectedAllowed() || (b.UnprotectedAllowed() && err != types.ErrInvalidChainId)) {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
|
||||
|
|
@ -2046,6 +2045,10 @@ func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs Transact
|
|||
for _, p := range pending {
|
||||
wantSigHash := s.signer.Hash(matchTx)
|
||||
pFrom, err := types.Sender(s.signer, p)
|
||||
|
||||
if err != nil && (s.b.UnprotectedAllowed() && err == types.ErrInvalidChainId) {
|
||||
err = nil
|
||||
}
|
||||
if err == nil && pFrom == sendArgs.from() && s.signer.Hash(p) == wantSigHash {
|
||||
// Match. Re-sign and send the transaction.
|
||||
if gasPrice != nil && (*big.Int)(gasPrice).Sign() != 0 {
|
||||
|
|
|
|||
|
|
@ -148,3 +148,35 @@ func (l *logger) flush() {
|
|||
}
|
||||
l.h.buf = nil
|
||||
}
|
||||
|
||||
func (l *logger) OnTrace(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlTrace {
|
||||
fn(l.Trace)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *logger) OnDebug(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlDebug {
|
||||
fn(l.Debug)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnInfo(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlInfo {
|
||||
fn(l.Info)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnWarn(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlWarn {
|
||||
fn(l.Warn)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnError(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlError {
|
||||
fn(l.Error)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnCrit(fn func(l log.Logging)) {
|
||||
if l.GetHandler().Level() >= log.LvlCrit {
|
||||
fn(l.Crit)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,6 +192,15 @@ web3._extend({
|
|||
name: 'stopWS',
|
||||
call: 'admin_stopWS'
|
||||
}),
|
||||
new web3._extend.Method({
|
||||
name: 'getMaxPeers',
|
||||
call: 'admin_getMaxPeers'
|
||||
}),
|
||||
new web3._extend.Method({
|
||||
name: 'setMaxPeers',
|
||||
call: 'admin_setMaxPeers',
|
||||
params: 1
|
||||
}),
|
||||
],
|
||||
properties: [
|
||||
new web3._extend.Property({
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ type RecordKeyNames struct {
|
|||
Ctx string
|
||||
}
|
||||
|
||||
type Logging func(msg string, ctx ...interface{})
|
||||
|
||||
// A Logger writes key/value pairs to a Handler
|
||||
type Logger interface {
|
||||
// New returns a new Logger that has this logger's context plus the given context
|
||||
|
|
@ -124,6 +126,13 @@ type Logger interface {
|
|||
Warn(msg string, ctx ...interface{})
|
||||
Error(msg string, ctx ...interface{})
|
||||
Crit(msg string, ctx ...interface{})
|
||||
|
||||
OnTrace(func(l Logging))
|
||||
OnDebug(func(l Logging))
|
||||
OnInfo(func(l Logging))
|
||||
OnWarn(func(l Logging))
|
||||
OnError(func(l Logging))
|
||||
OnCrit(func(l Logging))
|
||||
}
|
||||
|
||||
type logger struct {
|
||||
|
|
@ -198,6 +207,38 @@ func (l *logger) SetHandler(h Handler) {
|
|||
l.h.Swap(h)
|
||||
}
|
||||
|
||||
func (l *logger) OnTrace(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlTrace {
|
||||
fn(l.Trace)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *logger) OnDebug(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlDebug {
|
||||
fn(l.Debug)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnInfo(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlInfo {
|
||||
fn(l.Info)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnWarn(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlWarn {
|
||||
fn(l.Warn)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnError(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlError {
|
||||
fn(l.Error)
|
||||
}
|
||||
}
|
||||
func (l *logger) OnCrit(fn func(l Logging)) {
|
||||
if l.GetHandler().Level() >= LvlCrit {
|
||||
fn(l.Crit)
|
||||
}
|
||||
}
|
||||
|
||||
func normalize(ctx []interface{}) []interface{} {
|
||||
// if the caller passed a Ctx object, then expand it
|
||||
if len(ctx) == 1 {
|
||||
|
|
|
|||
32
log/root.go
32
log/root.go
|
|
@ -60,6 +60,38 @@ func Crit(msg string, ctx ...interface{}) {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
func OnTrace(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlTrace {
|
||||
fn(root.Trace)
|
||||
}
|
||||
}
|
||||
|
||||
func OnDebug(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlDebug {
|
||||
fn(root.Debug)
|
||||
}
|
||||
}
|
||||
func OnInfo(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlInfo {
|
||||
fn(root.Info)
|
||||
}
|
||||
}
|
||||
func OnWarn(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlWarn {
|
||||
fn(root.Warn)
|
||||
}
|
||||
}
|
||||
func OnError(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlError {
|
||||
fn(root.Error)
|
||||
}
|
||||
}
|
||||
func OnCrit(fn func(l Logging)) {
|
||||
if root.GetHandler().Level() >= LvlCrit {
|
||||
fn(root.Crit)
|
||||
}
|
||||
}
|
||||
|
||||
// Output is a convenient alias for write, allowing for the modification of
|
||||
// the calldepth (number of stack frames to skip).
|
||||
// calldepth influences the reported line number of the log message.
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ func NewFakeBor(t TensingObject, chainDB ethdb.Database, chainConfig *params.Cha
|
|||
chainConfig.Bor = params.BorUnittestChainConfig.Bor
|
||||
}
|
||||
|
||||
return bor.New(chainConfig, chainDB, ethAPIMock, spanner, heimdallClientMock, contractMock)
|
||||
return bor.New(chainConfig, chainDB, ethAPIMock, spanner, heimdallClientMock, contractMock, false)
|
||||
}
|
||||
|
||||
type mockBackend struct {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,19 @@
|
|||
package miner
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
cmath "github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/common/tracing"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor"
|
||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||
|
|
@ -18,7 +25,12 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -169,14 +181,612 @@ func (b *testWorkerBackend) newRandomTx(creation bool) *types.Transaction {
|
|||
return tx
|
||||
}
|
||||
|
||||
func NewTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, blocks int) (*worker, *testWorkerBackend, func()) {
|
||||
func NewTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, blocks int, noempty uint32, delay uint) (*worker, *testWorkerBackend, func()) {
|
||||
backend := newTestWorkerBackend(t, chainConfig, engine, db, blocks)
|
||||
backend.txPool.AddLocals(pendingTxs)
|
||||
|
||||
//nolint:staticcheck
|
||||
w := newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false)
|
||||
var w *worker
|
||||
|
||||
if delay != 0 {
|
||||
//nolint:staticcheck
|
||||
w = newWorkerWithDelay(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false, delay)
|
||||
} else {
|
||||
//nolint:staticcheck
|
||||
w = newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false)
|
||||
}
|
||||
|
||||
w.setEtherbase(TestBankAddress)
|
||||
|
||||
// enable empty blocks
|
||||
w.noempty = noempty
|
||||
|
||||
return w, backend, w.close
|
||||
}
|
||||
|
||||
//nolint:staticcheck
|
||||
func newWorkerWithDelay(config *Config, chainConfig *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, isLocalBlock func(header *types.Header) bool, init bool, delay uint) *worker {
|
||||
worker := &worker{
|
||||
config: config,
|
||||
chainConfig: chainConfig,
|
||||
engine: engine,
|
||||
eth: eth,
|
||||
mux: mux,
|
||||
chain: eth.BlockChain(),
|
||||
isLocalBlock: isLocalBlock,
|
||||
localUncles: make(map[common.Hash]*types.Block),
|
||||
remoteUncles: make(map[common.Hash]*types.Block),
|
||||
unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), sealingLogAtDepth),
|
||||
pendingTasks: make(map[common.Hash]*task),
|
||||
txsCh: make(chan core.NewTxsEvent, txChanSize),
|
||||
chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize),
|
||||
chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize),
|
||||
newWorkCh: make(chan *newWorkReq),
|
||||
getWorkCh: make(chan *getWorkReq),
|
||||
taskCh: make(chan *task),
|
||||
resultCh: make(chan *types.Block, resultQueueSize),
|
||||
exitCh: make(chan struct{}),
|
||||
startCh: make(chan struct{}, 1),
|
||||
resubmitIntervalCh: make(chan time.Duration),
|
||||
resubmitAdjustCh: make(chan *intervalAdjust, resubmitAdjustChanSize),
|
||||
noempty: 1,
|
||||
}
|
||||
worker.profileCount = new(int32)
|
||||
// Subscribe NewTxsEvent for tx pool
|
||||
worker.txsSub = eth.TxPool().SubscribeNewTxsEvent(worker.txsCh)
|
||||
// Subscribe events for blockchain
|
||||
worker.chainHeadSub = eth.BlockChain().SubscribeChainHeadEvent(worker.chainHeadCh)
|
||||
worker.chainSideSub = eth.BlockChain().SubscribeChainSideEvent(worker.chainSideCh)
|
||||
|
||||
// Sanitize recommit interval if the user-specified one is too short.
|
||||
recommit := worker.config.Recommit
|
||||
if recommit < minRecommitInterval {
|
||||
log.Warn("Sanitizing miner recommit interval", "provided", recommit, "updated", minRecommitInterval)
|
||||
recommit = minRecommitInterval
|
||||
}
|
||||
|
||||
ctx := tracing.WithTracer(context.Background(), otel.GetTracerProvider().Tracer("MinerWorker"))
|
||||
|
||||
worker.wg.Add(4)
|
||||
|
||||
go worker.mainLoopWithDelay(ctx, delay)
|
||||
go worker.newWorkLoop(ctx, recommit)
|
||||
go worker.resultLoop()
|
||||
go worker.taskLoop()
|
||||
|
||||
// Submit first work to initialize pending state.
|
||||
if init {
|
||||
worker.startCh <- struct{}{}
|
||||
}
|
||||
|
||||
return worker
|
||||
}
|
||||
|
||||
// nolint:gocognit
|
||||
func (w *worker) mainLoopWithDelay(ctx context.Context, delay uint) {
|
||||
defer w.wg.Done()
|
||||
defer w.txsSub.Unsubscribe()
|
||||
defer w.chainHeadSub.Unsubscribe()
|
||||
defer w.chainSideSub.Unsubscribe()
|
||||
defer func() {
|
||||
if w.current != nil {
|
||||
w.current.discard()
|
||||
}
|
||||
}()
|
||||
|
||||
cleanTicker := time.NewTicker(time.Second * 10)
|
||||
defer cleanTicker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case req := <-w.newWorkCh:
|
||||
//nolint:contextcheck
|
||||
w.commitWorkWithDelay(req.ctx, req.interrupt, req.noempty, req.timestamp, delay)
|
||||
|
||||
case req := <-w.getWorkCh:
|
||||
//nolint:contextcheck
|
||||
block, err := w.generateWork(req.ctx, req.params)
|
||||
if err != nil {
|
||||
req.err = err
|
||||
req.result <- nil
|
||||
} else {
|
||||
req.result <- block
|
||||
}
|
||||
|
||||
case ev := <-w.chainSideCh:
|
||||
// Short circuit for duplicate side blocks
|
||||
if _, exist := w.localUncles[ev.Block.Hash()]; exist {
|
||||
continue
|
||||
}
|
||||
|
||||
if _, exist := w.remoteUncles[ev.Block.Hash()]; exist {
|
||||
continue
|
||||
}
|
||||
|
||||
// Add side block to possible uncle block set depending on the author.
|
||||
if w.isLocalBlock != nil && w.isLocalBlock(ev.Block.Header()) {
|
||||
w.localUncles[ev.Block.Hash()] = ev.Block
|
||||
} else {
|
||||
w.remoteUncles[ev.Block.Hash()] = ev.Block
|
||||
}
|
||||
|
||||
// If our sealing block contains less than 2 uncle blocks,
|
||||
// add the new uncle block if valid and regenerate a new
|
||||
// sealing block for higher profit.
|
||||
if w.isRunning() && w.current != nil && len(w.current.uncles) < 2 {
|
||||
start := time.Now()
|
||||
if err := w.commitUncle(w.current, ev.Block.Header()); err == nil {
|
||||
commitErr := w.commit(ctx, w.current.copy(), nil, true, start)
|
||||
if commitErr != nil {
|
||||
log.Error("error while committing work for mining", "err", commitErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case <-cleanTicker.C:
|
||||
chainHead := w.chain.CurrentBlock()
|
||||
for hash, uncle := range w.localUncles {
|
||||
if uncle.NumberU64()+staleThreshold <= chainHead.NumberU64() {
|
||||
delete(w.localUncles, hash)
|
||||
}
|
||||
}
|
||||
|
||||
for hash, uncle := range w.remoteUncles {
|
||||
if uncle.NumberU64()+staleThreshold <= chainHead.NumberU64() {
|
||||
delete(w.remoteUncles, hash)
|
||||
}
|
||||
}
|
||||
|
||||
case ev := <-w.txsCh:
|
||||
// Apply transactions to the pending state if we're not sealing
|
||||
//
|
||||
// Note all transactions received may not be continuous with transactions
|
||||
// already included in the current sealing block. These transactions will
|
||||
// be automatically eliminated.
|
||||
if !w.isRunning() && w.current != nil {
|
||||
// If block is already full, abort
|
||||
if gp := w.current.gasPool; gp != nil && gp.Gas() < params.TxGas {
|
||||
continue
|
||||
}
|
||||
|
||||
txs := make(map[common.Address]types.Transactions)
|
||||
|
||||
for _, tx := range ev.Txs {
|
||||
acc, _ := types.Sender(w.current.signer, tx)
|
||||
txs[acc] = append(txs[acc], tx)
|
||||
}
|
||||
|
||||
txset := types.NewTransactionsByPriceAndNonce(w.current.signer, txs, cmath.FromBig(w.current.header.BaseFee))
|
||||
tcount := w.current.tcount
|
||||
|
||||
interruptCh, stopFn := getInterruptTimer(ctx, w.current, w.chain.CurrentBlock())
|
||||
w.commitTransactionsWithDelay(w.current, txset, nil, interruptCh, delay)
|
||||
|
||||
// Only update the snapshot if any new transactions were added
|
||||
// to the pending block
|
||||
if tcount != w.current.tcount {
|
||||
w.updateSnapshot(w.current)
|
||||
}
|
||||
|
||||
stopFn()
|
||||
} else {
|
||||
// Special case, if the consensus engine is 0 period clique(dev mode),
|
||||
// submit sealing work here since all empty submission will be rejected
|
||||
// by clique. Of course the advance sealing(empty submission) is disabled.
|
||||
if w.chainConfig.Clique != nil && w.chainConfig.Clique.Period == 0 {
|
||||
w.commitWork(ctx, nil, true, time.Now().Unix())
|
||||
}
|
||||
}
|
||||
|
||||
atomic.AddInt32(&w.newTxs, int32(len(ev.Txs)))
|
||||
|
||||
// System stopped
|
||||
case <-w.exitCh:
|
||||
return
|
||||
case <-w.txsSub.Err():
|
||||
return
|
||||
case <-w.chainHeadSub.Err():
|
||||
return
|
||||
case <-w.chainSideSub.Err():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nolint:gocognit
|
||||
func (w *worker) commitTransactionsWithDelay(env *environment, txs *types.TransactionsByPriceAndNonce, interrupt *int32, interruptCh chan struct{}, delay uint) bool {
|
||||
gasLimit := env.header.GasLimit
|
||||
if env.gasPool == nil {
|
||||
env.gasPool = new(core.GasPool).AddGas(gasLimit)
|
||||
}
|
||||
|
||||
var coalescedLogs []*types.Log
|
||||
|
||||
initialGasLimit := env.gasPool.Gas()
|
||||
initialTxs := txs.GetTxs()
|
||||
|
||||
var breakCause string
|
||||
|
||||
defer func() {
|
||||
log.OnDebug(func(lg log.Logging) {
|
||||
lg("commitTransactions-stats",
|
||||
"initialTxsCount", initialTxs,
|
||||
"initialGasLimit", initialGasLimit,
|
||||
"resultTxsCount", txs.GetTxs(),
|
||||
"resultGapPool", env.gasPool.Gas(),
|
||||
"exitCause", breakCause)
|
||||
})
|
||||
}()
|
||||
|
||||
mainloop:
|
||||
for {
|
||||
// case of interrupting by timeout
|
||||
select {
|
||||
case <-interruptCh:
|
||||
commitInterruptCounter.Inc(1)
|
||||
break mainloop
|
||||
default:
|
||||
}
|
||||
// In the following three cases, we will interrupt the execution of the transaction.
|
||||
// (1) new head block event arrival, the interrupt signal is 1
|
||||
// (2) worker start or restart, the interrupt signal is 1
|
||||
// (3) worker recreate the sealing block with any newly arrived transactions, the interrupt signal is 2.
|
||||
// For the first two cases, the semi-finished work will be discarded.
|
||||
// For the third case, the semi-finished work will be submitted to the consensus engine.
|
||||
if interrupt != nil && atomic.LoadInt32(interrupt) != commitInterruptNone {
|
||||
// Notify resubmit loop to increase resubmitting interval due to too frequent commits.
|
||||
if atomic.LoadInt32(interrupt) == commitInterruptResubmit {
|
||||
ratio := float64(gasLimit-env.gasPool.Gas()) / float64(gasLimit)
|
||||
if ratio < 0.1 {
|
||||
// nolint:goconst
|
||||
ratio = 0.1
|
||||
}
|
||||
w.resubmitAdjustCh <- &intervalAdjust{
|
||||
ratio: ratio,
|
||||
inc: true,
|
||||
}
|
||||
}
|
||||
// nolint:goconst
|
||||
breakCause = "interrupt"
|
||||
return atomic.LoadInt32(interrupt) == commitInterruptNewHead
|
||||
}
|
||||
// If we don't have enough gas for any further transactions then we're done
|
||||
if env.gasPool.Gas() < params.TxGas {
|
||||
log.Trace("Not enough gas for further transactions", "have", env.gasPool, "want", params.TxGas)
|
||||
// nolint:goconst
|
||||
breakCause = "Not enough gas for further transactions"
|
||||
break
|
||||
}
|
||||
// Retrieve the next transaction and abort if all done
|
||||
tx := txs.Peek()
|
||||
if tx == nil {
|
||||
// nolint:goconst
|
||||
breakCause = "all transactions has been included"
|
||||
break
|
||||
}
|
||||
// Error may be ignored here. The error has already been checked
|
||||
// during transaction acceptance is the transaction pool.
|
||||
//
|
||||
// We use the eip155 signer regardless of the current hf.
|
||||
from, _ := types.Sender(env.signer, tx)
|
||||
// Check whether the tx is replay protected. If we're not in the EIP155 hf
|
||||
// phase, start ignoring the sender until we do.
|
||||
if tx.Protected() && !w.chainConfig.IsEIP155(env.header.Number) {
|
||||
log.Trace("Ignoring reply protected transaction", "hash", tx.Hash(), "eip155", w.chainConfig.EIP155Block)
|
||||
|
||||
txs.Pop()
|
||||
continue
|
||||
}
|
||||
// Start executing the transaction
|
||||
env.state.Prepare(tx.Hash(), env.tcount)
|
||||
|
||||
var start time.Time
|
||||
|
||||
log.OnDebug(func(log.Logging) {
|
||||
start = time.Now()
|
||||
})
|
||||
|
||||
logs, err := w.commitTransaction(env, tx)
|
||||
time.Sleep(time.Duration(delay) * time.Millisecond)
|
||||
|
||||
switch {
|
||||
case errors.Is(err, core.ErrGasLimitReached):
|
||||
// Pop the current out-of-gas transaction without shifting in the next from the account
|
||||
log.Trace("Gas limit exceeded for current block", "sender", from)
|
||||
txs.Pop()
|
||||
|
||||
case errors.Is(err, core.ErrNonceTooLow):
|
||||
// New head notification data race between the transaction pool and miner, shift
|
||||
log.Trace("Skipping transaction with low nonce", "sender", from, "nonce", tx.Nonce())
|
||||
txs.Shift()
|
||||
|
||||
case errors.Is(err, core.ErrNonceTooHigh):
|
||||
// Reorg notification data race between the transaction pool and miner, skip account =
|
||||
log.Trace("Skipping account with hight nonce", "sender", from, "nonce", tx.Nonce())
|
||||
txs.Pop()
|
||||
|
||||
case errors.Is(err, nil):
|
||||
// Everything ok, collect the logs and shift in the next transaction from the same account
|
||||
coalescedLogs = append(coalescedLogs, logs...)
|
||||
env.tcount++
|
||||
txs.Shift()
|
||||
|
||||
log.OnDebug(func(lg log.Logging) {
|
||||
lg("Committed new tx", "tx hash", tx.Hash(), "from", from, "to", tx.To(), "nonce", tx.Nonce(), "gas", tx.Gas(), "gasPrice", tx.GasPrice(), "value", tx.Value(), "time spent", time.Since(start))
|
||||
})
|
||||
|
||||
case errors.Is(err, core.ErrTxTypeNotSupported):
|
||||
// Pop the unsupported transaction without shifting in the next from the account
|
||||
log.Trace("Skipping unsupported transaction type", "sender", from, "type", tx.Type())
|
||||
txs.Pop()
|
||||
|
||||
default:
|
||||
// Strange error, discard the transaction and get the next in line (note, the
|
||||
// nonce-too-high clause will prevent us from executing in vain).
|
||||
log.Debug("Transaction failed, account skipped", "hash", tx.Hash(), "err", err)
|
||||
txs.Shift()
|
||||
}
|
||||
}
|
||||
|
||||
if !w.isRunning() && len(coalescedLogs) > 0 {
|
||||
// We don't push the pendingLogsEvent while we are sealing. The reason is that
|
||||
// when we are sealing, the worker will regenerate a sealing block every 3 seconds.
|
||||
// In order to avoid pushing the repeated pendingLog, we disable the pending log pushing.
|
||||
// make a copy, the state caches the logs and these logs get "upgraded" from pending to mined
|
||||
// logs by filling in the block hash when the block was mined by the local miner. This can
|
||||
// cause a race condition if a log was "upgraded" before the PendingLogsEvent is processed.
|
||||
cpy := make([]*types.Log, len(coalescedLogs))
|
||||
for i, l := range coalescedLogs {
|
||||
cpy[i] = new(types.Log)
|
||||
*cpy[i] = *l
|
||||
}
|
||||
|
||||
w.pendingLogsFeed.Send(cpy)
|
||||
}
|
||||
// Notify resubmit loop to decrease resubmitting interval if current interval is larger
|
||||
// than the user-specified one.
|
||||
if interrupt != nil {
|
||||
w.resubmitAdjustCh <- &intervalAdjust{inc: false}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (w *worker) commitWorkWithDelay(ctx context.Context, interrupt *int32, noempty bool, timestamp int64, delay uint) {
|
||||
start := time.Now()
|
||||
|
||||
var (
|
||||
work *environment
|
||||
err error
|
||||
)
|
||||
|
||||
tracing.Exec(ctx, "", "worker.prepareWork", func(ctx context.Context, span trace.Span) {
|
||||
// Set the coinbase if the worker is running or it's required
|
||||
var coinbase common.Address
|
||||
if w.isRunning() {
|
||||
if w.coinbase == (common.Address{}) {
|
||||
log.Error("Refusing to mine without etherbase")
|
||||
return
|
||||
}
|
||||
|
||||
coinbase = w.coinbase // Use the preset address as the fee recipient
|
||||
}
|
||||
|
||||
work, err = w.prepareWork(&generateParams{
|
||||
timestamp: uint64(timestamp),
|
||||
coinbase: coinbase,
|
||||
})
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var interruptCh chan struct{}
|
||||
|
||||
stopFn := func() {}
|
||||
defer func() {
|
||||
stopFn()
|
||||
}()
|
||||
|
||||
if !noempty {
|
||||
interruptCh, stopFn = getInterruptTimer(ctx, work, w.chain.CurrentBlock())
|
||||
}
|
||||
|
||||
ctx, span := tracing.StartSpan(ctx, "commitWork")
|
||||
defer tracing.EndSpan(span)
|
||||
|
||||
tracing.SetAttributes(
|
||||
span,
|
||||
attribute.Int("number", int(work.header.Number.Uint64())),
|
||||
)
|
||||
|
||||
// Create an empty block based on temporary copied state for
|
||||
// sealing in advance without waiting block execution finished.
|
||||
if !noempty && atomic.LoadUint32(&w.noempty) == 0 {
|
||||
err = w.commit(ctx, work.copy(), nil, false, start)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Fill pending transactions from the txpool
|
||||
w.fillTransactionsWithDelay(ctx, interrupt, work, interruptCh, delay)
|
||||
|
||||
err = w.commit(ctx, work.copy(), w.fullTaskHook, true, start)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Swap out the old work with the new one, terminating any leftover
|
||||
// prefetcher processes in the mean time and starting a new one.
|
||||
if w.current != nil {
|
||||
w.current.discard()
|
||||
}
|
||||
|
||||
w.current = work
|
||||
}
|
||||
|
||||
// nolint:gocognit
|
||||
func (w *worker) fillTransactionsWithDelay(ctx context.Context, interrupt *int32, env *environment, interruptCh chan struct{}, delay uint) {
|
||||
ctx, span := tracing.StartSpan(ctx, "fillTransactions")
|
||||
defer tracing.EndSpan(span)
|
||||
|
||||
// Split the pending transactions into locals and remotes
|
||||
// Fill the block with all available pending transactions.
|
||||
|
||||
var (
|
||||
localTxsCount int
|
||||
remoteTxsCount int
|
||||
localTxs = make(map[common.Address]types.Transactions)
|
||||
remoteTxs map[common.Address]types.Transactions
|
||||
)
|
||||
|
||||
// TODO: move to config or RPC
|
||||
const profiling = false
|
||||
|
||||
if profiling {
|
||||
doneCh := make(chan struct{})
|
||||
|
||||
defer func() {
|
||||
close(doneCh)
|
||||
}()
|
||||
|
||||
go func(number uint64) {
|
||||
closeFn := func() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-time.After(150 * time.Millisecond):
|
||||
// Check if we've not crossed limit
|
||||
if attempt := atomic.AddInt32(w.profileCount, 1); attempt >= 10 {
|
||||
log.Info("Completed profiling", "attempt", attempt)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("Starting profiling in fill transactions", "number", number)
|
||||
|
||||
dir, err := os.MkdirTemp("", fmt.Sprintf("bor-traces-%s-", time.Now().UTC().Format("2006-01-02-150405Z")))
|
||||
if err != nil {
|
||||
log.Error("Error in profiling", "path", dir, "number", number, "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
// grab the cpu profile
|
||||
closeFnInternal, err := startProfiler("cpu", dir, number)
|
||||
if err != nil {
|
||||
log.Error("Error in profiling", "path", dir, "number", number, "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
closeFn = func() error {
|
||||
err := closeFnInternal()
|
||||
|
||||
log.Info("Completed profiling", "path", dir, "number", number, "error", err)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
case <-doneCh:
|
||||
err := closeFn()
|
||||
|
||||
if err != nil {
|
||||
log.Info("closing fillTransactions", "number", number, "error", err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
}(env.header.Number.Uint64())
|
||||
}
|
||||
|
||||
tracing.Exec(ctx, "", "worker.SplittingTransactions", func(ctx context.Context, span trace.Span) {
|
||||
|
||||
prePendingTime := time.Now()
|
||||
|
||||
pending := w.eth.TxPool().Pending(ctx, true)
|
||||
remoteTxs = pending
|
||||
|
||||
postPendingTime := time.Now()
|
||||
|
||||
for _, account := range w.eth.TxPool().Locals() {
|
||||
if txs := remoteTxs[account]; len(txs) > 0 {
|
||||
delete(remoteTxs, account)
|
||||
localTxs[account] = txs
|
||||
}
|
||||
}
|
||||
|
||||
postLocalsTime := time.Now()
|
||||
|
||||
localTxsCount = len(localTxs)
|
||||
remoteTxsCount = len(remoteTxs)
|
||||
|
||||
tracing.SetAttributes(
|
||||
span,
|
||||
attribute.Int("len of local txs", localTxsCount),
|
||||
attribute.Int("len of remote txs", remoteTxsCount),
|
||||
attribute.String("time taken by Pending()", fmt.Sprintf("%v", postPendingTime.Sub(prePendingTime))),
|
||||
attribute.String("time taken by Locals()", fmt.Sprintf("%v", postLocalsTime.Sub(postPendingTime))),
|
||||
)
|
||||
})
|
||||
|
||||
var (
|
||||
localEnvTCount int
|
||||
remoteEnvTCount int
|
||||
committed bool
|
||||
)
|
||||
|
||||
if localTxsCount > 0 {
|
||||
var txs *types.TransactionsByPriceAndNonce
|
||||
|
||||
tracing.Exec(ctx, "", "worker.LocalTransactionsByPriceAndNonce", func(ctx context.Context, span trace.Span) {
|
||||
txs = types.NewTransactionsByPriceAndNonce(env.signer, localTxs, cmath.FromBig(env.header.BaseFee))
|
||||
|
||||
tracing.SetAttributes(
|
||||
span,
|
||||
attribute.Int("len of tx local Heads", txs.GetTxs()),
|
||||
)
|
||||
})
|
||||
|
||||
tracing.Exec(ctx, "", "worker.LocalCommitTransactions", func(ctx context.Context, span trace.Span) {
|
||||
committed = w.commitTransactionsWithDelay(env, txs, interrupt, interruptCh, delay)
|
||||
})
|
||||
|
||||
if committed {
|
||||
return
|
||||
}
|
||||
|
||||
localEnvTCount = env.tcount
|
||||
}
|
||||
|
||||
if remoteTxsCount > 0 {
|
||||
var txs *types.TransactionsByPriceAndNonce
|
||||
|
||||
tracing.Exec(ctx, "", "worker.RemoteTransactionsByPriceAndNonce", func(ctx context.Context, span trace.Span) {
|
||||
txs = types.NewTransactionsByPriceAndNonce(env.signer, remoteTxs, cmath.FromBig(env.header.BaseFee))
|
||||
|
||||
tracing.SetAttributes(
|
||||
span,
|
||||
attribute.Int("len of tx remote Heads", txs.GetTxs()),
|
||||
)
|
||||
})
|
||||
|
||||
tracing.Exec(ctx, "", "worker.RemoteCommitTransactions", func(ctx context.Context, span trace.Span) {
|
||||
committed = w.commitTransactionsWithDelay(env, txs, interrupt, interruptCh, delay)
|
||||
})
|
||||
|
||||
if committed {
|
||||
return
|
||||
}
|
||||
|
||||
remoteEnvTCount = env.tcount
|
||||
}
|
||||
|
||||
tracing.SetAttributes(
|
||||
span,
|
||||
attribute.Int("len of final local txs ", localEnvTCount),
|
||||
attribute.Int("len of final remote txs", remoteEnvTCount),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
107
miner/worker.go
107
miner/worker.go
|
|
@ -39,6 +39,7 @@ import (
|
|||
cmath "github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/common/tracing"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
|
|
@ -94,6 +95,7 @@ const (
|
|||
var (
|
||||
sealedBlocksCounter = metrics.NewRegisteredCounter("worker/sealedBlocks", nil)
|
||||
sealedEmptyBlocksCounter = metrics.NewRegisteredCounter("worker/sealedEmptyBlocks", nil)
|
||||
commitInterruptCounter = metrics.NewRegisteredCounter("worker/commitInterrupt", nil)
|
||||
)
|
||||
|
||||
// environment is the worker's current environment and holds all
|
||||
|
|
@ -299,6 +301,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
|
|||
startCh: make(chan struct{}, 1),
|
||||
resubmitIntervalCh: make(chan time.Duration),
|
||||
resubmitAdjustCh: make(chan *intervalAdjust, resubmitAdjustChanSize),
|
||||
noempty: 1,
|
||||
}
|
||||
worker.profileCount = new(int32)
|
||||
// Subscribe NewTxsEvent for tx pool
|
||||
|
|
@ -651,13 +654,16 @@ func (w *worker) mainLoop(ctx context.Context) {
|
|||
txset := types.NewTransactionsByPriceAndNonce(w.current.signer, txs, cmath.FromBig(w.current.header.BaseFee))
|
||||
tcount := w.current.tcount
|
||||
|
||||
w.commitTransactions(w.current, txset, nil)
|
||||
interruptCh, stopFn := getInterruptTimer(ctx, w.current, w.chain.CurrentBlock())
|
||||
w.commitTransactions(w.current, txset, nil, interruptCh)
|
||||
|
||||
// Only update the snapshot if any new transactions were added
|
||||
// to the pending block
|
||||
if tcount != w.current.tcount {
|
||||
w.updateSnapshot(w.current)
|
||||
}
|
||||
|
||||
stopFn()
|
||||
} else {
|
||||
// Special case, if the consensus engine is 0 period clique(dev mode),
|
||||
// submit sealing work here since all empty submission will be rejected
|
||||
|
|
@ -939,7 +945,8 @@ func (w *worker) commitTransaction(env *environment, tx *types.Transaction) ([]*
|
|||
return receipt.Logs, nil
|
||||
}
|
||||
|
||||
func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByPriceAndNonce, interrupt *int32) bool {
|
||||
//nolint:gocognit
|
||||
func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByPriceAndNonce, interrupt *int32, interruptCh chan struct{}) bool {
|
||||
gasLimit := env.header.GasLimit
|
||||
if env.gasPool == nil {
|
||||
env.gasPool = new(core.GasPool).AddGas(gasLimit)
|
||||
|
|
@ -952,15 +959,26 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
|
|||
var breakCause string
|
||||
|
||||
defer func() {
|
||||
log.Warn("commitTransactions-stats",
|
||||
"initialTxsCount", initialTxs,
|
||||
"initialGasLimit", initialGasLimit,
|
||||
"resultTxsCount", txs.GetTxs(),
|
||||
"resultGapPool", env.gasPool.Gas(),
|
||||
"exitCause", breakCause)
|
||||
log.OnDebug(func(lg log.Logging) {
|
||||
lg("commitTransactions-stats",
|
||||
"initialTxsCount", initialTxs,
|
||||
"initialGasLimit", initialGasLimit,
|
||||
"resultTxsCount", txs.GetTxs(),
|
||||
"resultGapPool", env.gasPool.Gas(),
|
||||
"exitCause", breakCause)
|
||||
})
|
||||
}()
|
||||
|
||||
mainloop:
|
||||
for {
|
||||
// case of interrupting by timeout
|
||||
select {
|
||||
case <-interruptCh:
|
||||
commitInterruptCounter.Inc(1)
|
||||
break mainloop
|
||||
default:
|
||||
}
|
||||
|
||||
// In the following three cases, we will interrupt the execution of the transaction.
|
||||
// (1) new head block event arrival, the interrupt signal is 1
|
||||
// (2) worker start or restart, the interrupt signal is 1
|
||||
|
|
@ -1012,7 +1030,11 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
|
|||
// Start executing the transaction
|
||||
env.state.Prepare(tx.Hash(), env.tcount)
|
||||
|
||||
start := time.Now()
|
||||
var start time.Time
|
||||
|
||||
log.OnDebug(func(log.Logging) {
|
||||
start = time.Now()
|
||||
})
|
||||
|
||||
logs, err := w.commitTransaction(env, tx)
|
||||
|
||||
|
|
@ -1037,7 +1059,10 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
|
|||
coalescedLogs = append(coalescedLogs, logs...)
|
||||
env.tcount++
|
||||
txs.Shift()
|
||||
log.Info("Committed new tx", "tx hash", tx.Hash(), "from", from, "to", tx.To(), "nonce", tx.Nonce(), "gas", tx.Gas(), "gasPrice", tx.GasPrice(), "value", tx.Value(), "time spent", time.Since(start))
|
||||
|
||||
log.OnDebug(func(lg log.Logging) {
|
||||
lg("Committed new tx", "tx hash", tx.Hash(), "from", from, "to", tx.To(), "nonce", tx.Nonce(), "gas", tx.Gas(), "gasPrice", tx.GasPrice(), "value", tx.Value(), "time spent", time.Since(start))
|
||||
})
|
||||
|
||||
case errors.Is(err, core.ErrTxTypeNotSupported):
|
||||
// Pop the unsupported transaction without shifting in the next from the account
|
||||
|
|
@ -1136,7 +1161,12 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
|
|||
}
|
||||
// Run the consensus preparation with the default or customized consensus engine.
|
||||
if err := w.engine.Prepare(w.chain, header); err != nil {
|
||||
log.Error("Failed to prepare header for sealing", "err", err)
|
||||
switch err.(type) {
|
||||
case *bor.UnauthorizedSignerError:
|
||||
log.Debug("Failed to prepare header for sealing", "err", err)
|
||||
default:
|
||||
log.Error("Failed to prepare header for sealing", "err", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
// Could potentially happen if starting to mine in an odd state.
|
||||
|
|
@ -1237,7 +1267,7 @@ func startProfiler(profile string, filepath string, number uint64) (func() error
|
|||
// be customized with the plugin in the future.
|
||||
//
|
||||
//nolint:gocognit
|
||||
func (w *worker) fillTransactions(ctx context.Context, interrupt *int32, env *environment) {
|
||||
func (w *worker) fillTransactions(ctx context.Context, interrupt *int32, env *environment, interruptCh chan struct{}) {
|
||||
ctx, span := tracing.StartSpan(ctx, "fillTransactions")
|
||||
defer tracing.EndSpan(span)
|
||||
|
||||
|
|
@ -1361,7 +1391,7 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *int32, env *en
|
|||
})
|
||||
|
||||
tracing.Exec(ctx, "", "worker.LocalCommitTransactions", func(ctx context.Context, span trace.Span) {
|
||||
committed = w.commitTransactions(env, txs, interrupt)
|
||||
committed = w.commitTransactions(env, txs, interrupt, interruptCh)
|
||||
})
|
||||
|
||||
if committed {
|
||||
|
|
@ -1384,7 +1414,7 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *int32, env *en
|
|||
})
|
||||
|
||||
tracing.Exec(ctx, "", "worker.RemoteCommitTransactions", func(ctx context.Context, span trace.Span) {
|
||||
committed = w.commitTransactions(env, txs, interrupt)
|
||||
committed = w.commitTransactions(env, txs, interrupt, interruptCh)
|
||||
})
|
||||
|
||||
if committed {
|
||||
|
|
@ -1409,7 +1439,10 @@ func (w *worker) generateWork(ctx context.Context, params *generateParams) (*typ
|
|||
}
|
||||
defer work.discard()
|
||||
|
||||
w.fillTransactions(ctx, nil, work)
|
||||
interruptCh, stopFn := getInterruptTimer(ctx, work, w.chain.CurrentBlock())
|
||||
defer stopFn()
|
||||
|
||||
w.fillTransactions(ctx, nil, work, interruptCh)
|
||||
|
||||
return w.engine.FinalizeAndAssemble(ctx, w.chain, work.header, work.state, work.txs, work.unclelist(), work.receipts)
|
||||
}
|
||||
|
|
@ -1417,6 +1450,7 @@ func (w *worker) generateWork(ctx context.Context, params *generateParams) (*typ
|
|||
// commitWork generates several new sealing tasks based on the parent block
|
||||
// and submit them to the sealer.
|
||||
func (w *worker) commitWork(ctx context.Context, interrupt *int32, noempty bool, timestamp int64) {
|
||||
|
||||
start := time.Now()
|
||||
|
||||
var (
|
||||
|
|
@ -1446,6 +1480,17 @@ func (w *worker) commitWork(ctx context.Context, interrupt *int32, noempty bool,
|
|||
return
|
||||
}
|
||||
|
||||
var interruptCh chan struct{}
|
||||
|
||||
stopFn := func() {}
|
||||
defer func() {
|
||||
stopFn()
|
||||
}()
|
||||
|
||||
if !noempty {
|
||||
interruptCh, stopFn = getInterruptTimer(ctx, work, w.chain.CurrentBlock())
|
||||
}
|
||||
|
||||
ctx, span := tracing.StartSpan(ctx, "commitWork")
|
||||
defer tracing.EndSpan(span)
|
||||
|
||||
|
|
@ -1464,7 +1509,7 @@ func (w *worker) commitWork(ctx context.Context, interrupt *int32, noempty bool,
|
|||
}
|
||||
|
||||
// Fill pending transactions from the txpool
|
||||
w.fillTransactions(ctx, interrupt, work)
|
||||
w.fillTransactions(ctx, interrupt, work, interruptCh)
|
||||
|
||||
err = w.commit(ctx, work.copy(), w.fullTaskHook, true, start)
|
||||
if err != nil {
|
||||
|
|
@ -1480,6 +1525,30 @@ func (w *worker) commitWork(ctx context.Context, interrupt *int32, noempty bool,
|
|||
w.current = work
|
||||
}
|
||||
|
||||
func getInterruptTimer(ctx context.Context, work *environment, current *types.Block) (chan struct{}, func()) {
|
||||
delay := time.Until(time.Unix(int64(work.header.Time), 0))
|
||||
|
||||
timeoutTimer := time.NewTimer(delay)
|
||||
stopFn := func() {
|
||||
timeoutTimer.Stop()
|
||||
}
|
||||
|
||||
blockNumber := current.NumberU64() + 1
|
||||
interruptCh := make(chan struct{})
|
||||
|
||||
go func() {
|
||||
select {
|
||||
case <-timeoutTimer.C:
|
||||
log.Info("Commit Interrupt. Pre-committing the current block", "block", blockNumber)
|
||||
|
||||
close(interruptCh)
|
||||
case <-ctx.Done(): // nothing to do
|
||||
}
|
||||
}()
|
||||
|
||||
return interruptCh, stopFn
|
||||
}
|
||||
|
||||
// commit runs any post-transaction state modifications, assembles the final block
|
||||
// and commits new work if consensus engine is running.
|
||||
// Note the assumption is held that the mutation is allowed to the passed env, do
|
||||
|
|
@ -1501,9 +1570,9 @@ func (w *worker) commit(ctx context.Context, env *environment, interval func(),
|
|||
|
||||
tracing.SetAttributes(
|
||||
span,
|
||||
attribute.Int("number", int(block.Number().Uint64())),
|
||||
attribute.String("hash", block.Hash().String()),
|
||||
attribute.String("sealhash", w.engine.SealHash(block.Header()).String()),
|
||||
attribute.Int("number", int(env.header.Number.Uint64())),
|
||||
attribute.String("hash", env.header.Hash().String()),
|
||||
attribute.String("sealhash", w.engine.SealHash(env.header).String()),
|
||||
attribute.Int("len of env.txs", len(env.txs)),
|
||||
attribute.Bool("error", err != nil),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,11 +18,14 @@ package miner
|
|||
|
||||
import (
|
||||
"math/big"
|
||||
"os"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"gotest.tools/assert"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
|
|
@ -35,6 +38,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/tests/bor/mocks"
|
||||
)
|
||||
|
|
@ -63,35 +67,14 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool, isBor bool) {
|
|||
engine consensus.Engine
|
||||
chainConfig *params.ChainConfig
|
||||
db = rawdb.NewMemoryDatabase()
|
||||
ctrl *gomock.Controller
|
||||
)
|
||||
|
||||
if isBor {
|
||||
chainConfig = params.BorUnittestChainConfig
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
engine, ctrl = getFakeBorFromConfig(t, chainConfig)
|
||||
defer ctrl.Finish()
|
||||
|
||||
ethAPIMock := api.NewMockCaller(ctrl)
|
||||
ethAPIMock.EXPECT().Call(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
|
||||
|
||||
spanner := bor.NewMockSpanner(ctrl)
|
||||
spanner.EXPECT().GetCurrentValidators(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
{
|
||||
ID: 0,
|
||||
Address: TestBankAddress,
|
||||
VotingPower: 100,
|
||||
ProposerPriority: 0,
|
||||
},
|
||||
}, nil).AnyTimes()
|
||||
|
||||
heimdallClientMock := mocks.NewMockIHeimdallClient(ctrl)
|
||||
heimdallClientMock.EXPECT().Close().Times(1)
|
||||
|
||||
contractMock := bor.NewMockGenesisContract(ctrl)
|
||||
|
||||
db, _, _ = NewDBForFakes(t)
|
||||
|
||||
engine = NewFakeBor(t, db, chainConfig, ethAPIMock, spanner, heimdallClientMock, contractMock)
|
||||
} else {
|
||||
if isClique {
|
||||
chainConfig = params.AllCliqueProtocolChanges
|
||||
|
|
@ -107,7 +90,7 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool, isBor bool) {
|
|||
|
||||
chainConfig.LondonBlock = big.NewInt(0)
|
||||
|
||||
w, b, _ := NewTestWorker(t, chainConfig, engine, db, 0)
|
||||
w, b, _ := NewTestWorker(t, chainConfig, engine, db, 0, 0, 0)
|
||||
defer w.close()
|
||||
|
||||
// This test chain imports the mined blocks.
|
||||
|
|
@ -171,17 +154,49 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool, isBor bool) {
|
|||
}
|
||||
}
|
||||
|
||||
func getFakeBorFromConfig(t *testing.T, chainConfig *params.ChainConfig) (consensus.Engine, *gomock.Controller) {
|
||||
t.Helper()
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
|
||||
ethAPIMock := api.NewMockCaller(ctrl)
|
||||
ethAPIMock.EXPECT().Call(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
|
||||
|
||||
spanner := bor.NewMockSpanner(ctrl)
|
||||
spanner.EXPECT().GetCurrentValidators(gomock.Any(), gomock.Any(), gomock.Any()).Return([]*valset.Validator{
|
||||
{
|
||||
ID: 0,
|
||||
Address: TestBankAddress,
|
||||
VotingPower: 100,
|
||||
ProposerPriority: 0,
|
||||
},
|
||||
}, nil).AnyTimes()
|
||||
|
||||
heimdallClientMock := mocks.NewMockIHeimdallClient(ctrl)
|
||||
heimdallClientMock.EXPECT().Close().Times(1)
|
||||
|
||||
contractMock := bor.NewMockGenesisContract(ctrl)
|
||||
|
||||
db, _, _ := NewDBForFakes(t)
|
||||
|
||||
engine := NewFakeBor(t, db, chainConfig, ethAPIMock, spanner, heimdallClientMock, contractMock)
|
||||
|
||||
return engine, ctrl
|
||||
}
|
||||
|
||||
func TestEmptyWorkEthash(t *testing.T) {
|
||||
t.Skip()
|
||||
testEmptyWork(t, ethashChainConfig, ethash.NewFaker())
|
||||
}
|
||||
func TestEmptyWorkClique(t *testing.T) {
|
||||
t.Skip()
|
||||
testEmptyWork(t, cliqueChainConfig, clique.New(cliqueChainConfig.Clique, rawdb.NewMemoryDatabase()))
|
||||
}
|
||||
|
||||
func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine) {
|
||||
defer engine.Close()
|
||||
|
||||
w, _, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0)
|
||||
w, _, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, 0, 0)
|
||||
defer w.close()
|
||||
|
||||
var (
|
||||
|
|
@ -235,7 +250,7 @@ func TestStreamUncleBlock(t *testing.T) {
|
|||
ethash := ethash.NewFaker()
|
||||
defer ethash.Close()
|
||||
|
||||
w, b, _ := NewTestWorker(t, ethashChainConfig, ethash, rawdb.NewMemoryDatabase(), 1)
|
||||
w, b, _ := NewTestWorker(t, ethashChainConfig, ethash, rawdb.NewMemoryDatabase(), 1, 0, 0)
|
||||
defer w.close()
|
||||
|
||||
var taskCh = make(chan struct{})
|
||||
|
|
@ -297,7 +312,7 @@ func TestRegenerateMiningBlockClique(t *testing.T) {
|
|||
func testRegenerateMiningBlock(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine) {
|
||||
defer engine.Close()
|
||||
|
||||
w, b, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0)
|
||||
w, b, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, 0, 0)
|
||||
defer w.close()
|
||||
|
||||
var taskCh = make(chan struct{}, 3)
|
||||
|
|
@ -368,7 +383,7 @@ func TestAdjustIntervalClique(t *testing.T) {
|
|||
func testAdjustInterval(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine) {
|
||||
defer engine.Close()
|
||||
|
||||
w, _, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0)
|
||||
w, _, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, 0, 0)
|
||||
defer w.close()
|
||||
|
||||
w.skipSealHook = func(task *task) bool {
|
||||
|
|
@ -476,7 +491,7 @@ func TestGetSealingWorkPostMerge(t *testing.T) {
|
|||
func testGetSealingWork(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine, postMerge bool) {
|
||||
defer engine.Close()
|
||||
|
||||
w, b, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0)
|
||||
w, b, _ := NewTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, 0, 0)
|
||||
defer w.close()
|
||||
|
||||
w.setExtra([]byte{0x01, 0x02})
|
||||
|
|
@ -612,6 +627,64 @@ func testGetSealingWork(t *testing.T, chainConfig *params.ChainConfig, engine co
|
|||
}
|
||||
}
|
||||
|
||||
func TestCommitInterruptExperimentBor(t *testing.T) {
|
||||
t.Parallel()
|
||||
// with 1 sec block time and 200 millisec tx delay we should get 5 txs per block
|
||||
testCommitInterruptExperimentBor(t, 200, 5)
|
||||
|
||||
// with 1 sec block time and 100 millisec tx delay we should get 10 txs per block
|
||||
testCommitInterruptExperimentBor(t, 100, 10)
|
||||
}
|
||||
|
||||
func testCommitInterruptExperimentBor(t *testing.T, delay uint, txCount int) {
|
||||
t.Helper()
|
||||
|
||||
var (
|
||||
engine consensus.Engine
|
||||
chainConfig *params.ChainConfig
|
||||
db = rawdb.NewMemoryDatabase()
|
||||
ctrl *gomock.Controller
|
||||
)
|
||||
|
||||
chainConfig = params.BorUnittestChainConfig
|
||||
|
||||
log.Root().SetHandler(log.LvlFilterHandler(4, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
|
||||
|
||||
engine, ctrl = getFakeBorFromConfig(t, chainConfig)
|
||||
defer func() {
|
||||
engine.Close()
|
||||
ctrl.Finish()
|
||||
}()
|
||||
|
||||
w, b, _ := NewTestWorker(t, chainConfig, engine, db, 0, 1, delay)
|
||||
defer w.close()
|
||||
|
||||
wg := new(sync.WaitGroup)
|
||||
wg.Add(1)
|
||||
|
||||
go func() {
|
||||
wg.Done()
|
||||
|
||||
for {
|
||||
tx := b.newRandomTx(false)
|
||||
if err := b.TxPool().AddRemote(tx); err != nil {
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
}
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
|
||||
// Start mining!
|
||||
w.start()
|
||||
time.Sleep(5 * time.Second)
|
||||
w.stop()
|
||||
|
||||
assert.Equal(t, txCount, w.chain.CurrentBlock().Transactions().Len())
|
||||
}
|
||||
|
||||
func BenchmarkBorMining(b *testing.B) {
|
||||
chainConfig := params.BorUnittestChainConfig
|
||||
|
||||
|
|
@ -643,7 +716,7 @@ func BenchmarkBorMining(b *testing.B) {
|
|||
|
||||
chainConfig.LondonBlock = big.NewInt(0)
|
||||
|
||||
w, back, _ := NewTestWorker(b, chainConfig, engine, db, 0)
|
||||
w, back, _ := NewTestWorker(b, chainConfig, engine, db, 0, 0, 0)
|
||||
defer w.close()
|
||||
|
||||
// This test chain imports the mined blocks.
|
||||
|
|
|
|||
24
node/api.go
24
node/api.go
|
|
@ -61,6 +61,30 @@ type privateAdminAPI struct {
|
|||
node *Node // Node interfaced by this API
|
||||
}
|
||||
|
||||
// This function sets the param maxPeers for the node. If there are excess peers attached to the node, it will remove the difference.
|
||||
func (api *privateAdminAPI) SetMaxPeers(maxPeers int) (bool, error) {
|
||||
// Make sure the server is running, fail otherwise
|
||||
server := api.node.Server()
|
||||
if server == nil {
|
||||
return false, ErrNodeStopped
|
||||
}
|
||||
|
||||
server.SetMaxPeers(maxPeers)
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// This function gets the maxPeers param for the node.
|
||||
func (api *privateAdminAPI) GetMaxPeers() (int, error) {
|
||||
// Make sure the server is running, fail otherwise
|
||||
server := api.node.Server()
|
||||
if server == nil {
|
||||
return 0, ErrNodeStopped
|
||||
}
|
||||
|
||||
return server.MaxPeers, nil
|
||||
}
|
||||
|
||||
// AddPeer requests connecting to a remote node, and also maintaining the new
|
||||
// connection at all times, even reconnecting if it is lost.
|
||||
func (api *privateAdminAPI) AddPeer(url string) (bool, error) {
|
||||
|
|
|
|||
|
|
@ -57,15 +57,19 @@ func TestClientSyncTree(t *testing.T) {
|
|||
|
||||
c := NewClient(Config{Resolver: r, Logger: testlog.Logger(t, log.LvlTrace)})
|
||||
stree, err := c.SyncTree("enrtree://AKPYQIUQIL7PSIACI32J7FGZW56E5FKHEFCCOFHILBIMW3M6LWXS2@n")
|
||||
|
||||
if err != nil {
|
||||
t.Fatal("sync error:", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(sortByID(stree.Nodes()), sortByID(wantNodes)) {
|
||||
t.Errorf("wrong nodes in synced tree:\nhave %v\nwant %v", spew.Sdump(stree.Nodes()), spew.Sdump(wantNodes))
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(stree.Links(), wantLinks) {
|
||||
t.Errorf("wrong links in synced tree: %v", stree.Links())
|
||||
}
|
||||
|
||||
if stree.Seq() != wantSeq {
|
||||
t.Errorf("synced tree has wrong seq: %d", stree.Seq())
|
||||
}
|
||||
|
|
@ -295,7 +299,7 @@ func TestIteratorEmptyTree(t *testing.T) {
|
|||
|
||||
// updateSomeNodes applies ENR updates to some of the given nodes.
|
||||
func updateSomeNodes(keySeed int64, nodes []*enode.Node) {
|
||||
keys := testKeys(nodesSeed1, len(nodes))
|
||||
keys := testKeys(keySeed, len(nodes))
|
||||
for i, n := range nodes[:len(nodes)/2] {
|
||||
r := n.Record()
|
||||
r.Set(enr.IP{127, 0, 0, 1})
|
||||
|
|
@ -384,10 +388,12 @@ func makeTestTree(domain string, nodes []*enode.Node, links []string) (*Tree, st
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
url, err := tree.Sign(testKey(signingKeySeed), domain)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return tree, url
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -311,6 +311,35 @@ func (srv *Server) Peers() []*Peer {
|
|||
return ps
|
||||
}
|
||||
|
||||
// This function retrieves the peers that are not trusted-peers
|
||||
func (srv *Server) getNonTrustedPeers() []*Peer {
|
||||
allPeers := srv.Peers()
|
||||
|
||||
nontrustedPeers := []*Peer{}
|
||||
|
||||
for _, peer := range allPeers {
|
||||
if !peer.Info().Network.Trusted {
|
||||
nontrustedPeers = append(nontrustedPeers, peer)
|
||||
}
|
||||
}
|
||||
|
||||
return nontrustedPeers
|
||||
}
|
||||
|
||||
// SetMaxPeers sets the maximum number of peers that can be connected
|
||||
func (srv *Server) SetMaxPeers(maxPeers int) {
|
||||
currentPeers := srv.getNonTrustedPeers()
|
||||
if len(currentPeers) > maxPeers {
|
||||
peersToDrop := currentPeers[maxPeers:]
|
||||
for _, peer := range peersToDrop {
|
||||
log.Warn("CurrentPeers more than MaxPeers", "removing", peer.ID())
|
||||
srv.RemovePeer(peer.Node())
|
||||
}
|
||||
}
|
||||
|
||||
srv.MaxPeers = maxPeers
|
||||
}
|
||||
|
||||
// PeerCount returns the number of connected peers.
|
||||
func (srv *Server) PeerCount() int {
|
||||
var count int
|
||||
|
|
@ -372,6 +401,8 @@ func (srv *Server) RemoveTrustedPeer(node *enode.Node) {
|
|||
case srv.removetrusted <- node:
|
||||
case <-srv.quit:
|
||||
}
|
||||
// Disconnect the peer if maxPeers is breached.
|
||||
srv.SetMaxPeers(srv.MaxPeers)
|
||||
}
|
||||
|
||||
// SubscribeEvents subscribes the given channel to peer events
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -8,9 +9,16 @@ syncmode = "full"
|
|||
gcmode = "archive"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -18,6 +26,9 @@ gcmode = "archive"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -52,12 +63,15 @@ gcmode = "archive"
|
|||
# mine = false
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -80,6 +94,11 @@ gcmode = "archive"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -88,6 +107,8 @@ gcmode = "archive"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -120,6 +141,7 @@ gcmode = "archive"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -134,3 +156,11 @@ gcmode = "archive"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -8,9 +9,16 @@ syncmode = "full"
|
|||
# gcmode = "full"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -18,6 +26,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -52,12 +63,15 @@ syncmode = "full"
|
|||
# mine = false
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -80,6 +94,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -88,6 +107,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -120,6 +141,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -134,3 +156,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -10,9 +11,16 @@ syncmode = "full"
|
|||
# gcmode = "full"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 1
|
||||
port = 30303
|
||||
|
|
@ -20,6 +28,9 @@ syncmode = "full"
|
|||
# maxpendpeers = 50
|
||||
# bind = "0.0.0.0"
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -54,12 +65,15 @@ syncmode = "full"
|
|||
gasprice = "30000000000"
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -82,6 +96,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +109,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -122,6 +143,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -136,3 +158,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -10,9 +11,16 @@ syncmode = "full"
|
|||
# gcmode = "full"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -20,6 +28,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -54,12 +65,15 @@ syncmode = "full"
|
|||
gasprice = "30000000000"
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -82,6 +96,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +109,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -122,6 +143,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -136,3 +158,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -8,9 +9,16 @@ syncmode = "full"
|
|||
gcmode = "archive"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -18,6 +26,9 @@ gcmode = "archive"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -52,12 +63,15 @@ gcmode = "archive"
|
|||
# mine = false
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -80,6 +94,11 @@ gcmode = "archive"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -88,6 +107,8 @@ gcmode = "archive"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -120,6 +141,7 @@ gcmode = "archive"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -134,3 +156,11 @@ gcmode = "archive"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -8,9 +9,16 @@ syncmode = "full"
|
|||
# gcmode = "full"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -18,6 +26,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -52,12 +63,15 @@ syncmode = "full"
|
|||
# mine = false
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -80,6 +94,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -88,6 +107,8 @@ syncmode = "full"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -120,6 +141,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -134,3 +156,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -10,9 +11,16 @@ syncmode = "full"
|
|||
# gcmode = "full"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 1
|
||||
port = 30303
|
||||
|
|
@ -20,6 +28,9 @@ syncmode = "full"
|
|||
# maxpendpeers = 50
|
||||
# bind = "0.0.0.0"
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -54,12 +65,15 @@ syncmode = "full"
|
|||
# gasprice = "1000000000"
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -82,6 +96,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +109,8 @@ syncmode = "full"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -122,6 +143,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -136,3 +158,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# log-level = "INFO"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -10,9 +11,16 @@ syncmode = "full"
|
|||
# gcmode = "full"
|
||||
# snapshot = true
|
||||
# ethstats = ""
|
||||
# devfakeauthor = false
|
||||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -20,6 +28,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# txarrivalwait = "500ms"
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
|
|
@ -54,12 +65,15 @@ syncmode = "full"
|
|||
# gasprice = "1000000000"
|
||||
# etherbase = ""
|
||||
# extradata = ""
|
||||
# recommit = "2m5s"
|
||||
|
||||
[jsonrpc]
|
||||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
enabled = true
|
||||
port = 8545
|
||||
|
|
@ -82,6 +96,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +109,8 @@ syncmode = "full"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -122,6 +143,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -136,3 +158,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ const (
|
|||
VersionMeta = "stable" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
var (
|
||||
GitCommit = ""
|
||||
)
|
||||
|
||||
// Version holds the textual version string.
|
||||
var Version = func() string {
|
||||
return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
|
||||
|
|
@ -41,6 +45,16 @@ var VersionWithMeta = func() string {
|
|||
return v
|
||||
}()
|
||||
|
||||
// VersionWithCommitDetails holds the textual version string including the metadata and Git Details.
|
||||
var VersionWithMetaCommitDetails = func() string {
|
||||
v := Version
|
||||
if VersionMeta != "" {
|
||||
v += "-" + VersionMeta
|
||||
}
|
||||
v_git := fmt.Sprintf("Version : %s\nGitCommit : %s\n", v, GitCommit)
|
||||
return v_git
|
||||
}()
|
||||
|
||||
// ArchiveVersion holds the textual version string used for Geth archives.
|
||||
// e.g. "1.8.11-dea1ce05" for stable releases, or
|
||||
//
|
||||
|
|
|
|||
|
|
@ -28,27 +28,27 @@ import (
|
|||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// nolint: gofmt
|
||||
// handler handles JSON-RPC messages. There is one handler per connection. Note that
|
||||
// handler is not safe for concurrent use. Message handling never blocks indefinitely
|
||||
// because RPCs are processed on background goroutines launched by handler.
|
||||
//
|
||||
// The entry points for incoming messages are:
|
||||
//
|
||||
// h.handleMsg(message)
|
||||
// h.handleBatch(message)
|
||||
// h.handleMsg(message)
|
||||
// h.handleBatch(message)
|
||||
//
|
||||
// Outgoing calls use the requestOp struct. Register the request before sending it
|
||||
// on the connection:
|
||||
//
|
||||
// op := &requestOp{ids: ...}
|
||||
// h.addRequestOp(op)
|
||||
// op := &requestOp{ids: ...}
|
||||
// h.addRequestOp(op)
|
||||
//
|
||||
// Now send the request, then wait for the reply to be delivered through handleMsg:
|
||||
//
|
||||
// if err := op.wait(...); err != nil {
|
||||
// h.removeRequestOp(op) // timeout, etc.
|
||||
// }
|
||||
//
|
||||
// if err := op.wait(...); err != nil {
|
||||
// h.removeRequestOp(op) // timeout, etc.
|
||||
// }
|
||||
type handler struct {
|
||||
reg *serviceRegistry
|
||||
unsubscribeCb *callback
|
||||
|
|
@ -219,6 +219,7 @@ func (h *handler) cancelServerSubscriptions(err error) {
|
|||
// startCallProc runs fn in a new goroutine and starts tracking it in the h.calls wait group.
|
||||
func (h *handler) startCallProc(fn func(*callProc)) {
|
||||
h.callWG.Add(1)
|
||||
|
||||
go func() {
|
||||
ctx, cancel := context.WithCancel(h.rootCtx)
|
||||
defer h.callWG.Done()
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ func DialInProc(handler *Server) *Client {
|
|||
initctx := context.Background()
|
||||
c, _ := newClient(initctx, func(context.Context) (ServerCodec, error) {
|
||||
p1, p2 := net.Pipe()
|
||||
|
||||
// nolint: contextcheck
|
||||
go handler.ServeCodec(NewCodec(p1), 0)
|
||||
return NewCodec(p2), nil
|
||||
})
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ func (s *Server) ServeListener(l net.Listener) error {
|
|||
return err
|
||||
}
|
||||
log.Trace("Accepted RPC connection", "conn", conn.RemoteAddr())
|
||||
|
||||
go s.ServeCodec(NewCodec(conn), 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,11 +105,15 @@ func (s *Server) serveSingleRequest(ctx context.Context, codec ServerCodec) {
|
|||
reqs, batch, err := codec.readBatch()
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
// nolint: errcheck
|
||||
codec.writeJSON(ctx, errorMessage(&invalidMessageError{"parse error"}))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// nolint: contextcheck
|
||||
if batch {
|
||||
// nolint: contextcheck
|
||||
h.handleBatch(reqs)
|
||||
} else {
|
||||
h.handleMsg(reqs[0])
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ var flagMap = map[string][]string{
|
|||
var nameTagMap = map[string]string{
|
||||
"chain": "chain",
|
||||
"identity": "identity",
|
||||
"log-level": "log-level",
|
||||
"verbosity": "verbosity",
|
||||
"datadir": "datadir",
|
||||
"keystore": "keystore",
|
||||
"syncmode": "syncmode",
|
||||
|
|
@ -216,15 +216,15 @@ var replacedFlagsMapFlagAndValue = map[string]map[string]map[string]string{
|
|||
},
|
||||
"verbosity": {
|
||||
"flag": {
|
||||
"verbosity": "log-level",
|
||||
"verbosity": "verbosity",
|
||||
},
|
||||
"value": {
|
||||
"0": "SILENT",
|
||||
"0": "CRIT",
|
||||
"1": "ERROR",
|
||||
"2": "WARN",
|
||||
"3": "INFO",
|
||||
"4": "DEBUG",
|
||||
"5": "DETAIL",
|
||||
"5": "TRACE",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue