-
Notifications
You must be signed in to change notification settings - Fork 208
feat: update both optimistic submission methods to use adjustment data v3 #860
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ pub struct BidAdjustmentDataV1 { | |
| ssz_derive::Encode, | ||
| ssz_derive::Decode, | ||
| )] | ||
| pub struct BidAdjustmentDataV2 { | ||
| pub struct BidAdjustmentDataV3 { | ||
| /// Transactions root of the payload. | ||
| pub el_transactions_root: B256, | ||
| /// Withdrawals root of the payload. | ||
|
|
@@ -80,9 +80,12 @@ pub struct BidAdjustmentDataV2 { | |
| pub cl_placeholder_transaction_proof: Vec<B256>, | ||
| /// The merkle proof for the receipt of the placeholder transaction. It's required for | ||
| /// adjusting payments to contract addresses. | ||
| pub placeholder_receipt_proof: Vec<Bytes>, | ||
| pub el_placeholder_receipt_proof: Vec<Bytes>, | ||
| /// New in V2: Logs bloom accrued until but not including the last (payment) transaction. | ||
| pub pre_payment_logs_bloom: Bloom, | ||
| /// Gas used by the placeholder (payout) transaction. Required for V3 to relax the | ||
| /// gas_limit == gas_used requirement. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New V3 field - verify relay compatibility The Please verify:
|
||
| pub placeholder_gas_used: u64, | ||
| } | ||
|
|
||
| /// Common bid adjustment information that can be used for creating bid adjustment data. | ||
|
|
@@ -106,6 +109,8 @@ pub struct BidAdjustmentData { | |
| pub placeholder_receipt_proof: Vec<Bytes>, | ||
| /// New in V2: Logs bloom accrued until but not including the last (payment) transaction. | ||
| pub pre_payment_logs_bloom: Bloom, | ||
| /// Gas used by the placeholder (payout) transaction. | ||
| pub placeholder_gas_used: u64, | ||
| /// State proofs. | ||
| pub state_proofs: BidAdjustmentStateProofs, | ||
| } | ||
|
|
@@ -128,9 +133,9 @@ impl BidAdjustmentData { | |
| } | ||
| } | ||
|
|
||
| /// Convert bid adjustment data into [`BidAdjustmentDataV2`]. | ||
| pub fn into_v2(self) -> BidAdjustmentDataV2 { | ||
| BidAdjustmentDataV2 { | ||
| /// Convert bid adjustment data into [`BidAdjustmentDataV3`]. | ||
| pub fn into_v3(self) -> BidAdjustmentDataV3 { | ||
| BidAdjustmentDataV3 { | ||
| el_transactions_root: self.el_transactions_root, | ||
| el_withdrawals_root: self.el_withdrawals_root, | ||
| builder_address: self.state_proofs.builder_address, | ||
|
|
@@ -141,8 +146,9 @@ impl BidAdjustmentData { | |
| fee_payer_proof: self.state_proofs.fee_payer_proof, | ||
| el_placeholder_transaction_proof: self.el_placeholder_transaction_proof, | ||
| cl_placeholder_transaction_proof: self.cl_placeholder_transaction_proof, | ||
| placeholder_receipt_proof: self.placeholder_receipt_proof, | ||
| el_placeholder_receipt_proof: self.placeholder_receipt_proof, | ||
| pre_payment_logs_bloom: self.pre_payment_logs_bloom, | ||
| placeholder_gas_used: self.placeholder_gas_used, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1141,6 +1141,11 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec | |||||
| &local_ctx.tx_ssz_leaf_root_cache, | ||||||
| ) | ||||||
| }); | ||||||
| let placeholder_gas_used = self | ||||||
| .executed_tx_infos | ||||||
| .last() | ||||||
| .map(|tx_info| tx_info.space_used.gas) | ||||||
| .expect("payout transaction must exist"); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential panic in edge cases This Consider deferring this calculation to only when
Suggested change
Alternatively, you could compute this lazily: let placeholder_gas_used = LazyCell::new(|| {
self.executed_tx_infos
.last()
.map(|tx_info| tx_info.space_used.gas)
.expect("payout transaction must exist")
});This preserves the original behavior where the expect would only be evaluated when bid adjustments are actually created. |
||||||
| let bid_adjustments = bid_adjustment_state_proofs | ||||||
| .into_iter() | ||||||
| .map(|(fee_payer, state_proofs)| { | ||||||
|
|
@@ -1155,6 +1160,7 @@ impl<Tracer: SimulationTracer, PartialBlockExecutionTracerType: PartialBlockExec | |||||
| cl_placeholder_transaction_proof: cl_placeholder_transaction_proof.clone(), | ||||||
| placeholder_receipt_proof: placeholder_receipt_proof.clone(), | ||||||
| pre_payment_logs_bloom, | ||||||
| placeholder_gas_used, | ||||||
| state_proofs, | ||||||
| }, | ||||||
| ) | ||||||
|
|
||||||
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.
Field naming change
The field was renamed from
placeholder_receipt_prooftoel_placeholder_receipt_proof. While this naming is more consistent with the EL/CL prefix convention used elsewhere in V3, ensure this matches the exact field name expected by the relay API. The UltraSound docs should be the source of truth for field names.The
el_prefix makes sense as this is an execution layer proof (vs consensus layer), similar toel_transactions_rootandcl_placeholder_transaction_proof.