Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/blockifier/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub const TEST_ERC20_CONTRACT_CLASS_HASH: &str = "0x1010";
pub const ERC20_CONTRACT_PATH: &str = "./ERC20/ERC20_Cairo0/ERC20_without_some_syscalls/ERC20/\
erc20_contract_without_some_syscalls_compiled.json";

// TODO(Aviv, 14/7/2024): Move from test utils module, and use it in ContractClassVersionMismatch
// error.
#[derive(Clone, Copy, Debug)]
pub enum CairoVersion {
Cairo0,
Expand Down
2 changes: 2 additions & 0 deletions crates/blockifier/src/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub mod account_transaction;
pub mod constants;
#[cfg(test)]
pub mod error_format_test;
pub mod errors;
pub mod objects;
#[cfg(any(feature = "testing", test))]
Expand Down
15 changes: 15 additions & 0 deletions crates/blockifier/src/transaction/error_format_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use starknet_api::transaction::TransactionVersion;

use crate::transaction::errors::TransactionExecutionError;

#[test]
fn test_contract_class_version_mismatch() {
let error = TransactionExecutionError::ContractClassVersionMismatch {
declare_version: TransactionVersion::ONE,
cairo_version: 2,
};
assert_eq!(
error.to_string(),
"Declare transaction version 1 must have a contract class of Cairo version 2."
);
}
4 changes: 2 additions & 2 deletions crates/blockifier/src/transaction/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub enum TransactionFeeError {
#[derive(Debug, Error)]
pub enum TransactionExecutionError {
#[error(
"Declare transaction version {declare_version:?} must have a contract class of Cairo \
version {cairo_version:?}."
"Declare transaction version {} must have a contract class of Cairo \
version {cairo_version:?}.", **declare_version
)]
ContractClassVersionMismatch { declare_version: TransactionVersion, cairo_version: u64 },
#[error(
Expand Down