Skip to content

Conversation

@Himess
Copy link
Contributor

@Himess Himess commented Jan 10, 2026

Summary

Introduces UnifiedReceiptBuilder - a wrapper that handles both deposit and non-deposit transaction receipts seamlessly, eliminating the try-catch pattern required by OpReceiptBuilder.

Changes

  • Added receipt_builder.rs with UnifiedReceiptBuilder<C> struct
  • Single build() method handles both tx types internally
  • Simplified state_builder.rs - removed ~40 lines of manual deposit handling
  • Removed unused alloy-op-evm dependency

Closes #309

…eipt handling

Add a new UnifiedReceiptBuilder that handles both deposit and non-deposit
transactions seamlessly without requiring error handling at the call site.

The builder wraps OpRethReceiptBuilder and automatically handles the deposit
receipt case internally, eliminating the need for callers to implement the
try-catch pattern typically required when using build_receipt followed by
build_deposit_receipt.

Changes:
- Add receipt_builder module with UnifiedReceiptBuilder
- Update PendingStateBuilder to use UnifiedReceiptBuilder
- Simplify execute_with_evm method by removing manual deposit handling
- Remove receipt_builder parameter from PendingStateBuilder::new()

Closes base#309
@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jan 10, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 -1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@Himess Himess marked this pull request as draft January 10, 2026 21:58
Removed wrapper around OpRethReceiptBuilder and implemented direct
receipt building logic. This fixes type mismatches between OpTxEnvelope
and OpTransactionSigned that prevented compilation.

- Use direct OpTxType matching instead of build_receipt/build_deposit_receipt pattern
- Accept ExecutionResult<E::HaltReason> for proper generic type handling
- Remove unused alloy-op-evm dependency
@Himess Himess marked this pull request as ready for review January 10, 2026 22:53
input,
&mut self.l1_block_info,
)
.unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we properly bubble up an error here instead of using .unwrap()? We should have fixed this previously but if we're modifying this, let's cleanup past issues.

self.cumulative_gas_used,
self.pending_block.timestamp,
)
.map_err(|_| ExecutionError::DepositAccountLoad)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's implement From<ReceiptBuildError> for ExecutionError. This should let us remove the .map_err here and just use the ? operator.

So this would just become:

let receipt = self
    .receipt_builder
    .build(
        &mut self.evm,
        &transaction,
        result,
        &state,
        self.cumulative_gas_used,
        self.pending_block.timestamp,
    )?;

evm: &mut E,
transaction: &Recovered<OpTxEnvelope>,
result: ExecutionResult<E::HaltReason>,
_state: &EvmState,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this argument if it's unused?

Comment on lines +137 to +142
#[test]
fn test_unified_receipt_builder_creation() {
let chain_spec = Arc::new(OpChainSpecBuilder::base_mainnet().build());
let builder = UnifiedReceiptBuilder::new(chain_spec);
assert!(std::mem::size_of_val(&builder) > 0);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some tests that cover the logic of the UnifiedReceiptBuilder? This test is effectively a no-op

Copy link
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

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

A few changes + nits

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.

Create a new ReceiptBuilder builds deposit receipts

3 participants