-
Notifications
You must be signed in to change notification settings - Fork 277
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
Add trait methods cumulative_gas_used
and state_root
to ReceiptResponse
#1275
Conversation
/// The post-transaction state root (pre Byzantium) | ||
/// | ||
/// EIP98 makes this field optional. | ||
fn state_root(&self) -> Option<&B256>; |
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.
we can ingore this because no longer useful
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.
when converting from ReceiptResponse
to TransactionReceipt<T>
, would it not be a bug to assume the field to be None
for historic blocks?
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.
when converting from ReceiptResponse to TransactionReceipt
this isn't the purpose of this trait, this trait just serves the purpose of providing expected values
but I guess it doesn't really hurt to add this function, even if this is useless.
/// Returns the cumulative gas used at this receipt. | ||
fn cumulative_gas_used(&self) -> u128; |
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.
this makes sense
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
/// The post-transaction state root (pre Byzantium) | ||
/// | ||
/// EIP98 makes this field optional. | ||
fn state_root(&self) -> Option<&B256>; |
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.
fn state_root(&self) -> Option<&B256>; | |
fn state_root(&self) -> Option<B256>; |
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.
not always a need to clone all the 32 bytes, the caller can decide
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.
this is at odds with the other trait functions. I'd like to unify this and return a copy
…esponse` (alloy-rs#1275) * Add trait methods cumulative_gas_used and state_root to ReceiptResponse * touchup --------- Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Motivation
Use generic
ReceiptResponse
type in place ofalloy_rpc_types_eth::TransactionReceipt
in reth RPCSolution
Adds trait methods
ReceiptResponse::cumulative_gas_used
andReceiptResponse::state_root
PR Checklist