Skip to content

Commit

Permalink
Parser now properly handles txn & receipt tries for dummy txns
Browse files Browse the repository at this point in the history
  • Loading branch information
BGluth committed Oct 4, 2023
1 parent f53f11c commit 39c189a
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions parser/src/plonky2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,51 @@ impl EdgeBlockTrace {
.collect::<TraceParsingResult<Vec<_>>>()?;

Ok(match tx_proof_gen_ir.len() {
0 => vec![
TxnProofGenIR::create_dummy(b_height, 0),
TxnProofGenIR::create_dummy(b_height, 1),
],
0 => {
let (mut receipt_trie, mut txn_trie) =
(HashedPartialTrie::default(), HashedPartialTrie::default());
let dummy_txn_0 = Self::update_txn_receipt_tries_and_create_dummy_txn(
&mut receipt_trie,
&mut txn_trie,
b_height,
0,
);
let dummy_txn_1 = Self::update_txn_receipt_tries_and_create_dummy_txn(
&mut receipt_trie,
&mut txn_trie,
b_height,
1,
);

vec![dummy_txn_0, dummy_txn_1]
}
1 => {
tx_proof_gen_ir.push(tx_proof_gen_ir[0].dummy_with_at(b_height, 1));
let (mut receipt_trie, mut txn_trie) =
(HashedPartialTrie::default(), HashedPartialTrie::default());
let dummy_txn = Self::update_txn_receipt_tries_and_create_dummy_txn(
&mut receipt_trie,
&mut txn_trie,
b_height,
1,
);

tx_proof_gen_ir.push(dummy_txn);
tx_proof_gen_ir
}
_ => tx_proof_gen_ir,
})
}

fn update_txn_receipt_tries_and_create_dummy_txn(
receipt_trie: &mut HashedPartialTrie,
txn_trie: &mut HashedPartialTrie,
b_height: BlockHeight,
txn_idx: usize,
) -> TxnProofGenIR {
Self::update_receipt_and_txn_tries(receipt_trie, txn_trie, vec![], vec![], txn_idx);
TxnProofGenIR::create_dummy(b_height, txn_idx, receipt_trie, txn_trie).unwrap()

Check failure on line 368 in parser/src/plonky2.rs

View workflow job for this annotation

GitHub Actions / check

this function takes 2 arguments but 4 arguments were supplied

Check failure on line 368 in parser/src/plonky2.rs

View workflow job for this annotation

GitHub Actions / check

no method named `unwrap` found for struct `plonky_block_proof_gen::proof_types::TxnProofGenIR` in the current scope

Check failure on line 368 in parser/src/plonky2.rs

View workflow job for this annotation

GitHub Actions / check

this function takes 2 arguments but 4 arguments were supplied

Check failure on line 368 in parser/src/plonky2.rs

View workflow job for this annotation

GitHub Actions / check

no method named `unwrap` found for struct `plonky_block_proof_gen::proof_types::TxnProofGenIR` in the current scope
}

/// Edge gives us contract bytecode that was accessed
fn extract_all_contract_bytecode_from_txn_traces(&self) -> HashMap<H256, Vec<u8>> {
// TODO: Clean up and move to a map...
Expand Down

0 comments on commit 39c189a

Please sign in to comment.