-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
crates/blockifier/src/execution/syscalls/syscall_tests/failure_format.rs
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,23 @@ | ||
use cairo_lang_utils::byte_array::BYTE_ARRAY_MAGIC; | ||
use starknet_types_core::felt::Felt; | ||
|
||
use crate::execution::errors::EntryPointExecutionError; | ||
|
||
#[test] | ||
fn test_syscall_failure_format() { | ||
let error_data = vec![ | ||
// Magic to indicate that this is a byte array. | ||
BYTE_ARRAY_MAGIC, | ||
// The number of full words in the byte array. | ||
"0x00", | ||
// The pending word of the byte array: "Execution failure" | ||
"0x457865637574696f6e206661696c757265", | ||
// The length of the pending word. | ||
"0x11", | ||
] | ||
.into_iter() | ||
.map(|x| Felt::from_hex(x).unwrap()) | ||
.collect(); | ||
let error = EntryPointExecutionError::ExecutionFailed { error_data }; | ||
assert_eq!(error.to_string(), "Execution failed. Failure reason: \"Execution failure\"."); | ||
} |
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