* Add more tracing logs to transaction pool
* Prevent adding non executable transactions and evict based on age
* Move sender account in TransactionsForSenderInfo
* Implement a size expiration cache for lowest invalid nonce for sender
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
* Retry mechanism for block creation
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Update CHANGELOG
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Always keep 1 thread active in the computation executors
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Surface StorageException when building a block for finer filtering
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Log successful block created at info
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Reformat block proposal logs
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Remove test code
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* refactors to rely on blocks added, and behave like singleton
* pulls up synchronizer building to keep merge related stuff in right place
* shows ready on pre-merge nets. no display on most merge nets
* listens for finalized, explains more pandas
Signed-off-by: Justin Florentine <justin+github@florentine.us>
* evict transactions from tail of senderAndNonce rather than just lowest price
* make pendingTransactions secondary sort based on timestamp rather than sequence id (to better prevent collisions for same gas price and sequence id)
Signed-off-by: garyschulte <garyschulte@gmail.com>
* if merge enabled, wrap two clique rules in composed Attached rule to enable fast-sync to proceed normally for post-merge networks
* move BlockPropagationManager warning to debug until #4274
Signed-off-by: garyschulte <garyschulte@gmail.com>
* initial impl of engine-api override:
* remove reliance on isMergeEnabled in pre-merge block header validation rules
* create a merge-specific block header validtion stack rather than leveraging mainnet
* re-add --engine-api-enabled cli param
* make engine api usable without a merge config.
leaves the door open to supporting the engine api with other MiningCoordinators, but disables all but engine_exchangeTransitionConfiguration in the absence of mergeCoordinator
Signed-off-by: garyschulte <garyschulte@gmail.com>
* fix infinite loop if a reorg contain a bad block
* add cache for latest valid ancestors for bad blocks
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
* add a merge-specific definiton of bestPeer and the supporting plumbing
Signed-off-by: garyschulte <garyschulte@gmail.com>
* set reached TTD when finishing a fast sync if appropriate
Signed-off-by: garyschulte <garyschulte@gmail.com>
* spdx header
Signed-off-by: garyschulte <garyschulte@gmail.com>
* fix BetterSyncTargetEvaluatorTest tests
Signed-off-by: garyschulte <garyschulte@gmail.com>
* adds interfaces for tracking merge state and forchoices
* after 2 finalizations from fcu, disconnect any peers sending new blocks, or connecting with td > ttd
* tests for preventing pow peers from joining
* refactored to separate out merge logic
Signed-off-by: Justin Florentine <justin+github@florentine.us>
* After merge add a rule to check that the current block is more recent than its parent
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Update CHANGELOG
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* Unit test
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* ignore forkchoice update if new head is an ancestor of the chain head
* added draft for CHANGELOG.md
* update PR link for CHANGELOG.md
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
* fix for TransitionProtocolSchedule getByBlockHeader when the chain is not finalized AND terminal block was exactly TTD
Signed-off-by: garyschulte <garyschulte@gmail.com>
* make invalid timestamp error return success response with INVALID status
* fix newPayloadTest expectation for invalid timestamp, add check in bad blocks for heads not in blockchain, return Hash.ZERO for latest valid ancestors that are PoW
* assert latestValidHash returns ZERO if PoW and ancestor hash if not.
Signed-off-by: garyschulte <garyschulte@gmail.com>
* When executing a newPayload do not move the chain head or update the world state
* When proposing a block, use a lightweight validation, without storing
* forwardToBlock moves head to the block and triggers advanced head event
* Do not persist prepared blocks
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Co-authored-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Jiri Peinlich <jiri.peinlich@gmail.com>
Co-authored-by: Karim TAAM <karim.t2am@gmail.com>
* removed check from fcU if new blocks are descendants of the previous finalized block
* backwards sync: remove check that block must be a descendant of finalized
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
* Backward Sync is now remembering recent finalized blocks.
When syncing using BWS we now consider finalized blocks reported by consensus layer.
When no finalized block is specified, nothing strange will go on. When Finalized block is specified
But Besu is not aware of any finalized block yet, we will sync as usual until the finalized block is about to get imported.
A new invariant is introduced when importing blocks using BWS.
All imported blocks has to descent from latest finalized block or a TTD block if we did not finalize yet.
* Importing a finalized block updates the information in Besu Mutable Blockchain.
* It is no longer possible to import blocks into the blockchain below a previously finalized block when using BWS
* When a new finalized block gets announced while BWS is in progress and Besu already has it imported, the Mutable Blockchain gets updated, and the chain gets checked for possible pruning
* When trying to import blocks of equal height as newly announced finalized block, then only the new announced finalized block will be possible to import using BWS
* When importing a new block using BWS after finalized, we can now guarantee that the block descends from latest finalized block
Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
* BWS now has explicit parametrized check for how deep to sync
Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
* addressing review comments
Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
* Addressing review comment
Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
Co-authored-by: Fabio Di Fabio <fabio.difabio@consensys.net>
* check that the timestamp in fcu payload attributes is greater than the one of the head block
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
* rearranged some things so EthProtocolManager can get notified of ttd
* adds some needed state and locking
* listens to MergeContext
* tests for preventing pow peers from joining
* disconnecting block senders after ttd
* wait till finalizing 2 blocks before locking out pow nodes
* hacking around clique networks, will need to be fixed still for Goerli
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Add a new way to synchronize which is X_CHECKPOINT. This mode is experimental so use it at your own risk. This mode allows you to do like a snapsync but starting from a specific checkpoint instead of starting from the genesis.
This checkpoint will be in the genesis configuration of each network. To add the checkpoint mechanism in a network you just have to add the checkpoint section in the genesis.
Currently there is a checkpoint for ropten, goerli and mainnet.
Mainnet on i3.2xlarge <6 hours
Goerli on i3.2xlarge <1 hours
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
* added acceptance tests
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
* updated EngineForkchoiceUpdated to return INVALID_FORKCHOICE_STATE when finalized block hash or safe block hash are unknown
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
* fixed tests and added new ones for invalid forkchoice state and saving safe block
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
* Upgrade Errorprone
Upgrade errorprone to 2.13.1. Like all errorprone upgrades there are
new checks requiring code changes.
* Unused methods now cause compilation errors
* fields must be static and final
* Effectively constant booleans must now be returned as true/false.
* longs should not auto-cast to double.
* turn off errorprone javadocs
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
* Fix two operand stack tests
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Remove unreachable assert
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Replace expected annotation field with assert
Signed-off-by: Diego López León <dieguitoll@gmail.com>
* Extract variables to let only a single call for assert
Signed-off-by: Diego López León <dieguitoll@gmail.com>
Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
* avoid the edge case of long minimum value which gives a negative value when passed into abs()
* changed some Longs to long where they were statically intialized
* replace Lists.emptyList() with Collections.emptyList()
* removed unnecessary eq() invocation and resulting code smell
Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
* timestamp being behind or at head does not make a block invalid
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>