* 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>
* 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>
* 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>
* 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>
* use paris evm config in merge protocolschedule
catch exception on block persist so that it can be added to badBlocks
Signed-off-by: garyschulte <garyschulte@gmail.com>
Change the unit test execution to use the Junit5 JUnitPlatform. This
allows for a mix of junit 4 and junit 5 tests and for a gradual
migration to junit 5 instead of a big bang. One class depended on
junit 4 exceptions and was updated. Two tests depending on
native libraries fail gracefully on mac (and only mac).
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>