Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
test: improve readablity of test_validate_accounts_tx (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware authored Apr 30, 2024
1 parent 12820a2 commit 6b87bdc
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions crates/blockifier/src/transaction/transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1522,9 +1522,8 @@ fn test_validate_accounts_tx(
..default_args
},
);
account_tx
.execute(state, block_context, true, true)
.unwrap_or_else(|err| panic!("Execution failed: {:?}", err));
let result = account_tx.execute(state, block_context, true, true);
assert!(result.is_ok(), "Execution failed: {:?}", result.unwrap_err());

if tx_type != TransactionType::DeployAccount {
// Call self (allowed).
Expand All @@ -1536,9 +1535,8 @@ fn test_validate_accounts_tx(
..default_args
},
);
account_tx
.execute(state, block_context, true, true)
.unwrap_or_else(|err| panic!("Execution failed: {:?}", err));
let result = account_tx.execute(state, block_context, true, true);
assert!(result.is_ok(), "Execution failed: {:?}", result.unwrap_err());
}

if let CairoVersion::Cairo0 = cairo_version {
Expand All @@ -1553,9 +1551,8 @@ fn test_validate_accounts_tx(
..default_args
},
);
account_tx
.execute(state, block_context, true, true)
.unwrap_or_else(|err| panic!("Execution failed: {:?}", err));
let result = account_tx.execute(state, block_context, true, true);
assert!(result.is_ok(), "Execution failed: {:?}", result.unwrap_err());

// Call the syscall get_block_timestamp and assert the returned timestamp was modified
// for validate.
Expand All @@ -1568,9 +1565,8 @@ fn test_validate_accounts_tx(
..default_args
},
);
account_tx
.execute(state, block_context, true, true)
.unwrap_or_else(|err| panic!("Execution failed: {:?}", err));
let result = account_tx.execute(state, block_context, true, true);
assert!(result.is_ok(), "Execution failed: {:?}", result.unwrap_err());
}

if let CairoVersion::Cairo1 = cairo_version {
Expand All @@ -1589,9 +1585,8 @@ fn test_validate_accounts_tx(
..default_args
},
);
account_tx
.execute(state, block_context, true, true)
.unwrap_or_else(|err| panic!("Execution failed: {:?}", err));
let result = account_tx.execute(state, block_context, true, true);
assert!(result.is_ok(), "Execution failed: {:?}", result.unwrap_err());
}
}

Expand Down

0 comments on commit 6b87bdc

Please sign in to comment.