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

Commit

Permalink
fix: invalid version format
Browse files Browse the repository at this point in the history
commit-id:776e06e7
  • Loading branch information
AvivYossef-starkware committed Jul 14, 2024
1 parent 410b547 commit 20207a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions crates/blockifier/src/transaction/error_format_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ fn test_declare_transaction_error_format() {
already declared."
);
}

#[test]
fn test_invalid_version_format() {
let error = TransactionExecutionError::InvalidVersion {
version: TransactionVersion::THREE,
allowed_versions: vec![TransactionVersion::ONE, TransactionVersion::TWO],
};
assert_eq!(
error.to_string(),
"Transaction version 0x3 is not supported. Supported versions: [0x1, 0x2]."
);
}
4 changes: 2 additions & 2 deletions crates/blockifier/src/transaction/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ pub enum TransactionExecutionError {
#[error("The `validate` entry point should return `VALID`. Got {actual:?}.")]
InvalidValidateReturnData { actual: Retdata },
#[error(
"Transaction version {version:?} is not supported. Supported versions: \
{allowed_versions:?}."
"Transaction version {:?} is not supported. Supported versions: \
{:?}.", **version, allowed_versions.iter().map(|v| **v).collect::<Vec<_>>()
)]
InvalidVersion { version: TransactionVersion, allowed_versions: Vec<TransactionVersion> },
#[error(transparent)]
Expand Down

0 comments on commit 20207a1

Please sign in to comment.