reth icon indicating copy to clipboard operation
reth copied to clipboard

feat: validate sidechain state roots

Open Rjected opened this issue 2 years ago • 4 comments

This validates sidechain state roots by first unwinding, trying to insert the new payload, and then re-committing the unwinded data.

Fixes #3060 Fixes #3057

TODO:

  • [x] fix latestValidHash - currently is incorrect for invalid payloads on forks
  • [x] remove unwraps

Rjected avatar Jun 08 '23 22:06 Rjected

Codecov Report

Merging #3074 (33fa694) into main (4de1ff0) will decrease coverage by 0.03%. Report is 11 commits behind head on main. The diff coverage is 61.66%.

Impacted file tree graph

Files Changed Coverage Δ
crates/interfaces/src/executor.rs 100.00% <ø> (ø)
crates/interfaces/src/provider.rs 12.50% <0.00%> (-87.50%) :arrow_down:
crates/payload/basic/src/lib.rs 0.00% <0.00%> (ø)
crates/payload/builder/src/error.rs 0.00% <0.00%> (ø)
crates/rpc/rpc-engine-api/src/error.rs 60.00% <0.00%> (-10.59%) :arrow_down:
crates/blockchain-tree/src/blockchain_tree.rs 82.61% <50.00%> (-0.77%) :arrow_down:
crates/consensus/beacon/src/engine/mod.rs 76.08% <96.29%> (+0.29%) :arrow_up:
crates/blockchain-tree/src/chain.rs 76.81% <100.00%> (-0.25%) :arrow_down:

... and 18 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.84% <0.00%> (-0.03%) :arrow_down:
unit-tests 64.05% <61.66%> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 25.94% <ø> (ø)
blockchain tree 82.48% <57.89%> (-0.36%) :arrow_down:
pipeline 90.07% <ø> (ø)
storage (db) 74.58% <ø> (-0.18%) :arrow_down:
trie 94.71% <ø> (ø)
txpool 48.20% <ø> (+0.53%) :arrow_up:
networking 77.69% <ø> (-0.04%) :arrow_down:
rpc 58.64% <0.00%> (-0.07%) :arrow_down:
consensus 63.95% <96.29%> (+0.19%) :arrow_up:
revm 32.26% <ø> (ø)
payload builder 6.54% <0.00%> (-0.04%) :arrow_down:
primitives 87.83% <0.00%> (-0.08%) :arrow_down:

codecov[bot] avatar Jun 08 '23 22:06 codecov[bot]

What's blocking us here?

onbjerg avatar Jun 19 '23 11:06 onbjerg

What's blocking us here?

Need to convert some unwraps to errors, then this should be r4r

Rjected avatar Jun 19 '23 20:06 Rjected

I'm split if we should go forward with this as an intermediate solution. imo we should have taken the in-mem diff approach instead of non-committing unwind

Agree that the in memory approach is strictly better, whether or not we want to merge this is there an issue for the in-memory design?

Rjected avatar Jun 21 '23 01:06 Rjected

Update here, we can probably include this as an intermediate solution. Otherwise this just needs to be rebased

Rjected avatar Jul 07 '23 19:07 Rjected

this needs some work because of error mapping since rebase - will update when this is working again

Rjected avatar Jul 10 '23 19:07 Rjected

Ready for review now

Rjected avatar Jul 11 '23 01:07 Rjected

converted to draft because this should not be merged - I'll check the hive results with this PR, post them here, and close the PR. This should give us a good idea of how far we'll get with hive tests if we implement sidechain root validation in some other way.

Rjected avatar Aug 10 '23 18:08 Rjected

Hive results:

INFO[08-10|14:35:31] API: suite ended                         suite=0
INFO[08-10|14:35:32] simulation ethereum/engine finished      suites=1 tests=109 failed=7
7 tests failed

Closing the PR now

Rjected avatar Aug 16 '23 17:08 Rjected