Remove some uses of ptr_to_int and int_to_ptr, using ptr instead (#7297)
Some checks failed
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-sway-examples (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (push) Has been cancelled
CI / build-mdbook (push) Has been cancelled
CI / build-forc-doc-sway-lib-std (push) Has been cancelled
CI / cargo-clippy (push) Has been cancelled
CI / build-forc-test-project (push) Has been cancelled
CI / cargo-build-workspace (push) Has been cancelled
CI / cargo-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (push) Has been cancelled
CI / cargo-test-sway-lsp (push) Has been cancelled
CI / cargo-run-e2e-test-evm (push) Has been cancelled
CI / cargo-test-lib-std (push) Has been cancelled
CI / cargo-test-forc (push) Has been cancelled
CI / cargo-test-workspace (push) Has been cancelled
CI / cargo-unused-deps-check (push) Has been cancelled
CI / pre-publish-check (push) Has been cancelled
github pages / deploy (push) Has been cancelled
CI / verifications-complete (push) Has been cancelled
CI / cargo-run-e2e-test (push) Has been cancelled
CI / cargo-run-e2e-test-release (push) Has been cancelled
CI / cargo-test-forc-debug (push) Has been cancelled
CI / cargo-test-forc-client (push) Has been cancelled
CI / cargo-test-forc-mcp (push) Has been cancelled
CI / cargo-test-forc-node (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled

This is in preparation for the argument mutability analysis. This PR
also has some skeleton code for this analysis, but the actual analysis
is still a `todo!()`.

The analysis will also have better precision if we use fewer asm blocks,
but I'll get to that after working on the analysis itself.
This commit is contained in:
Vaivaswatha N 2025-08-01 14:52:59 +05:30 committed by GitHub
parent 8b29cc39c5
commit 05e667dfc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 358 additions and 301 deletions

View file

@ -377,7 +377,7 @@ async fn test_simple_deploy() {
node.kill().unwrap(); node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract { let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str( id: ContractId::from_str(
"e6a03496312ff25990b73489e9ef253d20e2fd09701371d64ec54c9fb31516ae", "440b559604961bdbeaa31421823f34e45d246b5d139aa4886e5e1cf2901fc925",
) )
.unwrap(), .unwrap(),
proxy: None, proxy: None,
@ -421,7 +421,7 @@ async fn test_deploy_submit_only() {
node.kill().unwrap(); node.kill().unwrap();
let expected = vec![DeployedPackage::Contract(DeployedContract { let expected = vec![DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str( id: ContractId::from_str(
"e6a03496312ff25990b73489e9ef253d20e2fd09701371d64ec54c9fb31516ae", "440b559604961bdbeaa31421823f34e45d246b5d139aa4886e5e1cf2901fc925",
) )
.unwrap(), .unwrap(),
proxy: None, proxy: None,
@ -468,12 +468,12 @@ async fn test_deploy_fresh_proxy() {
node.kill().unwrap(); node.kill().unwrap();
let impl_contract = DeployedPackage::Contract(DeployedContract { let impl_contract = DeployedPackage::Contract(DeployedContract {
id: ContractId::from_str( id: ContractId::from_str(
"e6a03496312ff25990b73489e9ef253d20e2fd09701371d64ec54c9fb31516ae", "440b559604961bdbeaa31421823f34e45d246b5d139aa4886e5e1cf2901fc925",
) )
.unwrap(), .unwrap(),
proxy: Some( proxy: Some(
ContractId::from_str( ContractId::from_str(
"b5a98fd0d185284ee0775c9872d342914f0934ed479884096fe7bbd2c0b6aca7", "19d465200575ebd085300242002efcda38db99e22449a5c1346588efe9ced7f7",
) )
.unwrap(), .unwrap(),
), ),

View file

@ -51,10 +51,10 @@ fn test_forc_test_raw_logs() -> Result<(), rexpect::error::Error> {
// Assert that the output is correct // Assert that the output is correct
process.exp_string(" test test_log_4")?; process.exp_string(" test test_log_4")?;
process.exp_string("raw logs:")?; process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12460,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?; process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12456,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?; process.exp_string(" test test_log_2")?;
process.exp_string("raw logs:")?; process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12460,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?; process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12456,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.process.exit()?; process.process.exit()?;
Ok(()) Ok(())
@ -77,12 +77,12 @@ fn test_forc_test_both_logs() -> Result<(), rexpect::error::Error> {
process.exp_string("decoded log values:")?; process.exp_string("decoded log values:")?;
process.exp_string("4, log rb: 1515152261580153489")?; process.exp_string("4, log rb: 1515152261580153489")?;
process.exp_string("raw logs:")?; process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12460,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?; process.exp_string(r#"[{"LogData":{"data":"0000000000000004","digest":"8005f02d43fa06e7d0585fb64c961d57e318b27a145c857bcd3a6bdb413ff7fc","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12456,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.exp_string(" test test_log_2")?; process.exp_string(" test test_log_2")?;
process.exp_string("decoded log values:")?; process.exp_string("decoded log values:")?;
process.exp_string("2, log rb: 1515152261580153489")?; process.exp_string("2, log rb: 1515152261580153489")?;
process.exp_string("raw logs:")?; process.exp_string("raw logs:")?;
process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12460,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?; process.exp_string(r#"[{"LogData":{"data":"0000000000000002","digest":"cd04a4754498e06db5a13c5f371f1f04ff6d2470f24aa9bd886540e5dce77f70","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":12456,"ptr":67107840,"ra":0,"rb":1515152261580153489}}]"#)?;
process.process.exit()?; process.process.exit()?;
Ok(()) Ok(())
} }

View file

@ -187,14 +187,16 @@ fn calc_addr_as_ptr(
assert!(ptr.get_type(context).unwrap().is_ptr(context)); assert!(ptr.get_type(context).unwrap().is_ptr(context));
assert!(len.get_type(context).unwrap().is_uint64(context)); assert!(len.get_type(context).unwrap().is_uint64(context));
let uint64 = Type::get_uint64(context);
let ptr = current_block.append(context).ptr_to_int(ptr, uint64);
let addr = current_block let addr = current_block
.append(context) .append(context)
.binary_op(BinaryOpKind::Add, ptr, len); .binary_op(BinaryOpKind::Add, ptr, len);
// cast the addr to ptr_to
let ptr_to = Type::new_typed_pointer(context, ptr_to); let ptr_to = Type::new_typed_pointer(context, ptr_to);
current_block.append(context).int_to_ptr(addr, ptr_to) current_block
.append(context)
.cast_ptr(addr, ptr_to)
.add_metadatum(context, None)
} }
impl<'a> FnCompiler<'a> { impl<'a> FnCompiler<'a> {
@ -450,17 +452,18 @@ impl<'a> FnCompiler<'a> {
string_len: u64, string_len: u64,
) -> Result<TerminatorValue, CompileError> { ) -> Result<TerminatorValue, CompileError> {
let int_ty = Type::get_uint64(context); let int_ty = Type::get_uint64(context);
let ptr_ty = Type::get_ptr(context);
// build field values of the slice // build field values of the slice
let ptr_val = self let ptr_val = self
.current_block .current_block
.append(context) .append(context)
.ptr_to_int(string_data, int_ty) .cast_ptr(string_data, ptr_ty)
.add_metadatum(context, span_md_idx); .add_metadatum(context, span_md_idx);
let len_val = ConstantContent::get_uint(context, 64, string_len); let len_val = ConstantContent::get_uint(context, 64, string_len);
// a slice is a pointer and a length // a slice is a pointer and a length
let field_types = vec![int_ty, int_ty]; let field_types = vec![ptr_ty, int_ty];
// build a struct variable to store the values // build a struct variable to store the values
let struct_type = Type::new_struct(context, field_types.clone()); let struct_type = Type::new_struct(context, field_types.clone());
@ -1777,16 +1780,15 @@ impl<'a> FnCompiler<'a> {
immediate: None, immediate: None,
metadata: None, metadata: None,
}]; }];
let ptr_ty = Type::get_ptr(context);
let ptr = self.current_block.append(context).asm_block( let ptr = self.current_block.append(context).asm_block(
args, args,
body, body,
uint64, ptr_ty,
Some(Ident::new_no_span("hp".into())), Some(Ident::new_no_span("hp".into())),
); );
let ptr_ty = Type::get_ptr(context);
let ptr = self.current_block.append(context).int_to_ptr(ptr, ptr_ty);
let len = ConstantContent::new_uint(context, 64, 0); let len = ConstantContent::new_uint(context, 64, 0);
let len_c = Constant::unique(context, len); let len_c = Constant::unique(context, len);
let len = Value::new_constant(context, len_c); let len = Value::new_constant(context, len_c);
@ -2353,13 +2355,13 @@ impl<'a> FnCompiler<'a> {
) )
.expect_register(); .expect_register();
let uint64 = Type::get_uint64(context); let uint64_ty = Type::get_uint64(context);
let ptr_ty = Type::get_ptr(context);
let (ptr, _, len) = self.compile_buffer_into_parts(context, buffer)?; let (ptr, _, len) = self.compile_buffer_into_parts(context, buffer)?;
let ptr = self.current_block.append(context).ptr_to_int(ptr, uint64);
let slice_as_tuple = self.compile_tuple_from_values( let slice_as_tuple = self.compile_tuple_from_values(
context, context,
vec![ptr, len], vec![ptr, len],
vec![uint64, uint64], vec![ptr_ty, uint64_ty],
None, None,
)?; )?;

View file

@ -4,3 +4,5 @@ pub mod dominator;
pub use dominator::*; pub use dominator::*;
pub mod memory_utils; pub mod memory_utils;
pub use memory_utils::*; pub use memory_utils::*;
pub mod arg_mutability;
pub use arg_mutability::*;

View file

@ -0,0 +1,62 @@
//! For every function argument that is a pointer, determine if that function
//! may mutate the corresponding pointee.
use rustc_hash::FxHashMap;
use crate::{
build_call_graph, callee_first_order, AnalysisResult, AnalysisResultT, AnalysisResults,
Context, Function, IrError, Module, Pass, PassMutability, ScopedPass,
};
#[derive(Debug, Clone)]
/// The mutability of a pointer function argument's pointee.
pub enum ArgPointeeMutability {
Immutable,
Mutable,
NotAPointer,
}
// The dominator tree is represented by mapping each Block to its DomTreeNode.
#[derive(Default)]
pub struct ArgPointeeMutabilityResult(FxHashMap<Function, Vec<ArgPointeeMutability>>);
impl AnalysisResultT for ArgPointeeMutabilityResult {}
pub const ARG_POINTEE_MUTABILITY_NAME: &str = "arg_pointee_mutability";
pub fn create_arg_pointee_mutability_pass() -> Pass {
Pass {
name: ARG_POINTEE_MUTABILITY_NAME,
descr: "Analyze the mutability of function argument pointees",
deps: vec![],
runner: ScopedPass::ModulePass(PassMutability::Analysis(
compute_arg_pointee_mutability_pass,
)),
}
}
impl ArgPointeeMutabilityResult {
/// Get the mutability of the pointee for a function argument.
/// Panics on invalid function or argument index.
pub fn get_mutability(&self, function: Function, arg_index: usize) -> ArgPointeeMutability {
self.0.get(&function).unwrap()[arg_index].clone()
}
}
pub fn compute_arg_pointee_mutability_pass(
context: &Context,
_: &AnalysisResults,
module: Module,
) -> Result<AnalysisResult, IrError> {
Ok(Box::new(compute_arg_pointee_mutability(context, module)))
}
/// Compute the mutability of function argument pointees.
pub fn compute_arg_pointee_mutability(
context: &Context,
module: Module,
) -> ArgPointeeMutabilityResult {
let cg = build_call_graph(context, &context.modules.get(module.0).unwrap().functions);
let _callee_first = callee_first_order(&cg);
todo!()
}

View file

@ -68,7 +68,7 @@ script {
local { ptr, u64, u64 } __anon_01 local { ptr, u64, u64 } __anon_01
local { { ptr, u64, u64 } } __anon_1 local { { ptr, u64, u64 } } __anon_1
local { ptr, u64, u64 } __anon_10 local { ptr, u64, u64 } __anon_10
local { u64, u64 } __anon_11 local { ptr, u64 } __anon_11
local { { ptr, u64, u64 } } __anon_2 local { { ptr, u64, u64 } } __anon_2
local slice __ret_value local slice __ret_value
local { { ptr, u64, u64 } } buffer local { { ptr, u64, u64 } } buffer
@ -79,133 +79,129 @@ script {
v0 = get_local __ptr slice, __ret_value v0 = get_local __ptr slice, __ret_value
v1 = call main_8(), !51 v1 = call main_8(), !51
v2 = const u64 1024 v2 = const u64 1024
v3 = asm(cap: v2) -> u64 hp, !56 { v3 = asm(cap: v2) -> ptr hp, !56 {
aloc cap aloc cap
} }
v4 = int_to_ptr v3 to ptr, !57 v4 = get_local __ptr { ptr, u64, u64 }, __anon_0, !57
v5 = get_local __ptr { ptr, u64, u64 }, __anon_0, !58 v5 = const u64 0
v6 = const u64 0 v6 = get_elem_ptr v4, __ptr ptr, v5, !58
v7 = get_elem_ptr v5, __ptr ptr, v6, !59 store v3 to v6, !59
store v4 to v7, !60 v7 = const u64 1
v8 = const u64 1 v8 = get_elem_ptr v4, __ptr u64, v7, !60
v9 = get_elem_ptr v5, __ptr u64, v8, !61 store v2 to v8, !61
store v2 to v9, !62 v9 = const u64 2
v10 = const u64 2 v10 = get_elem_ptr v4, __ptr u64, v9, !62
v11 = get_elem_ptr v5, __ptr u64, v10, !63 v11 = const u64 0
v12 = const u64 0 store v11 to v10, !63
store v12 to v11, !64 v12 = asm(buffer: v4) -> __ptr { ptr, u64, u64 } buffer {
v13 = asm(buffer: v5) -> __ptr { ptr, u64, u64 } buffer {
} }
v14 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_0 v13 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_0
mem_copy_val v14, v13 mem_copy_val v13, v12
v15 = get_local __ptr { { ptr, u64, u64 } }, __anon_1, !66 v14 = get_local __ptr { { ptr, u64, u64 } }, __anon_1, !65
v16 = const u64 0 v15 = const u64 0
v17 = get_elem_ptr v15, __ptr { ptr, u64, u64 }, v16, !67 v16 = get_elem_ptr v14, __ptr { ptr, u64, u64 }, v15, !66
mem_copy_val v16, v13
v17 = get_local __ptr { { ptr, u64, u64 } }, buffer_, !69
mem_copy_val v17, v14 mem_copy_val v17, v14
v18 = get_local __ptr { { ptr, u64, u64 } }, buffer_, !70 v18 = get_local __ptr { { ptr, u64, u64 } }, buffer_, !71
mem_copy_val v18, v15 v19 = const u64 0
v19 = get_local __ptr { { ptr, u64, u64 } }, buffer_, !72 v20 = get_elem_ptr v18, __ptr { ptr, u64, u64 }, v19, !73
v20 = const u64 0 v21 = asm(buffer: v20) -> __ptr { ptr, u64, u64 } buffer {
v21 = get_elem_ptr v19, __ptr { ptr, u64, u64 }, v20, !74
v22 = asm(buffer: v21) -> __ptr { ptr, u64, u64 } buffer {
} }
v23 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_00 v22 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_00
mem_copy_val v22, v21
v23 = get_local __ptr { ptr, u64, u64 }, __anon_00, !74
mem_copy_val v23, v22 mem_copy_val v23, v22
v24 = get_local __ptr { ptr, u64, u64 }, __anon_00, !75 v24 = const u64 0
mem_copy_val v24, v23 v25 = get_elem_ptr v23, __ptr ptr, v24, !75
v25 = const u64 0 v26 = load v25, !76
v26 = get_elem_ptr v24, __ptr ptr, v25, !76 v27 = const u64 1
v27 = load v26, !77 v28 = get_elem_ptr v23, __ptr u64, v27, !77
v28 = const u64 1 v29 = load v28, !78
v29 = get_elem_ptr v24, __ptr u64, v28, !78 v30 = const u64 2
v30 = load v29, !79 v31 = get_elem_ptr v23, __ptr u64, v30, !79
v31 = const u64 2 v32 = load v31, !80
v32 = get_elem_ptr v24, __ptr u64, v31, !80 v33 = const u64 8
v33 = load v32, !81 v34 = add v32, v33, !81
v34 = const u64 8 v35 = cmp gt v34 v29, !82
v35 = add v33, v34, !82 cbr v35, encode_10_abi_encode_11_block1(), encode_10_abi_encode_11_block0(v26, v29), !83
v36 = cmp gt v35 v30, !83
cbr v36, encode_10_abi_encode_11_block1(), encode_10_abi_encode_11_block0(v27, v30), !84
encode_10_abi_encode_11_block0(v37: ptr, v38: u64): encode_10_abi_encode_11_block0(v36: ptr, v37: u64):
v39 = ptr_to_int v37 to u64, !85 v38 = add v36, v32, !84
v40 = add v39, v33, !86 v39 = cast_ptr v38 to __ptr u64, !85
v41 = int_to_ptr v40 to __ptr u64, !87 store v1 to v39, !86
store v1 to v41, !88 v40 = get_local __ptr { ptr, u64, u64 }, __anon_10, !87
v42 = get_local __ptr { ptr, u64, u64 }, __anon_10, !89 v41 = const u64 0
v43 = const u64 0 v42 = get_elem_ptr v40, __ptr ptr, v41, !88
v44 = get_elem_ptr v42, __ptr ptr, v43, !90 store v36 to v42, !89
v43 = const u64 1
v44 = get_elem_ptr v40, __ptr u64, v43, !90
store v37 to v44, !91 store v37 to v44, !91
v45 = const u64 1 v45 = const u64 2
v46 = get_elem_ptr v42, __ptr u64, v45, !92 v46 = get_elem_ptr v40, __ptr u64, v45, !92
store v38 to v46, !93 store v34 to v46, !93
v47 = const u64 2 v47 = asm(buffer: v40) -> __ptr { ptr, u64, u64 } buffer {
v48 = get_elem_ptr v42, __ptr u64, v47, !94
store v35 to v48, !95
v49 = asm(buffer: v42) -> __ptr { ptr, u64, u64 } buffer {
} }
v50 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_01 v48 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_01
mem_copy_val v50, v49 mem_copy_val v48, v47
v51 = get_local __ptr { { ptr, u64, u64 } }, __anon_2, !97 v49 = get_local __ptr { { ptr, u64, u64 } }, __anon_2, !95
v52 = const u64 0 v50 = const u64 0
v53 = get_elem_ptr v51, __ptr { ptr, u64, u64 }, v52, !98 v51 = get_elem_ptr v49, __ptr { ptr, u64, u64 }, v50, !96
mem_copy_val v53, v50 mem_copy_val v51, v48
v54 = get_local __ptr { { ptr, u64, u64 } }, buffer, !100 v52 = get_local __ptr { { ptr, u64, u64 } }, buffer, !98
mem_copy_val v54, v51 mem_copy_val v52, v49
v55 = get_local __ptr { { ptr, u64, u64 } }, buffer, !102 v53 = get_local __ptr { { ptr, u64, u64 } }, buffer, !100
v56 = get_local __ptr { { ptr, u64, u64 } }, self_0, !105 v54 = get_local __ptr { { ptr, u64, u64 } }, self_0, !103
mem_copy_val v56, v55 mem_copy_val v54, v53
v57 = get_local __ptr { { ptr, u64, u64 } }, self_0, !107 v55 = get_local __ptr { { ptr, u64, u64 } }, self_0, !105
v58 = const u64 0 v56 = const u64 0
v59 = get_elem_ptr v57, __ptr { ptr, u64, u64 }, v58, !108 v57 = get_elem_ptr v55, __ptr { ptr, u64, u64 }, v56, !106
v60 = asm(buffer: v59) -> __ptr { ptr, u64, u64 } buffer { v58 = asm(buffer: v57) -> __ptr { ptr, u64, u64 } buffer {
} }
v61 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_02 v59 = get_local __ptr { ptr, u64, u64 }, __aggr_memcpy_02
mem_copy_val v61, v60 mem_copy_val v59, v58
v62 = get_local __ptr { ptr, u64, u64 }, __anon_01, !109 v60 = get_local __ptr { ptr, u64, u64 }, __anon_01, !107
mem_copy_val v62, v61 mem_copy_val v60, v59
v63 = const u64 0 v61 = const u64 0
v64 = get_elem_ptr v62, __ptr ptr, v63, !110 v62 = get_elem_ptr v60, __ptr ptr, v61, !108
v65 = load v64, !111 v63 = const u64 2
v66 = const u64 2 v64 = get_elem_ptr v60, __ptr u64, v63, !109
v67 = get_elem_ptr v62, __ptr u64, v66, !112 v65 = get_local __ptr { ptr, u64 }, __anon_11, !110
v68 = ptr_to_int v65 to u64, !113 v66 = const u64 0
v69 = get_local __ptr { u64, u64 }, __anon_11, !114 v67 = get_elem_ptr v65, __ptr ptr, v66, !111
v70 = const u64 0 mem_copy_val v67, v62
v71 = get_elem_ptr v69, __ptr u64, v70, !115 v68 = const u64 1
store v68 to v71, !116 v69 = get_elem_ptr v65, __ptr u64, v68, !112
v72 = const u64 1 mem_copy_val v69, v64
v73 = get_elem_ptr v69, __ptr u64, v72, !117 v70 = asm(s: v65) -> __ptr slice s {
mem_copy_val v73, v67
v74 = asm(s: v69) -> __ptr slice s {
} }
v75 = get_local __ptr slice, __aggr_memcpy_03 v71 = get_local __ptr slice, __aggr_memcpy_03
mem_copy_val v75, v74 mem_copy_val v71, v70
mem_copy_val v0, v75 mem_copy_val v0, v71
ret __ptr slice v0 ret __ptr slice v0
encode_10_abi_encode_11_block1(): encode_10_abi_encode_11_block1():
v76 = const u64 2 v72 = const u64 2
v77 = mul v30, v76, !118 v73 = mul v29, v72, !113
v78 = add v77, v34, !119 v74 = add v73, v33, !114
v79 = asm(new_cap: v78, old_ptr: v27, len: v33) -> __ptr u8 hp, !120 { v75 = asm(new_cap: v74, old_ptr: v26, len: v32) -> __ptr u8 hp, !115 {
aloc new_cap aloc new_cap
mcp hp old_ptr len mcp hp old_ptr len
} }
br encode_10_abi_encode_11_block0(v79, v78), !121 br encode_10_abi_encode_11_block0(v75, v74), !116
} }
entry_orig fn main_8() -> u64, !124 { entry_orig fn main_8() -> u64, !119 {
entry(): entry():
v0 = get_config __ptr { u64 }, WRAPPED, !125 v0 = get_config __ptr { u64 }, WRAPPED, !120
v1 = const u64 0 v1 = const u64 0
v2 = get_elem_ptr v0, __ptr u64, v1, !126 v2 = get_elem_ptr v0, __ptr u64, v1, !121
v3 = load v2 v3 = load v2
v4 = get_config __ptr { u64 }, TUPLE, !127 v4 = get_config __ptr { u64 }, TUPLE, !122
v5 = const u64 0 v5 = const u64 0
v6 = get_elem_ptr v4, __ptr u64, v5, !128 v6 = get_elem_ptr v4, __ptr u64, v5, !123
v7 = load v6 v7 = load v6
v8 = add v3, v7, !131 v8 = add v3, v7, !126
ret u64 v8 ret u64 v8
} }
} }
@ -274,74 +270,69 @@ script {
!61 = (!52 !53 !54 !55) !61 = (!52 !53 !54 !55)
!62 = (!52 !53 !54 !55) !62 = (!52 !53 !54 !55)
!63 = (!52 !53 !54 !55) !63 = (!52 !53 !54 !55)
!64 = (!52 !53 !54 !55) !64 = span !3 191 254
!65 = span !3 191 254 !65 = (!52 !53 !54 !55 !64)
!66 = (!52 !53 !54 !55 !65) !66 = (!52 !53 !54 !55)
!67 = (!52 !53 !54 !55) !67 = span !3 67754 67784
!68 = span !3 67754 67784 !68 = fn_call_path_span !3 67759 67769
!69 = fn_call_path_span !3 67759 67769 !69 = (!52 !53 !67 !68)
!70 = (!52 !53 !68 !69) !70 = span !3 4768 4774
!71 = span !3 4768 4774 !71 = (!52 !53 !67 !68 !70)
!72 = (!52 !53 !68 !69 !71) !72 = span !3 87 114
!73 = span !3 87 114 !73 = (!52 !53 !67 !68 !72)
!74 = (!52 !53 !68 !69 !73) !74 = (!52 !53 !67 !68)
!75 = (!52 !53 !68 !69) !75 = (!52 !53 !67 !68)
!76 = (!52 !53 !68 !69) !76 = (!52 !53 !67 !68)
!77 = (!52 !53 !68 !69) !77 = (!52 !53 !67 !68)
!78 = (!52 !53 !68 !69) !78 = (!52 !53 !67 !68)
!79 = (!52 !53 !68 !69) !79 = (!52 !53 !67 !68)
!80 = (!52 !53 !68 !69) !80 = (!52 !53 !67 !68)
!81 = (!52 !53 !68 !69) !81 = (!52 !53 !67 !68)
!82 = (!52 !53 !68 !69) !82 = (!52 !53 !67 !68)
!83 = (!52 !53 !68 !69) !83 = (!52 !53 !67 !68)
!84 = (!52 !53 !68 !69) !84 = (!52 !53 !67 !68)
!85 = (!52 !53 !68 !69) !85 = (!52 !53 !67 !68)
!86 = (!52 !53 !68 !69) !86 = (!52 !53 !67 !68)
!87 = (!52 !53 !68 !69) !87 = (!52 !53 !67 !68)
!88 = (!52 !53 !68 !69) !88 = (!52 !53 !67 !68)
!89 = (!52 !53 !68 !69) !89 = (!52 !53 !67 !68)
!90 = (!52 !53 !68 !69) !90 = (!52 !53 !67 !68)
!91 = (!52 !53 !68 !69) !91 = (!52 !53 !67 !68)
!92 = (!52 !53 !68 !69) !92 = (!52 !53 !67 !68)
!93 = (!52 !53 !68 !69) !93 = (!52 !53 !67 !68)
!94 = (!52 !53 !68 !69) !94 = span !3 4716 4799
!95 = (!52 !53 !68 !69) !95 = (!52 !53 !67 !68 !94)
!96 = span !3 4716 4799 !96 = (!52 !53 !67 !68)
!97 = (!52 !53 !68 !69 !96) !97 = span !3 67741 67785
!98 = (!52 !53 !68 !69) !98 = (!52 !53 !97)
!99 = span !3 67741 67785 !99 = span !3 67790 67796
!100 = (!52 !53 !99) !100 = (!52 !53 !99)
!101 = span !3 67790 67796 !101 = span !3 67790 67811
!102 = (!52 !53 !101) !102 = fn_call_path_span !3 67797 67809
!103 = span !3 67790 67811 !103 = (!52 !53 !101 !102)
!104 = fn_call_path_span !3 67797 67809 !104 = span !3 573 577
!105 = (!52 !53 !103 !104) !105 = (!52 !53 !101 !102 !104)
!106 = span !3 573 577 !106 = (!52 !53 !101 !102 !72)
!107 = (!52 !53 !103 !104 !106) !107 = (!52 !53 !101 !102)
!108 = (!52 !53 !103 !104 !73) !108 = (!52 !53 !101 !102)
!109 = (!52 !53 !103 !104) !109 = (!52 !53 !101 !102)
!110 = (!52 !53 !103 !104) !110 = (!52 !53 !101 !102)
!111 = (!52 !53 !103 !104) !111 = (!52 !53 !101 !102)
!112 = (!52 !53 !103 !104) !112 = (!52 !53 !101 !102)
!113 = (!52 !53 !103 !104) !113 = (!52 !53 !67 !68)
!114 = (!52 !53 !103 !104) !114 = (!52 !53 !67 !68)
!115 = (!52 !53 !103 !104) !115 = (!52 !53 !67 !68)
!116 = (!52 !53 !103 !104) !116 = (!52 !53 !67 !68)
!117 = (!52 !53 !103 !104) !117 = span !0 202 246
!118 = (!52 !53 !68 !69) !118 = fn_name_span !0 205 209
!119 = (!52 !53 !68 !69) !119 = (!117 !118)
!120 = (!52 !53 !68 !69) !120 = span !0 225 232
!121 = (!52 !53 !68 !69) !121 = span !0 30 36
!122 = span !0 202 246 !122 = span !0 237 242
!123 = fn_name_span !0 205 209 !123 = span !0 243 244
!124 = (!122 !123) !124 = span !0 225 244
!125 = span !0 225 232 !125 = fn_call_path_span !0 235 236
!126 = span !0 30 36 !126 = (!124 !125)
!127 = span !0 237 242
!128 = span !0 243 244
!129 = span !0 225 244
!130 = fn_call_path_span !0 235 236
!131 = (!129 !130)
;; ASM: Final program ;; ASM: Final program
;; Program kind: Script ;; Program kind: Script
@ -358,15 +349,15 @@ cfei i16 ; allocate stack space for globals
addr $$arg0 data_Configurable_0; get pointer to configurable TUPLE default value addr $$arg0 data_Configurable_0; get pointer to configurable TUPLE default value
addi $$arg1 $zero i8 ; get length of configurable TUPLE default value addi $$arg1 $zero i8 ; get length of configurable TUPLE default value
addi $$arg2 $ssp i0 ; get pointer to configurable TUPLE stack address addi $$arg2 $ssp i0 ; get pointer to configurable TUPLE stack address
jal $$reta $pc i75 ; decode configurable TUPLE jal $$reta $pc i74 ; decode configurable TUPLE
addr $$arg0 data_Configurable_1; get pointer to configurable WRAPPED default value addr $$arg0 data_Configurable_1; get pointer to configurable WRAPPED default value
addi $$arg1 $zero i8 ; get length of configurable WRAPPED default value addi $$arg1 $zero i8 ; get length of configurable WRAPPED default value
addi $$arg2 $ssp i8 ; get pointer to configurable WRAPPED stack address addi $$arg2 $ssp i8 ; get pointer to configurable WRAPPED stack address
jal $$reta $pc i70 ; decode configurable WRAPPED jal $$reta $pc i69 ; decode configurable WRAPPED
move $$locbase $sp ; save locals base register for function __entry move $$locbase $sp ; save locals base register for function __entry
cfei i360 ; allocate 360 bytes for locals and 0 slots for call arguments cfei i360 ; allocate 360 bytes for locals and 0 slots for call arguments
addi $r0 $$locbase i272 ; get offset to local addi $r0 $$locbase i272 ; get offset to local
jal $$reta $pc i94 ; [call]: call main_8 jal $$reta $pc i93 ; [call]: call main_8
move $r1 $$retv ; [call]: copy the return value move $r1 $$retv ; [call]: copy the return value
movi $r2 i1024 ; initialize constant into register movi $r2 i1024 ; initialize constant into register
aloc $r2 aloc $r2
@ -420,12 +411,11 @@ addi $r2 $$locbase i72 ; get offset to local
mcpi $r2 $r1 i24 ; copy memory mcpi $r2 $r1 i24 ; copy memory
addi $r1 $$locbase i160 ; get offset to local addi $r1 $$locbase i160 ; get offset to local
mcpi $r1 $r2 i24 ; copy memory mcpi $r1 $r2 i24 ; copy memory
lw $r2 $$locbase i20 ; load word addi $r2 $r1 i16 ; get offset to aggregate element
addi $r1 $r1 i16 ; get offset to aggregate element
addi $r3 $$locbase i232 ; get offset to local addi $r3 $$locbase i232 ; get offset to local
sw $$locbase $r2 i29 ; store word mcpi $r3 $r1 i8 ; copy memory
addi $r2 $r3 i8 ; get offset to aggregate element addi $r1 $r3 i8 ; get offset to aggregate element
mcpi $r2 $r1 i8 ; copy memory mcpi $r1 $r2 i8 ; copy memory
addi $r1 $$locbase i96 ; get offset to local addi $r1 $$locbase i96 ; get offset to local
mcpi $r1 $r3 i16 ; copy memory mcpi $r1 $r3 i16 ; copy memory
mcpi $r0 $r1 i16 ; copy memory mcpi $r0 $r1 i16 ; copy memory

View file

@ -24,7 +24,7 @@ ____
tested -- panic_handling_in_unit_tests tested -- panic_handling_in_unit_tests
test passing_dbgs_and_logs ... ok (???, 2219 gas) test passing_dbgs_and_logs ... ok (???, 2221 gas)
debug output: debug output:
[src/main.sw:23:13] "This is a passing test containing `__dbg` outputs." = "This is a passing test containing `__dbg` outputs." [src/main.sw:23:13] "This is a passing test containing `__dbg` outputs." = "This is a passing test containing `__dbg` outputs."
[src/main.sw:25:13] x = 42 [src/main.sw:25:13] x = 42
@ -32,7 +32,7 @@ tested -- panic_handling_in_unit_tests
AsciiString { data: "This is a log from the passing test." }, log rb: 10098701174489624218 AsciiString { data: "This is a log from the passing test." }, log rb: 10098701174489624218
42, log rb: 1515152261580153489 42, log rb: 1515152261580153489
raw logs: raw logs:
[{"LogData":{"data":"0000000000000024546869732069732061206c6f672066726f6d207468652070617373696e6720746573742e","digest":"29d742ad9093cdf81404ff756467a44448729b85ab3c0d65197829fb61d2dd29","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":44,"pc":16216,"ptr":67107840,"ra":0,"rb":10098701174489624218}},{"LogData":{"data":"000000000000002a","digest":"a6bb133cb1e3638ad7b8a3ff0539668e9e56f9b850ef1b2a810f5422eaa6c323","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":16652,"ptr":67106816,"ra":0,"rb":1515152261580153489}}] [{"LogData":{"data":"0000000000000024546869732069732061206c6f672066726f6d207468652070617373696e6720746573742e","digest":"29d742ad9093cdf81404ff756467a44448729b85ab3c0d65197829fb61d2dd29","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":44,"pc":16212,"ptr":67107840,"ra":0,"rb":10098701174489624218}},{"LogData":{"data":"000000000000002a","digest":"a6bb133cb1e3638ad7b8a3ff0539668e9e56f9b850ef1b2a810f5422eaa6c323","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10368,"len":8,"pc":16648,"ptr":67106816,"ra":0,"rb":1515152261580153489}}]
test passing_no_dbgs_or_logs ... ok (???, 18 gas) test passing_no_dbgs_or_logs ... ok (???, 18 gas)
test result: OK. 2 passed; 0 failed; finished in ??? test result: OK. 2 passed; 0 failed; finished in ???
@ -61,26 +61,26 @@ ____
tested -- panic_handling_in_unit_tests tested -- panic_handling_in_unit_tests
test passing_dbgs_and_logs ... ok (???, 2219 gas) test passing_dbgs_and_logs ... ok (???, 2221 gas)
test passing_no_dbgs_or_logs ... ok (???, 18 gas) test passing_no_dbgs_or_logs ... ok (???, 18 gas)
test failing_revert_intrinsic ... FAILED (???, 19 gas) test failing_revert_intrinsic ... FAILED (???, 19 gas)
test failing_revert_function_with_dbgs_and_logs ... FAILED (???, 2347 gas) test failing_revert_function_with_dbgs_and_logs ... FAILED (???, 2348 gas)
test failing_error_signal_assert ... FAILED (???, 497 gas) test failing_error_signal_assert ... FAILED (???, 497 gas)
test failing_error_signal_assert_eq ... FAILED (???, 1393 gas) test failing_error_signal_assert_eq ... FAILED (???, 1396 gas)
test failing_error_signal_assert_ne ... FAILED (???, 1388 gas) test failing_error_signal_assert_ne ... FAILED (???, 1391 gas)
test failing_error_signal_require_str_error ... FAILED (???, 319 gas) test failing_error_signal_require_str_error ... FAILED (???, 320 gas)
test failing_error_signal_require_enum_error ... FAILED (???, 413 gas) test failing_error_signal_require_enum_error ... FAILED (???, 414 gas)
test failing_panic_no_arg ... FAILED (???, 194 gas) test failing_panic_no_arg ... FAILED (???, 195 gas)
test failing_panic_unit_arg ... FAILED (???, 194 gas) test failing_panic_unit_arg ... FAILED (???, 195 gas)
test failing_panic_const_eval_str_arg ... FAILED (???, 19 gas) test failing_panic_const_eval_str_arg ... FAILED (???, 19 gas)
test failing_panic_const_eval_empty_str_arg ... FAILED (???, 19 gas) test failing_panic_const_eval_empty_str_arg ... FAILED (???, 19 gas)
test failing_panic_const_eval_whitespace_str_arg ... FAILED (???, 19 gas) test failing_panic_const_eval_whitespace_str_arg ... FAILED (???, 19 gas)
test failing_panic_non_const_eval_str_arg ... FAILED (???, 297 gas) test failing_panic_non_const_eval_str_arg ... FAILED (???, 298 gas)
test failing_panic_non_const_eval_str_empty_arg ... FAILED (???, 291 gas) test failing_panic_non_const_eval_str_empty_arg ... FAILED (???, 292 gas)
test failing_panic_non_const_eval_str_whitespace_arg ... FAILED (???, 297 gas) test failing_panic_non_const_eval_str_whitespace_arg ... FAILED (???, 298 gas)
test failing_panic_error_enum_arg ... FAILED (???, 394 gas) test failing_panic_error_enum_arg ... FAILED (???, 395 gas)
test failing_panic_error_enum_arg_with_empty_msg ... FAILED (???, 486 gas) test failing_panic_error_enum_arg_with_empty_msg ... FAILED (???, 487 gas)
test failing_panic_error_enum_arg_with_whitespace_msg ... FAILED (???, 503 gas) test failing_panic_error_enum_arg_with_whitespace_msg ... FAILED (???, 504 gas)
failures: failures:
test failing_revert_intrinsic, "test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panic_handling_in_unit_tests/src/main.sw":34 test failing_revert_intrinsic, "test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panic_handling_in_unit_tests/src/main.sw":34
@ -103,7 +103,7 @@ AsciiString { data: "This is a log from the reverting test." }, log rb: 10098701
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 46, "len": 46,
"pc": 16216, "pc": 16212,
"ptr": 67107840, "ptr": 67107840,
"ra": 0, "ra": 0,
"rb": 10098701174489624218 "rb": 10098701174489624218
@ -137,7 +137,7 @@ AsciiString { data: "We will get logged the asserted values and this message." }
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 64, "len": 64,
"pc": 16216, "pc": 16212,
"ptr": 67107840, "ptr": 67107840,
"ra": 0, "ra": 0,
"rb": 10098701174489624218 "rb": 10098701174489624218
@ -150,7 +150,7 @@ AsciiString { data: "We will get logged the asserted values and this message." }
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 8, "len": 8,
"pc": 16652, "pc": 16648,
"ptr": 67106816, "ptr": 67106816,
"ra": 0, "ra": 0,
"rb": 1515152261580153489 "rb": 1515152261580153489
@ -163,7 +163,7 @@ AsciiString { data: "We will get logged the asserted values and this message." }
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 8, "len": 8,
"pc": 16652, "pc": 16648,
"ptr": 67105792, "ptr": 67105792,
"ra": 0, "ra": 0,
"rb": 1515152261580153489 "rb": 1515152261580153489
@ -190,7 +190,7 @@ AsciiString { data: "We will get logged the asserted values and this message." }
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 64, "len": 64,
"pc": 16216, "pc": 16212,
"ptr": 67107840, "ptr": 67107840,
"ra": 0, "ra": 0,
"rb": 10098701174489624218 "rb": 10098701174489624218
@ -203,7 +203,7 @@ AsciiString { data: "We will get logged the asserted values and this message." }
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 8, "len": 8,
"pc": 16652, "pc": 16648,
"ptr": 67106816, "ptr": 67106816,
"ra": 0, "ra": 0,
"rb": 1515152261580153489 "rb": 1515152261580153489
@ -216,7 +216,7 @@ AsciiString { data: "We will get logged the asserted values and this message." }
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 8, "len": 8,
"pc": 16652, "pc": 16648,
"ptr": 67105792, "ptr": 67105792,
"ra": 0, "ra": 0,
"rb": 1515152261580153489 "rb": 1515152261580153489
@ -239,7 +239,7 @@ AsciiString { data: "This is an error message in a `require` call." }, log rb: 1
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 53, "len": 53,
"pc": 16216, "pc": 16212,
"ptr": 67107840, "ptr": 67107840,
"ra": 0, "ra": 0,
"rb": 10098701174489624218 "rb": 10098701174489624218
@ -352,7 +352,7 @@ AsciiString { data: "Panicked with a non-const evaluated string argument." }, lo
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 60, "len": 60,
"pc": 18500, "pc": 18496,
"ptr": 67107840, "ptr": 67107840,
"ra": 0, "ra": 0,
"rb": 10098701174489624218 "rb": 10098701174489624218
@ -376,7 +376,7 @@ AsciiString { data: "" }, log rb: 10098701174489624218
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 8, "len": 8,
"pc": 18500, "pc": 18496,
"ptr": 67107840, "ptr": 67107840,
"ra": 0, "ra": 0,
"rb": 10098701174489624218 "rb": 10098701174489624218
@ -400,7 +400,7 @@ AsciiString { data: " " }, log rb: 10098701174489624218
"id": "0000000000000000000000000000000000000000000000000000000000000000", "id": "0000000000000000000000000000000000000000000000000000000000000000",
"is": 10368, "is": 10368,
"len": 12, "len": 12,
"pc": 18500, "pc": 18496,
"ptr": 67107840, "ptr": 67107840,
"ra": 0, "ra": 0,
"rb": 10098701174489624218 "rb": 10098701174489624218

View file

@ -9,78 +9,78 @@ output:
Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core) Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core)
Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib) Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib)
Compiling contract panicking_contract (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_contract) Compiling contract panicking_contract (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_contract)
Finished release [optimized + fuel] target(s) [8.168 KB] in ??? Finished release [optimized + fuel] target(s) [8.136 KB] in ???
Running 11 tests, filtered 0 tests Running 11 tests, filtered 0 tests
tested -- panicking_contract tested -- panicking_contract
test test_directly_panicking_method ... ok (???, 1635 gas) test test_directly_panicking_method ... ok (???, 1595 gas)
revert code: ffffffff00000000 revert code: ffffffff00000000
├─ panic message: Error C. ├─ panic message: Error C.
├─ panic value: C(true) ├─ panic value: C(true)
└─ panicked in: panicking_contract@1.2.3, src/main.sw:22:9 └─ panicked in: panicking_contract@1.2.3, src/main.sw:22:9
decoded log values: decoded log values:
C(true), log rb: 5503570629422409978 C(true), log rb: 5503570629422409978
test test_nested_panic_inlined ... ok (???, 2961 gas) test test_nested_panic_inlined ... ok (???, 2921 gas)
revert code: ffffffff00000005 revert code: ffffffff00000005
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]) ├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
└─ panicked in: panicking_lib, src/lib.sw:41:9 └─ panicked in: panicking_lib, src/lib.sw:41:9
decoded log values: decoded log values:
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978 E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978
test test_nested_panic_inlined_same_revert_code ... ok (???, 2961 gas) test test_nested_panic_inlined_same_revert_code ... ok (???, 2921 gas)
revert code: ffffffff00000005 revert code: ffffffff00000005
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]) ├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
└─ panicked in: panicking_lib, src/lib.sw:41:9 └─ panicked in: panicking_lib, src/lib.sw:41:9
decoded log values: decoded log values:
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978 E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978
test test_nested_panic_not_inlined ... ok (???, 3160 gas) test test_nested_panic_not_inlined ... ok (???, 3120 gas)
revert code: ffffffff00000006 revert code: ffffffff00000006
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]) ├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
└─ panicked in: panicking_lib, src/lib.sw:35:5 └─ panicked in: panicking_lib, src/lib.sw:35:5
decoded log values: decoded log values:
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978 E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978
test test_nested_panic_not_inlined_same_revert_code ... ok (???, 3160 gas) test test_nested_panic_not_inlined_same_revert_code ... ok (???, 3120 gas)
revert code: ffffffff00000006 revert code: ffffffff00000006
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]) ├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
└─ panicked in: panicking_lib, src/lib.sw:35:5 └─ panicked in: panicking_lib, src/lib.sw:35:5
decoded log values: decoded log values:
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978 E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978
test test_generic_panic_with_unit ... ok (???, 2092 gas) test test_generic_panic_with_unit ... ok (???, 2052 gas)
revert code: ffffffff00000004 revert code: ffffffff00000004
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
(), log rb: 3330666440490685604 (), log rb: 3330666440490685604
test test_generic_panic_with_unit_same_revert_code ... ok (???, 2092 gas) test test_generic_panic_with_unit_same_revert_code ... ok (???, 2052 gas)
revert code: ffffffff00000004 revert code: ffffffff00000004
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
(), log rb: 3330666440490685604 (), log rb: 3330666440490685604
test test_generic_panic_with_str ... ok (???, 2102 gas) test test_generic_panic_with_str ... ok (???, 2062 gas)
revert code: ffffffff00000002 revert code: ffffffff00000002
├─ panic message: generic panic with string ├─ panic message: generic panic with string
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
AsciiString { data: "generic panic with string" }, log rb: 10098701174489624218 AsciiString { data: "generic panic with string" }, log rb: 10098701174489624218
test test_generic_panic_with_different_str_same_revert_code ... ok (???, 1772 gas) test test_generic_panic_with_different_str_same_revert_code ... ok (???, 1732 gas)
revert code: ffffffff00000002 revert code: ffffffff00000002
├─ panic message: generic panic with different string ├─ panic message: generic panic with different string
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
AsciiString { data: "generic panic with different string" }, log rb: 10098701174489624218 AsciiString { data: "generic panic with different string" }, log rb: 10098701174489624218
test test_generic_panic_with_error_type_enum ... ok (???, 1902 gas) test test_generic_panic_with_error_type_enum ... ok (???, 1862 gas)
revert code: ffffffff00000003 revert code: ffffffff00000003
├─ panic message: Error A. ├─ panic message: Error A.
├─ panic value: A ├─ panic value: A
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
A, log rb: 5503570629422409978 A, log rb: 5503570629422409978
test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 2071 gas) test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 2031 gas)
revert code: ffffffff00000003 revert code: ffffffff00000003
├─ panic message: Error B. ├─ panic message: Error B.
├─ panic value: B(42) ├─ panic value: B(42)

View file

@ -8,84 +8,84 @@ output:
Building test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib Building test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib
Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core) Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core)
Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib) Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib)
Finished release [optimized + fuel] target(s) [5.688 KB] in ??? Finished release [optimized + fuel] target(s) [5.656 KB] in ???
Running 18 tests, filtered 0 tests Running 18 tests, filtered 0 tests
tested -- panicking_lib tested -- panicking_lib
test test_nested_panic_inlined ... ok (???, 808 gas) test test_nested_panic_inlined ... ok (???, 798 gas)
revert code: ffffffff00000000 revert code: ffffffff00000000
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]) ├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
└─ panicked in: panicking_lib, src/lib.sw:41:9 └─ panicked in: panicking_lib, src/lib.sw:41:9
decoded log values: decoded log values:
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 2721958641300806892 E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 2721958641300806892
test test_nested_panic_inlined_same_revert_code ... ok (???, 808 gas) test test_nested_panic_inlined_same_revert_code ... ok (???, 798 gas)
revert code: ffffffff00000000 revert code: ffffffff00000000
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]) ├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
└─ panicked in: panicking_lib, src/lib.sw:41:9 └─ panicked in: panicking_lib, src/lib.sw:41:9
decoded log values: decoded log values:
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 2721958641300806892 E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 2721958641300806892
test test_nested_panic_not_inlined ... ok (???, 787 gas) test test_nested_panic_not_inlined ... ok (???, 777 gas)
revert code: ffffffff00000001 revert code: ffffffff00000001
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]) ├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
└─ panicked in: panicking_lib, src/lib.sw:35:5 └─ panicked in: panicking_lib, src/lib.sw:35:5
decoded log values: decoded log values:
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 2721958641300806892 E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 2721958641300806892
test test_nested_panic_not_inlined_same_revert_code ... ok (???, 787 gas) test test_nested_panic_not_inlined_same_revert_code ... ok (???, 777 gas)
revert code: ffffffff00000001 revert code: ffffffff00000001
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]) ├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
└─ panicked in: panicking_lib, src/lib.sw:35:5 └─ panicked in: panicking_lib, src/lib.sw:35:5
decoded log values: decoded log values:
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 2721958641300806892 E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 2721958641300806892
test test_generic_panic_with_unit ... ok (???, 152 gas) test test_generic_panic_with_unit ... ok (???, 142 gas)
revert code: ffffffff00000002 revert code: ffffffff00000002
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
(), log rb: 3330666440490685604 (), log rb: 3330666440490685604
test test_generic_panic_with_unit_same_revert_code ... ok (???, 152 gas) test test_generic_panic_with_unit_same_revert_code ... ok (???, 142 gas)
revert code: ffffffff00000002 revert code: ffffffff00000002
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
(), log rb: 3330666440490685604 (), log rb: 3330666440490685604
test test_generic_panic_with_str ... ok (???, 283 gas) test test_generic_panic_with_str ... ok (???, 273 gas)
revert code: ffffffff00000003 revert code: ffffffff00000003
├─ panic message: generic panic with string ├─ panic message: generic panic with string
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
AsciiString { data: "generic panic with string" }, log rb: 10098701174489624218 AsciiString { data: "generic panic with string" }, log rb: 10098701174489624218
test test_generic_panic_with_different_str_same_revert_code ... ok (???, 283 gas) test test_generic_panic_with_different_str_same_revert_code ... ok (???, 273 gas)
revert code: ffffffff00000003 revert code: ffffffff00000003
├─ panic message: generic panic different string ├─ panic message: generic panic different string
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
AsciiString { data: "generic panic different string" }, log rb: 10098701174489624218 AsciiString { data: "generic panic different string" }, log rb: 10098701174489624218
test test_generic_panic_with_error_type_enum_variant ... ok (???, 303 gas) test test_generic_panic_with_error_type_enum_variant ... ok (???, 293 gas)
revert code: ffffffff00000004 revert code: ffffffff00000004
├─ panic message: Error A. ├─ panic message: Error A.
├─ panic value: A ├─ panic value: A
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
A, log rb: 2721958641300806892 A, log rb: 2721958641300806892
test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 303 gas) test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 293 gas)
revert code: ffffffff00000004 revert code: ffffffff00000004
├─ panic message: Error A. ├─ panic message: Error A.
├─ panic value: A ├─ panic value: A
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
A, log rb: 2721958641300806892 A, log rb: 2721958641300806892
test test_panic_without_arg ... ok (???, 152 gas) test test_panic_without_arg ... ok (???, 142 gas)
revert code: ffffffff00000005 revert code: ffffffff00000005
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:113:5 └─ panicked in: panicking_lib, src/lib.sw:113:5
decoded log values: decoded log values:
(), log rb: 3330666440490685604 (), log rb: 3330666440490685604
test test_panic_with_unit ... ok (???, 152 gas) test test_panic_with_unit ... ok (???, 142 gas)
revert code: ffffffff00000006 revert code: ffffffff00000006
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:118:5 └─ panicked in: panicking_lib, src/lib.sw:118:5
@ -95,32 +95,32 @@ A, log rb: 2721958641300806892
revert code: ffffffff00000007 revert code: ffffffff00000007
├─ panic message: panic with string ├─ panic message: panic with string
└─ panicked in: panicking_lib, src/lib.sw:123:5 └─ panicked in: panicking_lib, src/lib.sw:123:5
test test_panic_with_error_type_enum ... ok (???, 395 gas) test test_panic_with_error_type_enum ... ok (???, 385 gas)
revert code: ffffffff00000008 revert code: ffffffff00000008
├─ panic message: Error C. ├─ panic message: Error C.
├─ panic value: C(true) ├─ panic value: C(true)
└─ panicked in: panicking_lib, src/lib.sw:128:5 └─ panicked in: panicking_lib, src/lib.sw:128:5
decoded log values: decoded log values:
C(true), log rb: 2721958641300806892 C(true), log rb: 2721958641300806892
test test_panic_with_generic_error_type_enum ... ok (???, 335 gas) test test_panic_with_generic_error_type_enum ... ok (???, 325 gas)
revert code: ffffffff00000009 revert code: ffffffff00000009
├─ panic value: A(42) ├─ panic value: A(42)
└─ panicked in: panicking_lib, src/lib.sw:133:5 └─ panicked in: panicking_lib, src/lib.sw:133:5
decoded log values: decoded log values:
A(42), log rb: 12408470889216862137 A(42), log rb: 12408470889216862137
test test_panic_with_nested_generic_error_type ... ok (???, 614 gas) test test_panic_with_nested_generic_error_type ... ok (???, 604 gas)
revert code: ffffffff0000000a revert code: ffffffff0000000a
├─ panic value: B(B(C(true))) ├─ panic value: B(B(C(true)))
└─ panicked in: panicking_lib, src/lib.sw:138:5 └─ panicked in: panicking_lib, src/lib.sw:138:5
decoded log values: decoded log values:
B(B(C(true))), log rb: 14988555917426256081 B(B(C(true))), log rb: 14988555917426256081
test test_panic_with_generic_error_type_enum_with_abi_encode ... ok (???, 335 gas) test test_panic_with_generic_error_type_enum_with_abi_encode ... ok (???, 325 gas)
revert code: ffffffff0000000b revert code: ffffffff0000000b
├─ panic value: A(42) ├─ panic value: A(42)
└─ panicked in: panicking_lib, src/lib.sw:143:5 └─ panicked in: panicking_lib, src/lib.sw:143:5
decoded log values: decoded log values:
A(42), log rb: 17388243649088655852 A(42), log rb: 17388243649088655852
test test_panic_with_nested_generic_error_type_enum_with_abi_encode ... ok (???, 614 gas) test test_panic_with_nested_generic_error_type_enum_with_abi_encode ... ok (???, 604 gas)
revert code: ffffffff0000000c revert code: ffffffff0000000c
├─ panic value: B(B(C(true))) ├─ panic value: B(B(C(true)))
└─ panicked in: panicking_lib, src/lib.sw:148:5 └─ panicked in: panicking_lib, src/lib.sw:148:5

