This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main-v0.13.2' into avi/replay_batcher/switch-versioned-…
…constants3
- Loading branch information
Showing
12 changed files
with
1,130 additions
and
645 deletions.
There are no files selected for viewing
1,492 changes: 877 additions & 615 deletions
1,492
crates/blockifier/feature_contracts/cairo1/compiled/test_contract.casm.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use starknet_api::core::{ClassHash, ContractAddress, Nonce, PatriciaKey}; | ||
use starknet_api::hash::StarkHash; | ||
use starknet_api::transaction::TransactionVersion; | ||
|
||
use crate::transaction::errors::{TransactionExecutionError, TransactionPreValidationError}; | ||
|
||
#[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." | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_declare_transaction_error_format() { | ||
let error = TransactionExecutionError::DeclareTransactionError { | ||
class_hash: ClassHash(StarkHash::THREE), | ||
}; | ||
assert_eq!( | ||
error.to_string(), | ||
"Class with hash 0x0000000000000000000000000000000000000000000000000000000000000003 is \ | ||
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]." | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_invalid_nonce_format() { | ||
let error = TransactionPreValidationError::InvalidNonce { | ||
address: ContractAddress(PatriciaKey::from(20_u8)), | ||
account_nonce: Nonce(StarkHash::THREE), | ||
incoming_tx_nonce: Nonce(StarkHash::TWO), | ||
}; | ||
assert_eq!( | ||
error.to_string(), | ||
"Invalid transaction nonce of contract at address \ | ||
0x0000000000000000000000000000000000000000000000000000000000000014. Account nonce: \ | ||
0x0000000000000000000000000000000000000000000000000000000000000003; got: \ | ||
0x0000000000000000000000000000000000000000000000000000000000000002." | ||
); | ||
} |
Oops, something went wrong.