diff --git a/mp2-test/src/mpt_sequential.rs b/mp2-test/src/mpt_sequential.rs index bd49669fa..42e550623 100644 --- a/mp2-test/src/mpt_sequential.rs +++ b/mp2-test/src/mpt_sequential.rs @@ -191,11 +191,17 @@ pub fn generate_receipt_test_info 4 => event_contract.testTwoData().into_transaction_request(), _ => unreachable!(), }; + let random_two = match (0..5).sample_single(&mut rng) { + 0 => event_contract.testEmit().into_transaction_request(), + 1 => event_contract.testTwoIndexed().into_transaction_request(), + 2 => event_contract.testThreeIndexed().into_transaction_request(), + 3 => event_contract.testOneData().into_transaction_request(), + 4 => event_contract.testTwoData().into_transaction_request(), + _ => unreachable!(), + }; let tx_req = match i % 4 { 0 => random, - 1 => event_contract - .twoEmits(U256::from((0..5).sample_single(&mut rng))) - .into_transaction_request(), + 1 => random_two, 2 => other_contract.otherEmit().into_transaction_request(), 3 => other_contract.twoEmits().into_transaction_request(), _ => unreachable!(), @@ -219,31 +225,33 @@ pub fn generate_receipt_test_info pending_tx_builders.push(rpc.send_transaction(tx_req_final).await.unwrap()); } - // Finally we guarantee at least one of the event we are going to query for - let queried_event_req = match (NO_TOPICS, MAX_DATA) { - (1, 0) => event_contract.testEmit().into_transaction_request(), - (2, 0) => event_contract.testTwoIndexed().into_transaction_request(), - (3, 0) => event_contract.testThreeIndexed().into_transaction_request(), - (3, 1) => event_contract.testOneData().into_transaction_request(), - (3, 2) => event_contract.testTwoData().into_transaction_request(), - _ => unreachable!(), - }; + // Finally we guarantee at least three of the event we are going to query for + for _ in 0..3 { + let queried_event_req = match (NO_TOPICS, MAX_DATA) { + (1, 0) => event_contract.testEmit().into_transaction_request(), + (2, 0) => event_contract.testTwoIndexed().into_transaction_request(), + (3, 0) => event_contract.testThreeIndexed().into_transaction_request(), + (3, 1) => event_contract.testOneData().into_transaction_request(), + (3, 2) => event_contract.testTwoData().into_transaction_request(), + _ => unreachable!(), + }; - let sender_address = Address::random(); - let funding = U256::from(1e18 as u64); - rpc.anvil_set_balance(sender_address, funding) - .await - .unwrap(); - rpc.anvil_auto_impersonate_account(true).await.unwrap(); - let new_req = queried_event_req.with_from(sender_address); - let tx_req_final = rpc - .fill(new_req) - .await - .unwrap() - .as_builder() - .unwrap() - .clone(); - pending_tx_builders.push(rpc.send_transaction(tx_req_final).await.unwrap()); + let sender_address = Address::random(); + let funding = U256::from(1e18 as u64); + rpc.anvil_set_balance(sender_address, funding) + .await + .unwrap(); + rpc.anvil_auto_impersonate_account(true).await.unwrap(); + let new_req = queried_event_req.with_from(sender_address); + let tx_req_final = rpc + .fill(new_req) + .await + .unwrap() + .as_builder() + .unwrap() + .clone(); + pending_tx_builders.push(rpc.send_transaction(tx_req_final).await.unwrap()); + } // Mine a block, it should include all the transactions created above. rpc.anvil_mine(Some(U256::from(1u8)), None).await.unwrap(); diff --git a/mp2-v1/src/values_extraction/leaf_receipt.rs b/mp2-v1/src/values_extraction/leaf_receipt.rs index 93a3ca983..cef724c25 100644 --- a/mp2-v1/src/values_extraction/leaf_receipt.rs +++ b/mp2-v1/src/values_extraction/leaf_receipt.rs @@ -41,7 +41,7 @@ use rlp::Encodable; use serde::{Deserialize, Serialize}; use std::{array::from_fn, iter}; /// Maximum number of logs per transaction we can process -const MAX_LOGS_PER_TX: usize = 2; +const MAX_LOGS_PER_TX: usize = 1; /// The number of bytes that `gas_used` could take up in the receipt. /// We set a max of 3 here because this would be over half the gas in the block for Ethereum. @@ -243,6 +243,7 @@ impl EventWires { // Pack the data and get the digest let packed_data = data_bytes.arr.pack(b, Endianness::Big); + let data_digest = b.map_to_curve_point( &std::iter::once(log_column.column_id) .chain(packed_data) @@ -764,6 +765,7 @@ mod tests { let node = info.mpt_proof.last().unwrap().clone(); + assert!(node.len() <= NODE_LEN); let proof = run_circuit::(test_circuit); let pi = PublicInputs::new(&proof.public_inputs);