View file

@ -9,78 +9,78 @@ output:
Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core) Compiling library std (test/src/e2e_vm_tests/reduced_std_libs/sway-lib-std-core)
Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib) Compiling library panicking_lib (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_lib)
Compiling script panicking_script (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_script) Compiling script panicking_script (test/src/e2e_vm_tests/test_programs/should_pass/language/panic_expression/panicking_script)
Finished release [optimized + fuel] target(s) [3.72 KB] in ??? Finished release [optimized + fuel] target(s) [3.688 KB] in ???
Running 11 tests, filtered 0 tests Running 11 tests, filtered 0 tests
tested -- panicking_script tested -- panicking_script
test test_panic_in_main ... ok (???, 372 gas) test test_panic_in_main ... ok (???, 362 gas)
revert code: ffffffff00000000 revert code: ffffffff00000000
├─ panic message: Error C. ├─ panic message: Error C.
├─ panic value: C(true) ├─ panic value: C(true)
└─ panicked in: panicking_script, src/main.sw:6:5 └─ panicked in: panicking_script, src/main.sw:6:5
decoded log values: decoded log values:
C(true), log rb: 5503570629422409978 C(true), log rb: 5503570629422409978
test test_nested_panic_inlined ... ok (???, 810 gas) test test_nested_panic_inlined ... ok (???, 800 gas)
revert code: ffffffff00000001 revert code: ffffffff00000001
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]) ├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
└─ panicked in: panicking_lib, src/lib.sw:41:9 └─ panicked in: panicking_lib, src/lib.sw:41:9
decoded log values: decoded log values:
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978 E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978
test test_nested_panic_inlined_same_revert_code ... ok (???, 810 gas) test test_nested_panic_inlined_same_revert_code ... ok (???, 800 gas)
revert code: ffffffff00000001 revert code: ffffffff00000001
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]) ├─ panic value: E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }])
└─ panicked in: panicking_lib, src/lib.sw:41:9 └─ panicked in: panicking_lib, src/lib.sw:41:9
decoded log values: decoded log values:
E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978 E([AsciiString { data: "this" }, AsciiString { data: "is not" }, AsciiString { data: "the best practice" }]), log rb: 5503570629422409978
test test_nested_panic_not_inlined ... ok (???, 790 gas) test test_nested_panic_not_inlined ... ok (???, 780 gas)
revert code: ffffffff00000002 revert code: ffffffff00000002
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]) ├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
└─ panicked in: panicking_lib, src/lib.sw:35:5 └─ panicked in: panicking_lib, src/lib.sw:35:5
decoded log values: decoded log values:
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978 E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978
test test_nested_panic_not_inlined_same_revert_code ... ok (???, 790 gas) test test_nested_panic_not_inlined_same_revert_code ... ok (???, 780 gas)
revert code: ffffffff00000002 revert code: ffffffff00000002
├─ panic message: Error E. ├─ panic message: Error E.
├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]) ├─ panic value: E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }])
└─ panicked in: panicking_lib, src/lib.sw:35:5 └─ panicked in: panicking_lib, src/lib.sw:35:5
decoded log values: decoded log values:
E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978 E([AsciiString { data: "to have" }, AsciiString { data: "strings" }, AsciiString { data: "in error enum variants" }]), log rb: 5503570629422409978
test test_generic_panic_with_unit ... ok (???, 152 gas) test test_generic_panic_with_unit ... ok (???, 142 gas)
revert code: ffffffff00000003 revert code: ffffffff00000003
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
(), log rb: 3330666440490685604 (), log rb: 3330666440490685604
test test_generic_panic_with_unit_same_revert_code ... ok (???, 152 gas) test test_generic_panic_with_unit_same_revert_code ... ok (???, 142 gas)
revert code: ffffffff00000003 revert code: ffffffff00000003
├─ panic value: () ├─ panic value: ()
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
(), log rb: 3330666440490685604 (), log rb: 3330666440490685604
test test_generic_panic_with_str ... ok (???, 283 gas) test test_generic_panic_with_str ... ok (???, 273 gas)
revert code: ffffffff00000004 revert code: ffffffff00000004
├─ panic message: generic panic with string ├─ panic message: generic panic with string
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
AsciiString { data: "generic panic with string" }, log rb: 10098701174489624218 AsciiString { data: "generic panic with string" }, log rb: 10098701174489624218
test test_generic_panic_with_different_str_same_revert_code ... ok (???, 283 gas) test test_generic_panic_with_different_str_same_revert_code ... ok (???, 273 gas)
revert code: ffffffff00000004 revert code: ffffffff00000004
├─ panic message: generic panic with different string ├─ panic message: generic panic with different string
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
AsciiString { data: "generic panic with different string" }, log rb: 10098701174489624218 AsciiString { data: "generic panic with different string" }, log rb: 10098701174489624218
test test_generic_panic_with_error_type_enum ... ok (???, 298 gas) test test_generic_panic_with_error_type_enum ... ok (???, 288 gas)
revert code: ffffffff00000005 revert code: ffffffff00000005
├─ panic message: Error A. ├─ panic message: Error A.
├─ panic value: A ├─ panic value: A
└─ panicked in: panicking_lib, src/lib.sw:74:5 └─ panicked in: panicking_lib, src/lib.sw:74:5
decoded log values: decoded log values:
A, log rb: 5503570629422409978 A, log rb: 5503570629422409978
test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 357 gas) test test_generic_panic_with_error_type_enum_different_variant_same_revert_code ... ok (???, 347 gas)
revert code: ffffffff00000005 revert code: ffffffff00000005
├─ panic message: Error B. ├─ panic message: Error B.
├─ panic value: B(42) ├─ panic value: B(42)

