711 Commits

Author SHA1 Message Date
Danno Ferrin
f20b4b3bd1 "Small" Ethereum Object Format (EIP-3540 + EIP-3670) (#4644)
Implement "Small" EOF - EIP-3540 (container) and EIP-3670 (validation).

Make code an interface so EOF specific features are compartmentalized,
including an 'invalid' code type representing a code block that didn't
pass validation, CodeV1 for EOF1, and CodeV0 which represents pre-EOF
code. EVMs track a maximum supported EOF version (where 0 is pre-eof)and
code is generated from a CodeFactory taking in context (is it a CREATE
operation and max code size) for the validation.

Includes spec versions for "Shanghai" and transient testnet "Shandong".
"Small" EOF is only activated in Shandong.

Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
2022-11-15 18:09:28 -06:00
Fabio Di Fabio
af04357874 Backward sync log UX improvements (#4655)
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2022-11-15 14:31:01 +01:00
Gabriel-Trintinalia
3406f06fcf Remove misleading fastSyncEnabled variable (#4668)
* Rename fastSyncEnabled to fullSyncDisabled and pass syncConfig down instead of boolean

Signed-off-by: Gabriel Trintinalia <gabriel.trintinalia@gmail.com>

* Fix tests references

Signed-off-by: Gabriel Trintinalia <gabriel.trintinalia@gmail.com>

* Fix class references

Signed-off-by: Gabriel Trintinalia <gabriel.trintinalia@gmail.com>

Signed-off-by: Gabriel Trintinalia <gabriel.trintinalia@gmail.com>
2022-11-14 10:48:04 +11:00
Gabriel-Trintinalia
2f2628b9a8 ♻️ Refactor EthProtocol to externalise EthVersion into its own class (#4640)
Signed-off-by: Gabriel Trintinalia <gabriel.trintinalia@consensys.net>

Signed-off-by: Gabriel Trintinalia <gabriel.trintinalia@consensys.net>
Co-authored-by: Gabriel Trintinalia <gabriel.trintinalia@consensys.net>
2022-11-10 11:05:09 +11:00
Danno Ferrin
6f20060182 Rollback #4578 and #44562 (#4583)
Due to subtle differences between Bytes32 and UInt256 the changes failed
burn-in testing and are being reverted.

Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>

Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
2022-11-01 14:53:01 +10:00
Danno Ferrin
aff38f414d Remove Bytes32.ZERO (#4578)
Replace the use of the Bytes32.ZERO constant with a byte array variant.

Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
2022-10-30 22:07:36 -05:00
Justin Florentine
fe79c02102 4512 invalid badblock (#4554)
* don't add to bad blocks manager on StorageException
* support for MerklePatriciaTrie exceptions

Signed-off-by: Justin Florentine <justin+github@florentine.us>
2022-10-29 02:03:36 -04:00
Pedro Novais
df56576ab0 BlockCreator returns BlockCreationResult transaction selection results (#4465)
* BlockCreator returns BlockCreationResult with block and transactions selection results

Signed-off-by: Pedro Novais <jpvnovais@gmail.com>
2022-10-14 17:03:27 -04:00
Fabio Di Fabio
e9f979ebd3 Try to build better block proposals until timeout or GetPayload is ca… (#4516)
* Try to build better block proposals until timeout or GetPayload is called

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2022-10-14 09:25:50 +02:00
Fabio Di Fabio
33a0188fe2 Make PoS block creation max time a config option (#4519)
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2022-10-12 11:42:55 +02:00
mark-terry
7a2db24695 RPC parameter error improvements. Test updates. (#4510)
* RPC parameter error improvements. Test updates.

Signed-off-by: mark-terry <mark.terry@consensys.net>
2022-10-11 13:47:57 +10:00
Justin Florentine
6b31efa0b9 Log receipts reorg (#4497)
* re-emits correct block added event when reminding
* uprevs version of log bloom cache metadata to force regeneration on startup

Signed-off-by: Justin Florentine <justin+github@florentine.us>
2022-10-07 15:06:38 -07:00
Fabio Di Fabio
84eab6977e Refactor unverified forkchoice event (#4487)
* Refactor unverified forkchoice event

Renaming to make clear everywhere that the forkchoice is not verified, so
it will be clear in case there will be a future event for a verified forkchoice.
Finalized block hash no more optional.

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2022-10-06 14:10:54 -04:00
Justin Florentine
e4477f908d removes pandas (#4472)
* removes pandas

Signed-off-by: Justin Florentine <justin+github@florentine.us>
2022-10-06 13:25:58 -04:00
Justin Traglia
9e267ae0e8 Access fields/methods more directly (#4449)
* Access fields/methods more directly

Signed-off-by: Justin Traglia <jtraglia@pm.me>

Signed-off-by: Justin Traglia <jtraglia@pm.me>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
2022-10-05 13:26:53 +10:00
Gabriel-Trintinalia
a80ed4e35d Replace boolean return with BlockImportResult object (#4386)
* Replace boolean return with BlockImportResult object

Signed-off-by: Gabriel Trintinalia <gabriel.trintinalia@consensys.net>
Co-authored-by: Gabriel Trintinalia <gabriel.trintinalia@consensys.net>
2022-10-05 09:09:36 +10:00
Fabio Di Fabio
64bf83cfeb Keep the best block built until now instead of the last one (#4455)
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2022-09-30 10:55:32 +02:00
Fabio Di Fabio
30bff31823 Transaction pool improvements to avoid filling the pool with not executable transactions (#4425)
* 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>
2022-09-22 17:40:21 -07:00
Fabio Di Fabio
5e156253ab Retry mechanism for block creation (#4407)
* 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>
2022-09-20 09:54:14 +02:00
Sally MacFarlane
9a6701eb4e add tostring (#4392)
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
2022-09-14 23:51:45 +02:00
garyschulte
26e23ac808 Quieten merkletrie exceptions (#4378)
* quieten the txpool merkletrie exceptions
* move prepareBlock stacktraces to debug

Signed-off-by: garyschulte <garyschulte@gmail.com>
2022-09-13 11:37:03 -07:00
Justin Florentine
101f5efbdc refactors to rely on blocks added, and behave like singleton (#4325)
* 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>
2022-09-08 01:57:29 +10:00
garyschulte
8ee253982c Feature/tx sender future nonce limits (#4336)
* add max future nonce configs, update plumbing to use txpool config rather than constants

Signed-off-by: garyschulte <garyschulte@gmail.com>
2022-09-02 09:44:51 -07:00
garyschulte
f3fd946edf Evict Transactions by sender from tail first (#4327)
* 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>
2022-09-01 22:39:47 +02:00
Pedro Novais
c5ae9f5da9 changes MergeCoordinator fields to protected to allow extension; (#4287)
Signed-off-by: Pedro Novais <jpvnovais@gmail.com>

Co-authored-by: Antony Denyer <git@antonydenyer.co.uk>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
2022-08-26 15:41:14 +10:00
Justin Florentine
1d508bab42 Panda prove ments (#4267)
* breaks pandas up, test coverage

Signed-off-by: Justin Florentine <justin+github@florentine.us>
2022-08-18 11:51:37 -07:00
garyschulte
cdeecf36fd Bugfix/clique post merge fast sync (#4276)
* 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>
2022-08-18 11:52:50 -06:00
garyschulte
f43b9ade7e remove MergeUnfinalizedRule since consensus layer should be allowed to execute a reorg around an already finalized block. (#4240)
Signed-off-by: garyschulte <garyschulte@gmail.com>
2022-08-10 05:02:23 +10:00
garyschulte
826648b2de Feature/engine api override (#4190)
* 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>
2022-07-31 13:45:35 +10:00
garyschulte
9b2fcde2b0 Panda print only when crossing TTD the first time (#4194)
* add oldState to MergeStateHandler, move Pandas to Transition watcher

Signed-off-by: garyschulte <garyschulte@gmail.com>
2022-07-29 11:33:55 -04:00
Justin Florentine
1400646ebf 4169 dont recurse (#4171)
* reimplemented with simple loop instead of recursing

Signed-off-by: Justin Florentine <justin+github@florentine.us>
2022-07-26 20:12:56 -07:00
Daniel Lehrner
979988707b Fix post merge chain reog with invalid block (#4131)
* 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>
2022-07-26 19:26:28 +10:00
garyschulte
e48b73bb70 post-merge sync and peering fix (#4116)
* 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>
2022-07-18 07:49:07 -07:00
Justin Florentine
0d1d36afc0 log execution errors at right level, stops transition message propagation post-merge sync. (#4104)
Signed-off-by: Justin Florentine <justin+github@florentine.us>

Co-authored-by: garyschulte <garyschulte@gmail.com>
2022-07-14 19:17:25 +02:00
Fabio Di Fabio
a1af83b8de Backward sync exception improvements (#4092)
* Remove backward sync exception recursive nesting

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2022-07-14 08:57:27 +10:00
Daniel Lehrner
750580dcca New payload: add invalid to bad blocks (#4080)
* if block did not descend from the terminal block add it to the bad blocks

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
2022-07-12 06:21:38 +10:00
Justin Florentine
1a62d2a6c2 3943 stop blocks on finalized (#4058)
* 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>
2022-07-11 13:34:39 -04:00
Fabio Di Fabio
08fedc6863 Fix transition protocol schedule (#4078)
* Fix to return pre-merge protocol schedule when block difficulty is less that TTD

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
2022-07-08 16:59:23 -07:00
Fabio Di Fabio
93b8770022 After merge add a rule to check that the current block is more recent than its parent (#4066)
* 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>
2022-07-08 11:19:36 +02:00
Daniel Lehrner
c84a243547 fcU: Ignore newHead if it is an ancestor of chain head (#4055)
* 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>
2022-07-06 09:51:57 +10:00
mbaxter
3dce6a93ec [Issue-3867] Limit outbound eth message sizes (#4034)
Signed-off-by: Meredith Baxter <meredith.baxter@palm.io>
2022-07-05 16:24:31 +02:00
garyschulte
8d372a0ac3 Fix for TransitionProtocolSchedule by header when terminal block exactly at TTD (#4045)
* fix for TransitionProtocolSchedule getByBlockHeader when the chain is not finalized AND terminal block was exactly TTD

Signed-off-by: garyschulte <garyschulte@gmail.com>
2022-07-02 19:25:46 -07:00
garyschulte
051c959342 Hive engine suite conformance: Invalid Timestamp, Invalid Transition Payload (#4042)
* 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>
2022-07-01 19:49:18 -07:00
Fabio Di Fabio
90f891b78c When on PoS the head can be only be updated by ForkchoiceUpdate (#4013)
* 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>
2022-07-01 14:47:18 -04:00
Daniel Lehrner
ed37cba977 Remove check in fcU if new blocks are descendants of the previous finalized block (#3975)
* 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>
2022-06-24 23:12:51 +10:00
Danno Ferrin
755771d22c Dependency Version Updates for 22.7.0-RC1 (#4004)
Update dependency versions.

Dependencies skipped because they require compatibility work
 * vertx
 * JMH
 * Prometheus
 * RocksDB
 * Web3j
 * Gradle

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
2022-06-23 11:03:07 -03:00
Jiri Peinlich
82aed63577 Backwards Sync now adding blocks to BadBlocksManager (#3999)
Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
2022-06-22 15:13:49 +01:00
Justin Florentine
963da3d7ac Release 22.4.3 (#3978)
* reverts disconnect of pow network
* updates gav coords to 22.4.3

Signed-off-by: Justin Florentine <justin+github@florentine.us>
2022-06-16 14:04:18 -04:00
Jiri Peinlich
2b42f6e222 Backward Sync should remember recent finalized blocks. (#3808)
* 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>
2022-06-16 11:20:30 +01:00
Daniel Lehrner
81f25e15f9 Fcu verify payload attributes (#3837)
* 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>
2022-06-13 10:40:03 +02:00