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.
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.
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.
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.
For now, I've added a manual deposit tx type check. Will write up a ticket to fix this.
fix(derive): Trait Abstractions and Pipeline Builder
fix(derive): Pipeline
clabby
left a comment
There was a problem hiding this comment.
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.
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.
* feat(derive): span batch validation * feat(derive): span batch validity unit tests * feat(derive): span batch unit tests with acceptance test * fix(derive): unit tests * fix(derive): add more unit tests * feat(derive): span batch validity unit tests for txs * feat(derive): pipeline builder * fix(derive): so close :sadge * fix(derive): ugly refactor * fix(derive): pipeline construction and trait abstractions * fix(derive): nit fixes * fix(derive): temp manual deposit type check
* feat(derive): span batch validation * feat(derive): span batch validity unit tests * feat(derive): span batch unit tests with acceptance test * fix(derive): unit tests * fix(derive): add more unit tests * feat(derive): span batch validity unit tests for txs * feat(derive): pipeline builder * fix(derive): so close :sadge * fix(derive): ugly refactor * fix(derive): pipeline construction and trait abstractions * fix(derive): nit fixes * fix(derive): temp manual deposit type check
Description
Implements the pipeline builder.
Metadata
Fixes #110