Skip to content

Commit 05d9bb4

Browse files
blockifier: get proof_facts_length from tx
1 parent d4e9ba8 commit 05d9bb4

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

crates/blockifier/src/fee/receipt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ impl TransactionReceipt {
184184
tx_type: account_tx.tx_type(),
185185
reverted_steps,
186186
reverted_sierra_gas,
187-
// TODO(AvivG): Get proof facts length from account_tx when it supports retrieving it.
188-
proof_facts_length: 0,
187+
proof_facts_length: account_tx.proof_facts_length(),
189188
})
190189
}
191190
}

crates/blockifier/src/transaction/account_transaction.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ impl AccountTransaction {
220220
self.signature().0.len()
221221
}
222222

223+
pub fn proof_facts_length(&self) -> usize {
224+
if let Transaction::Invoke(tx) = &self.tx { tx.proof_facts_length() } else { 0 }
225+
}
226+
223227
pub fn enforce_fee(&self) -> bool {
224228
self.create_tx_info().enforce_fee()
225229
}

crates/blockifier/src/transaction/transactions_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ fn test_invoke_tx(
623623
// transaction.
624624
let calldata_length = invoke_tx.calldata_length();
625625
let signature_length = invoke_tx.signature_length();
626+
let proof_facts_length = invoke_tx.proof_facts_length();
626627
let state_changes_for_fee = StateChangesCount {
627628
n_storage_updates: 1,
628629
n_modified_contracts: 1,
@@ -635,8 +636,7 @@ fn test_invoke_tx(
635636
StateResources::new_for_testing(state_changes_for_fee, 0),
636637
None,
637638
ExecutionSummary::default(),
638-
// TODO(AvivG): Test non-zero proof facts length after invoke_tx supports retrieving it.
639-
0,
639+
proof_facts_length,
640640
);
641641
let sender_address = invoke_tx.sender_address();
642642

crates/starknet_api/src/executable_transaction.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,16 @@ impl InvokeTransaction {
345345
let tx_hash = invoke_tx.calculate_transaction_hash(chain_id, &invoke_tx.version())?;
346346
Ok(Self { tx: invoke_tx, tx_hash })
347347
}
348+
349+
/// Returns the length of proof facts for client-side proving.
350+
pub fn proof_facts_length(&self) -> usize {
351+
match &self.tx {
352+
crate::transaction::InvokeTransaction::V3(tx) => tx.proof_facts.0.len(),
353+
// Client-side proving is only supported starting from V3.
354+
crate::transaction::InvokeTransaction::V0(_)
355+
| crate::transaction::InvokeTransaction::V1(_) => 0,
356+
}
357+
}
348358
}
349359

350360
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize, Hash)]

0 commit comments

Comments
 (0)