View file

@ -10,7 +10,7 @@
"concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e",
"indirect": false, "indirect": false,
"name": "SOME_U256", "name": "SOME_U256",
"offset": 752 "offset": 744
} }
], ],
"encodingVersion": "1", "encodingVersion": "1",

View file

@ -1,5 +1,6 @@
--- ---
source: test/src/snapshot/mod.rs source: test/src/snapshot/mod.rs
assertion_line: 162
--- ---
> forc test --path test/src/e2e_vm_tests/test_programs/should_pass/panic_in_non_statement_positions --logs --test-threads 1 > forc test --path test/src/e2e_vm_tests/test_programs/should_pass/panic_in_non_statement_positions --logs --test-threads 1
exit status: 0 exit status: 0
@ -286,57 +287,57 @@ warning
____ ____
Compiled library "panic_in_non_statement_positions" with 23 warnings. Compiled library "panic_in_non_statement_positions" with 23 warnings.
Finished debug [unoptimized + fuel] target(s) [2.128 KB] in ??? Finished debug [unoptimized + fuel] target(s) [2.12 KB] in ???
Running 16 tests, filtered 0 tests Running 16 tests, filtered 0 tests
tested -- panic_in_non_statement_positions tested -- panic_in_non_statement_positions
test in_init ... ok (???, 351 gas) test in_init ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_array ... ok (???, 351 gas) test in_array ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_length_1_array ... ok (???, 351 gas) test in_length_1_array ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_length_2_array_first ... ok (???, 351 gas) test in_length_2_array_first ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_length_2_array_second ... ok (???, 351 gas) test in_length_2_array_second ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_tuple ... ok (???, 351 gas) test in_tuple ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_struct ... ok (???, 351 gas) test in_struct ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_parentheses ... ok (???, 351 gas) test in_parentheses ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_if_condition ... ok (???, 351 gas) test in_if_condition ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_while_condition ... ok (???, 351 gas) test in_while_condition ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_enum ... ok (???, 351 gas) test in_enum ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_enum_multivariant ... ok (???, 351 gas) test in_enum_multivariant ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_fun_arg ... ok (???, 351 gas) test in_fun_arg ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_lazy_and ... ok (???, 351 gas) test in_lazy_and ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_lazy_or ... ok (???, 351 gas) test in_lazy_or ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899
test in_match_scrutinee ... ok (???, 351 gas) test in_match_scrutinee ... ok (???, 352 gas)
decoded log values: decoded log values:
E(42), log rb: 5087777005172090899 E(42), log rb: 5087777005172090899

