Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(error): revamp make_canonical error #3899

Merged
merged 11 commits into from
Sep 20, 2023
Merged

Conversation

tcoratger
Copy link
Contributor

Should solve #2752.

I added a dedicated CanonicalError enum and embedded that inside reth_interfaces::error::Error. I don't know whether to also change the declaration of the function pub fn make_canonical(&mut self, block_hash: &BlockHash) -> Result<CanonicalOutcome, Error> to pub fn make_canonical(&mut self, block_hash: &BlockHash) -> Result<CanonicalOutcome, CanonicalError> but I think that would induce many other changes which are not desired, am I wrong?

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #3899 (33bed53) into main (aaf2d2c) will decrease coverage by 0.58%.
Report is 354 commits behind head on main.
The diff coverage is 45.45%.

Impacted file tree graph

Files Changed Coverage Δ
crates/consensus/beacon/src/engine/mod.rs 74.27% <0.00%> (-1.52%) ⬇️
crates/interfaces/src/error.rs 100.00% <ø> (ø)
crates/interfaces/src/blockchain_tree/error.rs 36.88% <50.00%> (+0.92%) ⬆️
crates/blockchain-tree/src/blockchain_tree.rs 83.80% <100.00%> (+0.43%) ⬆️

... and 263 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.76% <0.00%> (+0.26%) ⬆️
unit-tests 63.37% <45.45%> (-0.64%) ⬇️

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

Components Coverage Δ
reth binary 32.17% <ø> (+6.66%) ⬆️
blockchain tree 83.75% <100.00%> (+0.70%) ⬆️
pipeline 88.54% <ø> (-1.53%) ⬇️
storage (db) 73.47% <ø> (-1.09%) ⬇️
trie 94.73% <ø> (+0.02%) ⬆️
txpool 49.44% <ø> (+1.08%) ⬆️
networking 77.21% <ø> (-0.23%) ⬇️
rpc 57.83% <ø> (+0.37%) ⬆️
consensus 62.54% <0.00%> (-1.54%) ⬇️
revm 28.04% <ø> (-4.50%) ⬇️
payload builder 8.45% <ø> (+1.86%) ⬆️
primitives 86.45% <50.00%> (-1.56%) ⬇️

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this.

pending @Rjected

but I think that would induce many other changes which are not desired, am I wrong?

agree

@mattsse mattsse added C-debt Refactor of code section that is hard to understand or maintain A-blockchain-tree Related to sidechains, reorgs and pending blocks labels Jul 26, 2023
@mattsse
Copy link
Collaborator

mattsse commented Aug 1, 2023

@Rjected friendly bump

looks like some tests are stalling though

@tcoratger perhaps we also need to update some checks?

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me pending tests passing / checks updated

@Rjected
Copy link
Member

Rjected commented Aug 10, 2023

Looks like the tests still need to be fixed, @tcoratger do you need any help on this?

@tcoratger
Copy link
Contributor Author

@Rjected Yes sure, I thought my last commit solved the problem but apparently not. I feel like the CI tests stop because many of them are too slow. But I don't understand why because nothing fundamental changes here? Maybe I missed something.

@tcoratger
Copy link
Contributor Author

@mattsse Do you know why the tests fail here?

@@ -1398,7 +1398,9 @@ where
// it's part of the canonical chain: if it's the safe or the finalized block
if matches!(
err,
Error::Execution(BlockExecutionError::BlockHashNotFoundInChain { .. })
Error::Canonical(CanonicalError::BlockchainTree(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattsse @Rjected I still don't understand what's going wrong with this one. @mattsse I just saw that you had merge master in there two weeks ago but that doesn't change anything. Considering where the tests are slow, I imagine it's coming from that place in the code right? but it seems strange to me because there is no major change right?

Copy link
Collaborator

@mattsse mattsse Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some change must have led to an issue with the tokio test runner

try with #[tokio::test(flavor = "multi_thread")] for forkchoice_updated_invalid_pow

and you'll see a failing assertion

assertion left == right failed
left: ForkchoiceUpdated { payload_status: PayloadStatus { status: Syncing, latest_valid_hash: None }, payload_id: None }
right: ForkchoiceUpdated { payload_status: PayloadStatus { status: Invalid { validation_error: "Block 0x1a46761f926c32ba02e1da554fc3e4b53af8b44fb55e20036370745b54a2246f is pre merge" }, latest_valid_hash: Some(0x0000000000000000000000000000000000000000000000000000000000000000) }, payload_id: None }

error @ BlockExecutionError::Validation(BlockValidationError::BlockPreMerge {
..
}),
Error::Canonical(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattsse I think I spotted the bug, this one had to be modified too. Now it should be good

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, this is a lot cleaner

@mattsse mattsse added this pull request to the merge queue Sep 20, 2023
Merged via the queue into paradigmxyz:main with commit afbe88f Sep 20, 2023
22 checks passed
@tcoratger tcoratger deleted the tree-error branch September 20, 2023 11:16
alessandromazza98 added a commit to alessandromazza98/reth that referenced this pull request Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants