diff --git a/sway-core/src/build_config.rs b/sway-core/src/build_config.rs index dc8e5f98433..375a45d2208 100644 --- a/sway-core/src/build_config.rs +++ b/sway-core/src/build_config.rs @@ -114,7 +114,9 @@ impl BuildConfig { time_phases: false, metrics_outfile: None, optimization_level: OptLevel::Opt0, - experimental: ExperimentalFlags::default(), + experimental: ExperimentalFlags { + new_encoding: false, + }, lsp_mode: None, } } @@ -203,7 +205,7 @@ impl BuildConfig { } } -#[derive(Debug, Default, Clone, Copy)] +#[derive(Debug, Clone, Copy)] pub struct ExperimentalFlags { pub new_encoding: bool, } diff --git a/sway-core/src/ir_generation/const_eval.rs b/sway-core/src/ir_generation/const_eval.rs index fb4cb968c8c..04f519e153f 100644 --- a/sway-core/src/ir_generation/const_eval.rs +++ b/sway-core/src/ir_generation/const_eval.rs @@ -1183,7 +1183,12 @@ mod tests { fn assert_is_constant(is_constant: bool, prefix: &str, expr: &str) { let engines = Engines::default(); let handler = Handler::default(); - let mut context = Context::new(engines.se(), sway_ir::ExperimentalFlags::default()); + let mut context = Context::new( + engines.se(), + sway_ir::ExperimentalFlags { + new_encoding: false, + }, + ); let mut md_mgr = MetadataManager::default(); let core_lib = namespace::Root::from(namespace::Module { name: Some(sway_types::Ident::new_no_span( diff --git a/sway-core/src/ir_generation/function.rs b/sway-core/src/ir_generation/function.rs index 9fbb87ceb93..5f88530f370 100644 --- a/sway-core/src/ir_generation/function.rs +++ b/sway-core/src/ir_generation/function.rs @@ -1823,7 +1823,18 @@ impl<'eng> FnCompiler<'eng> { // args and type parameters. It's using the Sway types rather than IR types, which would // be more accurate but also more fiddly. - let (fn_key, item) = if !callee.span().as_str().is_empty() { + let no_span = callee.span().as_str().is_empty(); + let is_autogenerated = if let Some(s) = callee.span.source_id() { + context + .source_engine + .get_path(s) + .starts_with("") + } else { + false + }; + let (fn_key, item) = if no_span || is_autogenerated { + (None, None) + } else { let fn_key = ( callee.span(), callee @@ -1833,12 +1844,11 @@ impl<'eng> FnCompiler<'eng> { .collect(), callee.type_parameters.iter().map(|tp| tp.type_id).collect(), ); + ( Some(fn_key.clone()), self.recreated_fns.get(&fn_key).copied(), ) - } else { - (None, None) }; let new_callee = match item { diff --git a/sway-core/src/lib.rs b/sway-core/src/lib.rs index f36a7c96365..1ed0fa9788d 100644 --- a/sway-core/src/lib.rs +++ b/sway-core/src/lib.rs @@ -91,7 +91,14 @@ pub fn parse( config: Option<&BuildConfig>, ) -> Result<(lexed::LexedProgram, parsed::ParseProgram), ErrorEmitted> { match config { - None => parse_in_memory(handler, engines, input), + None => parse_in_memory( + handler, + engines, + input, + ExperimentalFlags { + new_encoding: false, + }, + ), // When a `BuildConfig` is given, // the module source may declare `dep`s that must be parsed from other files. Some(config) => parse_module_tree( @@ -190,6 +197,7 @@ fn parse_in_memory( handler: &Handler, engines: &Engines, src: Arc, + experimental: ExperimentalFlags, ) -> Result<(lexed::LexedProgram, parsed::ParseProgram), ErrorEmitted> { let mut hasher = DefaultHasher::new(); src.hash(&mut hasher); @@ -197,7 +205,7 @@ fn parse_in_memory( let module = sway_parse::parse_file(handler, src, None)?; let (kind, tree) = to_parsed_lang::convert_parse_tree( - &mut to_parsed_lang::Context::default(), + &mut to_parsed_lang::Context::new(BuildTarget::EVM, experimental), handler, engines, module.value.clone(), @@ -481,7 +489,11 @@ pub fn parsed_to_ast( package_name: &str, retrigger_compilation: Option>, ) -> Result { - let experimental = build_config.map(|x| x.experimental).unwrap_or_default(); + let experimental = build_config + .map(|x| x.experimental) + .unwrap_or(ExperimentalFlags { + new_encoding: false, + }); let lsp_config = build_config.map(|x| x.lsp_mode.clone()).unwrap_or_default(); // Build the dependency graph for the submodules. diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs index 5274abe4b6a..4a9d47ce38d 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs @@ -767,7 +767,6 @@ pub(crate) fn monomorphize_method_application( type_binding.as_mut().unwrap().type_arguments.to_vec_mut(), )?; let mut method = (*decl_engine.get_function(fn_ref)).clone(); - method.is_trait_method_dummy = false; // Unify method type parameters with implementing type type parameters. if let Some(implementing_for_typeid) = method.implementing_for_typeid { diff --git a/sway-core/src/semantic_analysis/namespace/module.rs b/sway-core/src/semantic_analysis/namespace/module.rs index d3ba5777280..5b6d633b0d7 100644 --- a/sway-core/src/semantic_analysis/namespace/module.rs +++ b/sway-core/src/semantic_analysis/namespace/module.rs @@ -133,7 +133,7 @@ impl Module { let attributes = Default::default(); // convert to const decl let const_decl_id = to_parsed_lang::item_const_to_constant_declaration( - &mut to_parsed_lang::Context::default(), + &mut to_parsed_lang::Context::new(crate::BuildTarget::EVM, experimental), handler, engines, const_item, diff --git a/sway-core/src/semantic_analysis/program.rs b/sway-core/src/semantic_analysis/program.rs index 7c0cff92d76..0036df611e3 100644 --- a/sway-core/src/semantic_analysis/program.rs +++ b/sway-core/src/semantic_analysis/program.rs @@ -51,7 +51,12 @@ impl TyProgram { build_config: Option<&BuildConfig>, module_eval_order: ModuleEvaluationOrder, ) -> Result { - let experimental = build_config.map(|x| x.experimental).unwrap_or_default(); + let experimental = + build_config + .map(|x| x.experimental) + .unwrap_or(crate::ExperimentalFlags { + new_encoding: false, + }); let mut namespace = Namespace::init_root(initial_namespace); let mut ctx = TypeCheckContext::from_root(&mut namespace, engines, experimental) diff --git a/sway-core/src/transform/to_parsed_lang/context.rs b/sway-core/src/transform/to_parsed_lang/context.rs index 3ad43f1c991..4358abec4f0 100644 --- a/sway-core/src/transform/to_parsed_lang/context.rs +++ b/sway-core/src/transform/to_parsed_lang/context.rs @@ -1,6 +1,5 @@ use crate::{build_config::ExperimentalFlags, language::parsed::TreeType, BuildTarget}; -#[derive(Default)] pub struct Context { pub experimental: ExperimentalFlags, @@ -30,7 +29,11 @@ impl Context { Self { build_target, experimental, - ..Default::default() + module_has_configurable_block: std::default::Default::default(), + destructured_struct_unique_suffix: std::default::Default::default(), + destructured_tuple_unique_suffix: std::default::Default::default(), + match_expression_matched_value_unique_suffix: std::default::Default::default(), + program_type: std::default::Default::default(), } } diff --git a/sway-ir/src/bin/opt.rs b/sway-ir/src/bin/opt.rs index 22da9e58e24..b4b1bc1a5a1 100644 --- a/sway-ir/src/bin/opt.rs +++ b/sway-ir/src/bin/opt.rs @@ -26,7 +26,13 @@ fn main() -> Result<(), anyhow::Error> { let source_engine = SourceEngine::default(); // Parse it. XXX Improve this error message too. - let mut ir = sway_ir::parser::parse(&input_str, &source_engine, ExperimentalFlags::default())?; + let mut ir = sway_ir::parser::parse( + &input_str, + &source_engine, + ExperimentalFlags { + new_encoding: false, + }, + )?; // Perform optimisation passes in order. let mut passes = PassGroup::default(); diff --git a/sway-ir/src/context.rs b/sway-ir/src/context.rs index 4cbdeb50c1e..94ce1112028 100644 --- a/sway-ir/src/context.rs +++ b/sway-ir/src/context.rs @@ -39,7 +39,7 @@ pub struct Context<'eng> { pub experimental: ExperimentalFlags, } -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone)] pub struct ExperimentalFlags { pub new_encoding: bool, } diff --git a/sway-ir/src/irtype.rs b/sway-ir/src/irtype.rs index f65ccf18736..f1ac2d18a27 100644 --- a/sway-ir/src/irtype.rs +++ b/sway-ir/src/irtype.rs @@ -944,7 +944,12 @@ mod tests { static SOURCE_ENGINE: Lazy = Lazy::new(SourceEngine::default); fn create_context() -> Context<'static> { - Context::new(&SOURCE_ENGINE, ExperimentalFlags::default()) + Context::new( + &SOURCE_ENGINE, + ExperimentalFlags { + new_encoding: false, + }, + ) } /// Creates sample types that are not aggregates and do not point to diff --git a/sway-ir/src/optimize.rs b/sway-ir/src/optimize.rs index f0b722cc704..925431dbc3c 100644 --- a/sway-ir/src/optimize.rs +++ b/sway-ir/src/optimize.rs @@ -81,7 +81,9 @@ pub mod tests { " ), &source_engine, - ExperimentalFlags::default(), + ExperimentalFlags { + new_encoding: false, + }, ) .unwrap(); diff --git a/sway-ir/tests/tests.rs b/sway-ir/tests/tests.rs index c2ee5aca417..c30e904a37f 100644 --- a/sway-ir/tests/tests.rs +++ b/sway-ir/tests/tests.rs @@ -22,11 +22,17 @@ fn run_tests bool>(sub_dir: &str, opt_fn: F) { let input_bytes = std::fs::read(&path).unwrap(); let input = String::from_utf8_lossy(&input_bytes); - let mut ir = sway_ir::parser::parse(&input, &source_engine, ExperimentalFlags::default()) - .unwrap_or_else(|parse_err| { - println!("{}: {parse_err}", path.display()); - panic!() - }); + let mut ir = sway_ir::parser::parse( + &input, + &source_engine, + ExperimentalFlags { + new_encoding: false, + }, + ) + .unwrap_or_else(|parse_err| { + println!("{}: {parse_err}", path.display()); + panic!() + }); let first_line = input.split('\n').next().unwrap(); diff --git a/sway-lib-core/generate.sh b/sway-lib-core/generate.sh index c78e818efea..6a66a8482a4 100755 --- a/sway-lib-core/generate.sh +++ b/sway-lib-core/generate.sh @@ -13,7 +13,7 @@ remove_generated_code "STRARRAY_ENCODE" START=1 END=64 for ((i=END;i>=START;i--)); do - CODE="impl AbiEncode for str[$i] { fn abi_encode(self, ref mut buffer: Buffer) { use ::str::*; let s = from_str_array(self); let len = s.len(); let ptr = s.as_ptr(); let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); buffer.push(byte); i += 1; } } }" + CODE="impl AbiEncode for str[$i] { fn abi_encode(self, ref mut buffer: Buffer) { use ::str::*; let s = from_str_array(self); let len = s.len(); let ptr = s.as_ptr(); let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); buffer.push_byte(byte); i += 1; } } }" sed -i "s/\/\/ BEGIN STRARRAY_ENCODE/\/\/ BEGIN STRARRAY_ENCODE\n$CODE/g" ./src/codec.sw done diff --git a/sway-lib-core/src/codec.sw b/sway-lib-core/src/codec.sw index 95e91dbf30e..a2d8771c568 100644 --- a/sway-lib-core/src/codec.sw +++ b/sway-lib-core/src/codec.sw @@ -21,11 +21,26 @@ impl Buffer { } } - pub fn push(ref mut self, val: T) { - let count = __size_of::(); + pub fn push_byte(ref mut self, val: u8) { + let count = 1; + if self.cap >= self.size + count { + let ptr = self.buffer.add::(self.size); + asm(ptr: ptr, val: val) { + sb ptr val i0; + }; + self.size += count; + } else { + __revert(123456789); + } + } + pub fn push_u64(ref mut self, val: u64) { + let count = 8; if self.cap >= self.size + count { - self.buffer.add::(self.size).write(val); + let ptr = self.buffer.add::(self.size); + asm(ptr: ptr, val: val) { + sw ptr val i0; + }; self.size += count; } else { __revert(123456789); @@ -169,7 +184,7 @@ pub trait AbiEncode { impl AbiEncode for bool { fn abi_encode(self, ref mut buffer: Buffer) { - buffer.push(self); + buffer.push_byte(if self { 1 } else { 0 }); } } @@ -180,10 +195,10 @@ impl AbiEncode for b256 { let (a, b, c, d): (u64, u64, u64, u64) = asm(r1: self) { r1: (u64, u64, u64, u64) }; - buffer.push(a); - buffer.push(b); - buffer.push(c); - buffer.push(d); + buffer.push_u64(a); + buffer.push_u64(b); + buffer.push_u64(c); + buffer.push_u64(d); } } @@ -192,16 +207,16 @@ impl AbiEncode for u256 { let (a, b, c, d): (u64, u64, u64, u64) = asm(r1: self) { r1: (u64, u64, u64, u64) }; - buffer.push(a); - buffer.push(b); - buffer.push(c); - buffer.push(d); + buffer.push_u64(a); + buffer.push_u64(b); + buffer.push_u64(c); + buffer.push_u64(d); } } impl AbiEncode for u64 { fn abi_encode(self, ref mut buffer: Buffer) { - buffer.push(self); + buffer.push_u64(self); } } @@ -235,10 +250,10 @@ impl AbiEncode for u32 { output: [u8; 4] }; - buffer.push(output[3]); - buffer.push(output[2]); - buffer.push(output[1]); - buffer.push(output[0]); + buffer.push_byte(output[3]); + buffer.push_byte(output[2]); + buffer.push_byte(output[1]); + buffer.push_byte(output[0]); } } @@ -256,14 +271,14 @@ impl AbiEncode for u16 { output: [u8; 2] }; - buffer.push(output[1]); - buffer.push(output[0]); + buffer.push_byte(output[1]); + buffer.push_byte(output[0]); } } impl AbiEncode for u8 { fn abi_encode(self, ref mut buffer: Buffer) { - buffer.push(self); + buffer.push_byte(self); } } @@ -273,14 +288,14 @@ impl AbiEncode for str { fn abi_encode(self, ref mut buffer: Buffer) { use ::str::*; let len = self.len(); - buffer.push(len); + buffer.push_u64(len); let ptr = self.as_ptr(); let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -300,7 +315,7 @@ impl AbiEncode for str[1] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -314,7 +329,7 @@ impl AbiEncode for str[2] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -328,7 +343,7 @@ impl AbiEncode for str[3] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -342,7 +357,7 @@ impl AbiEncode for str[4] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -356,7 +371,7 @@ impl AbiEncode for str[5] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -370,7 +385,7 @@ impl AbiEncode for str[6] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -384,7 +399,7 @@ impl AbiEncode for str[7] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -398,7 +413,7 @@ impl AbiEncode for str[8] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -412,7 +427,7 @@ impl AbiEncode for str[9] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -426,7 +441,7 @@ impl AbiEncode for str[10] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -440,7 +455,7 @@ impl AbiEncode for str[11] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -454,7 +469,7 @@ impl AbiEncode for str[12] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -468,7 +483,7 @@ impl AbiEncode for str[13] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -482,7 +497,7 @@ impl AbiEncode for str[14] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -496,7 +511,7 @@ impl AbiEncode for str[15] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -510,7 +525,7 @@ impl AbiEncode for str[16] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -524,7 +539,7 @@ impl AbiEncode for str[17] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -538,7 +553,7 @@ impl AbiEncode for str[18] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -552,7 +567,7 @@ impl AbiEncode for str[19] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -566,7 +581,7 @@ impl AbiEncode for str[20] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -580,7 +595,7 @@ impl AbiEncode for str[21] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -594,7 +609,7 @@ impl AbiEncode for str[22] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -608,7 +623,7 @@ impl AbiEncode for str[23] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -622,7 +637,7 @@ impl AbiEncode for str[24] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -636,7 +651,7 @@ impl AbiEncode for str[25] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -650,7 +665,7 @@ impl AbiEncode for str[26] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -664,7 +679,7 @@ impl AbiEncode for str[27] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -678,7 +693,7 @@ impl AbiEncode for str[28] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -692,7 +707,7 @@ impl AbiEncode for str[29] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -706,7 +721,7 @@ impl AbiEncode for str[30] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -720,7 +735,7 @@ impl AbiEncode for str[31] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -734,7 +749,7 @@ impl AbiEncode for str[32] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -748,7 +763,7 @@ impl AbiEncode for str[33] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -762,7 +777,7 @@ impl AbiEncode for str[34] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -776,7 +791,7 @@ impl AbiEncode for str[35] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -790,7 +805,7 @@ impl AbiEncode for str[36] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -804,7 +819,7 @@ impl AbiEncode for str[37] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -818,7 +833,7 @@ impl AbiEncode for str[38] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -832,7 +847,7 @@ impl AbiEncode for str[39] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -846,7 +861,7 @@ impl AbiEncode for str[40] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -860,7 +875,7 @@ impl AbiEncode for str[41] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -874,7 +889,7 @@ impl AbiEncode for str[42] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -888,7 +903,7 @@ impl AbiEncode for str[43] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -902,7 +917,7 @@ impl AbiEncode for str[44] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -916,7 +931,7 @@ impl AbiEncode for str[45] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -930,7 +945,7 @@ impl AbiEncode for str[46] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -944,7 +959,7 @@ impl AbiEncode for str[47] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -958,7 +973,7 @@ impl AbiEncode for str[48] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -972,7 +987,7 @@ impl AbiEncode for str[49] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -986,7 +1001,7 @@ impl AbiEncode for str[50] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1000,7 +1015,7 @@ impl AbiEncode for str[51] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1014,7 +1029,7 @@ impl AbiEncode for str[52] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1028,7 +1043,7 @@ impl AbiEncode for str[53] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1042,7 +1057,7 @@ impl AbiEncode for str[54] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1056,7 +1071,7 @@ impl AbiEncode for str[55] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1070,7 +1085,7 @@ impl AbiEncode for str[56] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1084,7 +1099,7 @@ impl AbiEncode for str[57] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1098,7 +1113,7 @@ impl AbiEncode for str[58] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1112,7 +1127,7 @@ impl AbiEncode for str[59] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1126,7 +1141,7 @@ impl AbiEncode for str[60] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1140,7 +1155,7 @@ impl AbiEncode for str[61] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1154,7 +1169,7 @@ impl AbiEncode for str[62] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1168,7 +1183,7 @@ impl AbiEncode for str[63] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1182,7 +1197,7 @@ impl AbiEncode for str[64] { let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } @@ -1194,14 +1209,14 @@ impl AbiEncode for str[64] { impl AbiEncode for raw_slice { fn abi_encode(self, ref mut buffer: Buffer) { let len = self.number_of_bytes(); - buffer.push(len); + buffer.push_u64(len); let ptr = self.ptr(); let mut i = 0; while i < len { let byte = ptr.add::(i).read::(); - buffer.push(byte); + buffer.push_byte(byte); i += 1; } } diff --git a/sway-lib-std/src/bytes.sw b/sway-lib-std/src/bytes.sw index 1101c5c2000..8d115538c20 100644 --- a/sway-lib-std/src/bytes.sw +++ b/sway-lib-std/src/bytes.sw @@ -909,7 +909,7 @@ impl From for Vec { impl AbiEncode for Bytes { fn abi_encode(self, ref mut buffer: Buffer) { - buffer.push(self.len); + buffer.push_u64(self.len); let mut i = 0; while i < self.len { diff --git a/sway-lib-std/src/vec.sw b/sway-lib-std/src/vec.sw index bdd09c50e63..dd5ff3252c8 100644 --- a/sway-lib-std/src/vec.sw +++ b/sway-lib-std/src/vec.sw @@ -653,7 +653,7 @@ where { fn abi_encode(self, ref mut buffer: Buffer) { let len = self.len(); - buffer.push(len); + buffer.push_u64(len); let mut i = 0; while i < len { diff --git a/test/src/e2e_vm_tests/mod.rs b/test/src/e2e_vm_tests/mod.rs index e86d631aeb4..ca854b38729 100644 --- a/test/src/e2e_vm_tests/mod.rs +++ b/test/src/e2e_vm_tests/mod.rs @@ -1068,7 +1068,7 @@ fn get_expected_result(key: &str, toml_content: &toml::Value) -> Result Ok(TestResult::Result(*v as Word)), // A bytes32 value. - (Some("return_data"), toml::Value::String(v)) => hex::decode(v) + (Some("return_data"), toml::Value::String(v)) => hex::decode(v.replace(' ', "")) .map(TestResult::ReturnData) .map_err(|e| anyhow!("Invalid hex value for 'return_data': {}", e)), diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/src/main.sw index 138051e1ed3..6b41e0d8a22 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/src/main.sw @@ -32,7 +32,7 @@ struct CustomAbiEncode { impl AbiEncode for CustomAbiEncode { fn abi_encode(self, ref mut buffer: Buffer) { - buffer.push(77); + buffer.push_u64(77); } } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/Forc.lock deleted file mode 100644 index e124eb7aaa3..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/Forc.lock +++ /dev/null @@ -1,8 +0,0 @@ -[[package]] -name = 'core' -source = 'path+from-root-21A8479818A041E3' - -[[package]] -name = 'main_args_copy_copy' -source = 'member' -dependencies = ['core'] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/Forc.lock new file mode 100644 index 00000000000..1845c9ff1ee --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/Forc.lock @@ -0,0 +1,16 @@ +[[package]] +name = "core" +source = "path+from-root-8011322D04562685" + +[[package]] +name = "main_args_generics" +source = "member" +dependencies = [ + "core", + "std", +] + +[[package]] +name = "std" +source = "path+from-root-8011322D04562685" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/Forc.toml new file mode 100644 index 00000000000..641f5f81fbc --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/Forc.toml @@ -0,0 +1,9 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "main_args_generics" + +[dependencies] +core = { path = "../../../../../../../../sway-lib-core" } +std = { path = "../../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle.json new file mode 100644 index 00000000000..04a1e18e92e --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle.json @@ -0,0 +1,135 @@ +{ + "configurables": [], + "functions": [ + { + "attributes": null, + "inputs": [ + { + "name": "input", + "type": 0, + "typeArguments": null + } + ], + "name": "main", + "output": { + "name": "", + "type": 0, + "typeArguments": null + } + } + ], + "loggedTypes": [], + "messagesTypes": [], + "types": [ + { + "components": [ + { + "name": "__tuple_element", + "type": 5, + "typeArguments": [ + { + "name": "", + "type": 7, + "typeArguments": null + }, + { + "name": "", + "type": 6, + "typeArguments": null + } + ] + }, + { + "name": "__tuple_element", + "type": 4, + "typeArguments": [ + { + "name": "", + "type": 8, + "typeArguments": null + } + ] + } + ], + "type": "(struct TwoGenerics, struct OneGeneric)", + "typeId": 0, + "typeParameters": null + }, + { + "components": null, + "type": "generic T", + "typeId": 1, + "typeParameters": null + }, + { + "components": null, + "type": "generic U", + "typeId": 2, + "typeParameters": null + }, + { + "components": null, + "type": "generic V", + "typeId": 3, + "typeParameters": null + }, + { + "components": [ + { + "name": "a", + "type": 2, + "typeArguments": null + } + ], + "type": "struct OneGeneric", + "typeId": 4, + "typeParameters": [ + 2 + ] + }, + { + "components": [ + { + "name": "b", + "type": 4, + "typeArguments": [ + { + "name": "", + "type": 1, + "typeArguments": null + } + ] + }, + { + "name": "c", + "type": 3, + "typeArguments": null + } + ], + "type": "struct TwoGenerics", + "typeId": 5, + "typeParameters": [ + 1, + 3 + ] + }, + { + "components": null, + "type": "u32", + "typeId": 6, + "typeParameters": null + }, + { + "components": null, + "type": "u64", + "typeId": 7, + "typeParameters": null + }, + { + "components": null, + "type": "u8", + "typeId": 8, + "typeParameters": null + } + ] +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.json new file mode 100644 index 00000000000..7cf591df1b1 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.json @@ -0,0 +1,136 @@ +{ + "configurables": [], + "encoding": "1", + "functions": [ + { + "attributes": null, + "inputs": [ + { + "name": "input", + "type": 0, + "typeArguments": null + } + ], + "name": "main", + "output": { + "name": "", + "type": 0, + "typeArguments": null + } + } + ], + "loggedTypes": [], + "messagesTypes": [], + "types": [ + { + "components": [ + { + "name": "__tuple_element", + "type": 5, + "typeArguments": [ + { + "name": "", + "type": 7, + "typeArguments": null + }, + { + "name": "", + "type": 6, + "typeArguments": null + } + ] + }, + { + "name": "__tuple_element", + "type": 4, + "typeArguments": [ + { + "name": "", + "type": 8, + "typeArguments": null + } + ] + } + ], + "type": "(struct TwoGenerics, struct OneGeneric)", + "typeId": 0, + "typeParameters": null + }, + { + "components": null, + "type": "generic T", + "typeId": 1, + "typeParameters": null + }, + { + "components": null, + "type": "generic U", + "typeId": 2, + "typeParameters": null + }, + { + "components": null, + "type": "generic V", + "typeId": 3, + "typeParameters": null + }, + { + "components": [ + { + "name": "a", + "type": 2, + "typeArguments": null + } + ], + "type": "struct OneGeneric", + "typeId": 4, + "typeParameters": [ + 2 + ] + }, + { + "components": [ + { + "name": "b", + "type": 4, + "typeArguments": [ + { + "name": "", + "type": 1, + "typeArguments": null + } + ] + }, + { + "name": "c", + "type": 3, + "typeArguments": null + } + ], + "type": "struct TwoGenerics", + "typeId": 5, + "typeParameters": [ + 1, + 3 + ] + }, + { + "components": null, + "type": "u32", + "typeId": 6, + "typeParameters": null + }, + { + "components": null, + "type": "u64", + "typeId": 7, + "typeParameters": null + }, + { + "components": null, + "type": "u8", + "typeId": 8, + "typeParameters": null + } + ] +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/src/main.sw new file mode 100644 index 00000000000..c21c1f44fda --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/src/main.sw @@ -0,0 +1,22 @@ +script; + +struct OneGeneric { + a: U, +} + +struct TwoGenerics { + b: OneGeneric, + c: V, +} + +type A = (TwoGenerics, OneGeneric); + +fn main(input: A) -> A { + ( + TwoGenerics { + b: OneGeneric { a: input.0.b.a + 1 }, + c: input.0.c + 1 + }, + OneGeneric { a: input.1.a + 1 }, + ) +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/test.toml new file mode 100644 index 00000000000..bc5b71f19b1 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/test.toml @@ -0,0 +1,10 @@ +category = "run" + +# 1336 encoded as [0, 0, 0, 0, 0, 0, 5, 56] +script_data = "0000000000000538 0000000000000538 1100000000000000" +expected_result = { action = "return_data", value = "0000000000000539 0000000000000539 1200000000000000" } + +script_data_new_encoding = "0000000000000538 00000538 11" +expected_result_new_encoding = { action = "return_data", value = "0000000000000539 00000539 12" } + +validate_abi = true diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/Forc.lock similarity index 56% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.lock rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/Forc.lock index 6066710fa63..36098fe29de 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/Forc.lock @@ -1,9 +1,9 @@ [[package]] name = "core" -source = "path+from-root-EE00857339AC041F" +source = "path+from-root-BD9C2392ECDF84CD" [[package]] -name = "main_args_copy" +name = "main_args_one_u64" source = "member" dependencies = [ "core", @@ -12,5 +12,5 @@ dependencies = [ [[package]] name = "std" -source = "path+from-root-EE00857339AC041F" +source = "path+from-root-BD9C2392ECDF84CD" dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/Forc.toml similarity index 89% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/Forc.toml index 146f55f2d44..4704008108b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/Forc.toml @@ -2,7 +2,7 @@ authors = ["Fuel Labs "] entry = "main.sw" license = "Apache-2.0" -name = "main_args_copy" +name = "main_args_one_u64" [dependencies] core = { path = "../../../../../../../../sway-lib-core" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/json_abi_oracle.json similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/json_abi_oracle.json rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/json_abi_oracle.json diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/json_abi_oracle_new_encoding.json similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/json_abi_oracle_new_encoding.json rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/json_abi_oracle_new_encoding.json diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/src/main.sw similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/src/main.sw rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/src/main.sw diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/test.toml similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/test.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_one_u64/test.toml diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/Forc.lock new file mode 100644 index 00000000000..413f29c5edb --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/Forc.lock @@ -0,0 +1,8 @@ +[[package]] +name = "core" +source = "path+from-root-D5B01E451F774183" + +[[package]] +name = "main_args_two_u64" +source = "member" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/Forc.toml similarity index 86% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/Forc.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/Forc.toml index fb3a9fde369..4e2dd57ac96 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/Forc.toml @@ -2,7 +2,7 @@ authors = ["Fuel Labs "] entry = "main.sw" license = "Apache-2.0" -name = "main_args_copy_copy" +name = "main_args_two_u64" implicit-std = false [dependencies] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/json_abi_oracle.json similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/json_abi_oracle.json rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/json_abi_oracle.json diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/json_abi_oracle_new_encoding.json similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/json_abi_oracle_new_encoding.json rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/json_abi_oracle_new_encoding.json diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/src/main.sw similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/src/main.sw rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/src/main.sw diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/test.toml similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy_copy/test.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_two_u64/test.toml diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw index ef484f6f1d8..b9cb9b28d87 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw @@ -5,7 +5,7 @@ use abi_with_tuples::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x1200d031e9c10f8d9bd9dd556a98a0c88e74a4da991047556f78b1bcc1be2ab6; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x69e6f610ac1684cc754ed44fe67b3e9d3459bdb23e2db0956b57adb60f7658c7; +const CONTRACT_ID = 0x5de3f05e6429ea4b14d51b4797ba3f02a11cd0b546853d339f7b5ff13991c700; fn main() -> bool { let the_abi = abi(MyContract, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw index 04cb82bddd8..37ac22a2dea 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw @@ -4,7 +4,7 @@ use basic_storage_abi::{BasicStorage, Quad}; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xd956f6bb7ee577561325f16f51534c001061342972a0bef9c2dcfc6d83919491; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x65316bd92e820e3e9f139fd3d5f2a5402c10f7585a03a3a393485445af39667f; +const CONTRACT_ID = 0x4b4ffef69317dc68b6662b61819b219a2468ccb5b9785e580721eb5fe0447ae2; fn main() -> u64 { let addr = abi(BasicStorage, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw index c95352e0512..fd97a881bd6 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw @@ -5,7 +5,7 @@ use storage_enum_abi::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x039f59a5f7ab74f3c75eedaedeabdbff9b8bc5310f44ff10b0344fc316026e7d; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x2efef9b3a025bfe8acc8996c8b9b5547f8f0f89e53d0b4754950b1ad84e21b4e; +const CONTRACT_ID = 0xf5a4eff97a1729dfaaac2cdf8e4d05162013e21a347c66a47495cc9faf122b42; fn main() -> u64 { let caller = abi(StorageEnum, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw index a4b3a2d1d18..ebdc550b8be 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw @@ -5,7 +5,7 @@ use auth_testing_abi::AuthTesting; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x66d9f99ddeeff7d1c6d3b986afd5d20029860289cb74c64e30c255730966d24f; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x21ec5dab0f00c7718d752037fbb491280f14c124f903450618a641d53f5b88d3; +const CONTRACT_ID = 0x105954328a6682ec269dc73fe74198a4c5311775aec8b809e754000b3524bd0d; // should be false in the case of a script fn main() -> bool { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw index e791eff9fdc..a3a3a173cdf 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw @@ -6,7 +6,7 @@ use std::hash::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xcd976bf8d7f3a9b54416c215ee0c732cbae4f9221e281fbc6c6aa8f428f03eb1; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x61b5d0e4281ccc560bc434c86cb45460762c7d68c97c2e6b4d289c900f553acc; +const CONTRACT_ID = 0xa11832dffc2bf712660d7f32107cbce18643a9251839c569d9739a1b01b9e5aa; fn main() -> bool { let caller = abi(StorageAccess, CONTRACT_ID);