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: optimism-specific receipt #13317

Merged
merged 5 commits into from
Dec 12, 2024
Merged

feat: optimism-specific receipt #13317

merged 5 commits into from
Dec 12, 2024

Conversation

klkvr
Copy link
Collaborator

@klkvr klkvr commented Dec 11, 2024

Closes #12588

Same as #13295 but for OP receipt

Copy link
Member

@emhane emhane left a comment

Choose a reason for hiding this comment

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

is it not possible to make an enum with one variant wrapping op_alloy_consensus::OpDepositReceipt?

@klkvr
Copy link
Collaborator Author

klkvr commented Dec 11, 2024

this would require a manual compact impl through a struct same as the current one for compatibility but should be possible

@klkvr
Copy link
Collaborator Author

klkvr commented Dec 12, 2024

@emhane I've created a draft using an enum #13334, it needs an op-alloy release

I think we can proceed with the current approach given that it won't require any changes to existing OP components, and can refactor this into an enum and integrate everywhere later

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.

lgtm pending op-alloy bump

Comment on lines 248 to 250
/// TODO: Remove once <https://github.com/alloy-rs/op-alloy/pull/317> is released.
#[cfg(feature = "serde")]
mod tx_type_serde {
Copy link
Collaborator

Choose a reason for hiding this comment

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

released now

Comment on lines 196 to +199
pub fn get_bit_size(ftype: &str) -> u8 {
match ftype {
"TransactionKind" | "TxKind" | "bool" | "Option" | "Signature" => 1,
"TxType" => 2,
"TxType" | "OpTxType" => 2,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this could be a footgun.

perhaps a better approach long term would be a trait, maybe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've looked into this, we can't solve this with a trait while we depend on modular_bitifield the get_bit_size output is translates into B2/B1 etc inputs for bitfield macro:

#[bitfield]
pub struct OpReceiptFlags {
    pub tx_type_len: B2,
    pub success_len: B1,
    pub cumulative_gas_used_len: B4,
    pub deposit_nonce_len: B1,
    pub deposit_receipt_version_len: B1,
    pub __zstd: B1,
    #[skip]
    unused: B6,
}

@klkvr klkvr enabled auto-merge December 12, 2024 13:26
@klkvr klkvr added this pull request to the merge queue Dec 12, 2024
Merged via the queue into main with commit cdb03ac Dec 12, 2024
42 checks passed
@klkvr klkvr deleted the klkvr/op-receipt branch December 12, 2024 14:02
emhane added a commit to ethereum-optimism/op-reth that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define OpReceipt
3 participants