* 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 geth v1.10.15
* fix: Removed FastSync from cli server
* fix: TestHeadersRLPStorage
* Added t.skip(ETH2 in bor)
* fix: flow in create consensus engine
* bumped version
* Fix typo
* increase block time
* remove file
* bumped version
* merge gethv1.10.17
* bumped version
* fix failing tests
* Bump Go version to v1.18 (#368)
* Bump Go version to v1.18.1
* Build using netgo tag
This will create a static build using Go native networking stack.
Checked and it works stable for all archs and distros.
* Fix meta
* Bump version
* Meta as stable
Co-authored-by: Shivam Sharma <shivam691999@gmail.com>
Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Co-authored-by: Sandeep Sreenath <sandeep.sreenath@gmail.com>
Co-authored-by: Victor Castell <victor@victorcastell.com>
This removes some code:
- The clique engine calculated the snapshot twice when verifying headers/blocks.
- The method GetBlockHashesFromHash in Header/Block/Lightchain was only used by tests. It
is now removed from the API.
- The method GetTdByHash internally looked up the number before calling GetTd(hash, num).
In many cases, callers already had the number, and used this method just because it has a
shorter name. I have removed the method to make the API surface smaller.
This commit splits the eth package, separating the handling of eth and snap protocols. It also includes the capability to run snap sync (https://github.com/ethereum/devp2p/blob/master/caps/snap.md) , but does not enable it by default.
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
This adds a new API method on core.BlockChain to allow interrupting
running data inserts, and calls the method before shutting down the
downloader.
The BlockChain interrupt checks are now done through a method instead
of inlining the atomic load everywhere. There is no loss of efficiency from
this and it makes the interrupt protocol a lot clearer because the check is
defined next to the method that sets the flag.
* cmd, core, eth: init tx lookup in background
* core/rawdb: tiny log fixes to make it clearer what's happening
* core, eth: fix rebase errors
* core/rawdb: make reindexing less generic, but more optimal
* rlp: implement rlp list iterator
* core/rawdb: new implementation of tx indexing/unindex using generic tx iterator and hashing rlp-data
* core/rawdb, cmd/utils: fix review concerns
* cmd/utils: fix merge issue
* core/rawdb: add some log formatting polishes
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
* eth: improve shutdown synchronization
Most goroutines started by eth.Ethereum didn't have any shutdown sync at
all, which lead to weird error messages when quitting the client.
This change improves the clean shutdown path by stopping all internal
components in dependency order and waiting for them to actually be
stopped before shutdown is considered done. In particular, we now stop
everything related to peers before stopping 'resident' parts such as
core.BlockChain.
* eth: rewrite sync controller
* eth: remove sync start debug message
* eth: notify chainSyncer about new peers after handshake
* eth: move downloader.Cancel call into chainSyncer
* eth: make post-sync block broadcast synchronous
* eth: add comments
* core: change blockchain stop message
* eth: change closeBloomHandler channel type
Package p2p/enode provides a generalized representation of p2p nodes
which can contain arbitrary information in key/value pairs. It is also
the new home for the node database. The "v4" identity scheme is also
moved here from p2p/enr to remove the dependency on Ethereum crypto from
that package.
Record signature handling is changed significantly. The identity scheme
registry is removed and acceptable schemes must be passed to any method
that needs identity. This means records must now be validated explicitly
after decoding.
The enode API is designed to make signature handling easy and safe: most
APIs around the codebase work with enode.Node, which is a wrapper around
a valid record. Going from enr.Record to enode.Node requires a valid
signature.
* p2p/discover: port to p2p/enode
This ports the discovery code to the new node representation in
p2p/enode. The wire protocol is unchanged, this can be considered a
refactoring change. The Kademlia table can now deal with nodes using an
arbitrary identity scheme. This requires a few incompatible API changes:
- Table.Lookup is not available anymore. It used to take a public key
as argument because v4 protocol requires one. Its replacement is
LookupRandom.
- Table.Resolve takes *enode.Node instead of NodeID. This is also for
v4 protocol compatibility because nodes cannot be looked up by ID
alone.
- Types Node and NodeID are gone. Further commits in the series will be
fixes all over the the codebase to deal with those removals.
* p2p: port to p2p/enode and discovery changes
This adapts package p2p to the changes in p2p/discover. All uses of
discover.Node and discover.NodeID are replaced by their equivalents from
p2p/enode.
New API is added to retrieve the enode.Node instance of a peer. The
behavior of Server.Self with discovery disabled is improved. It now
tries much harder to report a working IP address, falling back to
127.0.0.1 if no suitable address can be determined through other means.
These changes were needed for tests of other packages later in the
series.
* p2p/simulations, p2p/testing: port to p2p/enode
No surprises here, mostly replacements of discover.Node, discover.NodeID
with their new equivalents. The 'interesting' API changes are:
- testing.ProtocolSession tracks complete nodes, not just their IDs.
- adapters.NodeConfig has a new method to create a complete node.
These changes were needed to make swarm tests work.
Note that the NodeID change makes the code incompatible with old
simulation snapshots.
* whisper/whisperv5, whisper/whisperv6: port to p2p/enode
This port was easy because whisper uses []byte for node IDs and
URL strings in the API.
* eth: port to p2p/enode
Again, easy to port because eth uses strings for node IDs and doesn't
care about node information in any way.
* les: port to p2p/enode
Apart from replacing discover.NodeID with enode.ID, most changes are in
the server pool code. It now deals with complete nodes instead
of (Pubkey, IP, Port) triples. The database format is unchanged for now,
but we should probably change it to use the node database later.
* node: port to p2p/enode
This change simply replaces discover.Node and discover.NodeID with their
new equivalents.
* swarm/network: port to p2p/enode
Swarm has its own node address representation, BzzAddr, containing both
an overlay address (the hash of a secp256k1 public key) and an underlay
address (enode:// URL).
There are no changes to the BzzAddr format in this commit, but certain
operations such as creating a BzzAddr from a node ID are now impossible
because node IDs aren't public keys anymore.
Most swarm-related changes in the series remove uses of
NewAddrFromNodeID, replacing it with NewAddr which takes a complete node
as argument. ToOverlayAddr is removed because we can just use the node
ID directly.
* accounts, cmd, eth, ethdb: port logs over to new system
* ethdb: drop concept of cache distribution between dbs
* eth: fix some log nitpicks to make them nicer
The transaction pool keeps track of the current nonce in its local pendingState. When a
new block comes in the pendingState is reset. During the reset it fetches multiple times
the current state through the use of the currentState callback. When a second block comes
in during the reset its possible that the state changes during the reset. If that block
holds transactions that are currently in the pool the local pendingState that is used to
determine nonces can get out of sync.
Shutting down geth prints hundreds of annoying error messages in some
cases. The errors appear because the Stop method of eth.ProtocolManager,
miner.Miner and core.TxPool is asynchronous. Left over peer sessions
generate events which are processed after Stop even though the database
has already been closed.
The fix is to make Stop synchronous using sync.WaitGroup.
For eth.ProtocolManager, in order to make use of WaitGroup safe, we need
a way to stop new peer sessions from being added while waiting on the
WaitGroup. The eth protocol Run function now selects on a signaling
channel and adds to the WaitGroup only if ProtocolManager is not
shutting down.
For miner.worker and core.TxPool the number of goroutines is static,
WaitGroup can be used in the usual way without additional
synchronisation.