Test an empty execute

This commit is contained in:
Luke Parker
2025-01-24 17:13:36 -05:00
parent ed599c8ab5
commit 3892fa30b7
6 changed files with 235 additions and 49 deletions

View File

@@ -97,12 +97,19 @@ impl primitives::Block for FullEpoch {
> {
let mut res = HashMap::new();
for executed in &self.executed {
let Some(expected) =
let Some(mut expected) =
eventualities.active_eventualities.remove(executed.nonce().to_le_bytes().as_slice())
else {
// TODO: Why is this a continue, not an assert?
continue;
};
// If this is a Batch Eventuality, we didn't know how the OutInstructions would resolve at
// time of creation. Copy the results from the actual transaction into the expectation
if let (Executed::Batch { results, .. }, Executed::Batch { results: expected_results, .. }) =
(executed, &mut expected.0)
{
*expected_results = results.clone();
}
assert_eq!(
executed,
&expected.0,
@@ -119,7 +126,7 @@ impl primitives::Block for FullEpoch {
Accordingly, we have free reign as to what to set the transaction ID to.
We set the ID to the nonce as it's the most helpful value and unique barring someone
finding the premise for this as a hash.
finding the preimage for this as a hash.
*/
let mut tx_id = [0; 32];
tx_id[.. 8].copy_from_slice(executed.nonce().to_le_bytes().as_slice());

View File

@@ -52,7 +52,7 @@ impl Action {
Executed::NextSeraiKeySet { nonce: *nonce, key: key.eth_repr() }
}
Self::Batch { chain_id: _, nonce, .. } => {
Executed::Batch { nonce: *nonce, message_hash: keccak256(self.message()) }
Executed::Batch { nonce: *nonce, message_hash: keccak256(self.message()), results: vec![] }
}
})
}