Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

release: prepare for v1.1.0 #207

Merged
merged 431 commits into from
Dec 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
431 commits
Select commit Hold shift + click to select a range
e52f647
chore(primitives): use alloy eth conversion constants (#11892)
tcoratger Oct 22, 2024
1342747
fix: spawn network manager on test exex ctx (#11907)
loocapro Oct 22, 2024
4a68c5e
refactor(rpc): small refactor in `block_with_senders` (#11950)
tcoratger Oct 22, 2024
0df7f65
chore: serde 1.0.210 (#11963)
mattsse Oct 22, 2024
75b39bc
chore: run clippy locked (#11964)
mattsse Oct 22, 2024
e820593
primitive-traits: rm unused `SELECTOR_LEN` (#11959)
tcoratger Oct 22, 2024
cab76f2
fix(engine): run pruner after saving blocks (#11927)
joshieDo Oct 22, 2024
90aaad8
opt: reduce allocs for `parse_deposits_from_receipts` (#11949)
prestwich Oct 22, 2024
df57aed
chore: bump discv5 (#11966)
mattsse Oct 22, 2024
60337d9
feat(rpc): Add flags to disable read tx timeout (#11856)
0x00101010 Oct 22, 2024
b3015c7
fix(trie): removing a blinded leaf should result in an error (#11869)
shekhirin Oct 22, 2024
b20a271
chore(tree): improved debug logging for block insertion (#11958)
fgimenez Oct 22, 2024
8b1dfcc
test(trie): proptest <-> alloy maps integration (#11962)
shekhirin Oct 22, 2024
468ac0d
chore: log enode (#11974)
mattsse Oct 22, 2024
e70b112
feat(trie): update sparse trie hashes below level (#11969)
shekhirin Oct 22, 2024
3174bd5
chore: bump aquamarine (#11965)
mattsse Oct 22, 2024
28c61c1
fix: invoke prometheus recorder on op-reth Cli::run (#11982)
mattsse Oct 22, 2024
22171d2
chore: unpin serde (#11977)
tcoratger Oct 22, 2024
8bfbd97
feat(discv4): add soft_remove_node (#11970)
mattsse Oct 22, 2024
527d344
feat: Add reproducible build profile (#10459)
MoeMahhouk Oct 22, 2024
d68dca1
chore: fix cargo feature warning (#11900)
0xalpharush Oct 22, 2024
74eb375
fix: correctly poll `BasicBlockDownloader` (#11981)
klkvr Oct 22, 2024
6e51762
fix: ping oldest more often (#11988)
mattsse Oct 22, 2024
ee1260a
refactor(tx-pool): move `is_underpriced` to `ValidPoolTransaction` im…
tcoratger Oct 23, 2024
7fd28df
fix: re-establish bond on ping (#11989)
mattsse Oct 23, 2024
ff04de3
chore: bump alloy-eip7702 (#11986)
klkvr Oct 23, 2024
5e0ba41
tx-pool: migrate `ensure_max_init_code_size` to `PoolTransaction` tra…
tcoratger Oct 23, 2024
cf4e774
chore: `Ethereum` -> `Optimism` in comment of `optimism_payload` (#11…
hai-rise Oct 23, 2024
386379e
test(tokio-util): add unit tests for `EventSender` (#11980)
tcoratger Oct 23, 2024
252cdf7
storage: add unit tests for `StorageRevertsIter` (#11999)
tcoratger Oct 23, 2024
55d98bb
fix: check failed find nodes requests before sending new ones (#11997)
mattsse Oct 23, 2024
ab407e7
chore: bump alloy 054 (#12000)
mattsse Oct 23, 2024
8a40d5c
feat(providers): add `AtomicBlockchainProvider` (#11705)
joshieDo Oct 23, 2024
e98a050
fix(trie): account for existing nodes when revealing a node (#11836)
shekhirin Oct 23, 2024
fa30a4f
feat: add osaka hardfork (#11984)
onbjerg Oct 23, 2024
b7167a9
test(tx-pool): add unit test for `GetPooledTransactionLimit` (#11975)
tcoratger Oct 23, 2024
889a7e0
primitive-traits: use alloy `_DURATION` constants (#11960)
tcoratger Oct 23, 2024
89eb73f
refactor: replace extra fields with `ExecutionPayloadSidecar` in engi…
onbjerg Oct 23, 2024
bf612be
chore(hive): update expected failures (#12006)
fgimenez Oct 23, 2024
f3853e7
test(trie): get sparse trie nodes at depth (#12007)
shekhirin Oct 23, 2024
b732619
chore(trie): prefix set doc comment clarification (#12010)
shekhirin Oct 23, 2024
57a21fc
chore: increase max proof window (#12001)
meyer9 Oct 23, 2024
d6f5a89
test: tests for empty block bodies (#12013)
mattsse Oct 23, 2024
2fb63b0
chore: dont log if nothing to evict (#12015)
mattsse Oct 23, 2024
565e4b4
refactor(primitive-traits): use alloy `ETHEREUM_BLOCK_GAS_LIMIT` cons…
tcoratger Oct 23, 2024
044e2d6
refactor(primitive-traits): use alloy `EPOCH_SLOTS` constant (#12018)
tcoratger Oct 23, 2024
f219502
test: more unit tests for `TreeState` (#11687)
tcoratger Oct 24, 2024
4093532
chore(cli): engine cli options conflict with legacy (#11993)
rkrasiuk Oct 24, 2024
082f2cd
refactor: use op-alloy deposit signature (#12016)
caglaryucekaya Oct 24, 2024
7a06298
chore(rpc): make `TransactionCompat::fill` stateful (#11732)
emhane Oct 24, 2024
d7f08cd
chore: remove some clones (#12008)
hai-rise Oct 24, 2024
fcca8b1
refactor: BlockchainTestCase::run rm repetitive convert ForkSpec to C…
nkysg Oct 24, 2024
e04d1b4
perf(net): P2P sink, revert pull/11658 (#11712)
emhane Oct 24, 2024
0df3148
feat(payload): introduce payload freezing for predetermined blocks (#…
hoank101 Oct 24, 2024
84a30b0
primitive-traits: use alloy `INITIAL_BASE_FEE` constant (#12022)
tcoratger Oct 24, 2024
bbeb799
primitive-traits: rm `ALLOWED_FUTURE_BLOCK_TIME_SECONDS` constant (#1…
tcoratger Oct 24, 2024
8bfb7f9
primitive-traits: use alloy `BEACON_NONCE` constant (#12029)
tcoratger Oct 24, 2024
ebd1ed9
feat(exex): notifications trait (#11972)
0xurb Oct 24, 2024
d50da7f
primitives-traits: use alloy `SEPOLIA_GENESIS_HASH` constant (#12024)
tcoratger Oct 24, 2024
2d83f20
chore: reuse alloy-primitives logs bloom (#12031)
mattsse Oct 24, 2024
5e4da59
feat: Add more complex E2E test (#12005)
klkvr Oct 24, 2024
8b317f2
fix: exclude withdrawals from uncle block (#12038)
mattsse Oct 24, 2024
bea6e27
primitive-traits: use alloy `MIN_PROTOCOL_BASE_FEE` constant (#12037)
tcoratger Oct 24, 2024
11149d2
feat(payload builder): transaction pool filter (#10542)
greged93 Oct 24, 2024
53c5476
chore(primitive-traits): rm `EIP1559_` constants (#12036)
tcoratger Oct 24, 2024
e74f185
feat: add BestTransactions::filter_transactions (#12041)
mattsse Oct 24, 2024
2fba3c0
feat: `ExExContext`'s dynamic config (#11983)
0xurb Oct 24, 2024
ba78e43
fix(exex): relax `ExExContext` trait bounds (#12055)
shekhirin Oct 24, 2024
777417a
feat: add `reth test-vectors compact --write|--read` (#11954)
joshieDo Oct 24, 2024
ea4fb26
ci: enable `compact-codec` job (#12056)
joshieDo Oct 25, 2024
965daba
chore: add missing helpers to BestTransactions (#12044)
mattsse Oct 25, 2024
674616c
chore: change `net::discv5` log target to `discv5` (#12045)
PanGan21 Oct 25, 2024
c3182f2
primitives-traits: small refac for `IntegerList` and more doc (#12049)
tcoratger Oct 25, 2024
d988978
feat: improve e2e tests API + feeHistory test (#12058)
klkvr Oct 25, 2024
5a5ec73
Change return type of ReceiptBuilder (#11987)
edisontim Oct 25, 2024
269d705
test: ensure we acquire file lock in tests (#12064)
mattsse Oct 25, 2024
2ae7ee5
fix: increase `arbitrary::Unstructured` buffer size if `NotEnoughData…
joshieDo Oct 25, 2024
a87d654
feat: introduce iterator for default_ethereum_payload function (#11978)
edisontim Oct 25, 2024
58441c1
fix: fail on unwind during `reth import` (#12062)
klkvr Oct 25, 2024
26d1b15
fix: ignore discovered peers with tcp port 0 (#12065)
mattsse Oct 25, 2024
07bda5d
chore: EthBuiltPayload touchups (#12067)
mattsse Oct 25, 2024
09506aa
chore: rm TransactionFilter (#12066)
mattsse Oct 25, 2024
e93e373
making `command` public (#12074)
debjit-bw Oct 25, 2024
5568cca
primitive-traits: add unit tests for `Account` (#12048)
tcoratger Oct 25, 2024
e676d71
feat: Freeze payload if final (#12078)
edisontim Oct 25, 2024
d91cacd
feat(rpc): rpc rate limiter impl (#11952)
kamiyaa Oct 25, 2024
16b64d8
feat(make): add docs lint (#12082)
kien6034 Oct 25, 2024
a349919
docs: remove deleted op-sync workflow from docs (#12086)
AJStonewee Oct 25, 2024
fa59bd5
fix: correctly detect first sync on headers stage (#12085)
klkvr Oct 25, 2024
e0ad598
dev: add `requests` to `EthBuiltPayload` (#12072)
greged93 Oct 26, 2024
cecdf61
feat: `map_chainspec` for `NodeConfig` (#12068)
greged93 Oct 26, 2024
ac329bf
perf: improve debug_traceBlock performance (#11979)
lakshya-sky Oct 26, 2024
44e4c47
chore(sdk): add helper trait to node API to simplify type definition …
emhane Oct 26, 2024
a06c3af
chore(rpc): Remove provider and network trait methods from `EthApiSpe…
emhane Oct 26, 2024
019f347
chore: move optimism execution types test to optimism crate (#12026)
l1nxy Oct 26, 2024
d5f5c0f
chore(rpc): set `RpcNodeCore` as supertrait for `LoadState` (#12094)
emhane Oct 26, 2024
09ebecf
prune: add unit tests for `PruneInput` `get_next_tx_num_range` (#12081)
tcoratger Oct 26, 2024
f616de6
feat(rpc): Start to implement flashbots_validateBuilderSubmissionV3 (…
ryanschneider Oct 26, 2024
b257408
Fix readonly check in libmdbx-rs (#12096)
wtdcode Oct 26, 2024
1bdf429
Remove trait method `Call::evm_config` (#12095)
emhane Oct 26, 2024
ab07fcf
chore(op): simplify blob fields in newly built block header (#12035)
hai-rise Oct 26, 2024
923f4ff
chore: only check for better payload if tx_pool (#12097)
mattsse Oct 26, 2024
a98dc39
chore(rpc): simplify trait bounds on `EthApiSpec` impl (#12101)
emhane Oct 26, 2024
988c5ee
chore(rpc): Add super trait `RpcNodeCore` to `LoadPendingBlock` (#12098)
emhane Oct 26, 2024
8eb1742
refactor(tx-pool): small refactor (#12107)
tcoratger Oct 27, 2024
fae36bd
refactor(storage): small refactor (#12106)
tcoratger Oct 27, 2024
e158369
chore(rpc): remove redundant trait method `LoadBlock::provider` (#12100)
emhane Oct 27, 2024
768404c
chore(rpc): remove redundant trait bounds in eth api (#12105)
emhane Oct 27, 2024
131cc51
chore(rpc): remove redundant `EthBlocks::provider` (#12109)
emhane Oct 27, 2024
b7b3f81
chore(rpc): remove redundant `Trace::evm_config` (#12102)
emhane Oct 27, 2024
0c51609
TransactionsHandle propagation commands should not adhere to caching …
Parikalp-Bhardwaj Oct 27, 2024
1c36b71
docs: small fix in payload doc (#12116)
tcoratger Oct 28, 2024
8605d04
refactor: rm re-exports of alloy eip 4844 constants (#12120)
tcoratger Oct 28, 2024
e4bd135
fix(ci): remove import path from type names on `compact-codec` (#12125)
joshieDo Oct 28, 2024
77e5748
chore(rpc): remove redundant `LoadFee::provider` (#12122)
emhane Oct 28, 2024
8f5fd1d
chore(rpc): remove redundant `EthTransactions::provider` (#12121)
emhane Oct 28, 2024
fbdebe0
chain-state: fix typo (#12112)
tcoratger Oct 28, 2024
0f86287
fix(trie): sparse trie walk should be done in a sorted manner (#12087)
shekhirin Oct 28, 2024
268090e
bench(trie): `RevealedSparseTrie::update_rlp_node_level` (#12046)
shekhirin Oct 28, 2024
1b0f625
perf(trie): collect only changed sparse nodes at a depth (#12093)
shekhirin Oct 28, 2024
0d07d27
feat: Add version to `BeaconEngineMessage` FCU (#12089)
0xOsiris Oct 28, 2024
b5c0a46
feat: add `pending|queued` txs pool helpers (#12128)
lean-apple Oct 28, 2024
7209622
refactor(chainspec): refac and improved doc for `last_block_fork_befo…
tcoratger Oct 28, 2024
87a615f
fix(ci): remove renaming from `compact-codec` (#12133)
joshieDo Oct 28, 2024
d74730a
feat: add a wrapper for `BestTransactions` prioritizing given senders…
klkvr Oct 28, 2024
719ca3a
chain-spec: use alloy `MAINNET_DEPOSIT_CONTRACT_ADDRESS` constant (#1…
tcoratger Oct 28, 2024
1f1c68d
perf(trie): cache prefix set lookups in sparse trie (#12088)
shekhirin Oct 28, 2024
e446feb
chore(deps): weekly `cargo update` (#12108)
github-actions[bot] Oct 28, 2024
380e237
refactor: replace receipt envelope encoded with trait (#11742)
hoank101 Oct 28, 2024
af5ae5a
perf(trie): reduce allocations in sparse trie rlp node calculation (#…
shekhirin Oct 28, 2024
3f4634c
chore: add version to PayloadBuilderAttributes::try_new (#12137)
0xOsiris Oct 28, 2024
1276277
test(trie): use proptest to generate random values (#12140)
shekhirin Oct 28, 2024
b36b021
chore(rpc): define trait `RpcNodeCoreExt` and replace `LoadBlock::cac…
emhane Oct 28, 2024
06d73ee
chore(rpc): inline trait methods of `RpcNodeCore` impl (#12144)
emhane Oct 28, 2024
0733da9
chore(rpc): relax `FullNodeComponents` trait bound on `OpEthApi` to `…
emhane Oct 28, 2024
473026f
chore(rpc): remove redundant `LoadFee::cache` (#12146)
emhane Oct 28, 2024
3d62bfd
chore(rpc): add super trait `RpcNodeCoreExt` to `LoadReceipt` (#12149)
emhane Oct 28, 2024
28f8c47
chore(rpc): remove redundant `LoadTransaction::cache` (#12148)
emhane Oct 28, 2024
37d9643
chore(rpc): remove redundant `LoadState::cache` (#12147)
emhane Oct 28, 2024
ddc9bda
fix(op): fix payload id calculation (#11730)
Rjected Oct 28, 2024
05ee75f
fix: restrict concurrent incoming connections (#12150)
mattsse Oct 28, 2024
367eb44
chore: remove one unwrap (#12152)
mattsse Oct 28, 2024
4621578
dev: track invalid transactions by sender in pool (#12138)
greged93 Oct 28, 2024
0297b8f
fix: use net::discv5 for reth's discv5 tracing target namespace (reve…
zilayo Oct 28, 2024
fbe0462
test: use port0 in tests (#12154)
mattsse Oct 29, 2024
cc2a33c
feat: rate limit incoming ips (#12153)
mattsse Oct 29, 2024
b48fa68
fix(ecies): ecies typo (#12155)
Rjected Oct 29, 2024
7880d4d
refactor: change `PayloadConfig` to use parent header instead of pare…
lean-apple Oct 29, 2024
2dbbd15
chore(provider): remove unused `BlockExecutionReader` trait (#12156)
joshieDo Oct 29, 2024
dd18af1
feat: without-evm cli option in reth (#12134)
debjit-bw Oct 29, 2024
3c60778
storage: `into_iter` with `self` by value (#12115)
tcoratger Oct 29, 2024
1653877
chore(ci): try to read all vectors on `compact-codec` before exiting …
joshieDo Oct 29, 2024
0f9ba64
feat: add geometry to database args (#11828)
evchip Oct 29, 2024
4a8799f
consensus: add unit tests for `ForkchoiceStateTracker` and `Forkchoic…
tcoratger Oct 29, 2024
6f3600d
Revert "feat: add geometry to database args" (#12164)
mattsse Oct 29, 2024
5232842
feat(storage): pass changesets to unwind methods (#7879)
shekhirin Oct 29, 2024
f545877
Revert "Revert "feat: add geometry to database args"" (#12165)
mattsse Oct 29, 2024
e92ecfb
feat: Introduce trait for OpTransaction (#11745)
hoank101 Oct 29, 2024
58f24e0
chore: remove generate sidecar fn (#12167)
mattsse Oct 29, 2024
1006ce7
feat(provider): use `NodeTypes` on `DatabaseProvider` instead (#12166)
joshieDo Oct 29, 2024
2e750f0
test(prune): add unit tests for `ReceiptsLogPruneConfig` (#11916)
tcoratger Oct 29, 2024
8278418
feat: transaction trait (#11877)
edisontim Oct 29, 2024
734c78f
feat(discv4): neighbors packet logging (#12042)
khayss Oct 29, 2024
129f3ba
feat: introduce StateCommitment type (#11842)
frisitano Oct 30, 2024
367b4ed
chore(meta): update SECURITY.md (#12190)
DaniPopes Oct 30, 2024
6e794ee
fix(ecies): bound initial header body size (#12172)
Rjected Oct 30, 2024
2778ba3
tx-pool: fix `ExceedsGasLimit` error message order (#12191)
tcoratger Oct 30, 2024
93a9b8a
feat: Eip1559 params in extradata (#11887)
cody-wang-cb Oct 30, 2024
ff9a42a
feat(eth69): support for ETH69 (#12158)
Abhishekkochar Oct 30, 2024
bb8da98
feat: add is_ethereum trait fn (#12197)
mattsse Oct 30, 2024
755fac0
Wrap sidecar in arcs (#11554)
kdonthi Oct 30, 2024
b3e8327
chore: rename v1 type (#12205)
mattsse Oct 30, 2024
0c39704
feat: add missing is active at timestamp fns (#12206)
mattsse Oct 30, 2024
09c666d
test: add test case for BestTransactions (#12209)
mattsse Oct 30, 2024
b42b189
Reth primitives traits tx type (#11720)
0xriazaka Oct 30, 2024
e5fc048
docs: add context truncated input (#12207)
mattsse Oct 30, 2024
c19af29
feat: add rlp support for `EthVersion` (#12221)
lean-apple Oct 31, 2024
9659717
renamed OptimismPayloadBuilderAttributes to OpPayloadBuilderAttribute…
stevencartavia Oct 31, 2024
66cc619
chore: rm deprecated txpool fn (#12198)
mattsse Oct 31, 2024
41044a2
Apply beacon system call to trace_block (#12030)
stevencartavia Oct 31, 2024
76c5aef
fix(trie): move to sibling on invalid tree mask (#12193)
rkrasiuk Oct 31, 2024
1f1dcc9
chore: simplify SystemCaller setup (#12223)
mattsse Oct 31, 2024
460e26c
renamed OptimismBuiltPayload to OpBuiltPayload (#12227)
stevencartavia Oct 31, 2024
219def9
chore(ci): pin kurtosis to working version (#12225)
fgimenez Oct 31, 2024
d555f9e
chore(book): fix engine api typo (#12231)
Rjected Oct 31, 2024
998b3b3
renamed OptimismPayloadBuilder to OpPayloadBuilder (#12234)
stevencartavia Oct 31, 2024
d020b41
feat: `flashbots_validateBuilderSubmissionV3` (#12168)
klkvr Oct 31, 2024
bd8c4ec
replace DisplayHardforks with Box<dyn Display> (#12219)
stevencartavia Oct 31, 2024
921d1cc
renamed OptimismPoolBuilder to OpPoolBuilder (#12246)
stevencartavia Nov 1, 2024
8d31b65
chore: clippy happy (#12248)
mattsse Nov 1, 2024
249c600
rpc: add `rename` method in `TransportRpcModules` (#12239)
tcoratger Nov 1, 2024
39bc8ce
refactor(revm): simplify `Database` impl for `StateProviderDatabase` …
tcoratger Nov 1, 2024
f0cef9d
revm: add `Database` `Either` helper type (#12240)
tcoratger Nov 1, 2024
2758a56
txpool: added a helper to filter pending txns by predicate (#12204)
lakshya-sky Nov 1, 2024
c6b7408
chore: apply same member order (#12253)
mattsse Nov 1, 2024
f52186c
db-api: opt StorageShardedKey encode, decode (#12143)
nkysg Nov 1, 2024
927be85
feat: track buffered outgoing messages (#12220)
caglaryucekaya Nov 1, 2024
f93dbf5
Remove redundant `SignedTransaction::Signature` (#12185)
emhane Nov 1, 2024
f6bd11c
feature: transaction's input truncate function (#12236)
nadtech-hub Nov 1, 2024
c1a68f2
refactor: move `payload/builder/src/database.rs` to `revm/src/cached.…
lean-apple Nov 1, 2024
d5a3a3a
test(chain-state): add unit tests for `CanonStateNotification` (#12110)
tcoratger Nov 1, 2024
eaac2aa
chore: simplify cached db usage (#12242)
mattsse Nov 1, 2024
d810001
renamed OptimismNetworkBuilder to OpNetworkBuilder (#12255)
stevencartavia Nov 1, 2024
41c4bab
chore: use deref directly (#12256)
mattsse Nov 1, 2024
bc69f63
feat: add asref impls (#12257)
mattsse Nov 1, 2024
969ca3e
fix: check hashed state for loading `TriePrefixSets::destroyed_accoun…
joshieDo Nov 1, 2024
166a234
renamed OptimismExecutorBuilder to OpExecutorBuilder (#12258)
stevencartavia Nov 1, 2024
fdf10a7
test: make cargo t compile in codecs (#12261)
mattsse Nov 1, 2024
a911104
test: make cargo t compile in db-models (#12263)
mattsse Nov 1, 2024
c72f11c
renamed OptimismConsensusBuilder to OpConsensusBuilder (#12265)
stevencartavia Nov 1, 2024
d8bbd36
feat: flashbots_validateBuilderSubmissionV4 (#12243)
ryanschneider Nov 1, 2024
d7ead13
fix: clippy lints (#12269)
klkvr Nov 2, 2024
962fa66
Use Arc<ChainSpec> in SystemCaller (#12268)
stevencartavia Nov 2, 2024
9593f4d
renamed OptimismGenesisInfo to OpGenesisInfo (#12270)
stevencartavia Nov 2, 2024
dbdf60b
renamed OptimismBeaconConsensus to OpBeaconConsensus (#12271)
stevencartavia Nov 2, 2024
c74d2a0
chore(ci): unpin kurtosis (#12272)
fgimenez Nov 2, 2024
f2de55d
chore: make some fields owned (#12274)
mattsse Nov 2, 2024
2aba40b
feat: add `CachedReads::extend` (#12277)
lean-apple Nov 2, 2024
af38a1a
renamed OptimismPayloadTypes to OpPayloadTypes (#12281)
stevencartavia Nov 2, 2024
adff5a9
feat: remove AnyNetwork usage (#12280)
klkvr Nov 2, 2024
e374e4b
renamed OptimismEvmConfig to OpEvmConfig (#12284)
stevencartavia Nov 2, 2024
e167cc9
chore(deps): weekly `cargo update` (#12289)
github-actions[bot] Nov 3, 2024
20d3b21
renamed OptimismEngineTypes to OpEngineTypes (#12285)
stevencartavia Nov 3, 2024
4e3b32c
feat: add more decimals to database growth (#12288)
edisontim Nov 3, 2024
61f19ab
Refactor: use fully-qualified paths in Compact derives(Deon Branch) …
DanielEmmanuel1 Nov 3, 2024
21d911a
docs: add debug.etherscan in the book (#12293)
kien6034 Nov 3, 2024
bb03578
chore: Move FillTxEnv::fill_tx_env into SignedTransaction trait and i…
garwahl Nov 4, 2024
9814041
primitives: rm useless `OP_` constants (#12298)
tcoratger Nov 4, 2024
56b7687
primitives: rm alloy `Withdrawal` reexport (#12296)
tcoratger Nov 4, 2024
566f2b4
primitives: rm alloy `BlockHashOrNumber` reexport (#12302)
tcoratger Nov 4, 2024
0475af8
primitives: rm alloy `BlockId` reexport (#12303)
tcoratger Nov 4, 2024
3fe2234
feat(engine): add StateRootTask skeleton (#12305)
fgimenez Nov 4, 2024
d5f0103
primitives: rm alloy `BlockNumHash` reexport (#12304)
tcoratger Nov 4, 2024
967cbc4
primitives: rm alloy `Signature` reexport (#12313)
tcoratger Nov 5, 2024
e317340
renamed OptimismEngineValidator to OpEngineValidator (#12312)
stevencartavia Nov 5, 2024
4222cbe
chore: switch op to new engine (#12329)
mattsse Nov 5, 2024
556995f
chore: limit initial status size (#12324)
mattsse Nov 5, 2024
441ddbf
primitives: rm more alloy block reexports (#12308)
tcoratger Nov 5, 2024
5c2e941
chore: 1.1.1 (#12334)
mattsse Nov 5, 2024
15c230b
primitives: rm alloy `BlobTransactionValidationError` reexport (#12311)
tcoratger Nov 5, 2024
4baf3fb
Merge tag 'v1.1.1' into merge_v1.1.1
j75689 Nov 7, 2024
f170052
fix: fix conflicts and ci issues
yutianwu Nov 15, 2024
328fbf9
Merge remote-tracking branch 'origin/develop' into yutian/fix_merge_v…
yutianwu Nov 15, 2024
1821f66
Merge remote-tracking branch 'bnb/develop' into yutian/fix_merge_v1.1.1
j75689 Nov 20, 2024
9aaf5ad
chore: fix lint ci job
j75689 Nov 20, 2024
955fee5
fix: rlp issue
j75689 Nov 20, 2024
4f510ba
fix: change default db size to 8TB
j75689 Nov 22, 2024
9026eec
Merge pull request #188 from bnb-chain/yutian/fix_merge_v1.1.1
unclezoro Nov 26, 2024
a860a86
fix: failed to sync opbnb by consensys mode (#205)
j75689 Nov 28, 2024
833886f
chore: prepare for v1.1.0 (#206)
j75689 Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
consensus: add unit tests for ForkchoiceStateTracker and `Forkchoic…
…eStateHash` (#12077)
tcoratger authored Oct 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 4a8799f98bba7aa80a8c333f9b32f23221cb0cb8
269 changes: 243 additions & 26 deletions crates/consensus/beacon/src/engine/forkchoice.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ pub struct ForkchoiceStateTracker {
///
/// Caution: this can be invalid.
latest: Option<ReceivedForkchoiceState>,

/// Tracks the latest forkchoice state that we received to which we need to sync.
last_syncing: Option<ForkchoiceState>,
/// The latest valid forkchoice state that we received and processed as valid.
@@ -48,19 +47,19 @@ impl ForkchoiceStateTracker {
/// Returns whether the latest received FCU is valid: [`ForkchoiceStatus::Valid`]
#[allow(dead_code)]
pub(crate) fn is_latest_valid(&self) -> bool {
self.latest_status().map(|s| s.is_valid()).unwrap_or(false)
self.latest_status().map_or(false, |s| s.is_valid())
}

/// Returns whether the latest received FCU is syncing: [`ForkchoiceStatus::Syncing`]
#[allow(dead_code)]
pub(crate) fn is_latest_syncing(&self) -> bool {
self.latest_status().map(|s| s.is_syncing()).unwrap_or(false)
self.latest_status().map_or(false, |s| s.is_syncing())
}

/// Returns whether the latest received FCU is syncing: [`ForkchoiceStatus::Invalid`]
#[allow(dead_code)]
pub(crate) fn is_latest_invalid(&self) -> bool {
self.latest_status().map(|s| s.is_invalid()).unwrap_or(false)
self.latest_status().map_or(false, |s| s.is_invalid())
}

/// Returns the last valid head hash.
@@ -75,32 +74,28 @@ impl ForkchoiceStateTracker {
self.last_syncing.as_ref().map(|s| s.head_block_hash)
}

/// Returns the latest received `ForkchoiceState`.
/// Returns the latest received [`ForkchoiceState`].
///
/// Caution: this can be invalid.
pub const fn latest_state(&self) -> Option<ForkchoiceState> {
self.last_valid
}

/// Returns the last valid `ForkchoiceState`.
/// Returns the last valid [`ForkchoiceState`].
pub const fn last_valid_state(&self) -> Option<ForkchoiceState> {
self.last_valid
}

/// Returns the last valid finalized hash.
///
/// This will return [`None`], if either there is no valid finalized forkchoice state, or the
/// finalized hash for the latest valid forkchoice state is zero.
/// This will return [`None`]:
/// - If either there is no valid finalized forkchoice state,
/// - Or the finalized hash for the latest valid forkchoice state is zero.
#[inline]
pub fn last_valid_finalized(&self) -> Option<B256> {
self.last_valid.and_then(|state| {
// if the hash is zero then we should act like there is no finalized hash
if state.finalized_block_hash.is_zero() {
None
} else {
Some(state.finalized_block_hash)
}
})
self.last_valid
.filter(|state| !state.finalized_block_hash.is_zero())
.map(|state| state.finalized_block_hash)
}

/// Returns the last received `ForkchoiceState` to which we need to sync.
@@ -110,18 +105,14 @@ impl ForkchoiceStateTracker {

/// Returns the sync target finalized hash.
///
/// This will return [`None`], if either there is no sync target forkchoice state, or the
/// finalized hash for the sync target forkchoice state is zero.
/// This will return [`None`]:
/// - If either there is no sync target forkchoice state,
/// - Or the finalized hash for the sync target forkchoice state is zero.
#[inline]
pub fn sync_target_finalized(&self) -> Option<B256> {
self.last_syncing.and_then(|state| {
// if the hash is zero then we should act like there is no finalized hash
if state.finalized_block_hash.is_zero() {
None
} else {
Some(state.finalized_block_hash)
}
})
self.last_syncing
.filter(|state| !state.finalized_block_hash.is_zero())
.map(|state| state.finalized_block_hash)
}

/// Returns true if no forkchoice state has been received yet.
@@ -222,3 +213,229 @@ impl AsRef<B256> for ForkchoiceStateHash {
}
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_forkchoice_state_tracker_set_latest_valid() {
let mut tracker = ForkchoiceStateTracker::default();

// Latest state is None
assert!(tracker.latest_status().is_none());

// Create a valid ForkchoiceState
let state = ForkchoiceState {
head_block_hash: B256::from_slice(&[1; 32]),
safe_block_hash: B256::from_slice(&[2; 32]),
finalized_block_hash: B256::from_slice(&[3; 32]),
};
let status = ForkchoiceStatus::Valid;

tracker.set_latest(state, status);

// Assert that the latest state is set
assert!(tracker.latest.is_some());
assert_eq!(tracker.latest.as_ref().unwrap().state, state);

// Assert that last valid state is updated
assert!(tracker.last_valid.is_some());
assert_eq!(tracker.last_valid.as_ref().unwrap(), &state);

// Assert that last syncing state is None
assert!(tracker.last_syncing.is_none());

// Test when there is a latest status and it is valid
assert_eq!(tracker.latest_status(), Some(ForkchoiceStatus::Valid));
}

#[test]
fn test_forkchoice_state_tracker_set_latest_syncing() {
let mut tracker = ForkchoiceStateTracker::default();

// Create a syncing ForkchoiceState
let state = ForkchoiceState {
head_block_hash: B256::from_slice(&[1; 32]),
safe_block_hash: B256::from_slice(&[2; 32]),
finalized_block_hash: B256::from_slice(&[0; 32]), // Zero to simulate not finalized
};
let status = ForkchoiceStatus::Syncing;

tracker.set_latest(state, status);

// Assert that the latest state is set
assert!(tracker.latest.is_some());
assert_eq!(tracker.latest.as_ref().unwrap().state, state);

// Assert that last valid state is None since the status is syncing
assert!(tracker.last_valid.is_none());

// Assert that last syncing state is updated
assert!(tracker.last_syncing.is_some());
assert_eq!(tracker.last_syncing.as_ref().unwrap(), &state);

// Test when there is a latest status and it is syncing
assert_eq!(tracker.latest_status(), Some(ForkchoiceStatus::Syncing));
}

#[test]
fn test_forkchoice_state_tracker_set_latest_invalid() {
let mut tracker = ForkchoiceStateTracker::default();

// Create an invalid ForkchoiceState
let state = ForkchoiceState {
head_block_hash: B256::from_slice(&[1; 32]),
safe_block_hash: B256::from_slice(&[2; 32]),
finalized_block_hash: B256::from_slice(&[3; 32]),
};
let status = ForkchoiceStatus::Invalid;

tracker.set_latest(state, status);

// Assert that the latest state is set
assert!(tracker.latest.is_some());
assert_eq!(tracker.latest.as_ref().unwrap().state, state);

// Assert that last valid state is None since the status is invalid
assert!(tracker.last_valid.is_none());

// Assert that last syncing state is None since the status is invalid
assert!(tracker.last_syncing.is_none());

// Test when there is a latest status and it is invalid
assert_eq!(tracker.latest_status(), Some(ForkchoiceStatus::Invalid));
}

#[test]
fn test_forkchoice_state_tracker_sync_target() {
let mut tracker = ForkchoiceStateTracker::default();

// Test when there is no last syncing state (should return None)
assert!(tracker.sync_target().is_none());

// Set a last syncing forkchoice state
let state = ForkchoiceState {
head_block_hash: B256::from_slice(&[1; 32]),
safe_block_hash: B256::from_slice(&[2; 32]),
finalized_block_hash: B256::from_slice(&[3; 32]),
};
tracker.last_syncing = Some(state);

// Test when the last syncing state is set (should return the head block hash)
assert_eq!(tracker.sync_target(), Some(B256::from_slice(&[1; 32])));
}

#[test]
fn test_forkchoice_state_tracker_last_valid_finalized() {
let mut tracker = ForkchoiceStateTracker::default();

// No valid finalized state (should return None)
assert!(tracker.last_valid_finalized().is_none());

// Valid finalized state, but finalized hash is zero (should return None)
let zero_finalized_state = ForkchoiceState {
head_block_hash: B256::ZERO,
safe_block_hash: B256::ZERO,
finalized_block_hash: B256::ZERO, // Zero finalized hash
};
tracker.last_valid = Some(zero_finalized_state);
assert!(tracker.last_valid_finalized().is_none());

// Valid finalized state with non-zero finalized hash (should return finalized hash)
let valid_finalized_state = ForkchoiceState {
head_block_hash: B256::from_slice(&[1; 32]),
safe_block_hash: B256::from_slice(&[2; 32]),
finalized_block_hash: B256::from_slice(&[123; 32]), // Non-zero finalized hash
};
tracker.last_valid = Some(valid_finalized_state);
assert_eq!(tracker.last_valid_finalized(), Some(B256::from_slice(&[123; 32])));

// Reset the last valid state to None
tracker.last_valid = None;
assert!(tracker.last_valid_finalized().is_none());
}

#[test]
fn test_forkchoice_state_tracker_sync_target_finalized() {
let mut tracker = ForkchoiceStateTracker::default();

// No sync target state (should return None)
assert!(tracker.sync_target_finalized().is_none());

// Sync target state with finalized hash as zero (should return None)
let zero_finalized_sync_target = ForkchoiceState {
head_block_hash: B256::from_slice(&[1; 32]),
safe_block_hash: B256::from_slice(&[2; 32]),
finalized_block_hash: B256::ZERO, // Zero finalized hash
};
tracker.last_syncing = Some(zero_finalized_sync_target);
assert!(tracker.sync_target_finalized().is_none());

// Sync target state with non-zero finalized hash (should return the hash)
let valid_sync_target = ForkchoiceState {
head_block_hash: B256::from_slice(&[1; 32]),
safe_block_hash: B256::from_slice(&[2; 32]),
finalized_block_hash: B256::from_slice(&[22; 32]), // Non-zero finalized hash
};
tracker.last_syncing = Some(valid_sync_target);
assert_eq!(tracker.sync_target_finalized(), Some(B256::from_slice(&[22; 32])));

// Reset the last sync target state to None
tracker.last_syncing = None;
assert!(tracker.sync_target_finalized().is_none());
}

#[test]
fn test_forkchoice_state_tracker_is_empty() {
let mut forkchoice = ForkchoiceStateTracker::default();

// Initially, no forkchoice state has been received, so it should be empty.
assert!(forkchoice.is_empty());

// After setting a forkchoice state, it should no longer be empty.
forkchoice.set_latest(ForkchoiceState::default(), ForkchoiceStatus::Valid);
assert!(!forkchoice.is_empty());

// Reset the forkchoice latest, it should be empty again.
forkchoice.latest = None;
assert!(forkchoice.is_empty());
}

#[test]
fn test_forkchoice_state_hash_find() {
// Define example hashes
let head_hash = B256::random();
let safe_hash = B256::random();
let finalized_hash = B256::random();
let non_matching_hash = B256::random();

// Create a ForkchoiceState with specific hashes
let state = ForkchoiceState {
head_block_hash: head_hash,
safe_block_hash: safe_hash,
finalized_block_hash: finalized_hash,
};

// Test finding the head hash
assert_eq!(
ForkchoiceStateHash::find(&state, head_hash),
Some(ForkchoiceStateHash::Head(head_hash))
);

// Test finding the safe hash
assert_eq!(
ForkchoiceStateHash::find(&state, safe_hash),
Some(ForkchoiceStateHash::Safe(safe_hash))
);

// Test finding the finalized hash
assert_eq!(
ForkchoiceStateHash::find(&state, finalized_hash),
Some(ForkchoiceStateHash::Finalized(finalized_hash))
);

// Test with a hash that doesn't match any of the hashes in ForkchoiceState
assert_eq!(ForkchoiceStateHash::find(&state, non_matching_hash), None);
}
}