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

use alloy GenericContractError in reth_primitives::abi::decode_revert_reason #4759

Merged
merged 4 commits into from
Sep 26, 2023

Conversation

alessandromazza98
Copy link
Contributor

Closes #4730

@alessandromazza98
Copy link
Contributor Author

I get some errors related to git dependencies not allowed. Specifically related to alloy which I actually need to use GenericContractError...

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #4759 (146823e) into alloy (9e613b4) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

Files Coverage Δ
crates/revm/revm-inspectors/src/tracing/types.rs 0.00% <0.00%> (ø)
crates/rpc/rpc/src/eth/error.rs 9.39% <0.00%> (ø)
crates/primitives/src/abi.rs 0.00% <0.00%> (ø)

... and 8 files with indirect coverage changes

Flag Coverage Δ
integration-tests 15.99% <0.00%> (+<0.01%) ⬆️
unit-tests 62.84% <0.00%> (-0.03%) ⬇️

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

Components Coverage Δ
reth binary 32.07% <ø> (ø)
blockchain tree 83.76% <ø> (ø)
pipeline 88.53% <ø> (ø)
storage (db) 73.55% <ø> (ø)
trie 94.48% <ø> (ø)
txpool 49.52% <ø> (-0.47%) ⬇️
networking 76.92% <ø> (+0.03%) ⬆️
rpc 57.67% <0.00%> (ø)
consensus 62.89% <ø> (ø)
revm 28.40% <0.00%> (ø)
payload builder 8.20% <ø> (ø)
primitives 85.51% <0.00%> (-0.05%) ⬇️

@onbjerg
Copy link
Member

onbjerg commented Sep 25, 2023

@alessandromazza98 you need to add it here:

reth/deny.toml

Lines 97 to 103 in 0f9def0

allow-git = [
"https://github.com/bluealloy/revm",
"https://github.com/boa-dev/boa",
"https://github.com/ethereum/c-kzg-4844",
"https://github.com/sigp/discv5",
"https://github.com/stevefan1999-personal/rust-igd",
]

@onbjerg onbjerg added the C-debt Refactor of code section that is hard to understand or maintain label Sep 25, 2023
@DaniPopes
Copy link
Member

DaniPopes commented Sep 25, 2023

@alessandromazza98 Can you please rebase your branch on top of alloy (#4737) and change the target branch to it? (Same goes for all the other issues in #4715). This fixes any CI issues.

Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

rest LGTM after rebase

crates/rpc/rpc/src/eth/error.rs Outdated Show resolved Hide resolved
crates/primitives/src/abi.rs Outdated Show resolved Hide resolved
@alessandromazza98
Copy link
Contributor Author

alessandromazza98 commented Sep 25, 2023

Ok fixed the comments and changed branch where to put my PR into, hope to have done it correctly @DaniPopes ?

@alessandromazza98 alessandromazza98 changed the base branch from main to alloy September 25, 2023 17:05
Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

Last few things

Cargo.toml Outdated Show resolved Hide resolved
crates/primitives/src/abi.rs Outdated Show resolved Hide resolved
crates/primitives/src/abi.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/eth/error.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
@DaniPopes
Copy link
Member

Would be nice if we could add some test cases for this function, but I don't really know how to get them "efficiently". Maybe we can open an issue after this

@alessandromazza98
Copy link
Contributor Author

Solved comments.

Speaking about the .as_deref() it does not work and you have to use a closure because while Bytes can be automatically dereferened to &[u8], inside the and_then(..) method the compiler cannot do the conversion so you should force it with a closure like it is now.

Let me know if you like it.

@alessandromazza98
Copy link
Contributor Author

Would be nice if we could add some test cases for this function, but I don't really know how to get them "efficiently". Maybe we can open an issue after this

I am interested in helping on this one. We can create a related issue and I could work on that.

The properly test we should create some contracts that fails (both in Solidity and Vyper) and check if this function decodes the revert reason properly. Or maybe we could copy and paste some reverts from some contracts on-chain?

Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

Thanks!

@DaniPopes DaniPopes merged commit ba8110d into paradigmxyz:alloy Sep 26, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Replace ethers usage in reth_primitives::abi::decode_revert_reason
3 participants