diff --git a/src/test_utils/katana/mod.rs b/src/test_utils/katana/mod.rs index a2b69d2d1..47798402a 100644 --- a/src/test_utils/katana/mod.rs +++ b/src/test_utils/katana/mod.rs @@ -121,13 +121,6 @@ impl<'a> Katana { mongo_fuzzer.add_random_transactions(10).expect("Failed to add documents in the database"); // Add a hardcoded logs to the MongoDB database. mongo_fuzzer.add_random_logs(2).expect("Failed to logs in the database"); - // Add a hardcoded header to the MongoDB database. - let max_block_number = - mongo_fuzzer.headers.iter().map(|header| header.number.unwrap_or_default()).max().unwrap_or_default(); - mongo_fuzzer - .add_hardcoded_block_header_with_base_fee(max_block_number + 1, 0) - .expect("Failed to add header in the database"); - // Finalize the MongoDB database initialization and get the database instance. let database = mongo_fuzzer.finalize().await; diff --git a/src/test_utils/mongo/mod.rs b/src/test_utils/mongo/mod.rs index 0bbfdba85..e08befe05 100644 --- a/src/test_utils/mongo/mod.rs +++ b/src/test_utils/mongo/mod.rs @@ -127,23 +127,6 @@ impl MongoFuzzer { self.finalize().await } - /// Adds a hardcoded block header with a base fee to the collection of headers. - pub fn add_hardcoded_block_header_with_base_fee( - &mut self, - block_number: u64, - base_fee: u128, - ) -> Result<(), Box> { - let bytes: Vec = (0..self.rnd_bytes_size).map(|_| rand::random()).collect(); - let mut unstructured = arbitrary::Unstructured::new(&bytes); - let mut header = StoredHeader::arbitrary(&mut unstructured).unwrap(); - - header.header.number = Some(block_number); - header.header.base_fee_per_gas = Some(base_fee); - - self.headers.push(header); - Ok(()) - } - /// Adds random logs to the collection of logs. pub fn add_random_logs(&mut self, n_logs: usize) -> Result<(), Box> { for _ in 0..n_logs { @@ -203,6 +186,18 @@ impl MongoFuzzer { // Add the receipt to the receipts collection. self.receipts.push(receipt); } + + // At the end of our transaction list, for our tests, we need to add a block header with a base fee. + let mut header_with_base_fee = StoredHeader::arbitrary(&mut arbitrary::Unstructured::new( + &(0..self.rnd_bytes_size).map(|_| rand::random::()).collect::>(), + )) + .unwrap(); + + header_with_base_fee.header.number = Some(self.max_block_number() + 1); + header_with_base_fee.header.base_fee_per_gas = Some(0); + + self.headers.push(header_with_base_fee); + Ok(()) }