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: Eip 6110 #8204
feat: Eip 6110 #8204
Conversation
99b4802
to
e4f3932
Compare
/// Error when decoding deposit requests from receipts [EIP-6110] | ||
/// | ||
/// [EIP-6110]: https://eips.ethereum.org/EIPS/eip-6110 | ||
// TODO(gakonst): This is an RLP decoding error but we don't import alloy_rlp here, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not? It should be in reth_primitives already
crates/ethereum/evm/src/execute.rs
Outdated
} | ||
|
||
// Collect all EIP-6110 deposits | ||
let deposits = parse_deposits_from_receipts(&receipts)?; | ||
|
||
// Collect all EIP-7685 requests | ||
let withdrawal_requests = | ||
post_block_withdrawal_requests(&self.chain_spec, block.timestamp, &mut evm)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should accumulate, extending a vector, rather than two vecs and concatenating after. Can be done with &mut Vec as argument and transforming the iterator into a for loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The withdrawal function returns a Vec<Request>
via Vec<Request>::decode
and I cannot break out of the iterator without collecting so not sure how to do that here, also prob not big perf given smol list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, what about moving the parse_deposits to after post_block and extending that list?
} | ||
|
||
fn parse_deposit_from_log(log: &Log<DepositEvent>) -> DepositRequest { | ||
// SAFETY: These `expect` https://github.com/ethereum/consensus-specs/blob/5f48840f4d768bf0e0a8156a3ed06ec333589007/solidity_deposit_contract/deposit_contract.sol#L107-L110 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be NOTE or something else, SAFETY should be reserved for unsafe {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Panics
in the doc of the function actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -158,11 +158,11 @@ impl BundleStateWithReceipts { | |||
/// Transform block number to the index of block. | |||
fn block_number_to_index(&self, block_number: BlockNumber) -> Option<usize> { | |||
if self.first_block > block_number { | |||
return None | |||
return None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grrrr
crates/ethereum/evm/src/eip6110.rs
Outdated
use reth_primitives::Receipt; | ||
use revm_primitives::Log; | ||
|
||
pub(crate) fn parse_deposits_from_receipts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it pub
sol! { | ||
#[allow(missing_docs)] | ||
event DepositEvent( | ||
bytes pubkey, | ||
bytes withdrawal_credentials, | ||
bytes amount, | ||
bytes signature, | ||
bytes index | ||
); | ||
} | ||
|
||
fn parse_deposit_from_log(log: &Log<DepositEvent>) -> DepositRequest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should put the DepositEvent
in alloy-eips for the relevant eip, and have a conversion from DepositEvent → DepositRequest
in alloy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, let's do it after
crates/ethereum/evm/src/execute.rs
Outdated
// TODO: Does order matter? | ||
let requests = [deposits, withdrawal_requests].concat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes and this is the correct order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only variable naming nits. We can move a bunch of stuff to alloy but let's merge it as is now to iterate faster.
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
@@ -311,7 +315,7 @@ where | |||
receipts.iter(), | |||
) { | |||
debug!(target: "evm", %error, ?receipts, "receipts verification failed"); | |||
return Err(error) | |||
return Err(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe
return Err(error); | |
return Err(error) |
Adds EIP-6110, blocked on #8053