View file

@ -6,7 +6,7 @@ use std::hash::*;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0x14ed3cd06c2947248f69d54bfa681fe40d26267be84df7e19e253622b7921bbe; const CONTRACT_ID = 0x14ed3cd06c2947248f69d54bfa681fe40d26267be84df7e19e253622b7921bbe;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0x2d207680bb16a764aafdd3dcb1240f9e7a59a7dca7f366fbfef90bf964be500f; // AUTO-CONTRACT-ID ../../test_contracts/array_of_structs_contract --release const CONTRACT_ID = 0xbc79c91a95481c5414e861a294f86caa9ae996d3a736423cc9a6a928934abeef; // AUTO-CONTRACT-ID ../../test_contracts/array_of_structs_contract --release
fn get_address() -> Option<std::address::Address> { fn get_address() -> Option<std::address::Address> {
Some(CONTRACT_ID.into()) Some(CONTRACT_ID.into())

View file

@ -14,7 +14,7 @@ const FUEL_COIN_CONTRACT_ID = 0x68776e49d2128ae42ec01225bbf6c539ed4772494786dd81
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const BALANCE_CONTRACT_ID = 0xf6cd545152ac83225e8e7df2efb5c6fa6e37bc9b9e977b5ea8103d28668925df; const BALANCE_CONTRACT_ID = 0xf6cd545152ac83225e8e7df2efb5c6fa6e37bc9b9e977b5ea8103d28668925df;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const BALANCE_CONTRACT_ID = 0x7dbdd68390dcbfa60a2b3a45ad9b982b7e9f55d2aeda575df1f245e2d917de48; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release const BALANCE_CONTRACT_ID = 0xcb4895e795d860b37e866a09a8f08911e37f78c39dd4de8f5de1a1af8901f1f3; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release
fn main() -> bool { fn main() -> bool {
let default_gas = 1_000_000_000_000; let default_gas = 1_000_000_000_000;

View file

@ -5,7 +5,7 @@ use balance_test_abi::BalanceTest;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0xf6cd545152ac83225e8e7df2efb5c6fa6e37bc9b9e977b5ea8103d28668925df; const CONTRACT_ID = 0xf6cd545152ac83225e8e7df2efb5c6fa6e37bc9b9e977b5ea8103d28668925df;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0x7dbdd68390dcbfa60a2b3a45ad9b982b7e9f55d2aeda575df1f245e2d917de48; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release const CONTRACT_ID = 0xcb4895e795d860b37e866a09a8f08911e37f78c39dd4de8f5de1a1af8901f1f3; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release
fn main() -> bool { fn main() -> bool {
let balance_test_contract = abi(BalanceTest, CONTRACT_ID); let balance_test_contract = abi(BalanceTest, CONTRACT_ID);

View file

@ -6,7 +6,7 @@ use abi_with_tuples::{MyContract, Location, Person};
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0xfdc14550c8aee742cd556d0ab7f378b7be0d3b1e6e086c097352e94590d4ed02; const CONTRACT_ID = 0xfdc14550c8aee742cd556d0ab7f378b7be0d3b1e6e086c097352e94590d4ed02;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0x3eeff7fa1fcc1f284bb1df049da7ac53fe5879bc9b7f0e307bb5cd7a51f03cfe; // AUTO-CONTRACT-ID ../../test_contracts/abi_with_tuples_contract --release const CONTRACT_ID = 0xc899513a4e9f850e298959b7facc38b0ad6e2c3b5e1eecfb9768e0eb75ed5203; // AUTO-CONTRACT-ID ../../test_contracts/abi_with_tuples_contract --release
fn main() -> bool { fn main() -> bool {
let the_abi = abi(MyContract, CONTRACT_ID); let the_abi = abi(MyContract, CONTRACT_ID);

View file

@ -4,7 +4,7 @@ use basic_storage_abi::{BasicStorage, Quad};
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0x94db39f409a31b9f2ebcadeea44378e419208c20de90f5d8e1e33dc1523754cb; const CONTRACT_ID = 0x94db39f409a31b9f2ebcadeea44378e419208c20de90f5d8e1e33dc1523754cb;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0xa2042eefffce34f889cbebdbaa55357bbdf83b15870591155e196d210d8bfa65; // AUTO-CONTRACT-ID ../../test_contracts/basic_storage --release const CONTRACT_ID = 0xbd57a0138d242c9386c3689c1280d5cbccdf3c6a7db820c5934e2e87682be1a4; // AUTO-CONTRACT-ID ../../test_contracts/basic_storage --release
fn main() -> u64 { fn main() -> u64 {
let addr = abi(BasicStorage, CONTRACT_ID); let addr = abi(BasicStorage, CONTRACT_ID);

View file

@ -5,7 +5,7 @@ use contract_with_type_aliases_abi::*;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0x0cbeb6efe3104b460be769bdc4ea101ebf16ccc16f2d7b667ec3e1c7f5ce35b5; const CONTRACT_ID = 0x0cbeb6efe3104b460be769bdc4ea101ebf16ccc16f2d7b667ec3e1c7f5ce35b5;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0x5c112a81e15b21b17295dd215c775270c6db148636043768d1f6e7799a2df9ea; // AUTO-CONTRACT-ID ../../test_contracts/contract_with_type_aliases --release const CONTRACT_ID = 0x1893b1728265e4a683cb1882a69e417a2e69e3477e5547f7292fae36812cd8ff; // AUTO-CONTRACT-ID ../../test_contracts/contract_with_type_aliases --release
fn main() { fn main() {
let caller = abi(MyContract, CONTRACT_ID); let caller = abi(MyContract, CONTRACT_ID);

View file

@ -6,7 +6,7 @@ use dynamic_contract_call::*;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0xd1b4047af7ef111c023ab71069e01dc2abfde487c0a0ce1268e4f447e6c6e4c2; const CONTRACT_ID = 0xd1b4047af7ef111c023ab71069e01dc2abfde487c0a0ce1268e4f447e6c6e4c2;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0xbd7b975dfe17604529e218dbce7a3643b6173dc6d485d1c11d1b3c7f3beae110; // AUTO-CONTRACT-ID ../../test_contracts/increment_contract --release const CONTRACT_ID = 0x617b0e57c92cc91129f3bbb35ddffd2a05adf7e8424eb3ae939cb0fb3ff2a7e8; // AUTO-CONTRACT-ID ../../test_contracts/increment_contract --release
fn main() -> bool { fn main() -> bool {
let the_abi = abi(Incrementor, CONTRACT_ID); let the_abi = abi(Incrementor, CONTRACT_ID);

View file

@ -5,7 +5,7 @@ use storage_enum_abi::*;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0xc601d11767195485a6654d566c67774134668863d8c797a8c69e8778fb1f89e9; const CONTRACT_ID = 0xc601d11767195485a6654d566c67774134668863d8c797a8c69e8778fb1f89e9;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0x389d32c6f736950a7c3cd70a4d06991d1de11b5d233b0129febea779b8a8d217; // AUTO-CONTRACT-ID ../../test_contracts/storage_enum_contract --release const CONTRACT_ID = 0xc8de8a6f185095fe1ae870db2b708df2a44fbf13233ee3cebdb60ba335589c9a; // AUTO-CONTRACT-ID ../../test_contracts/storage_enum_contract --release
fn main() -> u64 { fn main() -> u64 {
let caller = abi(StorageEnum, CONTRACT_ID); let caller = abi(StorageEnum, CONTRACT_ID);

View file

@ -5,7 +5,7 @@ use auth_testing_abi::AuthTesting;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0xc2eec20491b53aab7232cbd27c31d15417b4e9daf0b89c74cc242ef1295f681f; const CONTRACT_ID = 0xc2eec20491b53aab7232cbd27c31d15417b4e9daf0b89c74cc242ef1295f681f;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0x3ea59842d25eff64eaccd63455954eb6d87b85d62e46c42ac9f30c7fee5d374e; // AUTO-CONTRACT-ID ../../test_contracts/auth_testing_contract --release const CONTRACT_ID = 0x1c7361535a532b2b36b357564f16707933190e7936fb3443e8fa197dee02e8fd; // AUTO-CONTRACT-ID ../../test_contracts/auth_testing_contract --release
// should be false in the case of a script // should be false in the case of a script
fn main() -> bool { fn main() -> bool {

View file

@ -6,7 +6,7 @@ use context_testing_abi::*;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0x6054c11cda000f5990373a4d61929396165be4dfdd61d5b7bd26da60ab0d8577; const CONTRACT_ID = 0x6054c11cda000f5990373a4d61929396165be4dfdd61d5b7bd26da60ab0d8577;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0x4404bb47772d6a57615723b2432bc2777d93f0285fb9498a091abe5755023ce9; // AUTO-CONTRACT-ID ../../test_contracts/context_testing_contract --release const CONTRACT_ID = 0xb4fd4240a53d376d2bfa13f98856407e766f90711ffb99d577856574e32e8d3b; // AUTO-CONTRACT-ID ../../test_contracts/context_testing_contract --release
fn main() -> bool { fn main() -> bool {
let gas: u64 = u64::max(); let gas: u64 = u64::max();

View file

@ -5,7 +5,7 @@ use nested_struct_args_abi::*;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0xe63d33a1b3a6903808b379f6a41a72fa8a370e8b76626775e7d9d2f9c4c5da40; const CONTRACT_ID = 0xe63d33a1b3a6903808b379f6a41a72fa8a370e8b76626775e7d9d2f9c4c5da40;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0xd7bc72f9b3ac9af765c8f5d522766c3c19dc03bc04a9fa40314d61d4d7439cad; // AUTO-CONTRACT-ID ../../test_contracts/nested_struct_args_contract --release const CONTRACT_ID = 0x7f7028de5ba246cf26c182536631f74230f5d6e3ab99df370e85ba749e2271b9; // AUTO-CONTRACT-ID ../../test_contracts/nested_struct_args_contract --release
fn main() -> bool { fn main() -> bool {
let caller = abi(NestedStructArgs, CONTRACT_ID); let caller = abi(NestedStructArgs, CONTRACT_ID);

View file

@ -6,7 +6,7 @@ use std::hash::*;
#[cfg(experimental_new_encoding = false)] #[cfg(experimental_new_encoding = false)]
const CONTRACT_ID = 0x3bc28acd66d327b8c1b9624c1fabfc07e9ffa1b5d71c2832c3bfaaf8f4b805e9; const CONTRACT_ID = 0x3bc28acd66d327b8c1b9624c1fabfc07e9ffa1b5d71c2832c3bfaaf8f4b805e9;
#[cfg(experimental_new_encoding = true)] #[cfg(experimental_new_encoding = true)]
const CONTRACT_ID = 0xaa29e9ce35fe5d324c1b6bd8fb791b957dabfc26e745d60b65202b31c87aeff7; // AUTO-CONTRACT-ID ../../test_contracts/storage_access_contract --release const CONTRACT_ID = 0xdf3edd8410770684479029baa31359437a80cd2889557689c088a39d67dd9375; // AUTO-CONTRACT-ID ../../test_contracts/storage_access_contract --release
fn main() -> bool { fn main() -> bool {
let caller = abi(StorageAccess, CONTRACT_ID); let caller = abi(StorageAccess, CONTRACT_ID);

View file

@ -13,10 +13,10 @@ fn main() -> u64 {
// check: v0 = get_local __ptr string<3>, $ID // check: v0 = get_local __ptr string<3>, $ID
// check: v1 = const string<3> "abc" // check: v1 = const string<3> "abc"
// check: store v1 to v0 // check: store v1 to v0
// check: v2 = ptr_to_int v0 to u64, // check: v2 = cast_ptr v0 to ptr,
// check: v3 = get_local __ptr { u64, u64 }, $ID // check: v3 = get_local __ptr { ptr, u64 }, $ID
// check: v4 = const u64 0 // check: v4 = const u64 0
// check: v5 = get_elem_ptr v3, __ptr u64, v4 // check: v5 = get_elem_ptr v3, __ptr ptr, v4
// check: store v2 to v5, // check: store v2 to v5,
// ::check-ir-optimized:: // ::check-ir-optimized::