mardizzone/merge-qa-to-master (#856)

* Added checks to RPC requests and introduced new flags to customise the parameters (#657)

* added a check to reject rpc requests with batch size > the one set using a newly added flag (rpcbatchlimit)

* added a check to reject rpc requests whose result size > the one set using a newly added flag (rpcreturndatalimit)

* updated the config files and docs

* chg : trieTimeout from 60 to 10 mins (#692)

* chg : trieTimeout from 60 to 10 mins

* chg : cache.timout to 10m from 1h in configs

* internal/cli/server : fix : added triesInMemory in config (#691)

* changed version from 0.3.0 to 0.3.4-beta (#693)

* fix nil state-sync issue, increase grpc limit (#695)

* Increase grpc message size limit in pprof

* consensus/bor/bor.go : stateSyncs init fixed [Fix #686]

* eth/filters: handle nil state-sync before notify

* eth/filters: update check

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>

* core, tests/bor: add more tests for state-sync validation (#710)

* core: add get state sync function for tests

* tests/bor: add validation for state sync events post consensus

* Arpit/temp bor sync (#701)

* Increase grpc message size limit in pprof

* ReadBorReceipts improvements

* use internal function

* fix tests

* fetch geth upstread for ReadBorReceiptRLP

* Only query bor receipt when the query index is equal to # tx in block body

This change reduces the frequency of calling ReadBorReceipt and
ReadBorTransaction, which are CPU and db intensive.

* Revert "fetch geth upstread for ReadBorReceiptRLP"

This reverts commit 2e838a6b1313d26674f3a8df4b044e35dcbf35a0.

* Restore ReadBorReceiptRLP

* fix bor receipts

* remove unused

* fix lints

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Revert "chg : trieTimeout from 60 to 10 mins (#692)" (#720)

This reverts commit 241843c7e7.

* Arpit/add execution pool 2 (#719)

* initial

* linters

* linters

* remove timeout

* update pool

* change pool size function

* check nil

* check nil

* fix tests

* Use execution pool from server in all handlers

* simplify things

* test fix

* add support for cli, config

* add to cli and config

* merge base branch

* debug statements

* fix bug

* atomic pointer timeout

* add apis

* update workerpool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* fix tests

* mutex

* refactor flag and value names

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* debug statements

* fix bug

* update workerpool

* atomic pointer timeout

* add apis

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* merge base branch

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* mutex

* fix tests

* Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* Change default size of execution pool to 40

* refactor flag and value names

* fix merge conflicts

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* fix linters

* fix go.mod

* change sec to ms

* change default value for ep timeout

* fix node api calls

* comment setter for ep timeout

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* version change (#721)

* Event based pprof (#732)

* feature

* Save pprof to /tmp

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Cherry-pick changes from develop (#738)

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* add max code init size check in txpool (#739)

* Revert "Event based pprof" and update version (#742)

* Revert "Event based pprof (#732)"

This reverts commit 22fa4033e8.

* params: update version to 0.3.4-beta3

* packaging/templates: update bor version

* internal/ethapi :: Fix : newRPCTransactionFromBlockIndex

* Merge master to qa (#813)

* Merge qa to master (#750)

* Added checks to RPC requests and introduced new flags to customise the parameters (#657)

* added a check to reject rpc requests with batch size > the one set using a newly added flag (rpcbatchlimit)

* added a check to reject rpc requests whose result size > the one set using a newly added flag (rpcreturndatalimit)

* updated the config files and docs

* chg : trieTimeout from 60 to 10 mins (#692)

* chg : trieTimeout from 60 to 10 mins

* chg : cache.timout to 10m from 1h in configs

* internal/cli/server : fix : added triesInMemory in config (#691)

* changed version from 0.3.0 to 0.3.4-beta (#693)

* fix nil state-sync issue, increase grpc limit (#695)

* Increase grpc message size limit in pprof

* consensus/bor/bor.go : stateSyncs init fixed [Fix #686]

* eth/filters: handle nil state-sync before notify

* eth/filters: update check

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>

* core, tests/bor: add more tests for state-sync validation (#710)

* core: add get state sync function for tests

* tests/bor: add validation for state sync events post consensus

* Arpit/temp bor sync (#701)

* Increase grpc message size limit in pprof

* ReadBorReceipts improvements

* use internal function

* fix tests

* fetch geth upstread for ReadBorReceiptRLP

* Only query bor receipt when the query index is equal to # tx in block body

This change reduces the frequency of calling ReadBorReceipt and
ReadBorTransaction, which are CPU and db intensive.

* Revert "fetch geth upstread for ReadBorReceiptRLP"

This reverts commit 2e838a6b1313d26674f3a8df4b044e35dcbf35a0.

* Restore ReadBorReceiptRLP

* fix bor receipts

* remove unused

* fix lints

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Revert "chg : trieTimeout from 60 to 10 mins (#692)" (#720)

This reverts commit 241843c7e7.

* Arpit/add execution pool 2 (#719)

* initial

* linters

* linters

* remove timeout

* update pool

* change pool size function

* check nil

* check nil

* fix tests

* Use execution pool from server in all handlers

* simplify things

* test fix

* add support for cli, config

* add to cli and config

* merge base branch

* debug statements

* fix bug

* atomic pointer timeout

* add apis

* update workerpool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* fix tests

* mutex

* refactor flag and value names

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* debug statements

* fix bug

* update workerpool

* atomic pointer timeout

* add apis

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* merge base branch

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* mutex

* fix tests

* Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* Change default size of execution pool to 40

* refactor flag and value names

* fix merge conflicts

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* fix linters

* fix go.mod

* change sec to ms

* change default value for ep timeout

* fix node api calls

* comment setter for ep timeout

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* version change (#721)

* Event based pprof (#732)

* feature

* Save pprof to /tmp

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Cherry-pick changes from develop (#738)

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* add max code init size check in txpool (#739)

* Revert "Event based pprof" and update version (#742)

* Revert "Event based pprof (#732)"

This reverts commit 22fa4033e8.

* params: update version to 0.3.4-beta3

* packaging/templates: update bor version

* params, packaging/templates: update bor version

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* core, miner: add sub-spans for tracing (#753)

* core, miner: add sub-spans for tracing

* fix linters

* core: add logs for debugging

* core: add more logs to print tdd while reorg

* fix linters

* core: minor fix

* core: remove debug logs

* core: use different span for write block and set head

* core: use internal context for sending traces (#755)

* core: add : impossible reorg block dump (#754)

* add : impossible reorg block dump

* chg : 3 seperate files for impossoble reorg dump

* add : use exportBlocks method and RLP blocks before writing

* chg : small changes

* bump : go version from 1.19 to 1.20.1 (#761)

* Revert "bump : go version from 1.19 to 1.20.1 (#761)"

This reverts commit 4561012af9.

* core/vm: use optimized bigint (#26021)

* Add holiman/big

* Fix linter

* Bump version to v0.3.5

* fix lints from develop (few lints decided to appear from code that was untouched, weird)

* upgrade crypto lib version (#770)

* bump dep : github.com/Masterminds/goutils to v1.1.1 (#769)

* mardizzone/pos-1313: bump crypto dependency (#772)

* dev: chg: bumd net dependency

* dev: chg: bump crypto dependency

* dev: chg: bump crypto dependency

* bump dep : golang.org/x/net to v0.8.0 (#771)

* Verify validator set against local contract on receiving an end-of-sprint block (#768)

* Verify validator set against local contract on receiving an end-of-sprint block

* Fix tests

* Respect error returned by ParseValidators

* Keep going back until a parent block presents

* core/txpool: implement DoS defenses from geth (#778)

* Hotfixes and deps bump (#776)

* dev: chg: bump deps

* internal/cli/server, rpc: lower down http readtimeout to 10s

* dev: chg: get p2p adapter

* dev: chg: lower down jsonrpc readtimeout to 10s

* cherry-pick txpool optimisation changes

* add check for empty lists in txpool (#704)

* add check

* linters

* core, miner: add empty instrumentation name for tracing

---------

Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Evgeny Danilenko <6655321@bk.ru>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* packaging,params: bump to v0.3.6 (#782)

* v0.3.6 fix (#787)

* Fix get validator set in header verifier

* chg : commit tx logs from info to debug (#673)

* chg : commit tx logs from info to debug

* fix : minor changes

* chg : miner : commitTransactions-stats moved from info to debug

* lint : fix linters

* refactor logging

* miner : chg : UnauthorizedSignerError to debug

* lint : fix lint

* fix : log.Logger interface compatibility

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Remove unnecessary sorting of valset from header in verification

* dev: chg: version bump

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: marcello33 <marcelloardizzone@hotmail.it>

* core: improve locks in txpool (#807)

* added a write lock to the txs.filter method and a read lock to the txs.reheap method - both of which are called by Filter during reorg adjustments to txpool

* txpool reorg locks

* more locks

* locks

* linters

* params, packaging: update version for v0.3.8-beta release

* core: add logs in reheap

---------

Co-authored-by: Alex <dalexwatts@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Merge qa to master (#808)

* Added checks to RPC requests and introduced new flags to customise the parameters (#657)

* added a check to reject rpc requests with batch size > the one set using a newly added flag (rpcbatchlimit)

* added a check to reject rpc requests whose result size > the one set using a newly added flag (rpcreturndatalimit)

* updated the config files and docs

* chg : trieTimeout from 60 to 10 mins (#692)

* chg : trieTimeout from 60 to 10 mins

* chg : cache.timout to 10m from 1h in configs

* internal/cli/server : fix : added triesInMemory in config (#691)

* changed version from 0.3.0 to 0.3.4-beta (#693)

* fix nil state-sync issue, increase grpc limit (#695)

* Increase grpc message size limit in pprof

* consensus/bor/bor.go : stateSyncs init fixed [Fix #686]

* eth/filters: handle nil state-sync before notify

* eth/filters: update check

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>

* core, tests/bor: add more tests for state-sync validation (#710)

* core: add get state sync function for tests

* tests/bor: add validation for state sync events post consensus

* Arpit/temp bor sync (#701)

* Increase grpc message size limit in pprof

* ReadBorReceipts improvements

* use internal function

* fix tests

* fetch geth upstread for ReadBorReceiptRLP

* Only query bor receipt when the query index is equal to # tx in block body

This change reduces the frequency of calling ReadBorReceipt and
ReadBorTransaction, which are CPU and db intensive.

* Revert "fetch geth upstread for ReadBorReceiptRLP"

This reverts commit 2e838a6b1313d26674f3a8df4b044e35dcbf35a0.

* Restore ReadBorReceiptRLP

* fix bor receipts

* remove unused

* fix lints

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Revert "chg : trieTimeout from 60 to 10 mins (#692)" (#720)

This reverts commit 241843c7e7.

* Arpit/add execution pool 2 (#719)

* initial

* linters

* linters

* remove timeout

* update pool

* change pool size function

* check nil

* check nil

* fix tests

* Use execution pool from server in all handlers

* simplify things

* test fix

* add support for cli, config

* add to cli and config

* merge base branch

* debug statements

* fix bug

* atomic pointer timeout

* add apis

* update workerpool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* fix tests

* mutex

* refactor flag and value names

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* debug statements

* fix bug

* update workerpool

* atomic pointer timeout

* add apis

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* merge base branch

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* mutex

* fix tests

* Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* Change default size of execution pool to 40

* refactor flag and value names

* fix merge conflicts

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* fix linters

* fix go.mod

* change sec to ms

* change default value for ep timeout

* fix node api calls

* comment setter for ep timeout

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* version change (#721)

* Event based pprof (#732)

* feature

* Save pprof to /tmp

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Cherry-pick changes from develop (#738)

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* add max code init size check in txpool (#739)

* Revert "Event based pprof" and update version (#742)

* Revert "Event based pprof (#732)"

This reverts commit 22fa4033e8.

* params: update version to 0.3.4-beta3

* packaging/templates: update bor version

* internal/ethapi :: Fix : newRPCTransactionFromBlockIndex

* fix: remove assignment for bor receipt

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* Setting up bor to use hosted 18.04 runner as ubuntu provided 18.04 runner is end of life

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: marcello33 <marcelloardizzone@hotmail.it>
Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: Raneet Debnath <35629432+Raneet10@users.noreply.github.com>
Co-authored-by: Alex <dalexwatts@gmail.com>
Co-authored-by: Daniel Jones <djones@polygon.technology>

* merge v0.3.9-alpha to qa (#824)

* commit logs

* CI: test launch devnet without hardcoded sleep time (pos-534)

* CI: try using checked out bor path

* CI: fix missing ;

* CI: fix assignment operator

* CI: echo peers and block no.

* CI: cleanup

* minor chg: add new line

* dev: add: pos-944: snyk and govuln integration (#578)

* dev: add: pos-944 security ci and readme

* dev: add: pos-944 remove linters as this is included already in build ci

* dev: chg: pos-947 dependencies upgrade to solve snyk security issues

* dev: chg: update security-ci

* dev: chg: remove linter to allow replacements for security issues

* dev: add: pos-944 verify path when updating metrics from config

* dev: add: pos-944 fix linter

* dev: add: pos-944 add .snyk policy file / fix snyk code vulnerabilities

* dev: fix: pos-944 import common package / gitignore snyk dccache file

* dev: fix: pos-944 verify canonical path for crashers

* dev: fix: pos-944 linter

* dev: add: pos-976 add govuln check

* dev: add: pos-976 test upload with permissions

* dev: add: pos-976 remove duplicated upload

* dev: add: pos-976 report upload

* dev: add: pos-976 remove upload

* dev: fix: pos-944 fix govuln action

* dev: fix: pos-944 move govulncheck to security-ci

* dev: fix: pos-944 bump golvun action and golang versions

* dev: fix: pos-944 remove persmissions and fix conflicts

* dev: chg: restore err msg

* dev: chg: remove duplicated function

* dev: chg: sort import

* dev: chg: fix linter

* dev: add: use common VerifyCrasher function to avoid duplications / replace deprecated ioutils.ReadFile

* dev: fix: typo

* fix linters

* upgrade grpc version

* add ignore rule for net/http2

* Shivam/txpool tracing (#604)

* lock, unlock to rlock, runlock

* add : tracing Pending() and Locals()

* Log time spent in committing a tx during mining

* Remove data from logging

* Move log into case where a tx completes without error

* profile fillTransactions

* fix conflict

* bug fixes

* add logs

* txpool: add tracing in Pending()

* rearrange tracing

* add attributes

* fix

* fix

* log error in profiling

* update file mode and file path for profiling

* full profiling

* fix log

* fix log

* less wait

* fix

* fix

* logs

* worker: use block number for prof files

* initial

* txList add

* fix gas calculation

* fix

* green tests

* linters

* prettify

* allocate less

* no locks between pending and reorg

* no locks

* no locks on locals

* more tests

* linters

* less allocs

* comment

* optimize errors

* linters

* fix

* fix

* Linters

* linters

* linters

* simplify errors

* atomics for transactions

* fix

* optimize workers

* fix copy

* linters

* txpool tracing

* linters

* fix tracing

* duration in mcs

* locks

* metrics

* fix

* cache hit/miss

* less locks on evict

* remove once

* remove once

* switch off pprof

* fix data race

* fix data race

* add : sealed total/empty blocks metric gauge

* add : RPC debug_getTraceStack

* fix : RPC debug_getTraceStack

* fix : RPC debug_getTraceStack for all go-routines

* linters

* add data race test on txpool

* fix concurrency

* noleak

* increase batch size

* prettify

* tests

* baseFee mutex

* panic fix

* linters

* fix gas fee data race

* linters

* more transactions

* debug

* debug

* fix ticker

* fix test

* add cacheMu

* more tests

* fix test panic

* linters

* add statistics

* add statistics

* txitems data race

* fix tx list Has

* fix : lint

Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Reduce txArriveTimeout to 100ms

* init : remove exit on keystore err

* add : multiple keystore tolerance

* lint : fix linters

* chg : use standard logging

* chg : logging strings

* Added flags to run heimdall as a child process (#597)

* Added flags to run heimdall as a child process

* Fix: Lint

* Fix btcd package dependency for CI

* Update btcd package version

* Try removing ambigious importts

* dev: fix: lint fix for parallel tests

* remove delete for ambigious import

* Remove unwanted space

* go mod tidy

* try replace

* try replace

* use vendor

* rename vendor

* tidy

* vendor btcec

* clean up

* remove submodule

* remove submodule

* remove submodule

* remove submodule

* remove vendor & added replacer in test

* go mod tidy

* added replacer

* Update replacer

* Update replacer

* Merge branch 'develop' into run-heimdall-flags

* Skip TestGolangBindings

* Typo fix

* Remove unwanted changes

Co-authored-by: marcello33 <marcelloardizzone@hotmail.it>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* dev: chg: update PR template to include nodes audience check (#641)

* dev: chg: update PR template to include nodes audience check

* dev: chg: better description

* dev: chg: add entry to changes too

* sonarqube integration (#658)

* dev: add: sonarqube integration into security-ci

* dev: add: exclude java files from sonarqube analysis

* Merge branch 'qa' and 'master' into develop (#663)

* Adding in Mumbai/Mainnet precursor deb packaging for tests to use during upgrade(iterations to come)

* Added changes per discussion in PR, more changes may be necessary

* Adding prerelease true

* Disabling goreleaser

* Removing README swap file

* change bor_dir and add bor user for v0.3.0 release

* rollback bor user and use root

* metrics: handle equal to separated config flag (#596)

* metrics: handle  based config path

* internal/cli/server: add more context to logs

* use space separated flag and value in bor.service

* fixed static-nodes related buf (os independent) (#598)

* fixed static-nodes related buf (os independent)

* taking static-nodes as input if default not present

* Update default flags (#600)

* internal/cli/server: use geth's default for txpool.pricelimit and add comments

* builder/files: update config.toml for mainnet

* packaging/templates: update defaults for mainnet and mumbai

* internal/cli/server: skip overriding cache

* packaging/templates: update cache value for mainnet

* packaging/templates: update gcmode for archive mumbai node

* metrics: handle nil telemetry config (#601)

* resolve merge conflicts

* update go version in release.yml

* update goversion in makefile

* update Docker login for goreleaser-cross v1.19

* Cleanup for the packager to use git tag in the package profile naming. Added conditional check for directory structure, this is in prep for v0.3.1, as this will create a failure on upgrade path in package due to file exist

* added a toml configuration file with comments describing each flag (#607)

* added a toml configuration file with comments describing each flag

* internal/cli/server: update flag description

* docs/cli: update example config and description of flags

* docs: update new-cli docs

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* Adding of 0.3.0 package changes, control file updates, postinst changes, and packager update

* added ancient datadir flag and toml field, need to decide on default value and update the conversion script

* updated toml files with ancient field

* Add support for new flags in new config.toml, which were present in old config.toml (#612)

* added HTTPTimeouts, and TrieTimeout flag in new tol, from old toml

* added RAW fields for these time.Duration flags

* updated the conversion script to support these extra 4 flags

* removed hcl and json config tests as we are only supporting toml config files

* updated toml files with cache.timeout field

* updated toml files with jsonrpc.timeouts field

* tests/bor: expect a call for latest checkpoint

* tests/bor: expect a call for latest checkpoint

* packaging/templates: update cache values for archive nodes

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* remove unwanted code

* Fix docker publish authentication issue

In gorelease-cross 1.19+, dockerhub authentication will require docker
logion action followed by mounting docker config file. See
https://github.com/goreleaser/goreleaser-cross#github-actions.

* Revert "update Docker login for goreleaser-cross v1.19"

This reverts commit 4d19cf5342.

* Bump version to stable

* Revert "Merge pull request #435 from maticnetwork/POS-553"

This reverts commit 657d262def, reversing
changes made to 88dbfa1c13.

* revert change for release for go1.19

* Add default values to CLI helper and docs

This commit adds default values to CLI helper and docs. When the default value of a string flag, slice string flag, or map string flag is empty, its helper message won't show any default value.

* Add a summary of new CLI in docs

* Updating packager as binutils changed version so that apt-get installs current versions

* Add state pruning to new CLI

* Minor wording fix in prune state description

* Bumping control file versions

* Mainnet Delhi fork

* Set version to stable

* change delhi hardfork block number

* handle future chain import and skip peer drop (#650)

* handle future chain import and skip peer drop

* add block import metric

* params: bump version to v0.3.3-stable

* Bump bor version in control files for v0.3.3 mainnet release

Co-authored-by: Daniel Jones <djones@polygon.technology>
Co-authored-by: Will Button <wbutton@polygon.technology>
Co-authored-by: Will Button <will@willbutton.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Daniel Jones <105369507+djpolygon@users.noreply.github.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>

* CI: use matic-cli master branch

* trigger ci

* internal/cli/server : fix : added triesInMemory in config (#677)

* update requirements in README (#681)

* consensus/bor : add : devFakeAuthor flag

* core,eth,internal/cli,internal/ethapi: add --rpc.allow-unprotected-txs flag to allow txs to get replayed (for shadow node)

* internal/cli: add `skiptrace` flag for profiling (#715)

* internal/cli: add skiptrace flag

* docs: update docs for skiptrace flag

* Added flag in Status to wait for backend, and fixed panic issue. (#708)

* checking if backend is available during status call, and added a flag to wait if backend is not available

* added test for status command (does not cover the whole code)

* Revert "Reduce txArriveTimeout to 100ms" (#707)

This reverts commit 243d231fe4.

* consensus/bor : add : devFakeAuthor flag (#697)

* add check for empty lists in txpool (#704)

* add check

* linters

* dev: chg: POS-215 move sonarqube to own ci (#733)

* Added verbosity flag, supports log-level as well, but will remove that in future. (#722)

* changed log-level flag back to verbosity, and updated the conversion script

* supporting both verbosity and log-level, with a message to deprecat log-level

* converted verbosity to a int value

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

* Add : mutex pprof profile (#731)

* add : mutex pprof profile

* rm : remove trace from default pprof profiles

* chg : commit tx logs from info to debug (#673)

* chg : commit tx logs from info to debug

* fix : minor changes

* chg : miner : commitTransactions-stats moved from info to debug

* lint : fix linters

* refactor logging

* miner : chg : UnauthorizedSignerError to debug

* lint : fix lint

* fix : log.Logger interface compatibility

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Add : commit details to bor version (#730)

* add : commit details to bor version

* fix : MAKEFILE

* undo : rm test-txpool-race

* rm : params/build_date

* rm : params/gitbranch and params/gitdate

* core,docs/cli,internal/cli/server: make docs

* builder,docs/cli,packaging: update toml files

* mardizzone/hotfix-snyk: remove vcs build when running snyk (#745)

* Feat : SetMaxPeers (#726)

* init : add admin.setMaxPeers and getMaxPeers

* lint : fix lint

* add : some comments

* Update wiki link (#762)

* Heimdall App implementation (#646)

* added support for miner.recommit flag (#743)

* interrupting commit experiment (#556)

* initial

* delete

* linters

* big benchmark

* benchmark big ints

* delay

* fix generate

* remove debug

* miner : chg : remove noempty check

* fix lints

* consensus/bor: handle unauthorized signer in consensus.Prepare (#651)

* fix : break loop fix

* lint : fix

* lint : more lint fix

* fix : skip TestEmptyWorkEthash and TestEmptyWorkClique

* add : metrics commitInterruptCounter

---------

Co-authored-by: Shivam Sharma <shivam691999@gmail.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* internal/cli: added missing flags (#744)

* minor comment update

* added support for rpc.evmtimeout flag

* added support for vmdebug (EnablePreimageRecording) flag

* added support for jsonrpc.auth.(jwtsecret, addr, port, vhosts) flags

* added support for miner.recommit flag

* added support for gpo.maxheaderhistory and gpo.maxblockhistory flag

* Revert "added support for miner.recommit flag"

This reverts commit fcb722e4bf5bdda23d4c91da40ab95c9023a80c3.

* added pprof related flags (expect --pprof.cpuprofile - Write CPU profile to the given file)

* added support for --dev.gaslimit flag

* added support for --fdlimit flag

* added support for --netrestrict flag

* added support for --nodekey and --nodekeyhex flag

* added support for --vmodule, --log.json, --log.backtrace, and --log.debug flags

* fixed related lint errors

* fix lints from develop (few lints decided to appear from code that was untouched, weird)

* more weird lints from develop

* small precautionary fix

* small bug ;) fix in NetRestrict

* weird lints

* change vmdebug = true to vmdebug = false

* internal/ethapi: set rpc gas cap as default gas limit when creating access list

* add : testcase for CommitInterruptExperiment (#792)

* add : TestCommitInterruptExperimentBor

* lint : fix lint

* chg : add waitgroup

* dev: chg: continue on error when uploading snyk results to GH (#795)

* consensus/bor: revert handle unauthorized signer in consensus.Prepare

* Revert "consensus/bor: handle unauthorized signer in consensus.Prepare (#651)"

This reverts commit 9ce8c7de75a1b5021bb6f2b8086e813c8244b22c.

* eth/downloader/whitelist: skip future chain validation (#796)

* eth/downloader/whitelist: skip future chain validation

* eth/downloader/whitelist: fix tests for future chain import

* Setting up bor to use hosted 18.04 runner as ubuntu provided 18.04 runner is end of life

* Merge qa to develop (#814)

* Adding in Mumbai/Mainnet precursor deb packaging for tests to use during upgrade(iterations to come)

* Added changes per discussion in PR, more changes may be necessary

* Adding prerelease true

* Disabling goreleaser

* Removing README swap file

* change bor_dir and add bor user for v0.3.0 release

* rollback bor user and use root

* metrics: handle equal to separated config flag (#596)

* metrics: handle  based config path

* internal/cli/server: add more context to logs

* use space separated flag and value in bor.service

* fixed static-nodes related buf (os independent) (#598)

* fixed static-nodes related buf (os independent)

* taking static-nodes as input if default not present

* Update default flags (#600)

* internal/cli/server: use geth's default for txpool.pricelimit and add comments

* builder/files: update config.toml for mainnet

* packaging/templates: update defaults for mainnet and mumbai

* internal/cli/server: skip overriding cache

* packaging/templates: update cache value for mainnet

* packaging/templates: update gcmode for archive mumbai node

* metrics: handle nil telemetry config (#601)

* resolve merge conflicts

* update go version in release.yml

* update goversion in makefile

* update Docker login for goreleaser-cross v1.19

* Cleanup for the packager to use git tag in the package profile naming. Added conditional check for directory structure, this is in prep for v0.3.1, as this will create a failure on upgrade path in package due to file exist

* added a toml configuration file with comments describing each flag (#607)

* added a toml configuration file with comments describing each flag

* internal/cli/server: update flag description

* docs/cli: update example config and description of flags

* docs: update new-cli docs

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* Adding of 0.3.0 package changes, control file updates, postinst changes, and packager update

* added ancient datadir flag and toml field, need to decide on default value and update the conversion script

* updated toml files with ancient field

* Add support for new flags in new config.toml, which were present in old config.toml (#612)

* added HTTPTimeouts, and TrieTimeout flag in new tol, from old toml

* added RAW fields for these time.Duration flags

* updated the conversion script to support these extra 4 flags

* removed hcl and json config tests as we are only supporting toml config files

* updated toml files with cache.timeout field

* updated toml files with jsonrpc.timeouts field

* tests/bor: expect a call for latest checkpoint

* tests/bor: expect a call for latest checkpoint

* packaging/templates: update cache values for archive nodes

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* remove unwanted code

* Fix docker publish authentication issue

In gorelease-cross 1.19+, dockerhub authentication will require docker
logion action followed by mounting docker config file. See
https://github.com/goreleaser/goreleaser-cross#github-actions.

* Revert "update Docker login for goreleaser-cross v1.19"

This reverts commit 4d19cf5342.

* Bump version to stable

* Revert "Merge pull request #435 from maticnetwork/POS-553"

This reverts commit 657d262def, reversing
changes made to 88dbfa1c13.

* revert change for release for go1.19

* Add default values to CLI helper and docs

This commit adds default values to CLI helper and docs. When the default value of a string flag, slice string flag, or map string flag is empty, its helper message won't show any default value.

* Add a summary of new CLI in docs

* Updating packager as binutils changed version so that apt-get installs current versions

* Add state pruning to new CLI

* Minor wording fix in prune state description

* Bumping control file versions

* Mainnet Delhi fork

* Set version to stable

* change delhi hardfork block number

* handle future chain import and skip peer drop (#650)

* handle future chain import and skip peer drop

* add block import metric

* params: bump version to v0.3.3-stable

* Bump bor version in control files for v0.3.3 mainnet release

* Added checks to RPC requests and introduced new flags to customise the parameters (#657)

* added a check to reject rpc requests with batch size > the one set using a newly added flag (rpcbatchlimit)

* added a check to reject rpc requests whose result size > the one set using a newly added flag (rpcreturndatalimit)

* updated the config files and docs

* chg : trieTimeout from 60 to 10 mins (#692)

* chg : trieTimeout from 60 to 10 mins

* chg : cache.timout to 10m from 1h in configs

* internal/cli/server : fix : added triesInMemory in config (#691)

* changed version from 0.3.0 to 0.3.4-beta (#693)

* fix nil state-sync issue, increase grpc limit (#695)

* Increase grpc message size limit in pprof

* consensus/bor/bor.go : stateSyncs init fixed [Fix #686]

* eth/filters: handle nil state-sync before notify

* eth/filters: update check

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>

* core, tests/bor: add more tests for state-sync validation (#710)

* core: add get state sync function for tests

* tests/bor: add validation for state sync events post consensus

* Arpit/temp bor sync (#701)

* Increase grpc message size limit in pprof

* ReadBorReceipts improvements

* use internal function

* fix tests

* fetch geth upstread for ReadBorReceiptRLP

* Only query bor receipt when the query index is equal to # tx in block body

This change reduces the frequency of calling ReadBorReceipt and
ReadBorTransaction, which are CPU and db intensive.

* Revert "fetch geth upstread for ReadBorReceiptRLP"

This reverts commit 2e838a6b1313d26674f3a8df4b044e35dcbf35a0.

* Restore ReadBorReceiptRLP

* fix bor receipts

* remove unused

* fix lints

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Revert "chg : trieTimeout from 60 to 10 mins (#692)" (#720)

This reverts commit 241843c7e7.

* Arpit/add execution pool 2 (#719)

* initial

* linters

* linters

* remove timeout

* update pool

* change pool size function

* check nil

* check nil

* fix tests

* Use execution pool from server in all handlers

* simplify things

* test fix

* add support for cli, config

* add to cli and config

* merge base branch

* debug statements

* fix bug

* atomic pointer timeout

* add apis

* update workerpool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* fix tests

* mutex

* refactor flag and value names

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* debug statements

* fix bug

* update workerpool

* atomic pointer timeout

* add apis

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* merge base branch

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* mutex

* fix tests

* Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* Change default size of execution pool to 40

* refactor flag and value names

* fix merge conflicts

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* fix linters

* fix go.mod

* change sec to ms

* change default value for ep timeout

* fix node api calls

* comment setter for ep timeout

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* version change (#721)

* Event based pprof (#732)

* feature

* Save pprof to /tmp

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Cherry-pick changes from develop (#738)

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* add max code init size check in txpool (#739)

* Revert "Event based pprof" and update version (#742)

* Revert "Event based pprof (#732)"

This reverts commit 22fa4033e8.

* params: update version to 0.3.4-beta3

* packaging/templates: update bor version

* internal/ethapi :: Fix : newRPCTransactionFromBlockIndex

* Merge master to qa (#813)

* Merge qa to master (#750)

* Added checks to RPC requests and introduced new flags to customise the parameters (#657)

* added a check to reject rpc requests with batch size > the one set using a newly added flag (rpcbatchlimit)

* added a check to reject rpc requests whose result size > the one set using a newly added flag (rpcreturndatalimit)

* updated the config files and docs

* chg : trieTimeout from 60 to 10 mins (#692)

* chg : trieTimeout from 60 to 10 mins

* chg : cache.timout to 10m from 1h in configs

* internal/cli/server : fix : added triesInMemory in config (#691)

* changed version from 0.3.0 to 0.3.4-beta (#693)

* fix nil state-sync issue, increase grpc limit (#695)

* Increase grpc message size limit in pprof

* consensus/bor/bor.go : stateSyncs init fixed [Fix #686]

* eth/filters: handle nil state-sync before notify

* eth/filters: update check

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>

* core, tests/bor: add more tests for state-sync validation (#710)

* core: add get state sync function for tests

* tests/bor: add validation for state sync events post consensus

* Arpit/temp bor sync (#701)

* Increase grpc message size limit in pprof

* ReadBorReceipts improvements

* use internal function

* fix tests

* fetch geth upstread for ReadBorReceiptRLP

* Only query bor receipt when the query index is equal to # tx in block body

This change reduces the frequency of calling ReadBorReceipt and
ReadBorTransaction, which are CPU and db intensive.

* Revert "fetch geth upstread for ReadBorReceiptRLP"

This reverts commit 2e838a6b1313d26674f3a8df4b044e35dcbf35a0.

* Restore ReadBorReceiptRLP

* fix bor receipts

* remove unused

* fix lints

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Revert "chg : trieTimeout from 60 to 10 mins (#692)" (#720)

This reverts commit 241843c7e7.

* Arpit/add execution pool 2 (#719)

* initial

* linters

* linters

* remove timeout

* update pool

* change pool size function

* check nil

* check nil

* fix tests

* Use execution pool from server in all handlers

* simplify things

* test fix

* add support for cli, config

* add to cli and config

* merge base branch

* debug statements

* fix bug

* atomic pointer timeout

* add apis

* update workerpool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* fix tests

* mutex

* refactor flag and value names

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* debug statements

* fix bug

* update workerpool

* atomic pointer timeout

* add apis

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* merge base branch

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* mutex

* fix tests

* Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* Change default size of execution pool to 40

* refactor flag and value names

* fix merge conflicts

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* fix linters

* fix go.mod

* change sec to ms

* change default value for ep timeout

* fix node api calls

* comment setter for ep timeout

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* version change (#721)

* Event based pprof (#732)

* feature

* Save pprof to /tmp

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Cherry-pick changes from develop (#738)

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* add max code init size check in txpool (#739)

* Revert "Event based pprof" and update version (#742)

* Revert "Event based pprof (#732)"

This reverts commit 22fa4033e8.

* params: update version to 0.3.4-beta3

* packaging/templates: update bor version

* params, packaging/templates: update bor version

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* core, miner: add sub-spans for tracing (#753)

* core, miner: add sub-spans for tracing

* fix linters

* core: add logs for debugging

* core: add more logs to print tdd while reorg

* fix linters

* core: minor fix

* core: remove debug logs

* core: use different span for write block and set head

* core: use internal context for sending traces (#755)

* core: add : impossible reorg block dump (#754)

* add : impossible reorg block dump

* chg : 3 seperate files for impossoble reorg dump

* add : use exportBlocks method and RLP blocks before writing

* chg : small changes

* bump : go version from 1.19 to 1.20.1 (#761)

* Revert "bump : go version from 1.19 to 1.20.1 (#761)"

This reverts commit 4561012af9.

* core/vm: use optimized bigint (#26021)

* Add holiman/big

* Fix linter

* Bump version to v0.3.5

* fix lints from develop (few lints decided to appear from code that was untouched, weird)

* upgrade crypto lib version (#770)

* bump dep : github.com/Masterminds/goutils to v1.1.1 (#769)

* mardizzone/pos-1313: bump crypto dependency (#772)

* dev: chg: bumd net dependency

* dev: chg: bump crypto dependency

* dev: chg: bump crypto dependency

* bump dep : golang.org/x/net to v0.8.0 (#771)

* Verify validator set against local contract on receiving an end-of-sprint block (#768)

* Verify validator set against local contract on receiving an end-of-sprint block

* Fix tests

* Respect error returned by ParseValidators

* Keep going back until a parent block presents

* core/txpool: implement DoS defenses from geth (#778)

* Hotfixes and deps bump (#776)

* dev: chg: bump deps

* internal/cli/server, rpc: lower down http readtimeout to 10s

* dev: chg: get p2p adapter

* dev: chg: lower down jsonrpc readtimeout to 10s

* cherry-pick txpool optimisation changes

* add check for empty lists in txpool (#704)

* add check

* linters

* core, miner: add empty instrumentation name for tracing

---------

Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Evgeny Danilenko <6655321@bk.ru>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* packaging,params: bump to v0.3.6 (#782)

* v0.3.6 fix (#787)

* Fix get validator set in header verifier

* chg : commit tx logs from info to debug (#673)

* chg : commit tx logs from info to debug

* fix : minor changes

* chg : miner : commitTransactions-stats moved from info to debug

* lint : fix linters

* refactor logging

* miner : chg : UnauthorizedSignerError to debug

* lint : fix lint

* fix : log.Logger interface compatibility

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Remove unnecessary sorting of valset from header in verification

* dev: chg: version bump

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: marcello33 <marcelloardizzone@hotmail.it>

* core: improve locks in txpool (#807)

* added a write lock to the txs.filter method and a read lock to the txs.reheap method - both of which are called by Filter during reorg adjustments to txpool

* txpool reorg locks

* more locks

* locks

* linters

* params, packaging: update version for v0.3.8-beta release

* core: add logs in reheap

---------

Co-authored-by: Alex <dalexwatts@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Merge qa to master (#808)

* Added checks to RPC requests and introduced new flags to customise the parameters (#657)

* added a check to reject rpc requests with batch size > the one set using a newly added flag (rpcbatchlimit)

* added a check to reject rpc requests whose result size > the one set using a newly added flag (rpcreturndatalimit)

* updated the config files and docs

* chg : trieTimeout from 60 to 10 mins (#692)

* chg : trieTimeout from 60 to 10 mins

* chg : cache.timout to 10m from 1h in configs

* internal/cli/server : fix : added triesInMemory in config (#691)

* changed version from 0.3.0 to 0.3.4-beta (#693)

* fix nil state-sync issue, increase grpc limit (#695)

* Increase grpc message size limit in pprof

* consensus/bor/bor.go : stateSyncs init fixed [Fix #686]

* eth/filters: handle nil state-sync before notify

* eth/filters: update check

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>

* core, tests/bor: add more tests for state-sync validation (#710)

* core: add get state sync function for tests

* tests/bor: add validation for state sync events post consensus

* Arpit/temp bor sync (#701)

* Increase grpc message size limit in pprof

* ReadBorReceipts improvements

* use internal function

* fix tests

* fetch geth upstread for ReadBorReceiptRLP

* Only query bor receipt when the query index is equal to # tx in block body

This change reduces the frequency of calling ReadBorReceipt and
ReadBorTransaction, which are CPU and db intensive.

* Revert "fetch geth upstread for ReadBorReceiptRLP"

This reverts commit 2e838a6b1313d26674f3a8df4b044e35dcbf35a0.

* Restore ReadBorReceiptRLP

* fix bor receipts

* remove unused

* fix lints

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>

* Revert "chg : trieTimeout from 60 to 10 mins (#692)" (#720)

This reverts commit 241843c7e7.

* Arpit/add execution pool 2 (#719)

* initial

* linters

* linters

* remove timeout

* update pool

* change pool size function

* check nil

* check nil

* fix tests

* Use execution pool from server in all handlers

* simplify things

* test fix

* add support for cli, config

* add to cli and config

* merge base branch

* debug statements

* fix bug

* atomic pointer timeout

* add apis

* update workerpool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* fix tests

* mutex

* refactor flag and value names

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* debug statements

* fix bug

* update workerpool

* atomic pointer timeout

* add apis

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* fix issues

* change params

* fix issues

* fix ipc issue

* remove execution pool from IPC

* revert

* merge base branch

* Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* mutex

* fix tests

* Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bor into arpit/add-execution-pool

* Change default size of execution pool to 40

* refactor flag and value names

* fix merge conflicts

* ordering fix

* refactor flag and value names

* update default ep size to 40

* fix bor start issues

* revert file changes

* fix linters

* fix go.mod

* change sec to ms

* change default value for ep timeout

* fix node api calls

* comment setter for ep timeout

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>

* version change (#721)

* Event based pprof (#732)

* feature

* Save pprof to /tmp

---------

Co-authored-by: Jerry <jerrycgh@gmail.com>

* Cherry-pick changes from develop (#738)

* Check if block is nil to prevent panic (#736)

* miner: use env for tracing instead of block object (#728)

---------

Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* add max code init size check in txpool (#739)

* Revert "Event based pprof" and update version (#742)

* Revert "Event based pprof (#732)"

This reverts commit 22fa4033e8.

* params: update version to 0.3.4-beta3

* packaging/templates: update bor version

* internal/ethapi :: Fix : newRPCTransactionFromBlockIndex

* fix: remove assignment for bor receipt

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>

* Setting up bor to use hosted 18.04 runner as ubuntu provided 18.04 runner is end of life

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: marcello33 <marcelloardizzone@hotmail.it>
Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: Raneet Debnath <35629432+Raneet10@users.noreply.github.com>
Co-authored-by: Alex <dalexwatts@gmail.com>
Co-authored-by: Daniel Jones <djones@polygon.technology>

* core: remove duplicate tests

* miner: use get validators by hash in tests

---------

Co-authored-by: Daniel Jones <djones@polygon.technology>
Co-authored-by: Will Button <wbutton@polygon.technology>
Co-authored-by: Will Button <will@willbutton.com>
Co-authored-by: Daniel Jones <105369507+djpolygon@users.noreply.github.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: marcello33 <marcelloardizzone@hotmail.it>
Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: Raneet Debnath <35629432+Raneet10@users.noreply.github.com>
Co-authored-by: Alex <dalexwatts@gmail.com>

---------

Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: builder90210 <anonbuilder90210@gmail.com>
Co-authored-by: Krishna Upadhyaya <KRISHNAU1604@GMAIL.COM>
Co-authored-by: Daniel Jones <djones@polygon.technology>
Co-authored-by: Will Button <wbutton@polygon.technology>
Co-authored-by: Will Button <will@willbutton.com>
Co-authored-by: Daniel Jones <105369507+djpolygon@users.noreply.github.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Raneet Debnath <35629432+Raneet10@users.noreply.github.com>
Co-authored-by: Didi <github@d10r.net>
Co-authored-by: ephess <e+github@ephess.nz>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Alex <dalexwatts@gmail.com>

* dev: chg: version bump for v0.3.9-beta (#825)

* eth/fetcher: if peers never respond, drop them (#837) (#844)

* dev: chg: bump version to beta-2 for v0.3.9 (#845)

* rm : disable interruptCommit on txsCh select case (#848)

* dev: chg: version bump (#849)

* fix : go-routine leak in commitInterrupt channel (#851)

* fix : go-routine leak in commitInterrupt channel

* fix : fix lint

* rm : remove t.Parallel() from TestGenerateBlockAndImport tests

* fix : minor optimisations in test

* fix : BenchmarkBorMining

* dev: chg: beta version bump (#853)

* dev: chg: bump version to stable

* dev: chg: contracts branch

* dev: fix: linter

* dev: chg: update templum/govulncheck-action to fix execution

---------

Co-authored-by: SHIVAM SHARMA <shivam691999@gmail.com>
Co-authored-by: Pratik Patil <pratikspatil024@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Jerry <jerrycgh@gmail.com>
Co-authored-by: Daniil <daniil.melnik@chainstack.com>
Co-authored-by: Arpit Temani <temaniarpit27@gmail.com>
Co-authored-by: Evgeny Danienko <6655321@bk.ru>
Co-authored-by: Dmitry <46797839+dkeysil@users.noreply.github.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Raneet Debnath <raneetdebnath10@gmail.com>
Co-authored-by: Raneet Debnath <35629432+Raneet10@users.noreply.github.com>
Co-authored-by: Alex <dalexwatts@gmail.com>
Co-authored-by: Daniel Jones <djones@polygon.technology>
Co-authored-by: builder90210 <anonbuilder90210@gmail.com>
Co-authored-by: Krishna Upadhyaya <KRISHNAU1604@GMAIL.COM>
Co-authored-by: Will Button <wbutton@polygon.technology>
Co-authored-by: Will Button <will@willbutton.com>
Co-authored-by: Daniel Jones <105369507+djpolygon@users.noreply.github.com>
Co-authored-by: Didi <github@d10r.net>
Co-authored-by: ephess <e+github@ephess.nz>
This commit is contained in:
marcello33 2023-05-10 22:52:14 +02:00 committed by GitHub
parent 2e3b77dce4
commit 3f71e3b676
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
98 changed files with 4140 additions and 870 deletions

View file

@ -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).

View file

@ -1,11 +1,15 @@
defaultStake: 10000
defaultFee: 2000
borChainId: "15001"
borChainId: 15001
heimdallChainId: heimdall-15001
contractsBranch: jc/v0.3.1-backport
sprintSize: 64
blockNumber: '0'
blockTime: '2'
contractsBranch: mardizzone/node-16
genesisContractsBranch: master
sprintSize:
- '64'
blockNumber:
- '0'
blockTime:
- '2'
numOfValidators: 3
numOfNonValidators: 0
ethURL: http://ganache:9545
@ -13,3 +17,6 @@ ethHostUser: ubuntu
devnetType: docker
borDockerBuildContext: "../../bor"
heimdallDockerBuildContext: "https://github.com/maticnetwork/heimdall.git#develop"
sprintSizeBlockNumber:
- '0'
numOfArchiveNodes: 0

View file

@ -8,11 +8,16 @@ Please provide a detailed description of what was done in this PR
- [ ] Hotfix (change that solves an urgent issue, and requires immediate attention)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality)
- [ ] Changes only for a subset of nodes
# Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
# Nodes audience
In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)
# Checklist
- [ ] I have added at least 2 reviewer or the whole pos-v1 team

View file

@ -104,7 +104,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: maticnetwork/matic-cli
ref: arpit/pos-655-2
ref: master
path: matic-cli
- name: Install dependencies on Linux
@ -119,7 +119,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '10.17.0'
node-version: '16.17.1'
cache: 'npm'
cache-dependency-path: |
matic-cli/package-lock.json
@ -142,11 +142,11 @@ jobs:
bash docker-heimdall-start-all.sh
bash docker-bor-setup.sh
bash docker-bor-start-all.sh
sleep 120 && bash ganache-deployment-bor.sh
sleep 120 && bash ganache-deployment-sync.sh
sleep 120
docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'admin.peers'"
docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'eth.blockNumber'"
cd -
timeout 2m bash bor/integration-tests/bor_health.sh
cd -
bash ganache-deployment-bor.sh
bash ganache-deployment-sync.sh
- name: Run smoke tests
run: |

67
.github/workflows/security-ci.yml vendored Normal file
View file

@ -0,0 +1,67 @@
name: Security CI
on: [ push, pull_request ]
jobs:
snyk:
name: Snyk and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
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
snyk-code:
name: Snyk Code and Publish
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout Source
uses: actions/checkout@master
- name: Run Snyk SAST to check for code vulnerabilities
uses: snyk/actions/golang@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --org=${{ secrets.SNYK_ORG }} --sarif-file-output=snyk.sarif
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
govuln:
name: Run govuln check and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Running govulncheck
uses: Templum/govulncheck-action@v0.10.1
continue-on-error: true
env:
DEBUG: "true"
with:
go-version: 1.19
vulncheck-version: latest
package: ./...
github-token: ${{ secrets.GITHUB_TOKEN }}
fail-on-vuln: true
- name: Upload govulncheck report
uses: actions/upload-artifact@v3
with:
name: raw-report
path: raw-report.json

View 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 }}

2
.gitignore vendored
View file

@ -54,4 +54,6 @@ profile.cov
dist
.dccache
*.csv

View file

@ -30,7 +30,7 @@ linters:
- gocognit
- gofmt
# - gomnd
- gomoddirectives
# - gomoddirectives
- gosec
- makezero
- nestif

41
.snyk Normal file
View file

@ -0,0 +1,41 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
'snyk:lic:golang:github.com:karalabe:usb:LGPL-3.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:06:37.028Z
'snyk:lic:golang:github.com:mitchellh:cli:MPL-2.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:07:42.661Z
'snyk:lic:golang:github.com:hashicorp:hcl:v2:MPL-2.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:09:08.112Z
'snyk:lic:golang:github.com:hashicorp:go-multierror:MPL-2.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:09:14.673Z
'snyk:lic:golang:github.com:hashicorp:go-bexpr:MPL-2.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:09:21.843Z
'snyk:lic:golang:github.com:hashicorp:errwrap:MPL-2.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:09:28.257Z
'snyk:lic:golang:github.com:ethereum:go-ethereum:LGPL-3.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:09:35.273Z
'snyk:lic:golang:github.com:maticnetwork:polyproto:GPL-3.0':
- '*':
reason: 'As open source org, we have no issues with licenses'
created: 2022-11-11T08:09:41.635Z
'SNYK-GOLANG-GOLANGORGXNETHTTP2-3160322':
- '*':
reason: 'grpc working on a release to fix the issue'
created: 2022-12-12T06:50:00.000Z
patch: {}

View file

@ -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."

View file

@ -56,7 +56,7 @@ We believe one of the things that makes Polygon special is its coherent design a
### Building the source
- Building `bor` requires both a Go (version 1.14 or later) and a C compiler. You can install
- Building `bor` requires both a Go (version 1.19 or later) and a C compiler. You can install
them using your favourite package manager. Once the dependencies are installed, run
```shell
@ -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]"

View file

@ -1,175 +1,14 @@
# Security Policy
# Polygon Technology Security Information
## Supported Versions
## Link to vulnerability disclosure details (Bug Bounty)
- Websites and Applications: https://hackerone.com/polygon-technology
- Smart Contracts: https://immunefi.com/bounty/polygon
Please see [Releases](https://github.com/ethereum/go-ethereum/releases). We recommend using the [most recently released version](https://github.com/ethereum/go-ethereum/releases/latest).
## Languages that our team speaks and understands.
Preferred-Languages: en
## Audit reports
## Security-related job openings at Polygon.
https://polygon.technology/careers
Audit reports are published in the `docs` folder: https://github.com/ethereum/go-ethereum/tree/master/docs/audits
| Scope | Date | Report Link |
| ------- | ------- | ----------- |
| `geth` | 20170425 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2017-04-25_Geth-audit_Truesec.pdf) |
| `clef` | 20180914 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2018-09-14_Clef-audit_NCC.pdf) |
| `Discv5` | 20191015 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2019-10-15_Discv5_audit_LeastAuthority.pdf) |
| `Discv5` | 20200124 | [pdf](https://github.com/ethereum/go-ethereum/blob/master/docs/audits/2020-01-24_DiscV5_audit_Cure53.pdf) |
## Reporting a Vulnerability
**Please do not file a public ticket** mentioning the vulnerability.
To find out how to disclose a vulnerability in Ethereum visit [https://bounty.ethereum.org](https://bounty.ethereum.org) or email bounty@ethereum.org. Please read the [disclosure page](https://github.com/ethereum/go-ethereum/security/advisories?state=published) for more information about publicly disclosed security vulnerabilities.
Use the built-in `geth version-check` feature to check whether the software is affected by any known vulnerability. This command will fetch the latest [`vulnerabilities.json`](https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities.json) file which contains known security vulnerabilities concerning `geth`, and cross-check the data against its own version number.
The following key may be used to communicate sensitive information to developers.
Fingerprint: `AE96 ED96 9E47 9B00 84F3 E17F E88D 3334 FA5F 6A0A`
```
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.6
Comment: Hostname: pgp.mit.edu
mQINBFgl3tgBEAC8A1tUBkD9YV+eLrOmtgy+/JS/H9RoZvkg3K1WZ8IYfj6iIRaYneAk3Bp1
82GUPVz/zhKr2g0tMXIScDR3EnaDsY+Qg+JqQl8NOG+Cikr1nnkG2on9L8c8yiqry1ZTCmYM
qCa2acTFqnyuXJ482aZNtB4QG2BpzfhW4k8YThpegk/EoRUim+y7buJDtoNf7YILlhDQXN8q
lHB02DWOVUihph9tUIFsPK6BvTr9SIr/eG6j6k0bfUo9pexOn7LS4SojoJmsm/5dp6AoKlac
48cZU5zwR9AYcq/nvkrfmf2WkObg/xRdEvKZzn05jRopmAIwmoC3CiLmqCHPmT5a29vEob/y
PFE335k+ujjZCPOu7OwjzDk7M0zMSfnNfDq8bXh16nn+ueBxJ0NzgD1oC6c2PhM+XRQCXCho
yI8vbfp4dGvCvYqvQAE1bWjqnumZ/7vUPgZN6gDfiAzG2mUxC2SeFBhacgzDvtQls+uuvm+F
nQOUgg2Hh8x2zgoZ7kqV29wjaUPFREuew7e+Th5BxielnzOfVycVXeSuvvIn6cd3g/s8mX1c
2kLSXJR7+KdWDrIrR5Az0kwAqFZt6B6QTlDrPswu3mxsm5TzMbny0PsbL/HBM+GZEZCjMXxB
8bqV2eSaktjnSlUNX1VXxyOxXA+ZG2jwpr51egi57riVRXokrQARAQABtDRFdGhlcmV1bSBG
b3VuZGF0aW9uIEJ1ZyBCb3VudHkgPGJvdW50eUBldGhlcmV1bS5vcmc+iQIcBBEBCAAGBQJa
FCY6AAoJEHoMA3Q0/nfveH8P+gJBPo9BXZL8isUfbUWjwLi81Yi70hZqIJUnz64SWTqBzg5b
mCZ69Ji5637THsxQetS2ARabz0DybQ779FhD/IWnqV9T3KuBM/9RzJtuhLzKCyMrAINPMo28
rKWdunHHarpuR4m3tL2zWJkle5QVYb+vkZXJJE98PJw+N4IYeKKeCs2ubeqZu636GA0sMzzB
Jn3m/dRRA2va+/zzbr6F6b51ynzbMxWKTsJnstjC8gs8EeI+Zcd6otSyelLtCUkk3h5sTvpV
Wv67BNSU0BYsMkxyFi9PUyy07Wixgeas89K5jG1oOtDva/FkpRHrTE/WA5OXDRcLrHJM+SwD
CwqcLQqJd09NxwUW1iKeBmPptTiOGu1Gv2o7aEyoaWrHRBO7JuYrQrj6q2B3H1Je0zjAd2qt
09ni2bLwLn4LA+VDpprNTO+eZDprv09s2oFSU6NwziHybovu0y7X4pADGkK2evOM7c86PohX
QRQ1M1T16xLj6wP8/Ykwl6v/LUk7iDPXP3GPILnh4YOkwBR3DsCOPn8098xy7FxEELmupRzt
Cj9oC7YAoweeShgUjBPzb+nGY1m6OcFfbUPBgFyMMfwF6joHbiVIO+39+Ut2g2ysZa7KF+yp
XqVDqyEkYXsOLb25OC7brt8IJEPgBPwcHK5GNag6RfLxnQV+iVZ9KNH1yQgSiQI+BBMBAgAo
AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAUCWglh+gUJBaNgWAAKCRDojTM0+l9qCgQ2
D/4udJpV4zGIZW1yNaVvtd3vfKsTLi7GIRJLUBqVb2Yx/uhnN8jTl/tAhCVosCQ1pzvi9kMl
s8qO1vu2kw5EWFFkwK96roI8pTql3VIjwhRVQrCkR7oAk/eUd1U/nt2q6J4UTYeVgqbq4dsI
ZZTRyPJMD667YpuAIcaah+w9j/E5xksYQdMeprnDrQkkBCb4FIMqfDzBPKvEa8DcQr949K85
kxhr6LDq9i5l4Egxt2JdH8DaR4GLca6+oHy0MyPs/bZOsfmZUObfM2oZgPpqYM96JanhzO1j
dpnItyBii2pc+kNx5nMOf4eikE/MBv+WUJ0TttWzApGGmFUzDhtuEvRH9NBjtJ/pMrYspIGu
O/QNY5KKOKQTvVIlwGcm8dTsSkqtBDSUwZyWbfKfKOI1/RhM9dC3gj5/BOY57DYYV4rdTK01
ZtYjuhdfs2bhuP1uF/cgnSSZlv8azvf7Egh7tHPnYxvLjfq1bJAhCIX0hNg0a81/ndPAEFky
fSko+JPKvdSvsUcSi2QQ4U2HX//jNBjXRfG4F0utgbJnhXzEckz6gqt7wSDZH2oddVuO8Ssc
T7sK+CdXthSKnRyuI+sGUpG+6glpKWIfYkWFKNZWuQ+YUatY3QEDHXTIioycSmV8p4d/g/0S
V6TegidLxY8bXMkbqz+3n6FArRffv5MH7qt3cYkCPgQTAQIAKAUCWCXhOwIbAwUJAeEzgAYL
CQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQ6I0zNPpfagrN/w/+Igp3vtYdNunikw3yHnYf
Jkm0MmaMDUM9mtsaXVN6xb9n25N3Xa3GWCpmdsbYZ8334tI/oQ4/NHq/bEI5WFH5F1aFkMkm
5AJVLuUkipCtmCZ5NkbRPJA9l0uNUUE6uuFXBhf4ddu7jb0jMetRF/kifJHVCCo5fISUNhLp
7bwcWq9qgDQNZNYMOo4s9WX5Tl+5x4gTZdd2/cAYt49h/wnkw+huM+Jm0GojpLqIQ1jZiffm
otf5rF4L+JhIIdW0W4IIh1v9BhHVllXw+z9oj0PALstT5h8/DuKoIiirFJ4DejU85GR1KKAS
DeO19G/lSpWj1rSgFv2N2gAOxq0X+BbQTua2jdcY6JpHR4H1JJ2wzfHsHPgDQcgY1rGlmjVF
aqU73WV4/hzXc/HshK/k4Zd8uD4zypv6rFsZ3UemK0aL2zXLVpV8SPWQ61nS03x675SmDlYr
A80ENfdqvsn00JQuBVIv4Tv0Ub7NfDraDGJCst8rObjBT/0vnBWTBCebb2EsnS2iStIFkWdz
/WXs4L4Yzre1iJwqRjiuqahZR5jHsjAUf2a0O29HVHE7zlFtCFmLPClml2lGQfQOpm5klGZF
rmvus+qZ9rt35UgWHPZezykkwtWrFOwspwuCWaPDto6tgbRJZ4ftitpdYYM3dKW9IGJXBwrt
BQrMsu+lp0vDF+yJAlUEEwEIAD8CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAFiEErpbt
lp5HmwCE8+F/6I0zNPpfagoFAmEAEJwFCQycmLgACgkQ6I0zNPpfagpWoBAAhOcbMAUw6Zt0
GYzT3sR5/c0iatezPzXEXJf9ebzR8M5uPElXcxcnMx1dvXZmGPXPJKCPa99WCu1NZYy8F+Wj
GTOY9tfIkvSxhys1p/giPAmvid6uQmD+bz7ivktnyzCkDWfMA+l8lsCSEqVlaq6y5T+a6SWB
6TzC2S0MPb/RrC/7DpwyrNYWumvyVJh09adm1Mw/UGgst/sZ8eMaRYEd3X0yyT1CBpX4zp2E
qQj9IEOTizvzv1x2jkHe5ZUeU3+nTBNlhSA+WFHUi0pfBdo2qog3Mv2EC1P2qMKoSdD5tPbA
zql1yKoHHnXOMsqdftGwbiv2sYXWvrYvmaCd3Ys/viOyt3HOy9uV2ZEtBd9Yqo9x/NZj8QMA
nY5k8jjrIXbUC89MqrJsQ6xxWQIg5ikMT7DvY0Ln89ev4oJyVvwIQAwCm4jUzFNm9bZLYDOP
5lGJCV7tF5NYVU7NxNM8vescKc40mVNK/pygS5mxhK9QYOUjZsIv8gddrl1TkqrFMuxFnTyN
WvzE29wFu/n4N1DkF+ZBqS70SlRvB+Hjz5LrDgEzF1Wf1eA/wq1dZbvMjjDVIc2VGlYp8Cp2
8ob23c1seTtYXTNYgSR5go4EpH+xi+bIWv01bQQ9xGwBbT5sm4WUeWOcmX4QewzLZ3T/wK9+
N4Ye/hmU9O34FwWJOY58EIe0OUV0aGVyZXVtIEZvdW5kYXRpb24gU2VjdXJpdHkgVGVhbSA8
c2VjdXJpdHlAZXRoZXJldW0ub3JnPokCHAQRAQgABgUCWhQmOgAKCRB6DAN0NP5372LSEACT
wZk1TASWZj5QF7rmkIM1GEyBxLE+PundNcMgM9Ktj1315ED8SmiukNI4knVS1MY99OIgXhQl
D1foF2GKdTomrwwC4012zTNyUYCY60LnPZ6Z511HG+rZgZtZrbkz0IiUpwAlhGQND77lBqem
J3K+CFX2XpDA/ojui/kqrY4cwMT5P8xPJkwgpRgw/jgdcZyJTsXdHblV9IGU4H1Vd1SgcfAf
Db3YxDUlBtzlp0NkZqxen8irLIXUQvsfuIfRUbUSkWoK/n3U/gOCajAe8ZNF07iX4OWjH4Sw
NDA841WhFWcGE+d8+pfMVfPASU3UPKH72uw86b2VgR46Av6voyMFd1pj+yCA+YAhJuOpV4yL
QaGg2Z0kVOjuNWK/kBzp1F58DWGh4YBatbhE/UyQOqAAtR7lNf0M3QF9AdrHTxX8oZeqVW3V
Fmi2mk0NwCIUv8SSrZr1dTchp04OtyXe5gZBXSfzncCSRQIUDC8OgNWaOzAaUmK299v4bvye
uSCxOysxC7Q1hZtjzFPKdljS81mRlYeUL4fHlJU9R57bg8mriSXLmn7eKrSEDm/EG5T8nRx7
TgX2MqJs8sWFxD2+bboVEu75yuFmZ//nmCBApAit9Hr2/sCshGIEpa9MQ6xJCYUxyqeJH+Cc
Aja0UfXhnK2uvPClpJLIl4RE3gm4OXeE1IkCPgQTAQIAKAIbAwYLCQgHAwIGFQgCCQoLBBYC
AwECHgECF4AFAloJYfoFCQWjYFgACgkQ6I0zNPpfagr4MQ//cfp3GSbSG8dkqgctW67Fy7cQ
diiTmx3cwxY+tlI3yrNmdjtrIQMzGdqtY6LNz7aN87F8mXNf+DyVHX9+wd1Y8U+E+hVCTzKC
sefUfxTz6unD9TTcGqaoelgIPMn4IiKz1RZE6eKpfDWe6q78W1Y6x1bE0qGNSjqT/QSxpezF
E/OAm/t8RRxVxDtqz8LfH2zLea5zaC+ADj8EqgY9vX9TQa4DyVV8MgOyECCCadJQCD5O5hIA
B2gVDWwrAUw+KBwskXZ7Iq4reJTKLEmt5z9zgtJ/fABwaCFt66ojwg0/RjbO9cNA3ZwHLGwU
C6hkb6bRzIoZoMfYxVS84opiqf/Teq+t/XkBYCxbSXTJDA5MKjcVuw3N6YKWbkGP/EfQThe7
BfAKFwwIw5YmsWjHK8IQj6R6hBxzTz9rz8y1Lu8EAAFfA7OJKaboI2qbOlauH98OuOUmVtr1
TczHO+pTcgWVN0ytq2/pX5KBf4vbmULNbg3HFRq+gHx8CW+jyXGkcqjbgU/5FwtDxeqRTdGJ
SyBGNBEU6pBNolyynyaKaaJjJ/biY27pvjymL5rlz95BH3Dn16Z4RRmqwlT6eq/wFYginujg
CCE1icqOSE+Vjl7V8tV8AcgANkXKdbBE+Q8wlKsGI/kS1w4XFAYcaNHFT8qNeS8TSFXFhvU8
HylYxO79t56JAj4EEwECACgFAlgl3tgCGwMFCQHhM4AGCwkIBwMCBhUIAgkKCwQWAgMBAh4B
AheAAAoJEOiNMzT6X2oKmUMP/0hnaL6bVyepAq2LIdvIUbHfagt/Oo/KVfZs4bkM+xJOitJR
0kwZV9PTihXFdzhL/YNWc2+LtEBtKItqkJZKmWC0E6OPXGVuU6hfFPebuzVccYJfm0Q3Ej19
VJI9Uomf59Bpak8HYyEED7WVQjoYn7XVPsonwus/9+LDX+c5vutbrUdbjga3KjHbewD93X4O
wVVoXyHEmU2Plyg8qvzFbNDylCWO7N2McO6SN6+7DitGZGr2+jO+P2R4RT1cnl2V3IRVcWZ0
OTspPSnRGVr2fFiHN/+v8G/wHPLQcJZFvYPfUGNdcYbTmhWdiY0bEYXFiNrgzCCsyad7eKUR
WN9QmxqmyqLDjUEDJCAh19ES6Vg3tqGwXk+uNUCoF30ga0TxQt6UXZJDEQFAGeASQ/RqE/q1
EAuLv8IGM8o7IqKO2pWfLuqsY6dTbKBwDzz9YOJt7EOGuPPQbHxaYStTushZmJnm7hi8lhVG
jT7qsEJdE95Il+I/mHWnXsCevaXjZugBiyV9yvOq4Hwwe2s1zKfrnQ4u0cadvGAh2eIqum7M
Y3o6nD47aJ3YmEPX/WnhI56bACa2GmWvUwjI4c0/er3esSPYnuHnM9L8Am4qQwMVSmyU80tC
MI7A9e13Mvv+RRkYFLJ7PVPdNpbW5jqX1doklFpKf6/XM+B+ngYneU+zgCUBiQJVBBMBCAA/
AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgBYhBK6W7ZaeR5sAhPPhf+iNMzT6X2oKBQJh
ABCQBQkMnJi4AAoJEOiNMzT6X2oKAv0P+gJ3twBp5efNWyVLcIg4h4cOo9uD0NPvz8/fm2gX
FoOJL3MeigtPuSVfE9kuTaTuRbArzuFtdvH6G/kcRQvOlO4zyiIRHCk1gDHoIvvtn6RbRhVm
/Xo4uGIsFHst7n4A7BjicwEK5Op6Ih5Hoq19xz83YSBgBVk2fYEJIRyJiKFbyPjH0eSYe8v+
Ra5/F85ugLx1P6mMVkW+WPzULns89riW7BGTnZmXFHZp8nO2pkUlcI7F3KRG7l4kmlC50ox6
DiG/6AJCVulbAClky9C68TmJ/R1RazQxU/9IqVywsydq66tbJQbm5Z7GEti0C5jjbSRJL2oT
1xC7Rilr85PMREkPL3vegJdgj5PKlffZ/MocD/0EohiQ7wFpejFD4iTljeh0exRUwCRb6655
9ib34JSQgU8Hl4JJu+mEgd9v0ZHD0/1mMD6fnAR84zca+O3cdASbnQmzTOKcGzLIrkE8TEnU
+2UZ8Ol7SAAqmBgzY1gKOilUho6dkyCAwNL+QDpvrITDPLEFPsjyB/M2KudZSVEn+Rletju1
qkMW31qFMNlsbwzMZw+0USeGcs31Cs0B2/WQsro99CExlhS9auUFkmoVjJmYVTIYOM0zuPa4
OyGspqPhRu5hEsmMDPDWD7Aad5k4GTqogQNnuKyRliZjXXrDZqFD5nfsJSL8Ky/sJGEMuQIN
BFgl3tgBEACbgq6HTN5gEBi0lkD/MafInmNi+59U5gRGYqk46WlfRjhHudXjDpgD0lolGb4h
YontkMaKRlCg2Rvgjvk3Zve0PKWjKw7gr8YBa9fMFY8BhAXI32OdyI9rFhxEZFfWAfwKVmT1
9BdeAQRFvcfd+8w8f1XVc+zddULMJFBTr+xKDlIRWwTkdLPQeWbjo0eHl/g4tuLiLrTxVbnj
26bf+2+1DbM/w5VavzPrkviHqvKe/QP/gay4QDViWvFgLb90idfAHIdsPgflp0VDS5rVHFL6
D73rSRdIRo3I8c8mYoNjSR4XDuvgOkAKW9LR3pvouFHHjp6Fr0GesRbrbb2EG66iPsR99MQ7
FqIL9VMHPm2mtR+XvbnKkH2rYyEqaMbSdk29jGapkAWle4sIhSKk749A4tGkHl08KZ2N9o6G
rfUehP/V2eJLaph2DioFL1HxRryrKy80QQKLMJRekxigq8greW8xB4zuf9Mkuou+RHNmo8Pe
bHjFstLigiD6/zP2e+4tUmrT0/JTGOShoGMl8Rt0VRxdPImKun+4LOXbfOxArOSkY6i35+gs
gkkSy1gTJE0BY3S9auT6+YrglY/TWPQ9IJxWVOKlT+3WIp5wJu2bBKQ420VLqDYzkoWytel/
bM1ACUtipMiIVeUs2uFiRjpzA1Wy0QHKPTdSuGlJPRrfcQARAQABiQIlBBgBAgAPAhsMBQJa
CWIIBQkFo2BYAAoJEOiNMzT6X2oKgSwQAKKs7BGF8TyZeIEO2EUK7R2bdQDCdSGZY06tqLFg
3IHMGxDMb/7FVoa2AEsFgv6xpoebxBB5zkhUk7lslgxvKiSLYjxfNjTBltfiFJ+eQnf+OTs8
KeR51lLa66rvIH2qUzkNDCCTF45H4wIDpV05AXhBjKYkrDCrtey1rQyFp5fxI+0IQ1UKKXvz
ZK4GdxhxDbOUSd38MYy93nqcmclGSGK/gF8XiyuVjeifDCM6+T1NQTX0K9lneidcqtBDvlgg
JTLJtQPO33o5EHzXSiud+dKth1uUhZOFEaYRZoye1YE3yB0TNOOE8fXlvu8iuIAMBSDL9ep6
sEIaXYwoD60I2gHdWD0lkP0DOjGQpi4ouXM3Edsd5MTi0MDRNTij431kn8T/D0LCgmoUmYYM
BgbwFhXr67axPZlKjrqR0z3F/Elv0ZPPcVg1tNznsALYQ9Ovl6b5M3cJ5GapbbvNWC7yEE1q
Scl9HiMxjt/H6aPastH63/7wcN0TslW+zRBy05VNJvpWGStQXcngsSUeJtI1Gd992YNjUJq4
/Lih6Z1TlwcFVap+cTcDptoUvXYGg/9mRNNPZwErSfIJ0Ibnx9wPVuRN6NiCLOt2mtKp2F1p
M6AOQPpZ85vEh6I8i6OaO0w/Z0UHBwvpY6jDUliaROsWUQsqz78Z34CVj4cy6vPW2EF4iQIl
BBgBAgAPBQJYJd7YAhsMBQkB4TOAAAoJEOiNMzT6X2oKTjgP/1ojCVyGyvHMLUgnX0zwrR5Q
1M5RKFz6kHwKjODVLR3Isp8I935oTQt3DY7yFDI4t0GqbYRQMtxcNEb7maianhK2trCXfhPs
6/L04igjDf5iTcmzamXN6xnh5xkz06hZJJCMuu4MvKxC9MQHCVKAwjswl/9H9JqIBXAY3E2l
LpX5P+5jDZuPxS86p3+k4Rrdp9KTGXjiuEleM3zGlz5BLWydqovOck7C2aKh27ETFpDYY0z3
yQ5AsPJyk1rAr0wrH6+ywmwWlzuQewavnrLnJ2M8iMFXpIhyHeEIU/f7o8f+dQk72rZ9CGzd
cqig2za/BS3zawZWgbv2vB2elNsIllYLdir45jxBOxx2yvJvEuu4glz78y4oJTCTAYAbMlle
5gVdPkVcGyvvVS9tinnSaiIzuvWrYHKWll1uYPm2Q1CDs06P5I7bUGAXpgQLUh/XQguy/0sX
GWqW3FS5JzP+XgcR/7UASvwBdHylubKbeqEpB7G1s+m+8C67qOrc7EQv3Jmy1YDOkhEyNig1
rmjplLuir3tC1X+D7dHpn7NJe7nMwFx2b2MpMkLA9jPPAGPp/ekcu5sxCe+E0J/4UF++K+CR
XIxgtzU2UJfp8p9x+ygbx5qHinR0tVRdIzv3ZnGsXrfxnWfSOaB582cU3VRN9INzHHax8ETa
QVDnGO5uQa+FiQI8BBgBCAAmAhsMFiEErpbtlp5HmwCE8+F/6I0zNPpfagoFAmEAELYFCQyc
mN4ACgkQ6I0zNPpfagoqAQ/+MnDjBx8JWMd/XjeFoYKx/Oo0ntkInV+ME61JTBls4PdVk+TB
8PWZdPQHw9SnTvRmykFeznXIRzuxkowjrZYXdPXBxY2b1WyD5V3Ati1TM9vqpaR4osyPs2xy
I4dzDssh9YvUsIRL99O04/65lGiYeBNuACq+yK/7nD/ErzBkDYJHhMCdadbVWUACxvVIDvro
yQeVLKMsHqMCd8BTGD7VDs79NXskPnN77pAFnkzS4Z2b8SNzrlgTc5pUiuZHIXPIpEYmsYzh
ucTU6uI3dN1PbSFHK5tG2pHb4ZrPxY3L20Dgc2Tfu5/SDApZzwvvKTqjdO891MEJ++H+ssOz
i4O1UeWKs9owWttan9+PI47ozBSKOTxmMqLSQ0f56Np9FJsV0ilGxRKfjhzJ4KniOMUBA7mP
+m+TmXfVtthJred4sHlJMTJNpt+sCcT6wLMmyc3keIEAu33gsJj3LTpkEA2q+V+ZiP6Q8HRB
402ITklABSArrPSE/fQU9L8hZ5qmy0Z96z0iyILgVMLuRCCfQOMWhwl8yQWIIaf1yPI07xur
epy6lH7HmxjjOR7eo0DaSxQGQpThAtFGwkWkFh8yki8j3E42kkrxvEyyYZDXn2YcI3bpqhJx
PtwCMZUJ3kc/skOrs6bOI19iBNaEoNX5Dllm7UHjOgWNDQkcCuOCxucKano=
=arte
-----END PGP PUBLIC KEY BLOCK------
```
## Polygon security contact details
security@polygon.technology

View file

@ -1959,6 +1959,7 @@ var bindTests = []struct {
// Tests that packages generated by the binder can be successfully compiled and
// the requested tester run against it.
func TestGolangBindings(t *testing.T) {
t.Skip("skipping test until we can fix it")
// Skip the test if no Go command can be found
gocmd := runtime.GOROOT() + "/bin/go"
if !common.FileExist(gocmd) {

View file

@ -24,19 +24,18 @@ Usage: go run build/ci.go <command> <command flags/arguments>
Available commands are:
install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
test [ -coverage ] [ packages... ] -- runs the tests
lint -- runs certain pre-selected linters
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts
importkeys -- imports signing keys from env
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
nsis -- creates a Windows NSIS installer
aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive
xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework
purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore
install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
test [ -coverage ] [ packages... ] -- runs the tests
lint -- runs certain pre-selected linters
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts
importkeys -- imports signing keys from env
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
nsis -- creates a Windows NSIS installer
aar [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an Android archive
xcode [ -local ] [ -sign key-id ] [-deploy repo] [ -upload dest ] -- creates an iOS XCode framework
purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore
For all commands, -n prevents execution of external programs (dry run mode).
*/
package main
@ -59,6 +58,7 @@ import (
"time"
"github.com/cespare/cp"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/signify"
"github.com/ethereum/go-ethereum/internal/build"
"github.com/ethereum/go-ethereum/params"
@ -674,21 +674,27 @@ func doDebianSource(cmdline []string) {
meta := newDebMetadata(distro, goboot, *signer, env, now, pkg.Name, pkg.Version, pkg.Executables)
pkgdir := stageDebianSource(*workdir, meta)
canonicalPath, err := common.VerifyPath(pkgdir)
if err != nil {
fmt.Println("path not verified: " + err.Error())
return
}
// Add Go source code
if err := build.ExtractArchive(gobundle, pkgdir); err != nil {
if err := build.ExtractArchive(gobundle, canonicalPath); err != nil {
log.Fatalf("Failed to extract Go sources: %v", err)
}
if err := os.Rename(filepath.Join(pkgdir, "go"), filepath.Join(pkgdir, ".go")); err != nil {
if err := os.Rename(filepath.Join(canonicalPath, "go"), filepath.Join(canonicalPath, ".go")); err != nil {
log.Fatalf("Failed to rename Go source folder: %v", err)
}
// Add all dependency modules in compressed form
os.MkdirAll(filepath.Join(pkgdir, ".mod", "cache"), 0755)
if err := cp.CopyAll(filepath.Join(pkgdir, ".mod", "cache", "download"), filepath.Join(*workdir, "modgopath", "pkg", "mod", "cache", "download")); err != nil {
os.MkdirAll(filepath.Join(canonicalPath, ".mod", "cache"), 0755)
if err := cp.CopyAll(filepath.Join(canonicalPath, ".mod", "cache", "download"), filepath.Join(*workdir, "modgopath", "pkg", "mod", "cache", "download")); err != nil {
log.Fatalf("Failed to copy Go module dependencies: %v", err)
}
// Run the packaging and upload to the PPA
debuild := exec.Command("debuild", "-S", "-sa", "-us", "-uc", "-d", "-Zxz", "-nc")
debuild.Dir = pkgdir
debuild.Dir = canonicalPath
build.MustRun(debuild)
var (

View file

@ -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"
@ -15,9 +16,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
@ -25,6 +32,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"]
@ -60,13 +70,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
@ -93,6 +106,11 @@ syncmode = "full"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -101,6 +119,8 @@ syncmode = "full"
[gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
ignoreprice = "30000000000"
@ -134,6 +154,7 @@ syncmode = "full"
# txlookuplimit = 2350000
# triesinmemory = 128
# timeout = "1h0m0s"
# fdlimit = 0
[accounts]
# allow-insecure-unlock = true
@ -148,3 +169,11 @@ syncmode = "full"
# [developer]
# dev = false
# period = 0
# gaslimit = 11500000
# [pprof]
# pprof = false
# port = 6060
# addr = "127.0.0.1"
# memprofilerate = 524288
# blockprofilerate = 0

View file

@ -162,9 +162,16 @@ func main() {
}
}
// Load up the account key and decrypt its password
blob, err := ioutil.ReadFile(*accPassFlag)
canonicalPath, err := common.VerifyPath(*accPassFlag)
if err != nil {
log.Crit("Failed to read account password contents", "file", *accPassFlag, "err", err)
fmt.Println("path not verified: " + err.Error())
return
}
blob, err := ioutil.ReadFile(canonicalPath)
if err != nil {
log.Crit("Failed to read account password contents", "file", canonicalPath, "err", err)
}
pass := strings.TrimSuffix(string(blob), "\n")

View file

@ -109,6 +109,9 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to
utils.HeimdallURLFlag,
utils.WithoutHeimdallFlag,
utils.HeimdallgRPCAddressFlag,
utils.RunHeimdallFlag,
utils.RunHeimdallArgsFlag,
utils.UseHeimdallAppFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `

View file

@ -18,11 +18,14 @@
package main
import (
"context"
"fmt"
"os"
"os/signal"
"sort"
"strconv"
"strings"
"syscall"
"time"
"github.com/ethereum/go-ethereum/accounts"
@ -44,6 +47,7 @@ import (
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
_ "github.com/ethereum/go-ethereum/eth/tracers/native"
"github.com/maticnetwork/heimdall/cmd/heimdalld/service"
"gopkg.in/urfave/cli.v1"
)
@ -343,6 +347,15 @@ func geth(ctx *cli.Context) error {
return fmt.Errorf("invalid command: %q", args[0])
}
if ctx.GlobalBool(utils.RunHeimdallFlag.Name) {
shutdownCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
defer stop()
go func() {
service.NewHeimdallService(shutdownCtx, getHeimdallArgs(ctx))
}()
}
prepare(ctx)
stack, backend := makeFullNode(ctx)
defer stack.Close()
@ -477,3 +490,8 @@ func unlockAccounts(ctx *cli.Context, stack *node.Node) {
unlockAccount(ks, account, i, passwords)
}
}
func getHeimdallArgs(ctx *cli.Context) []string {
heimdallArgs := strings.Split(ctx.GlobalString(utils.RunHeimdallArgsFlag.Name), ",")
return append([]string{"start"}, heimdallArgs...)
}

View file

@ -38,11 +38,32 @@ var (
Value: "",
}
// RunHeimdallFlag flag for running heimdall internally from bor
RunHeimdallFlag = cli.BoolFlag{
Name: "bor.runheimdall",
Usage: "Run Heimdall service as a child process",
}
RunHeimdallArgsFlag = cli.StringFlag{
Name: "bor.runheimdallargs",
Usage: "Arguments to pass to Heimdall service",
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,
WithoutHeimdallFlag,
HeimdallgRPCAddressFlag,
RunHeimdallFlag,
RunHeimdallArgsFlag,
UseHeimdallAppFlag,
}
)
@ -66,6 +87,9 @@ func SetBorConfig(ctx *cli.Context, cfg *eth.Config) {
cfg.HeimdallURL = ctx.GlobalString(HeimdallURLFlag.Name)
cfg.WithoutHeimdall = ctx.GlobalBool(WithoutHeimdallFlag.Name)
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

View file

@ -2035,6 +2035,9 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
HeimdallURL: ctx.GlobalString(HeimdallURLFlag.Name),
WithoutHeimdall: ctx.GlobalBool(WithoutHeimdallFlag.Name),
HeimdallgRPCAddress: ctx.GlobalString(HeimdallgRPCAddressFlag.Name),
RunHeimdall: ctx.GlobalBool(RunHeimdallFlag.Name),
RunHeimdallArgs: ctx.GlobalString(RunHeimdallArgsFlag.Name),
UseHeimdallApp: ctx.GlobalBool(UseHeimdallAppFlag.Name),
})
engine = ethereum.Engine()
} else {

View file

@ -47,3 +47,32 @@ func AbsolutePath(datadir string, filename string) string {
}
return filepath.Join(datadir, filename)
}
// VerifyPath sanitizes the path to avoid Path Traversal vulnerability
func VerifyPath(path string) (string, error) {
c := filepath.Clean(path)
r, err := filepath.EvalSymlinks(c)
if err != nil {
return c, fmt.Errorf("unsafe or invalid path specified: %s", path)
} else {
return r, nil
}
}
// VerifyCrasher sanitizes the path to avoid Path Traversal vulnerability and reads the file from that path, returning its content
func VerifyCrasher(crasher string) []byte {
canonicalPath, err := VerifyPath(crasher)
if err != nil {
fmt.Println("path not verified: " + err.Error())
return nil
}
data, err := os.ReadFile(canonicalPath)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", canonicalPath, err)
os.Exit(1)
}
return data
}

View file

@ -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{
@ -515,6 +518,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)

View 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,
}
}

View 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")
}

View 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,
}
}

View 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,
}
}

View file

@ -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.

View file

@ -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()

View file

@ -184,7 +184,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
@ -201,7 +202,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
@ -773,7 +775,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
}
@ -1161,6 +1163,10 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error {
continue
}
if pool.config.AllowUnprotectedTxs {
pool.signer = types.NewFakeSigner(tx.ChainId())
}
// Exclude transactions with invalid signatures as soon as
// possible and cache senders in transactions before
// obtaining lock
@ -1217,6 +1223,10 @@ 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)

View file

@ -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 (
@ -894,6 +896,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)
}
@ -958,6 +961,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.
//
@ -1900,6 +1950,7 @@ func TestTransactionPoolUnderpricing(t *testing.T) {
if err := validateEvents(events, 2); err != nil {
t.Fatalf("additional event firing failed: %v", err)
}
if err := validateTxPoolInternals(pool); err != nil {
t.Fatalf("pool internal state corrupted: %v", err)
}
@ -2079,6 +2130,7 @@ func TestTransactionPoolUnderpricingDynamicFee(t *testing.T) {
if err := validateEvents(events, 2); err != nil {
t.Fatalf("additional event firing failed: %v", err)
}
if err := validateTxPoolInternals(pool); err != nil {
t.Fatalf("pool internal state corrupted: %v", err)
}
@ -3707,6 +3759,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 (

View file

@ -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))

View file

@ -263,6 +263,7 @@ var (
big199680 = big.NewInt(199680)
)
// nolint: gofmt
// modexpMultComplexity implements bigModexp multComplexity formula, as defined in EIP-198
//
// def mult_complexity(x):

View file

@ -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)

View file

@ -6,6 +6,8 @@ The ```debug pprof <enode>``` command will create an archive containing bor ppro
- ```address```: Address of the grpc endpoint (default: 127.0.0.1:3131)
- ```seconds```: seconds to trace (default: 2)
- ```seconds```: seconds to profile (default: 2)
- ```output```: Output directory
- ```skiptrace```: Skip running the trace (default: false)

View file

@ -2,24 +2,32 @@
# The default value of the flags is provided below (except a few flags which has custom defaults which are explicitly mentioned).
# Recommended values for mainnet and/or mumbai are also provided.
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
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
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)
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
"rpc.batchlimit" = 100 # Maximum number of messages in a batch (default=100, use 0 for no limits)
"rpc.returndatalimit" = 100000 # Maximum size (in bytes) a result of an rpc request could have (default=100000, use 0 for no limits)
syncmode = "full" # Blockchain sync mode (only "full" sync supported)
gcmode = "full" # Blockchain garbage collection mode ("full", "archive")
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)
syncmode = "full" # Blockchain sync mode (only "full" sync supported)
gcmode = "full" # Blockchain garbage collection mode ("full", "archive")
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
@ -27,6 +35,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
[p2p.discovery]
v5disc = false # Enables the experimental RLPx V5 (Topic Discovery) mechanism
bootnodes = [] # Comma separated enode URLs for P2P discovery bootstrap
@ -60,12 +71,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
@ -75,16 +89,16 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
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)
ep-size = 40 # Maximum size of workers to run in rpc execution pool for HTTP requests (default: 40)
ep-requesttimeout = "0s" # Request Timeout for rpc execution pool for HTTP requests (default: 0s, 0s = disabled)
ep-requesttimeout = "0s" # Request Timeout for rpc execution pool for HTTP requests (default: 0s, 0s = disabled)
[jsonrpc.ws]
enabled = false # Enable the WS-RPC server
port = 8546 # WS-RPC server listening port
prefix = "" # HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
host = "localhost" # ws.addr
api = ["net", "web3"] # API's offered over the WS-RPC interface
origins = ["localhost"] # Origins from which to accept websockets requests
ep-size = 40 # Maximum size of workers to run in rpc execution pool for WS requests (default: 40)
ep-requesttimeout = "0s" # Request Timeout for rpc execution pool for WS requests (default: 0s, 0s = disabled)
enabled = false # Enable the WS-RPC server
port = 8546 # WS-RPC server listening port
prefix = "" # HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
host = "localhost" # ws.addr
api = ["net", "web3"] # API's offered over the WS-RPC interface
origins = ["localhost"] # Origins from which to accept websockets requests
ep-size = 40 # Maximum size of workers to run in rpc execution pool for WS requests (default: 40)
ep-requesttimeout = "0s" # Request Timeout for rpc execution pool for WS requests (default: 0s, 0s = disabled)
[jsonrpc.graphql]
enabled = false # Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.
port = 0 #
@ -92,15 +106,21 @@ 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 = "10s"
write = "30s"
idle = "2m0s"
[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)
@ -138,6 +158,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
@ -150,5 +171,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

View file

@ -8,10 +8,14 @@ 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
@ -20,7 +24,7 @@ The ```bor server``` command runs the Bor client.
- ```rpc.returndatalimit```: Maximum size (in bytes) a result of an rpc request could have (default=100000, use 0 for no limits) (default: 100000)
- ```config```: File for the config file
- ```config```: Path to the TOML configuration file
- ```syncmode```: Blockchain sync mode (only "full" sync supported) (default: full)
@ -36,14 +40,26 @@ 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
- ```bor.useheimdallapp```: Use child heimdall process to fetch data, Only works when bor.runheimdall is true (default: false)
- ```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)
@ -56,6 +72,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
@ -90,16 +118,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)
@ -140,6 +182,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)
@ -154,6 +206,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)
@ -170,6 +228,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)

View file

@ -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 {

View file

@ -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

View file

@ -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) {

View file

@ -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"
@ -225,6 +226,15 @@ type Config struct {
// Address to connect to Heimdall gRPC server
HeimdallgRPCAddress string
// Run heimdall service as a child process
RunHeimdall bool
// 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
@ -233,6 +243,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.
@ -253,16 +266,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 {

View file

@ -477,10 +477,21 @@ func (f *BlockFetcher) loop() {
}
defer req.Close()
res := <-resCh
res.Done <- nil
timeout := time.NewTimer(2 * fetchTimeout) // 2x leeway before dropping the peer
defer timeout.Stop()
f.FilterHeaders(peer, *res.Res.(*eth.BlockHeadersPacket), time.Now().Add(res.Time))
select {
case res := <-resCh:
res.Done <- nil
f.FilterHeaders(peer, *res.Res.(*eth.BlockHeadersPacket), time.Now().Add(res.Time))
case <-timeout.C:
// The peer didn't respond in time. The request
// was already rescheduled at this point, we were
// waiting for a catchup. With an unresponsive
// peer however, it's a protocol violation.
f.dropPeer(peer)
}
}(hash)
}
}(peer)
@ -523,11 +534,23 @@ func (f *BlockFetcher) loop() {
}
defer req.Close()
res := <-resCh
res.Done <- nil
timeout := time.NewTimer(2 * fetchTimeout) // 2x leeway before dropping the peer
defer timeout.Stop()
txs, uncles := res.Res.(*eth.BlockBodiesPacket).Unpack()
f.FilterBodies(peer, txs, uncles, time.Now())
select {
case res := <-resCh:
res.Done <- nil
txs, uncles := res.Res.(*eth.BlockBodiesPacket).Unpack()
f.FilterBodies(peer, txs, uncles, time.Now())
case <-timeout.C:
// The peer didn't respond in time. The request
// was already rescheduled at this point, we were
// waiting for a catchup. With an unresponsive
// peer however, it's a protocol violation.
f.dropPeer(peer)
}
}(peer, hashes)
}
// Schedule the next fetch if blocks are still pending

View file

@ -63,6 +63,7 @@ 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:

View file

@ -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 := &ethconfig.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 := &ethconfig.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) {

118
go.mod
View file

@ -5,6 +5,7 @@ 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/JekaMas/workerpool v1.1.5
github.com/VictoriaMetrics/fastcache v1.6.0
@ -13,7 +14,7 @@ require (
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/btcec/v2 v2.1.3
github.com/cespare/cp v0.1.0
github.com/cespare/cp v1.1.1
github.com/cloudflare/cloudflare-go v0.14.0
github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f
github.com/davecgh/go-spew v1.1.1
@ -21,15 +22,15 @@ require (
github.com/docker/docker v1.6.1
github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48
github.com/edsrzf/mmap-go v1.0.0
github.com/fatih/color v1.7.0
github.com/fatih/color v1.9.0
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
github.com/go-stack/stack v1.8.0
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
github.com/go-stack/stack v1.8.1
github.com/golang-jwt/jwt/v4 v4.3.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.4
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.2.0
github.com/gorilla/websocket v1.4.2
github.com/graph-gophers/graphql-go v1.3.0
@ -40,7 +41,7 @@ require (
github.com/holiman/big v0.0.0-20221017200358-a027dc42d04e
github.com/holiman/bloomfilter/v2 v2.0.3
github.com/holiman/uint256 v1.2.0
github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204
github.com/huin/goupnp v1.0.3
github.com/imdario/mergo v0.3.11
github.com/influxdata/influxdb v1.8.3
github.com/influxdata/influxdb-client-go/v2 v2.4.0
@ -49,22 +50,23 @@ 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.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
github.com/mitchellh/cli v1.1.2
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7
github.com/prometheus/tsdb v0.7.1
github.com/rjeczalik/notify v0.9.1
github.com/peterh/liner v1.2.0
github.com/prometheus/tsdb v0.10.0
github.com/rjeczalik/notify v0.9.2
github.com/rs/cors v1.7.0
github.com/ryanuber/columnize v2.1.2+incompatible
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
github.com/status-im/keycard-go v0.0.0-20211109104530-b0e0482ba91d
github.com/stretchr/testify v1.8.0
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef
github.com/tyler-smith/go-bip39 v1.1.0
github.com/xsleonard/go-merkle v1.1.0
go.opentelemetry.io/otel v1.2.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.2.0
@ -74,11 +76,11 @@ require (
golang.org/x/sync v0.1.0
golang.org/x/sys v0.6.0
golang.org/x/text v0.8.0
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
golang.org/x/tools v0.6.0
gonum.org/v1/gonum v0.11.0
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.0
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.28.1
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6
gopkg.in/urfave/cli.v1 v1.20.0
@ -86,53 +88,119 @@ require (
pgregory.net/rapid v0.4.8
)
require github.com/gammazero/deque v0.2.1 // indirect
require (
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/gammazero/deque v0.2.1 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
)
require (
cloud.google.com/go v0.65.0 // indirect
cloud.google.com/go/pubsub v1.3.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae // indirect
github.com/RichardKnop/machinery v1.7.4 // indirect
github.com/RichardKnop/redsync v1.2.0 // indirect
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 // indirect
github.com/aws/aws-sdk-go v1.29.15 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.1.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.1.1 // indirect
github.com/aws/smithy-go v1.1.0 // indirect
github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cbergoon/merkletree v0.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cosmos/cosmos-sdk v0.37.4
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 // indirect
github.com/cosmos/ledger-cosmos-go v0.10.3 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/deepmap/oapi-codegen v1.8.2 // indirect
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/etcd-io/bbolt v1.3.3 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-redis/redis v6.15.7+incompatible // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.0.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
github.com/kylelemons/godebug v1.1.0 // 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/jstemmer/go-junit-report v0.9.1 // indirect
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/libp2p/go-buffer-pool v0.0.2 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.1.1 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v0.0.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71 // indirect
github.com/stumble/gorocksdb v0.0.3 // indirect
github.com/tendermint/btcd v0.1.1 // indirect
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
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
github.com/xdg/scram v1.0.3 // indirect
github.com/xdg/stringprep v1.0.3 // indirect
github.com/zclconf/go-cty v1.8.0 // indirect
github.com/zondax/hid v0.9.0 // indirect
go.mongodb.org/mongo-driver v1.3.0 // indirect
go.opencensus.io v0.22.6 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.2.0 // indirect
go.opentelemetry.io/otel/trace v1.2.0
go.opentelemetry.io/proto/otlp v0.10.0 // indirect
@ -141,7 +209,17 @@ require (
golang.org/x/net v0.8.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
google.golang.org/api v0.34.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.37.5-0.20220311095845-81690c6a53e7
replace github.com/tendermint/tendermint => github.com/maticnetwork/tendermint v0.26.0-dev0.0.20220923185258-3e7c7f86ce9f
replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v0.2.18-0.20220922050621-c91d4ca1fa4f
replace github.com/Masterminds/goutils => github.com/Masterminds/goutils v1.1.1

687
go.sum

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#!/bin/bash
set -e
while true
do
peers=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'admin.peers'")
block=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'eth.blockNumber'")
if [[ -n "$peers" ]] && [[ -n "$block" ]]; then
break
fi
done
echo $peers
echo $block

View file

@ -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 {

View file

@ -8,7 +8,6 @@ import (
"strings"
"google.golang.org/grpc"
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"
@ -17,8 +16,9 @@ import (
type DebugPprofCommand struct {
*Meta2
seconds uint64
output string
seconds uint64
output string
skiptrace bool
}
func (p *DebugPprofCommand) MarkDown() string {
@ -45,7 +45,7 @@ func (d *DebugPprofCommand) Flags() *flagset.Flagset {
flags.Uint64Flag(&flagset.Uint64Flag{
Name: "seconds",
Usage: "seconds to trace",
Usage: "seconds to profile",
Value: &d.seconds,
Default: 2,
})
@ -55,6 +55,15 @@ func (d *DebugPprofCommand) Flags() *flagset.Flagset {
Usage: "Output directory",
})
// Trace profiles can be expensive and take too much size (for grpc).
// This flag will help in making it optional.
flags.BoolFlag(&flagset.BoolFlag{
Name: "skiptrace",
Value: &d.skiptrace,
Usage: "Skip running the trace",
Default: false,
})
return flags
}
@ -120,11 +129,17 @@ func (d *DebugPprofCommand) Run(args []string) int {
ctx, cancelFn := context.WithCancel(context.Background())
trapSignal(cancelFn)
// Only take cpu and heap profiles by default
profiles := map[string]string{
"heap": "heap",
"cpu": "cpu",
"trace": "trace",
"mutex": "mutex",
}
if !d.skiptrace {
profiles["trace"] = "trace"
}
for profile, filename := range profiles {
if err := pprofProfile(ctx, profile, filename); err != nil {
d.UI.Error(fmt.Sprintf("Error creating profile '%s': %v", profile, err))
@ -134,7 +149,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

View file

@ -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"

View file

@ -52,6 +52,7 @@ 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()
@ -60,6 +61,7 @@ func (c *DumpconfigCommand) Run(args []string) int {
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()

View file

@ -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 = &params.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{

View file

@ -1,13 +1,16 @@
package server
import (
"context"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"github.com/maticnetwork/heimdall/cmd/heimdalld/service"
"github.com/mitchellh/cli"
"github.com/pelletier/go-toml"
"github.com/ethereum/go-ethereum/log"
)
@ -88,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
@ -101,6 +130,15 @@ func (c *Command) Run(args []string) int {
return 1
}
if c.config.Heimdall.RunHeimdall {
shutdownCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
defer stop()
go func() {
service.NewHeimdallService(shutdownCtx, c.getHeimdallArgs())
}()
}
srv, err := NewServer(c.config, WithGRPCAddress())
if err != nil {
c.UI.Error(err.Error())
@ -141,3 +179,8 @@ func (c *Command) handleSignals() int {
func (c *Command) GetConfig() *Config {
return c.cliConfig
}
func (c *Command) getHeimdallArgs() []string {
heimdallArgs := strings.Split(c.config.Heimdall.RunHeimdallArgs, ",")
return append([]string{"start"}, heimdallArgs...)
}

View file

@ -1,6 +1,7 @@
package server
import (
"crypto/ecdsa"
"fmt"
"io/ioutil"
"math"
@ -21,8 +22,10 @@ import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
"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"
@ -32,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"
)
@ -48,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"`
@ -81,6 +91,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"`
@ -113,6 +126,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 {
@ -134,6 +191,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"`
}
@ -170,6 +238,15 @@ type HeimdallConfig struct {
// GRPCAddress is the address of the heimdall grpc server
GRPCAddress string `hcl:"grpc-address,optional" toml:"grpc-address,optional"`
// RunHeimdall is used to run heimdall as a child process
RunHeimdall bool `hcl:"bor.runheimdall,optional" toml:"bor.runheimdall,optional"`
// 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 {
@ -225,6 +302,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 {
@ -237,6 +318,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"`
@ -249,7 +334,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 {
@ -324,6 +429,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"`
@ -419,6 +530,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 {
@ -444,16 +558,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,
},
RPCBatchLimit: 100,
RPCReturnDataLimit: 100000,
P2P: &P2PConfig{
@ -463,6 +588,7 @@ func DefaultConfig() *Config {
Port: 30303,
NoDiscover: false,
NAT: "any",
NetRestrict: "",
Discovery: &P2PDiscovery{
V5Enabled: false,
Bootnodes: []string{},
@ -501,18 +627,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,
@ -544,6 +675,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{
@ -577,6 +714,7 @@ func DefaultConfig() *Config {
TxLookupLimit: 2350000,
TriesInMemory: 128,
TrieTimeout: 60 * time.Minute,
FDLimit: 0,
},
Accounts: &AccountsConfig{
Unlock: []string{},
@ -589,8 +727,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: "",
},
}
}
@ -636,6 +784,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},
@ -707,7 +857,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
}
@ -724,15 +874,28 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
n.HeimdallURL = c.Heimdall.URL
n.WithoutHeimdall = c.Heimdall.Without
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
@ -749,6 +912,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)
@ -781,10 +945,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
}
for i, account := range c.Accounts.Unlock {
err = ks.Unlock(accounts.Account{Address: common.HexToAddress(account)}, passwords[i])
if err != nil {
return nil, fmt.Errorf("could not unlock an account %q", account)
}
unlockAccount(ks, account, i, passwords)
}
}
@ -825,7 +986,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
@ -914,6 +1075,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
@ -973,6 +1136,104 @@ var (
gitDate = "" // Git commit date YYYYMMDD of the release (set via linker flags)
)
// tries unlocking the specified account a few times.
func unlockAccount(ks *keystore.KeyStore, address string, i int, passwords []string) (accounts.Account, string) {
account, err := utils.MakeAddress(ks, address)
if err != nil {
utils.Fatalf("Could not list accounts: %v", err)
}
for trials := 0; trials < 3; trials++ {
prompt := fmt.Sprintf("Unlocking account %s | Attempt %d/%d", address, trials+1, 3)
password := utils.GetPassPhraseWithList(prompt, false, i, passwords)
err = ks.Unlock(account, password)
if err == nil {
log.Info("Unlocked account", "address", account.Address.Hex())
return account, password
}
if err, ok := err.(*keystore.AmbiguousAddrError); ok {
log.Info("Unlocked account", "address", account.Address.Hex())
return ambiguousAddrRecovery(ks, err, password), password
}
if err != keystore.ErrDecrypt {
// No need to prompt again if the error is not decryption-related.
break
}
}
// All trials expended to unlock account, bail out
utils.Fatalf("Failed to unlock account %s (%v)", address, err)
return accounts.Account{}, ""
}
func ambiguousAddrRecovery(ks *keystore.KeyStore, err *keystore.AmbiguousAddrError, auth string) accounts.Account {
log.Warn("Multiple key files exist for", "address", err.Addr)
for _, a := range err.Matches {
log.Info("Multiple keys", "file", a.URL.String())
}
log.Info("Testing your password against all of them...")
var match *accounts.Account
for _, a := range err.Matches {
if err := ks.Unlock(a, auth); err == nil {
// nolint: gosec, exportloopref
match = &a
break
}
}
if match == nil {
utils.Fatalf("None of the listed files could be unlocked.")
}
log.Info("Your password unlocked", "key", match.URL.String())
log.Warn("In order to avoid this warning, you need to remove the following duplicate key files:")
for _, a := range err.Matches {
if a != *match {
log.Warn("Duplicate", "key", a.URL.String())
}
}
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 {
@ -990,6 +1251,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),
@ -1010,6 +1272,10 @@ 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,
RPCBatchLimit: c.RPCBatchLimit,
WSJsonRPCExecutionPoolSize: c.JsonRPC.Ws.ExecutionPoolSize,
WSJsonRPCExecutionPoolRequestTimeout: c.JsonRPC.Ws.ExecutionPoolRequestTimeout,
@ -1017,6 +1283,20 @@ func (c *Config) buildNode() (*node.Config, error) {
HTTPJsonRPCExecutionPoolRequestTimeout: c.JsonRPC.Http.ExecutionPoolRequestTimeout,
}
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
if c.Developer.Enabled {
cfg.UseLightweightKDF = true
@ -1104,18 +1384,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) {

View file

@ -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)",
@ -60,7 +72,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{
@ -94,6 +106,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",
@ -107,12 +149,36 @@ 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",
Value: &c.cliConfig.Heimdall.GRPCAddress,
Default: c.cliConfig.Heimdall.GRPCAddress,
})
f.BoolFlag(&flagset.BoolFlag{
Name: "bor.runheimdall",
Usage: "Run Heimdall service as a child process",
Value: &c.cliConfig.Heimdall.RunHeimdall,
Default: c.cliConfig.Heimdall.RunHeimdall,
})
f.StringFlag(&flagset.StringFlag{
Name: "bor.runheimdallargs",
Usage: "Arguments to pass to Heimdall service",
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 +295,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 +324,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 +427,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 +443,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 +457,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 +478,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)",
@ -562,6 +696,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)",
@ -735,5 +890,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
}

View file

@ -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)
}
}()
}

View file

@ -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,
},

View file

@ -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;

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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()

View file

@ -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

View file

@ -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

View 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)
}

View file

@ -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
}

View file

@ -1548,9 +1548,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 {
@ -1576,15 +1579,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
@ -1884,7 +1878,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
}
@ -2074,6 +2069,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 {

View file

@ -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
}),
new web3._extend.Method({
name: 'getExecutionPoolSize',
call: 'admin_getExecutionPoolSize'
@ -218,7 +227,6 @@ web3._extend({
new web3._extend.Method({
name: 'setHttpExecutionPoolSize',
call: 'admin_setHttpExecutionPoolSize',
params: 1
}),
],
properties: [

View file

@ -6,11 +6,14 @@
package metrics
import (
"fmt"
"os"
"runtime"
"strings"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/BurntSushi/toml"
)
@ -74,7 +77,13 @@ func init() {
func updateMetricsFromConfig(path string) {
// Don't act upon any errors here. They're already taken into
// consideration when the toml config file will be parsed in the cli.
data, err := os.ReadFile(path)
canonicalPath, err := common.VerifyPath(path)
if err != nil {
fmt.Println("path not verified: " + err.Error())
return
}
data, err := os.ReadFile(canonicalPath)
tomlData := string(data)
if err != nil {

View file

@ -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 {
@ -212,7 +212,7 @@ var (
// Test accounts
testBankKey, _ = crypto.GenerateKey()
TestBankAddress = crypto.PubkeyToAddress(testBankKey.PublicKey)
testBankFunds = big.NewInt(1000000000000000000)
testBankFunds = big.NewInt(9000000000000000000)
testUserKey, _ = crypto.GenerateKey()
testUserAddress = crypto.PubkeyToAddress(testUserKey.PublicKey)

View file

@ -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,615 @@ 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
//nolint:contextcheck
w.commitTransactions(w.current, txset, nil, context.Background())
// Only update the snapshot if any new transactions were added
// to the pending block
if tcount != w.current.tcount {
w.updateSnapshot(w.current)
}
} 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, interruptCtx context.Context, 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
if interruptCtx != nil {
// case of interrupting by timeout
select {
case <-interruptCtx.Done():
commitInterruptCounter.Inc(1)
log.Warn("Tx Level Interrupt")
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
}
//nolint:contextcheck
var interruptCtx = context.Background()
stopFn := func() {}
defer func() {
stopFn()
}()
if !noempty {
interruptCtx, 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, interruptCtx, 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, interruptCtx context.Context, 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, interruptCtx, 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, interruptCtx, 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),
)
}

View file

@ -95,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
@ -300,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
@ -652,7 +654,8 @@ 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)
//nolint:contextcheck
w.commitTransactions(w.current, txset, nil, context.Background())
// Only update the snapshot if any new transactions were added
// to the pending block
@ -940,7 +943,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, interruptCtx context.Context) bool {
gasLimit := env.header.GasLimit
if env.gasPool == nil {
env.gasPool = new(core.GasPool).AddGas(gasLimit)
@ -963,7 +967,20 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
})
}()
mainloop:
for {
// case of interrupting by timeout
if interruptCtx != nil {
// case of interrupting by timeout
select {
case <-interruptCtx.Done():
commitInterruptCounter.Inc(1)
log.Warn("Tx Level Interrupt")
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
@ -982,16 +999,21 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP
inc: true,
}
}
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)
breakCause = "Not enough gas for further transactions"
break
}
// Retrieve the next transaction and abort if all done
tx := txs.Peek()
if tx == nil {
breakCause = "all transactions has been included"
break
}
// Error may be ignored here. The error has already been checked
@ -1247,7 +1269,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, interruptCtx context.Context) {
ctx, span := tracing.StartSpan(ctx, "fillTransactions")
defer tracing.EndSpan(span)
@ -1371,7 +1393,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, interruptCtx)
})
if committed {
@ -1394,7 +1416,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, interruptCtx)
})
if committed {
@ -1419,7 +1441,10 @@ func (w *worker) generateWork(ctx context.Context, params *generateParams) (*typ
}
defer work.discard()
w.fillTransactions(ctx, nil, work)
interruptCtx, stopFn := getInterruptTimer(ctx, work, w.chain.CurrentBlock())
defer stopFn()
w.fillTransactions(ctx, nil, work, interruptCtx)
return w.engine.FinalizeAndAssemble(ctx, w.chain, work.header, work.state, work.txs, work.unclelist(), work.receipts)
}
@ -1427,6 +1452,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 (
@ -1456,6 +1482,18 @@ func (w *worker) commitWork(ctx context.Context, interrupt *int32, noempty bool,
return
}
//nolint:contextcheck
var interruptCtx = context.Background()
stopFn := func() {}
defer func() {
stopFn()
}()
if !noempty {
interruptCtx, stopFn = getInterruptTimer(ctx, work, w.chain.CurrentBlock())
}
ctx, span := tracing.StartSpan(ctx, "commitWork")
defer tracing.EndSpan(span)
@ -1474,7 +1512,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, interruptCtx)
err = w.commit(ctx, work.copy(), w.fullTaskHook, true, start)
if err != nil {
@ -1490,6 +1528,27 @@ func (w *worker) commitWork(ctx context.Context, interrupt *int32, noempty bool,
w.current = work
}
func getInterruptTimer(ctx context.Context, work *environment, current *types.Block) (context.Context, func()) {
delay := time.Until(time.Unix(int64(work.header.Time), 0))
interruptCtx, cancel := context.WithTimeout(context.Background(), delay)
blockNumber := current.NumberU64() + 1
go func() {
select {
case <-interruptCtx.Done():
if interruptCtx.Err() != context.Canceled {
log.Info("Commit Interrupt. Pre-committing the current block", "block", blockNumber)
cancel()
}
case <-ctx.Done(): // nothing to do
}
}()
return interruptCtx, cancel
}
// 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

View file

@ -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,25 +38,23 @@ 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"
)
// nolint : paralleltest
func TestGenerateBlockAndImportEthash(t *testing.T) {
t.Parallel()
testGenerateBlockAndImport(t, false, false)
}
// nolint : paralleltest
func TestGenerateBlockAndImportClique(t *testing.T) {
t.Parallel()
testGenerateBlockAndImport(t, true, false)
}
// nolint : paralleltest
func TestGenerateBlockAndImportBor(t *testing.T) {
t.Parallel()
testGenerateBlockAndImport(t, false, true)
}
@ -63,35 +64,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().GetCurrentValidatorsByHash(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 +87,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 +151,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().GetCurrentValidatorsByHash(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 +247,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 +309,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 +380,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 +488,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 +624,64 @@ func testGetSealingWork(t *testing.T, chainConfig *params.ChainConfig, engine co
}
}
// nolint:paralleltest
func TestCommitInterruptExperimentBor(t *testing.T) {
// with 1 sec block time and 200 millisec tx delay we should get 5 txs per block
testCommitInterruptExperimentBor(t, 200, 5)
time.Sleep(3 * time.Second)
// with 1 sec block time and 100 millisec tx delay we should get 10 txs per block
testCommitInterruptExperimentBor(t, 100, 10)
}
// nolint:thelper
func testCommitInterruptExperimentBor(t *testing.T, delay uint, txCount int) {
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 +713,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.
@ -653,11 +723,6 @@ func BenchmarkBorMining(b *testing.B) {
chain, _ := core.NewBlockChain(db2, nil, back.chain.Config(), engine, vm.Config{}, nil, nil, nil)
defer chain.Stop()
// Ignore empty commit here for less noise.
w.skipSealHook = func(task *task) bool {
return len(task.receipts) == 0
}
// fulfill tx pool
const (
totalGas = testGas + params.TxGas

View file

@ -62,6 +62,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) {

View file

@ -307,6 +307,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
@ -368,6 +397,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

View file

@ -1,6 +1,7 @@
chain = "mainnet"
# identity = "node_name"
# log-level = "INFO"
# verbosity = 3
# vmdebug = false
datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = ""
@ -10,9 +11,16 @@ syncmode = "full"
gcmode = "archive"
# snapshot = true
# ethstats = ""
# devfakeauthor = false
# ["eth.requiredblocks"]
# [log]
# vmodule = ""
# json = false
# backtrace = ""
# debug = true
[p2p]
maxpeers = 50
port = 30303
@ -20,6 +28,9 @@ gcmode = "archive"
# bind = "0.0.0.0"
# nodiscover = false
# nat = "any"
# netrestrict = ""
# nodekey = ""
# nodekeyhex = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -53,12 +64,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
@ -85,6 +99,11 @@ gcmode = "archive"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -93,6 +112,8 @@ gcmode = "archive"
[gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
ignoreprice = "30000000000"
@ -125,6 +146,7 @@ gcmode = "archive"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
# [accounts]
# unlock = []
@ -139,3 +161,11 @@ gcmode = "archive"
# [developer]
# dev = false
# period = 0
# gaslimit = 11500000
# [pprof]
# pprof = false
# port = 6060
# addr = "127.0.0.1"
# memprofilerate = 524288
# blockprofilerate = 0

View file

@ -1,6 +1,7 @@
chain = "mainnet"
# identity = "node_name"
# log-level = "INFO"
# verbosity = 3
# vmdebug = false
datadir = "/var/lib/bor/data"
# ancient = ""
# 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 = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -53,12 +64,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
@ -67,8 +81,8 @@ syncmode = "full"
vhosts = ["*"]
corsdomain = ["*"]
# prefix = ""
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.ws]
# enabled = false
# port = 8546
@ -76,8 +90,8 @@ syncmode = "full"
# host = "localhost"
# api = ["web3", "net"]
# origins = ["*"]
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.graphql]
# enabled = false
# port = 0
@ -85,6 +99,11 @@ syncmode = "full"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -93,6 +112,8 @@ syncmode = "full"
[gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
ignoreprice = "30000000000"
@ -125,6 +146,7 @@ syncmode = "full"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
# [accounts]
# unlock = []
@ -139,3 +161,11 @@ syncmode = "full"
# [developer]
# dev = false
# period = 0
# gaslimit = 11500000
# [pprof]
# pprof = false
# port = 6060
# addr = "127.0.0.1"
# memprofilerate = 524288
# blockprofilerate = 0

View file

@ -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"
@ -12,9 +13,16 @@ syncmode = "full"
# gcmode = "full"
# snapshot = true
# ethstats = ""
# devfakeauthor = false
# ["eth.requiredblocks"]
# [log]
# vmodule = ""
# json = false
# backtrace = ""
# debug = true
[p2p]
maxpeers = 1
port = 30303
@ -22,6 +30,9 @@ syncmode = "full"
# maxpendpeers = 50
# bind = "0.0.0.0"
# nat = "any"
# netrestrict = ""
# nodekey = ""
# nodekeyhex = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -55,12 +66,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
@ -69,8 +83,8 @@ syncmode = "full"
vhosts = ["*"]
corsdomain = ["*"]
# prefix = ""
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.ws]
# enabled = false
# port = 8546
@ -78,8 +92,8 @@ syncmode = "full"
# host = "localhost"
# api = ["web3", "net"]
# origins = ["*"]
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.graphql]
# enabled = false
# port = 0
@ -87,6 +101,11 @@ syncmode = "full"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -95,6 +114,8 @@ syncmode = "full"
[gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
ignoreprice = "30000000000"
@ -127,6 +148,7 @@ syncmode = "full"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
[accounts]
allow-insecure-unlock = true
@ -141,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

View file

@ -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"
@ -12,9 +13,16 @@ syncmode = "full"
# gcmode = "full"
# snapshot = true
# ethstats = ""
# devfakeauthor = false
# ["eth.requiredblocks"]
# [log]
# vmodule = ""
# json = false
# backtrace = ""
# debug = true
[p2p]
maxpeers = 50
port = 30303
@ -22,6 +30,9 @@ syncmode = "full"
# bind = "0.0.0.0"
# nodiscover = false
# nat = "any"
# netrestrict = ""
# nodekey = ""
# nodekeyhex = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -55,12 +66,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
@ -69,8 +83,8 @@ syncmode = "full"
vhosts = ["*"]
corsdomain = ["*"]
# prefix = ""
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.ws]
# enabled = false
# port = 8546
@ -78,8 +92,8 @@ syncmode = "full"
# host = "localhost"
# api = ["web3", "net"]
# origins = ["*"]
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.graphql]
# enabled = false
# port = 0
@ -87,6 +101,11 @@ syncmode = "full"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -95,6 +114,8 @@ syncmode = "full"
[gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
ignoreprice = "30000000000"
@ -127,6 +148,7 @@ syncmode = "full"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
[accounts]
allow-insecure-unlock = true
@ -141,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

View file

@ -1,5 +1,5 @@
Source: bor
Version: 0.3.8-beta
Version: 0.3.9-stable
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor
Version: 0.3.8-beta
Version: 0.3.9-stable
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile
Version: 0.3.8-beta
Version: 0.3.9-stable
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile
Version: 0.3.8-beta
Version: 0.3.9-stable
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile
Version: 0.3.8-beta
Version: 0.3.9-stable
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile
Version: 0.3.8-beta
Version: 0.3.9-stable
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,6 +1,7 @@
chain = "mumbai"
# identity = "node_name"
# log-level = "INFO"
# verbosity = 3
# vmdebug = false
datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = ""
@ -10,9 +11,16 @@ syncmode = "full"
gcmode = "archive"
# snapshot = true
# ethstats = ""
# devfakeauthor = false
# ["eth.requiredblocks"]
# [log]
# vmodule = ""
# json = false
# backtrace = ""
# debug = true
[p2p]
maxpeers = 50
port = 30303
@ -20,6 +28,9 @@ gcmode = "archive"
# bind = "0.0.0.0"
# nodiscover = false
# nat = "any"
# netrestrict = ""
# nodekey = ""
# nodekeyhex = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -53,12 +64,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
@ -85,6 +99,11 @@ gcmode = "archive"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -93,6 +112,8 @@ gcmode = "archive"
# [gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
# ignoreprice = "2"
@ -125,6 +146,7 @@ gcmode = "archive"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
# [accounts]
# unlock = []
@ -139,3 +161,11 @@ gcmode = "archive"
# [developer]
# dev = false
# period = 0
# gaslimit = 11500000
# [pprof]
# pprof = false
# port = 6060
# addr = "127.0.0.1"
# memprofilerate = 524288
# blockprofilerate = 0

View file

@ -1,6 +1,7 @@
chain = "mumbai"
# identity = "node_name"
# log-level = "INFO"
# verbosity = 3
# vmdebug = false
datadir = "/var/lib/bor/data"
# ancient = ""
# 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 = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -53,12 +64,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
@ -85,6 +99,11 @@ syncmode = "full"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -93,6 +112,8 @@ syncmode = "full"
# [gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
# ignoreprice = "2"
@ -125,6 +146,7 @@ syncmode = "full"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
# [accounts]
# unlock = []
@ -139,3 +161,11 @@ syncmode = "full"
# [developer]
# dev = false
# period = 0
# gaslimit = 11500000
# [pprof]
# pprof = false
# port = 6060
# addr = "127.0.0.1"
# memprofilerate = 524288
# blockprofilerate = 0

View file

@ -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"
@ -12,9 +13,16 @@ syncmode = "full"
# gcmode = "full"
# snapshot = true
# ethstats = ""
# devfakeauthor = false
# ["eth.requiredblocks"]
# [log]
# vmodule = ""
# json = false
# backtrace = ""
# debug = true
[p2p]
maxpeers = 1
port = 30303
@ -22,6 +30,9 @@ syncmode = "full"
# maxpendpeers = 50
# bind = "0.0.0.0"
# nat = "any"
# netrestrict = ""
# nodekey = ""
# nodekeyhex = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -55,12 +66,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
@ -69,8 +83,8 @@ syncmode = "full"
vhosts = ["*"]
corsdomain = ["*"]
# prefix = ""
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.ws]
# enabled = false
# port = 8546
@ -78,8 +92,8 @@ syncmode = "full"
# host = "localhost"
# api = ["web3", "net"]
# origins = ["*"]
# ep-size = 40
# ep-requesttimeout = "0s"
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.graphql]
# enabled = false
# port = 0
@ -87,6 +101,11 @@ syncmode = "full"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -95,6 +114,8 @@ syncmode = "full"
# [gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
# ignoreprice = "2"
@ -127,6 +148,7 @@ syncmode = "full"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
[accounts]
allow-insecure-unlock = true
@ -141,3 +163,10 @@ syncmode = "full"
# [developer]
# dev = false
# period = 0
# gaslimit = 11500000
# pprof = false
# port = 6060
# addr = "127.0.0.1"
# memprofilerate = 524288
# blockprofilerate = 0

View file

@ -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"
@ -12,9 +13,16 @@ syncmode = "full"
# gcmode = "full"
# snapshot = true
# ethstats = ""
# devfakeauthor = false
# ["eth.requiredblocks"]
# [log]
# vmodule = ""
# json = false
# backtrace = ""
# debug = true
[p2p]
maxpeers = 50
port = 30303
@ -22,6 +30,9 @@ syncmode = "full"
# bind = "0.0.0.0"
# nodiscover = false
# nat = "any"
# netrestrict = ""
# nodekey = ""
# nodekeyhex = ""
# [p2p.discovery]
# v5disc = false
# bootnodes = []
@ -55,12 +66,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
@ -87,6 +101,11 @@ syncmode = "full"
# host = ""
# vhosts = ["*"]
# corsdomain = ["*"]
# [jsonrpc.auth]
# jwtsecret = ""
# addr = "localhost"
# port = 8551
# vhosts = ["localhost"]
# [jsonrpc.timeouts]
# read = "10s"
# write = "30s"
@ -95,6 +114,8 @@ syncmode = "full"
# [gpo]
# blocks = 20
# percentile = 60
# maxheaderhistory = 1024
# maxblockhistory = 1024
# maxprice = "5000000000000"
# ignoreprice = "2"
@ -127,6 +148,7 @@ syncmode = "full"
# preimages = false
# txlookuplimit = 2350000
# timeout = "1h0m0s"
# fdlimit = 0
[accounts]
allow-insecure-unlock = true
@ -141,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

View file

@ -21,10 +21,11 @@ import (
)
const (
VersionMajor = 0 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 8 // Patch version component of the current release
VersionMeta = "beta" // Version metadata to append to the version string
GitCommit = ""
VersionMajor = 0 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 9 // Patch version component of the current release
VersionMeta = "stable" // Version metadata to append to the version string
)
// Version holds the textual version string.
@ -41,6 +42,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
//

View file

@ -26,6 +26,8 @@ import (
"os"
"golang.org/x/tools/go/packages"
"github.com/ethereum/go-ethereum/common"
)
const pathOfPackageRLP = "github.com/ethereum/go-ethereum/rlp"
@ -52,8 +54,15 @@ func main() {
}
if *output == "-" {
os.Stdout.Write(code)
} else if err := ioutil.WriteFile(*output, code, 0644); err != nil {
fatal(err)
} else {
canonicalPath, err := common.VerifyPath(*output)
if err != nil {
fmt.Println("path not verified: " + err.Error())
fatal(err)
}
if err := ioutil.WriteFile(canonicalPath, code, 0600); err != nil {
fatal(err)
}
}
}

View file

@ -28,6 +28,7 @@ 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.

View file

@ -11,6 +11,7 @@ import (
"github.com/pelletier/go-toml"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/internal/cli/server"
)
@ -100,100 +101,102 @@ var flagMap = map[string][]string{
// map from cli flags to corresponding toml tags
var nameTagMap = map[string]string{
"chain": "chain",
"identity": "identity",
"log-level": "log-level",
"datadir": "datadir",
"keystore": "keystore",
"syncmode": "syncmode",
"gcmode": "gcmode",
"eth.requiredblocks": "eth.requiredblocks",
"0-snapshot": "snapshot",
"\"bor.logs\"": "bor.logs",
"url": "bor.heimdall",
"\"bor.without\"": "bor.withoutheimdall",
"grpc-address": "bor.heimdallgRPC",
"locals": "txpool.locals",
"nolocals": "txpool.nolocals",
"journal": "txpool.journal",
"rejournal": "txpool.rejournal",
"pricelimit": "txpool.pricelimit",
"pricebump": "txpool.pricebump",
"accountslots": "txpool.accountslots",
"globalslots": "txpool.globalslots",
"accountqueue": "txpool.accountqueue",
"globalqueue": "txpool.globalqueue",
"lifetime": "txpool.lifetime",
"mine": "mine",
"etherbase": "miner.etherbase",
"extradata": "miner.extradata",
"gaslimit": "miner.gaslimit",
"gasprice": "miner.gasprice",
"ethstats": "ethstats",
"blocks": "gpo.blocks",
"percentile": "gpo.percentile",
"maxprice": "gpo.maxprice",
"ignoreprice": "gpo.ignoreprice",
"cache": "cache",
"1-database": "cache.database",
"trie": "cache.trie",
"trie.journal": "cache.journal",
"trie.rejournal": "cache.rejournal",
"gc": "cache.gc",
"1-snapshot": "cache.snapshot",
"noprefetch": "cache.noprefetch",
"preimages": "cache.preimages",
"txlookuplimit": "txlookuplimit",
"gascap": "rpc.gascap",
"txfeecap": "rpc.txfeecap",
"ipcdisable": "ipcdisable",
"ipcpath": "ipcpath",
"1-corsdomain": "http.corsdomain",
"1-vhosts": "http.vhosts",
"origins": "ws.origins",
"3-corsdomain": "graphql.corsdomain",
"3-vhosts": "graphql.vhosts",
"1-enabled": "http",
"1-host": "http.addr",
"1-port": "http.port",
"1-prefix": "http.rpcprefix",
"1-api": "http.api",
"2-enabled": "ws",
"2-host": "ws.addr",
"2-port": "ws.port",
"2-prefix": "ws.rpcprefix",
"2-api": "ws.api",
"3-enabled": "graphql",
"bind": "bind",
"0-port": "port",
"bootnodes": "bootnodes",
"maxpeers": "maxpeers",
"maxpendpeers": "maxpendpeers",
"nat": "nat",
"nodiscover": "nodiscover",
"v5disc": "v5disc",
"metrics": "metrics",
"expensive": "metrics.expensive",
"influxdb": "metrics.influxdb",
"endpoint": "metrics.influxdb.endpoint",
"0-database": "metrics.influxdb.database",
"username": "metrics.influxdb.username",
"0-password": "metrics.influxdb.password",
"tags": "metrics.influxdb.tags",
"prometheus-addr": "metrics.prometheus-addr",
"opencollector-endpoint": "metrics.opencollector-endpoint",
"influxdbv2": "metrics.influxdbv2",
"token": "metrics.influxdb.token",
"bucket": "metrics.influxdb.bucket",
"organization": "metrics.influxdb.organization",
"unlock": "unlock",
"1-password": "password",
"allow-insecure-unlock": "allow-insecure-unlock",
"lightkdf": "lightkdf",
"disable-bor-wallet": "disable-bor-wallet",
"addr": "grpc.addr",
"dev": "dev",
"period": "dev.period",
"chain": "chain",
"identity": "identity",
"verbosity": "verbosity",
"datadir": "datadir",
"keystore": "keystore",
"syncmode": "syncmode",
"gcmode": "gcmode",
"eth.requiredblocks": "eth.requiredblocks",
"0-snapshot": "snapshot",
"\"bor.logs\"": "bor.logs",
"url": "bor.heimdall",
"\"bor.without\"": "bor.withoutheimdall",
"grpc-address": "bor.heimdallgRPC",
"\"bor.runheimdall\"": "bor.runheimdall",
"\"bor.runheimdallargs\"": "bor.runheimdallargs",
"locals": "txpool.locals",
"nolocals": "txpool.nolocals",
"journal": "txpool.journal",
"rejournal": "txpool.rejournal",
"pricelimit": "txpool.pricelimit",
"pricebump": "txpool.pricebump",
"accountslots": "txpool.accountslots",
"globalslots": "txpool.globalslots",
"accountqueue": "txpool.accountqueue",
"globalqueue": "txpool.globalqueue",
"lifetime": "txpool.lifetime",
"mine": "mine",
"etherbase": "miner.etherbase",
"extradata": "miner.extradata",
"gaslimit": "miner.gaslimit",
"gasprice": "miner.gasprice",
"ethstats": "ethstats",
"blocks": "gpo.blocks",
"percentile": "gpo.percentile",
"maxprice": "gpo.maxprice",
"ignoreprice": "gpo.ignoreprice",
"cache": "cache",
"1-database": "cache.database",
"trie": "cache.trie",
"trie.journal": "cache.journal",
"trie.rejournal": "cache.rejournal",
"gc": "cache.gc",
"1-snapshot": "cache.snapshot",
"noprefetch": "cache.noprefetch",
"preimages": "cache.preimages",
"txlookuplimit": "txlookuplimit",
"gascap": "rpc.gascap",
"txfeecap": "rpc.txfeecap",
"ipcdisable": "ipcdisable",
"ipcpath": "ipcpath",
"1-corsdomain": "http.corsdomain",
"1-vhosts": "http.vhosts",
"origins": "ws.origins",
"3-corsdomain": "graphql.corsdomain",
"3-vhosts": "graphql.vhosts",
"1-enabled": "http",
"1-host": "http.addr",
"1-port": "http.port",
"1-prefix": "http.rpcprefix",
"1-api": "http.api",
"2-enabled": "ws",
"2-host": "ws.addr",
"2-port": "ws.port",
"2-prefix": "ws.rpcprefix",
"2-api": "ws.api",
"3-enabled": "graphql",
"bind": "bind",
"0-port": "port",
"bootnodes": "bootnodes",
"maxpeers": "maxpeers",
"maxpendpeers": "maxpendpeers",
"nat": "nat",
"nodiscover": "nodiscover",
"v5disc": "v5disc",
"metrics": "metrics",
"expensive": "metrics.expensive",
"influxdb": "metrics.influxdb",
"endpoint": "metrics.influxdb.endpoint",
"0-database": "metrics.influxdb.database",
"username": "metrics.influxdb.username",
"0-password": "metrics.influxdb.password",
"tags": "metrics.influxdb.tags",
"prometheus-addr": "metrics.prometheus-addr",
"opencollector-endpoint": "metrics.opencollector-endpoint",
"influxdbv2": "metrics.influxdbv2",
"token": "metrics.influxdb.token",
"bucket": "metrics.influxdb.bucket",
"organization": "metrics.influxdb.organization",
"unlock": "unlock",
"1-password": "password",
"allow-insecure-unlock": "allow-insecure-unlock",
"lightkdf": "lightkdf",
"disable-bor-wallet": "disable-bor-wallet",
"addr": "grpc.addr",
"dev": "dev",
"period": "dev.period",
}
var removedFlagsAndValues = map[string]string{}
@ -212,15 +215,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",
},
},
}
@ -232,6 +235,7 @@ var currentBoolFlags = []string{
"snapshot",
"bor.logs",
"bor.withoutheimdall",
"bor.runheimdall",
"txpool.nolocals",
"mine",
"cache.noprefetch",
@ -542,7 +546,13 @@ func commentFlags(path string, updatedArgs []string) {
ignoreLineFlag := false
input, err := os.ReadFile(path)
canonicalPath, err := common.VerifyPath(path)
if err != nil {
fmt.Println("path not verified: " + err.Error())
return
}
input, err := os.ReadFile(canonicalPath)
if err != nil {
log.Fatalln(err)
}
@ -622,7 +632,7 @@ func commentFlags(path string, updatedArgs []string) {
output := strings.Join(newLines, "\n")
err = os.WriteFile(path, []byte(output), 0600)
err = os.WriteFile(canonicalPath, []byte(output), 0600)
if err != nil {
log.Fatalln(err)
}

2
sonar-project.properties Normal file
View file

@ -0,0 +1,2 @@
sonar.projectKey=maticnetwork_bor_AYWWvIEKoHLw1uOg0ppA
sonar.exclusions=crypto/secp256k1/libsecp256k1/src/java/org/bitcoin/*.java

View file

@ -2,9 +2,9 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/tests/fuzzers/difficulty"
)
@ -14,10 +14,11 @@ func main() {
os.Exit(1)
}
crasher := os.Args[1]
data, err := ioutil.ReadFile(crasher)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
os.Exit(1)
data := common.VerifyCrasher(crasher)
if data == nil {
return
}
difficulty.Fuzz(data)
}

View file

@ -18,9 +18,9 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/tests/fuzzers/les"
)
@ -32,10 +32,11 @@ func main() {
os.Exit(1)
}
crasher := os.Args[1]
data, err := ioutil.ReadFile(crasher)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
os.Exit(1)
data := common.VerifyCrasher(crasher)
if data == nil {
return
}
les.Fuzz(data)
}

View file

@ -18,9 +18,9 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/tests/fuzzers/rangeproof"
)
@ -32,10 +32,11 @@ func main() {
os.Exit(1)
}
crasher := os.Args[1]
data, err := ioutil.ReadFile(crasher)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
os.Exit(1)
data := common.VerifyCrasher(crasher)
if data == nil {
return
}
rangeproof.Fuzz(data)
}

View file

@ -18,9 +18,9 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/tests/fuzzers/snap"
)
@ -30,10 +30,11 @@ func main() {
os.Exit(1)
}
crasher := os.Args[1]
data, err := ioutil.ReadFile(crasher)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
os.Exit(1)
data := common.VerifyCrasher(crasher)
if data == nil {
return
}
snap.FuzzTrieNodes(data)
}

View file

@ -2,9 +2,9 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/tests/fuzzers/stacktrie"
)
@ -14,10 +14,11 @@ func main() {
os.Exit(1)
}
crasher := os.Args[1]
data, err := ioutil.ReadFile(crasher)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
os.Exit(1)
data := common.VerifyCrasher(crasher)
if data == nil {
return
}
stacktrie.Debug(data)
}

View file

@ -18,9 +18,9 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/tests/fuzzers/vflux"
)
@ -35,10 +35,11 @@ func main() {
os.Exit(1)
}
crasher := os.Args[1]
data, err := ioutil.ReadFile(crasher)
if err != nil {
fmt.Fprintf(os.Stderr, "error loading crasher %v: %v", crasher, err)
os.Exit(1)
data := common.VerifyCrasher(crasher)
if data == nil {
return
}
vflux.FuzzClientPool(data)
}