-
Notifications
You must be signed in to change notification settings - Fork 46
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(derive): Pipeline Builder #127
Conversation
crates/derive/src/types/payload.rs
Outdated
let tx = TxDeposit::decode(&mut execution_payload.transactions[0][1..].as_ref()) | ||
.map_err(|e| anyhow::anyhow!(e))?; |
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 really don't like that I had to do this to strip the 0x7e
deposit prefix @clabby, I think there's an easier way to do this, but the issue is we check if the bytes are deposit transactions based on their first byte and then I think we should be decoding the deposit tx here. Maybe this should just be refactored into a TxDeposit::decode_with_prefix()
method that gracefully strips the prefix? Curious as to your thoughts 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.
You can also use OpTxEnvelope::decode_2718
(I think OpTxEnvelope::decode
does the same), which will decode a OpTxEnvelope::TxDeposit(TxDeposit)
. Just need some extra matching.
We should do this - need to ensure that the first tx is always a deposit.
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.
So unfortunately TxDeposit::decode
does not support this, it reads the header first in it's decoding and that's why the unit tests strip the 0x7e
type prefix. e.g. https://github.com/clabby/op-alloy/blob/refcell/consensus-port/crates/op-consensus/src/transaction/optimism.rs#L177
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.
For now, I've added a manual deposit tx type check. Will write up a ticket to fix this.
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.
Added a ticket here #147
fix(derive): Trait Abstractions and Pipeline Builder
fix(derive): Pipeline
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.
Looking good. The ol' Box<&dyn Trait>
recursion isn't too bad.
crates/derive/src/types/payload.rs
Outdated
let tx = TxDeposit::decode(&mut execution_payload.transactions[0][1..].as_ref()) | ||
.map_err(|e| anyhow::anyhow!(e))?; |
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.
You can also use OpTxEnvelope::decode_2718
(I think OpTxEnvelope::decode
does the same), which will decode a OpTxEnvelope::TxDeposit(TxDeposit)
. Just need some extra matching.
We should do this - need to ensure that the first tx is always a deposit.
Description
Implements the pipeline builder.
Metadata
Fixes #110