From f300e1752e630f95dd04459f01fc9037bf2d96b8 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 8 May 2024 07:16:29 +0100 Subject: [PATCH 1/9] Moves get_abi_type_str to it own file. --- sway-core/src/abi_generation/abi_str.rs | 164 +++++++++++++++ sway-core/src/abi_generation/fuel_abi.rs | 241 ++++++----------------- sway-core/src/abi_generation/mod.rs | 1 + 3 files changed, 221 insertions(+), 185 deletions(-) create mode 100644 sway-core/src/abi_generation/abi_str.rs diff --git a/sway-core/src/abi_generation/abi_str.rs b/sway-core/src/abi_generation/abi_str.rs new file mode 100644 index 00000000000..577a8bdc5d6 --- /dev/null +++ b/sway-core/src/abi_generation/abi_str.rs @@ -0,0 +1,164 @@ +use sway_types::integer_bits::IntegerBits; + +use crate::{language::CallPath, Engines, TypeArgument, TypeId, TypeInfo}; + +pub struct AbiStrContext { + pub program_name: Option, + pub abi_with_callpaths: bool, +} + +impl TypeId { + /// Gives back a string that represents the type, considering what it resolves to + pub fn get_abi_type_str( + &self, + ctx: &AbiStrContext, + engines: &Engines, + resolved_type_id: TypeId, + ) -> String { + let type_engine = engines.te(); + if self.is_generic_parameter(engines, resolved_type_id) { + format!("generic {}", type_engine.get(*self).abi_str(ctx, engines)) + } else { + match ( + &*type_engine.get(*self), + &*type_engine.get(resolved_type_id), + ) { + (TypeInfo::Custom { .. }, TypeInfo::Struct { .. }) => { + type_engine.get(resolved_type_id).abi_str(ctx, engines) + } + (TypeInfo::Custom { .. }, TypeInfo::Enum { .. }) => { + type_engine.get(resolved_type_id).abi_str(ctx, engines) + } + (TypeInfo::Custom { .. }, TypeInfo::Alias { .. }) => { + type_engine.get(resolved_type_id).abi_str(ctx, engines) + } + (TypeInfo::Tuple(fields), TypeInfo::Tuple(resolved_fields)) => { + assert_eq!(fields.len(), resolved_fields.len()); + let field_strs = fields + .iter() + .map(|_| "_".to_string()) + .collect::>(); + format!("({})", field_strs.join(", ")) + } + (TypeInfo::Array(_, count), TypeInfo::Array(_, resolved_count)) => { + assert_eq!(count.val(), resolved_count.val()); + format!("[_; {}]", count.val()) + } + (TypeInfo::Custom { .. }, _) => { + format!("generic {}", type_engine.get(*self).abi_str(ctx, engines)) + } + _ => type_engine.get(resolved_type_id).abi_str(ctx, engines), + } + } + } +} + +impl TypeInfo { + pub fn abi_str(&self, ctx: &AbiStrContext, engines: &Engines) -> String { + use TypeInfo::*; + let decl_engine = engines.de(); + match self { + Unknown => "unknown".into(), + Never => "never".into(), + UnknownGeneric { name, .. } => name.to_string(), + Placeholder(_) => "_".to_string(), + TypeParam(n) => format!("typeparam({n})"), + StringSlice => "str".into(), + StringArray(x) => format!("str[{}]", x.val()), + UnsignedInteger(x) => match x { + IntegerBits::Eight => "u8", + IntegerBits::Sixteen => "u16", + IntegerBits::ThirtyTwo => "u32", + IntegerBits::SixtyFour => "u64", + IntegerBits::V256 => "u256", + } + .into(), + Boolean => "bool".into(), + Custom { + qualified_call_path: call_path, + .. + } => call_path.call_path.suffix.to_string(), + Tuple(fields) => { + let field_strs = fields + .iter() + .map(|field| field.abi_str(ctx, engines)) + .collect::>(); + format!("({})", field_strs.join(", ")) + } + B256 => "b256".into(), + Numeric => "u64".into(), // u64 is the default + Contract => "contract".into(), + ErrorRecovery(_) => "unknown due to error".into(), + Enum(decl_ref) => { + let decl = decl_engine.get_enum(decl_ref); + format!("enum {}", call_path_display(ctx, &decl.call_path)) + } + Struct(decl_ref) => { + let decl = decl_engine.get_struct(decl_ref); + format!("struct {}", call_path_display(ctx, &decl.call_path)) + } + ContractCaller { abi_name, .. } => { + format!("contract caller {abi_name}") + } + Array(elem_ty, length) => { + format!("[{}; {}]", elem_ty.abi_str(ctx, engines), length.val()) + } + Storage { .. } => "contract storage".into(), + RawUntypedPtr => "raw untyped ptr".into(), + RawUntypedSlice => "raw untyped slice".into(), + Ptr(ty) => { + format!("__ptr {}", ty.abi_str(ctx, engines)) + } + Slice(ty) => { + format!("__slice {}", ty.abi_str(ctx, engines)) + } + Alias { ty, .. } => ty.abi_str(ctx, engines), + TraitType { + name, + trait_type_id: _, + } => format!("trait type {}", name), + Ref { + to_mutable_value, + referenced_type, + } => { + format!( + "__ref {}{}", // TODO-IG: No references in ABIs according to the RFC. Or we want to have them? + if *to_mutable_value { "mut " } else { "" }, + referenced_type.abi_str(ctx, engines) + ) + } + } + } +} + +/// `call_path_display` returns the provided `call_path` without the first prefix in case it is equal to the program name. +/// If the program name is `my_program` and the `call_path` is `my_program::MyStruct` then this function returns only `MyStruct`. +fn call_path_display(ctx: &AbiStrContext, call_path: &CallPath) -> String { + if !ctx.abi_with_callpaths { + return call_path.suffix.as_str().to_string(); + } + let mut buf = String::new(); + for (index, prefix) in call_path.prefixes.iter().enumerate() { + let mut skip_prefix = false; + if index == 0 { + if let Some(root_name) = &ctx.program_name { + if prefix.as_str() == root_name.as_str() { + skip_prefix = true; + } + } + } + if !skip_prefix { + buf.push_str(prefix.as_str()); + buf.push_str("::"); + } + } + buf.push_str(&call_path.suffix.to_string()); + + buf +} + +impl TypeArgument { + pub(self) fn abi_str(&self, ctx: &AbiStrContext, engines: &Engines) -> String { + engines.te().get(self.type_id).abi_str(ctx, engines) + } +} diff --git a/sway-core/src/abi_generation/fuel_abi.rs b/sway-core/src/abi_generation/fuel_abi.rs index 7d5ecb181ab..d19e5ca3b44 100644 --- a/sway-core/src/abi_generation/fuel_abi.rs +++ b/sway-core/src/abi_generation/fuel_abi.rs @@ -1,20 +1,32 @@ use fuel_abi_types::abi::program as program_abi; -use sway_types::integer_bits::IntegerBits; use crate::{ - language::{ - ty::{TyConstantDecl, TyFunctionDecl, TyProgram, TyProgramKind}, - CallPath, - }, + language::ty::{TyConstantDecl, TyFunctionDecl, TyProgram, TyProgramKind}, transform::AttributesMap, - Engines, TypeArgument, TypeId, TypeInfo, TypeParameter, + Engines, TypeId, TypeInfo, TypeParameter, }; +use super::abi_str::AbiStrContext; + pub struct AbiContext<'a> { pub program: &'a TyProgram, pub abi_with_callpaths: bool, } +impl<'a> AbiContext<'a> { + fn to_str_context(&self, engines: &Engines) -> AbiStrContext { + AbiStrContext { + program_name: self + .program + .root + .namespace + .module_id(engines) + .read(engines, |m| m.name.clone().map(|v| v.as_str().to_string())), + abi_with_callpaths: self.abi_with_callpaths, + } + } +} + pub fn generate_program_abi( ctx: &mut AbiContext, engines: &Engines, @@ -82,7 +94,7 @@ fn generate_logged_types( .iter() .map(|(_, type_id)| program_abi::TypeDeclaration { type_id: type_id.index(), - type_field: type_id.get_abi_type_str(ctx, engines, *type_id), + type_field: type_id.get_abi_type_str(&ctx.to_str_context(engines), engines, *type_id), components: type_id.get_abi_type_components(ctx, engines, types, *type_id), type_parameters: type_id.get_abi_type_parameters(ctx, engines, types, *type_id), }) @@ -118,7 +130,7 @@ fn generate_messages_types( .iter() .map(|(_, type_id)| program_abi::TypeDeclaration { type_id: type_id.index(), - type_field: type_id.get_abi_type_str(ctx, engines, *type_id), + type_field: type_id.get_abi_type_str(&ctx.to_str_context(engines), engines, *type_id), components: type_id.get_abi_type_components(ctx, engines, types, *type_id), type_parameters: type_id.get_abi_type_parameters(ctx, engines, types, *type_id), }) @@ -158,7 +170,7 @@ fn generate_configurables( }| program_abi::TypeDeclaration { type_id: type_ascription.type_id.index(), type_field: type_ascription.type_id.get_abi_type_str( - ctx, + &ctx.to_str_context(engines), engines, type_ascription.type_id, ), @@ -209,50 +221,6 @@ fn generate_configurables( } impl TypeId { - /// Gives back a string that represents the type, considering what it resolves to - pub(self) fn get_abi_type_str( - &self, - ctx: &mut AbiContext, - engines: &Engines, - resolved_type_id: TypeId, - ) -> String { - let type_engine = engines.te(); - if self.is_generic_parameter(engines, resolved_type_id) { - format!("generic {}", type_engine.get(*self).abi_str(ctx, engines)) - } else { - match ( - &*type_engine.get(*self), - &*type_engine.get(resolved_type_id), - ) { - (TypeInfo::Custom { .. }, TypeInfo::Struct { .. }) => { - type_engine.get(resolved_type_id).abi_str(ctx, engines) - } - (TypeInfo::Custom { .. }, TypeInfo::Enum { .. }) => { - type_engine.get(resolved_type_id).abi_str(ctx, engines) - } - (TypeInfo::Custom { .. }, TypeInfo::Alias { .. }) => { - type_engine.get(resolved_type_id).abi_str(ctx, engines) - } - (TypeInfo::Tuple(fields), TypeInfo::Tuple(resolved_fields)) => { - assert_eq!(fields.len(), resolved_fields.len()); - let field_strs = fields - .iter() - .map(|_| "_".to_string()) - .collect::>(); - format!("({})", field_strs.join(", ")) - } - (TypeInfo::Array(_, count), TypeInfo::Array(_, resolved_count)) => { - assert_eq!(count.val(), resolved_count.val()); - format!("[_; {}]", count.val()) - } - (TypeInfo::Custom { .. }, _) => { - format!("generic {}", type_engine.get(*self).abi_str(ctx, engines)) - } - _ => type_engine.get(resolved_type_id).abi_str(ctx, engines), - } - } - } - /// Return the type parameters of a given (potentially generic) type while considering what it /// actually resolves to. These parameters are essentially of type of `usize` which are /// basically the IDs of some set of `program_abi::TypeDeclaration`s. The method below also @@ -297,7 +265,7 @@ impl TypeId { .map(|x| program_abi::TypeDeclaration { type_id: x.type_argument.initial_type_id.index(), type_field: x.type_argument.initial_type_id.get_abi_type_str( - ctx, + &ctx.to_str_context(engines), engines, x.type_argument.type_id, ), @@ -345,7 +313,7 @@ impl TypeId { .map(|x| program_abi::TypeDeclaration { type_id: x.type_argument.initial_type_id.index(), type_field: x.type_argument.initial_type_id.get_abi_type_str( - ctx, + &ctx.to_str_context(engines), engines, x.type_argument.type_id, ), @@ -389,7 +357,7 @@ impl TypeId { let elem_abi_ty = program_abi::TypeDeclaration { type_id: elem_ty.initial_type_id.index(), type_field: elem_ty.initial_type_id.get_abi_type_str( - ctx, + &ctx.to_str_context(engines), engines, elem_ty.type_id, ), @@ -431,7 +399,11 @@ impl TypeId { .iter() .map(|x| program_abi::TypeDeclaration { type_id: x.initial_type_id.index(), - type_field: x.initial_type_id.get_abi_type_str(ctx, engines, x.type_id), + type_field: x.initial_type_id.get_abi_type_str( + &ctx.to_str_context(engines), + engines, + x.type_id, + ), components: x .initial_type_id .get_abi_type_components(ctx, engines, types, x.type_id), @@ -476,7 +448,11 @@ impl TypeId { ) .map(|(v, p)| program_abi::TypeDeclaration { type_id: v.initial_type_id.index(), - type_field: v.initial_type_id.get_abi_type_str(ctx, engines, p.type_id), + type_field: v.initial_type_id.get_abi_type_str( + &ctx.to_str_context(engines), + engines, + p.type_id, + ), components: v .initial_type_id .get_abi_type_components(ctx, engines, types, p.type_id), @@ -537,7 +513,11 @@ impl TypeId { .zip(resolved_params.iter()) .map(|(v, p)| program_abi::TypeDeclaration { type_id: v.initial_type_id.index(), - type_field: v.initial_type_id.get_abi_type_str(ctx, engines, p.type_id), + type_field: v.initial_type_id.get_abi_type_str( + &ctx.to_str_context(engines), + engines, + p.type_id, + ), components: v .initial_type_id .get_abi_type_components(ctx, engines, types, p.type_id), @@ -570,7 +550,11 @@ impl TypeId { .iter() .map(|v| program_abi::TypeDeclaration { type_id: v.type_id.index(), - type_field: v.type_id.get_abi_type_str(ctx, engines, v.type_id), + type_field: v.type_id.get_abi_type_str( + &ctx.to_str_context(engines), + engines, + v.type_id, + ), components: v .type_id .get_abi_type_components(ctx, engines, types, v.type_id), @@ -606,7 +590,11 @@ impl TypeId { .iter() .map(|v| program_abi::TypeDeclaration { type_id: v.type_id.index(), - type_field: v.type_id.get_abi_type_str(ctx, engines, v.type_id), + type_field: v.type_id.get_abi_type_str( + &ctx.to_str_context(engines), + engines, + v.type_id, + ), components: v .type_id .get_abi_type_components(ctx, engines, types, v.type_id), @@ -638,119 +626,6 @@ impl TypeId { } } -impl TypeInfo { - pub fn abi_str(&self, ctx: &mut AbiContext, engines: &Engines) -> String { - use TypeInfo::*; - let decl_engine = engines.de(); - match self { - Unknown => "unknown".into(), - Never => "never".into(), - UnknownGeneric { name, .. } => name.to_string(), - Placeholder(_) => "_".to_string(), - TypeParam(n) => format!("typeparam({n})"), - StringSlice => "str".into(), - StringArray(x) => format!("str[{}]", x.val()), - UnsignedInteger(x) => match x { - IntegerBits::Eight => "u8", - IntegerBits::Sixteen => "u16", - IntegerBits::ThirtyTwo => "u32", - IntegerBits::SixtyFour => "u64", - IntegerBits::V256 => "u256", - } - .into(), - Boolean => "bool".into(), - Custom { - qualified_call_path: call_path, - .. - } => call_path.call_path.suffix.to_string(), - Tuple(fields) => { - let field_strs = fields - .iter() - .map(|field| field.abi_str(ctx, engines)) - .collect::>(); - format!("({})", field_strs.join(", ")) - } - B256 => "b256".into(), - Numeric => "u64".into(), // u64 is the default - Contract => "contract".into(), - ErrorRecovery(_) => "unknown due to error".into(), - Enum(decl_ref) => { - let decl = decl_engine.get_enum(decl_ref); - format!("enum {}", call_path_display(ctx, engines, &decl.call_path)) - } - Struct(decl_ref) => { - let decl = decl_engine.get_struct(decl_ref); - format!( - "struct {}", - call_path_display(ctx, engines, &decl.call_path) - ) - } - ContractCaller { abi_name, .. } => { - format!("contract caller {abi_name}") - } - Array(elem_ty, length) => { - format!("[{}; {}]", elem_ty.abi_str(ctx, engines), length.val()) - } - Storage { .. } => "contract storage".into(), - RawUntypedPtr => "raw untyped ptr".into(), - RawUntypedSlice => "raw untyped slice".into(), - Ptr(ty) => { - format!("__ptr {}", ty.abi_str(ctx, engines)) - } - Slice(ty) => { - format!("__slice {}", ty.abi_str(ctx, engines)) - } - Alias { ty, .. } => ty.abi_str(ctx, engines), - TraitType { - name, - trait_type_id: _, - } => format!("trait type {}", name), - Ref { - to_mutable_value, - referenced_type, - } => { - format!( - "__ref {}{}", // TODO-IG: No references in ABIs according to the RFC. Or we want to have them? - if *to_mutable_value { "mut " } else { "" }, - referenced_type.abi_str(ctx, engines) - ) - } - } - } -} - -/// `call_path_display` returns the provided `call_path` without the first prefix in case it is equal to the program name. -/// If the program name is `my_program` and the `call_path` is `my_program::MyStruct` then this function returns only `MyStruct`. -fn call_path_display(ctx: &mut AbiContext, engines: &Engines, call_path: &CallPath) -> String { - if !ctx.abi_with_callpaths { - return call_path.suffix.as_str().to_string(); - } - let mut buf = String::new(); - for (index, prefix) in call_path.prefixes.iter().enumerate() { - let mut skip_prefix = false; - if index == 0 { - if let Some(root_name) = &ctx - .program - .root - .namespace - .module_id(engines) - .read(engines, |m| m.name.clone()) - { - if prefix.as_str() == root_name.as_str() { - skip_prefix = true; - } - } - } - if !skip_prefix { - buf.push_str(prefix.as_str()); - buf.push_str("::"); - } - } - buf.push_str(&call_path.suffix.to_string()); - - buf -} - impl TyFunctionDecl { pub(self) fn generate_abi_function( &self, @@ -765,7 +640,7 @@ impl TyFunctionDecl { .map(|x| program_abi::TypeDeclaration { type_id: x.type_argument.initial_type_id.index(), type_field: x.type_argument.initial_type_id.get_abi_type_str( - ctx, + &ctx.to_str_context(engines), engines, x.type_argument.type_id, ), @@ -788,7 +663,7 @@ impl TyFunctionDecl { let output_type = program_abi::TypeDeclaration { type_id: self.return_type.initial_type_id.index(), type_field: self.return_type.initial_type_id.get_abi_type_str( - ctx, + &ctx.to_str_context(engines), engines, self.return_type.type_id, ), @@ -871,9 +746,11 @@ impl TypeParameter { ) -> usize { let type_parameter = program_abi::TypeDeclaration { type_id: self.initial_type_id.index(), - type_field: self - .initial_type_id - .get_abi_type_str(ctx, engines, self.type_id), + type_field: self.initial_type_id.get_abi_type_str( + &ctx.to_str_context(engines), + engines, + self.type_id, + ), components: self.initial_type_id.get_abi_type_components( ctx, engines, @@ -886,9 +763,3 @@ impl TypeParameter { self.initial_type_id.index() } } - -impl TypeArgument { - pub(self) fn abi_str(&self, ctx: &mut AbiContext, engines: &Engines) -> String { - engines.te().get(self.type_id).abi_str(ctx, engines) - } -} diff --git a/sway-core/src/abi_generation/mod.rs b/sway-core/src/abi_generation/mod.rs index 33b6c8c3885..6a639f25ffc 100644 --- a/sway-core/src/abi_generation/mod.rs +++ b/sway-core/src/abi_generation/mod.rs @@ -1,2 +1,3 @@ +pub mod abi_str; pub mod evm_abi; pub mod fuel_abi; From 3cbfe281f77ea136a87a6d02ad8622b367d44cc7 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 8 May 2024 08:56:10 +0100 Subject: [PATCH 2/9] Adds abi_hash_ids flag to command line tools. --- forc-pkg/src/manifest/build_profile.rs | 8 +++++++- forc-pkg/src/pkg.rs | 4 ++++ forc-plugins/forc-client/src/cmd/deploy.rs | 4 ++++ forc-plugins/forc-client/src/cmd/run.rs | 4 ++++ forc-plugins/forc-client/src/op/deploy.rs | 1 + forc-plugins/forc-client/src/op/run/mod.rs | 1 + .../forc-debug/src/server/handlers/handle_launch.rs | 1 + forc-plugins/forc-doc/src/cli.rs | 4 ++++ forc-plugins/forc-doc/src/main.rs | 1 + .../forc-doc/src/tests/expects/impl_trait/mod.rs | 2 ++ forc/src/cli/commands/build.rs | 4 ++++ forc/src/cli/commands/check.rs | 4 ++++ forc/src/cli/commands/contract_id.rs | 4 ++++ forc/src/cli/commands/predicate_root.rs | 4 ++++ forc/src/cli/commands/test.rs | 1 + forc/src/ops/forc_build.rs | 1 + forc/src/ops/forc_check.rs | 2 ++ forc/src/ops/forc_contract_id.rs | 1 + forc/src/ops/forc_predicate_root.rs | 1 + sway-core/src/abi_generation/fuel_abi.rs | 1 + sway-core/src/asm_generation/from_ir.rs | 1 + sway-core/src/build_config.rs | 2 ++ sway-core/src/ir_generation.rs | 1 + sway-core/src/ir_generation/const_eval.rs | 1 + sway-core/src/lib.rs | 3 +++ .../ast_node/expression/typed_expression.rs | 2 ++ sway-core/src/semantic_analysis/program.rs | 1 + sway-ir/src/bin/opt.rs | 1 + sway-ir/src/context.rs | 1 + sway-ir/src/irtype.rs | 1 + sway-ir/src/optimize.rs | 1 + sway-ir/tests/tests.rs | 1 + sway-lsp/benches/lsp_benchmarks/compile.rs | 1 + sway-lsp/benches/lsp_benchmarks/mod.rs | 1 + sway-lsp/src/core/session.rs | 1 + sway-lsp/src/server_state.rs | 1 + test/src/e2e_vm_tests/harness.rs | 1 + test/src/ir_generation/mod.rs | 9 +++++++-- test/src/main.rs | 6 ++++++ 39 files changed, 86 insertions(+), 3 deletions(-) diff --git a/forc-pkg/src/manifest/build_profile.rs b/forc-pkg/src/manifest/build_profile.rs index 5c56a2421d3..bb80e5f65d6 100644 --- a/forc-pkg/src/manifest/build_profile.rs +++ b/forc-pkg/src/manifest/build_profile.rs @@ -5,6 +5,7 @@ use sway_core::{OptLevel, PrintAsm}; #[serde(rename_all = "kebab-case")] pub struct ExperimentalFlags { pub new_encoding: bool, + pub abi_hash_ids: bool, } /// Parameters to pass through to the `sway_core::BuildConfig` during compilation. @@ -67,6 +68,7 @@ impl BuildProfile { optimization_level: OptLevel::Opt0, experimental: ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, } } @@ -90,6 +92,7 @@ impl BuildProfile { optimization_level: OptLevel::Opt1, experimental: ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, } } @@ -141,7 +144,10 @@ mod tests { error_on_warnings: true, reverse_results: true, optimization_level: OptLevel::Opt0, - experimental: ExperimentalFlags { new_encoding: true }, + experimental: ExperimentalFlags { + new_encoding: true, + abi_hash_ids: true, + }, }; let profile = build_profiles.get("release").expect("release profile"); assert_eq!(*profile, expected); diff --git a/forc-pkg/src/pkg.rs b/forc-pkg/src/pkg.rs index 5de629576dd..b657ce605dc 100644 --- a/forc-pkg/src/pkg.rs +++ b/forc-pkg/src/pkg.rs @@ -1557,6 +1557,7 @@ pub fn sway_build_config( .with_optimization_level(build_profile.optimization_level) .with_experimental(sway_core::ExperimentalFlags { new_encoding: build_profile.experimental.new_encoding, + abi_hash_ids: build_profile.experimental.abi_hash_ids, }); Ok(build_config) } @@ -1828,6 +1829,7 @@ pub fn compile( &mut AbiContext { program: typed_program, abi_with_callpaths: profile.json_abi_with_callpaths, + abi_with_hash_ids: profile.experimental.abi_hash_ids, }, engines, &mut types, @@ -2083,6 +2085,7 @@ fn build_profile_from_opts( profile.error_on_warnings |= error_on_warnings; profile.experimental = ExperimentalFlags { new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids, }; Ok(profile) @@ -2161,6 +2164,7 @@ pub fn build_with_options(build_options: &BuildOpts) -> Result { &outputs, sway_core::ExperimentalFlags { new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids, }, )?; let output_dir = pkg.output_directory.as_ref().map(PathBuf::from); diff --git a/forc-plugins/forc-client/src/cmd/deploy.rs b/forc-plugins/forc-client/src/cmd/deploy.rs index cf1f26e2a2e..e2bf0ac10d8 100644 --- a/forc-plugins/forc-client/src/cmd/deploy.rs +++ b/forc-plugins/forc-client/src/cmd/deploy.rs @@ -84,4 +84,8 @@ pub struct Command { /// Disable the "new encoding" feature #[clap(long)] pub no_encoding_v1: bool, + + /// Enables abi ids using the first 8 bytes of sha256 of the type str. + #[clap(long)] + pub abi_hash_ids: bool, } diff --git a/forc-plugins/forc-client/src/cmd/run.rs b/forc-plugins/forc-client/src/cmd/run.rs index e23d9f6cb43..cda225e2c62 100644 --- a/forc-plugins/forc-client/src/cmd/run.rs +++ b/forc-plugins/forc-client/src/cmd/run.rs @@ -62,4 +62,8 @@ pub struct Command { /// Disable the "new encoding" feature #[clap(long)] pub no_encoding_v1: bool, + + /// Enables abi ids using the first 8 bytes of sha256 of the type str. + #[clap(long)] + pub abi_hash_ids: bool, } diff --git a/forc-plugins/forc-client/src/op/deploy.rs b/forc-plugins/forc-client/src/op/deploy.rs index b9b403a56d8..bf793182453 100644 --- a/forc-plugins/forc-client/src/op/deploy.rs +++ b/forc-plugins/forc-client/src/op/deploy.rs @@ -372,6 +372,7 @@ fn build_opts_from_cmd(cmd: &cmd::Deploy) -> pkg::BuildOpts { member_filter: pkg::MemberFilter::only_contracts(), experimental: ExperimentalFlags { new_encoding: !cmd.no_encoding_v1, + abi_hash_ids: cmd.abi_hash_ids, }, } } diff --git a/forc-plugins/forc-client/src/op/run/mod.rs b/forc-plugins/forc-client/src/op/run/mod.rs index e95c8fb2209..c3d143358ad 100644 --- a/forc-plugins/forc-client/src/op/run/mod.rs +++ b/forc-plugins/forc-client/src/op/run/mod.rs @@ -241,6 +241,7 @@ fn build_opts_from_cmd(cmd: &cmd::Run) -> pkg::BuildOpts { member_filter: pkg::MemberFilter::only_scripts(), experimental: ExperimentalFlags { new_encoding: !cmd.no_encoding_v1, + abi_hash_ids: cmd.abi_hash_ids, }, } } diff --git a/forc-plugins/forc-debug/src/server/handlers/handle_launch.rs b/forc-plugins/forc-debug/src/server/handlers/handle_launch.rs index fd281261347..d20de19bce0 100644 --- a/forc-plugins/forc-debug/src/server/handlers/handle_launch.rs +++ b/forc-plugins/forc-debug/src/server/handlers/handle_launch.rs @@ -56,6 +56,7 @@ impl DapServer { let experimental = sway_core::ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }; // 1. Build the packages diff --git a/forc-plugins/forc-doc/src/cli.rs b/forc-plugins/forc-doc/src/cli.rs index 8ba9906203f..d1fc3e97a4c 100644 --- a/forc-plugins/forc-doc/src/cli.rs +++ b/forc-plugins/forc-doc/src/cli.rs @@ -56,4 +56,8 @@ pub struct Command { /// Disable the "new encoding" feature #[clap(long)] pub no_encoding_v1: bool, + + /// Enables abi ids using the first 8 bytes of sha256 of the type str. + #[clap(long)] + pub abi_hash_ids: bool, } diff --git a/forc-plugins/forc-doc/src/main.rs b/forc-plugins/forc-doc/src/main.rs index ab990727d7f..5e18b3dfd4d 100644 --- a/forc-plugins/forc-doc/src/main.rs +++ b/forc-plugins/forc-doc/src/main.rs @@ -17,6 +17,7 @@ pub fn main() -> Result<()> { &get_doc_dir, sway_core::ExperimentalFlags { new_encoding: !build_instructions.no_encoding_v1, + abi_hash_ids: build_instructions.abi_hash_ids, }, )?; diff --git a/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs b/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs index 7aacbc7bd52..fb2c60410a0 100644 --- a/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs +++ b/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs @@ -31,6 +31,7 @@ fn test_impl_traits_default() { &get_doc_dir, ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ) .unwrap(); @@ -114,6 +115,7 @@ fn test_impl_traits_no_deps() { &get_doc_dir, ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ) .unwrap(); diff --git a/forc/src/cli/commands/build.rs b/forc/src/cli/commands/build.rs index ae88dfebfdc..59d1aba0865 100644 --- a/forc/src/cli/commands/build.rs +++ b/forc/src/cli/commands/build.rs @@ -36,6 +36,10 @@ pub struct Command { /// Disable the "new encoding" feature #[clap(long)] pub no_encoding_v1: bool, + + /// Enables abi ids using the first 8 bytes of sha256 of the type str. + #[clap(long)] + pub abi_hash_ids: bool, } pub(crate) fn exec(command: Command) -> ForcResult<()> { diff --git a/forc/src/cli/commands/check.rs b/forc/src/cli/commands/check.rs index 4d5f41e76a3..572e36a20b3 100644 --- a/forc/src/cli/commands/check.rs +++ b/forc/src/cli/commands/check.rs @@ -48,6 +48,10 @@ pub struct Command { /// Disable the "new encoding" feature #[clap(long)] pub no_encoding_v1: bool, + + /// Enables abi ids using the first 8 bytes of sha256 of the type str. + #[clap(long)] + pub abi_hash_ids: bool, } pub(crate) fn exec(command: Command) -> ForcResult<()> { diff --git a/forc/src/cli/commands/contract_id.rs b/forc/src/cli/commands/contract_id.rs index 55848428aa8..82e15035989 100644 --- a/forc/src/cli/commands/contract_id.rs +++ b/forc/src/cli/commands/contract_id.rs @@ -32,6 +32,10 @@ pub struct Command { /// Disable the "new encoding" feature #[clap(long)] pub no_encoding_v1: bool, + + /// Enables abi ids using the first 8 bytes of sha256 of the type str. + #[clap(long)] + pub abi_hash_ids: bool, } pub(crate) fn exec(cmd: Command) -> ForcResult<()> { diff --git a/forc/src/cli/commands/predicate_root.rs b/forc/src/cli/commands/predicate_root.rs index 5c9cbb6bf04..dfda69304d8 100644 --- a/forc/src/cli/commands/predicate_root.rs +++ b/forc/src/cli/commands/predicate_root.rs @@ -29,6 +29,10 @@ pub struct Command { /// Disable the "new encoding" feature #[clap(long)] pub no_encoding_v1: bool, + + /// Enables abi ids using the first 8 bytes of sha256 of the type str. + #[clap(long)] + pub abi_hash_ids: bool, } pub(crate) fn exec(cmd: Command) -> ForcResult<()> { diff --git a/forc/src/cli/commands/test.rs b/forc/src/cli/commands/test.rs index 921276e02c1..5512e046d62 100644 --- a/forc/src/cli/commands/test.rs +++ b/forc/src/cli/commands/test.rs @@ -253,6 +253,7 @@ fn opts_from_cmd(cmd: Command) -> forc_test::TestOpts { build_target: cmd.build.build_target, experimental: ExperimentalFlags { new_encoding: !cmd.no_encoding_v1, + abi_hash_ids: true, }, } } diff --git a/forc/src/ops/forc_build.rs b/forc/src/ops/forc_build.rs index cd6583bfeb5..4e7595f7fd2 100644 --- a/forc/src/ops/forc_build.rs +++ b/forc/src/ops/forc_build.rs @@ -45,6 +45,7 @@ fn opts_from_cmd(cmd: BuildCommand) -> pkg::BuildOpts { member_filter: MemberFilter::default(), experimental: ExperimentalFlags { new_encoding: !cmd.no_encoding_v1, + abi_hash_ids: cmd.abi_hash_ids, }, } } diff --git a/forc/src/ops/forc_check.rs b/forc/src/ops/forc_check.rs index e1419c90982..42c4d3097d1 100644 --- a/forc/src/ops/forc_check.rs +++ b/forc/src/ops/forc_check.rs @@ -17,6 +17,7 @@ pub fn check(command: CheckCommand, engines: &Engines) -> Result<(Option Result<(Option pkg::BuildOpts { member_filter: pkg::MemberFilter::only_contracts(), experimental: ExperimentalFlags { new_encoding: !cmd.no_encoding_v1, + abi_hash_ids: cmd.abi_hash_ids, }, } } diff --git a/forc/src/ops/forc_predicate_root.rs b/forc/src/ops/forc_predicate_root.rs index 04f92ce3bda..2e44ff647ea 100644 --- a/forc/src/ops/forc_predicate_root.rs +++ b/forc/src/ops/forc_predicate_root.rs @@ -49,6 +49,7 @@ fn build_opts_from_cmd(cmd: PredicateRootCommand) -> pkg::BuildOpts { member_filter: pkg::MemberFilter::only_predicates(), experimental: ExperimentalFlags { new_encoding: !cmd.no_encoding_v1, + abi_hash_ids: cmd.abi_hash_ids, }, } } diff --git a/sway-core/src/abi_generation/fuel_abi.rs b/sway-core/src/abi_generation/fuel_abi.rs index d19e5ca3b44..28423bc2060 100644 --- a/sway-core/src/abi_generation/fuel_abi.rs +++ b/sway-core/src/abi_generation/fuel_abi.rs @@ -11,6 +11,7 @@ use super::abi_str::AbiStrContext; pub struct AbiContext<'a> { pub program: &'a TyProgram, pub abi_with_callpaths: bool, + pub abi_with_hash_ids: bool, } impl<'a> AbiContext<'a> { diff --git a/sway-core/src/asm_generation/from_ir.rs b/sway-core/src/asm_generation/from_ir.rs index 04fc9b51325..25cbdf485ce 100644 --- a/sway-core/src/asm_generation/from_ir.rs +++ b/sway-core/src/asm_generation/from_ir.rs @@ -111,6 +111,7 @@ fn compile_module_to_asm( reg_seqr, ExperimentalFlags { new_encoding: context.experimental.new_encoding, + abi_hash_ids: context.experimental.abi_hash_ids, }, ); diff --git a/sway-core/src/build_config.rs b/sway-core/src/build_config.rs index b1ba367b442..88a9624e212 100644 --- a/sway-core/src/build_config.rs +++ b/sway-core/src/build_config.rs @@ -165,6 +165,7 @@ impl BuildConfig { optimization_level: OptLevel::Opt0, experimental: ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, lsp_mode: None, } @@ -254,6 +255,7 @@ impl BuildConfig { #[derive(Debug, Clone, Copy)] pub struct ExperimentalFlags { pub new_encoding: bool, + pub abi_hash_ids: bool, } #[derive(Clone, Debug, Default)] diff --git a/sway-core/src/ir_generation.rs b/sway-core/src/ir_generation.rs index 4506aaec7fb..8da6cc59b5e 100644 --- a/sway-core/src/ir_generation.rs +++ b/sway-core/src/ir_generation.rs @@ -51,6 +51,7 @@ pub fn compile_program<'eng>( engines.se(), sway_ir::ExperimentalFlags { new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids, }, ); ctx.program_kind = match kind { diff --git a/sway-core/src/ir_generation/const_eval.rs b/sway-core/src/ir_generation/const_eval.rs index 7b29b0f6f15..d72b13e84d4 100644 --- a/sway-core/src/ir_generation/const_eval.rs +++ b/sway-core/src/ir_generation/const_eval.rs @@ -1433,6 +1433,7 @@ mod tests { engines.se(), sway_ir::ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ); let mut md_mgr = MetadataManager::default(); diff --git a/sway-core/src/lib.rs b/sway-core/src/lib.rs index b72d63e7039..2f9d45453e9 100644 --- a/sway-core/src/lib.rs +++ b/sway-core/src/lib.rs @@ -97,6 +97,7 @@ pub fn parse( input, ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ), // When a `BuildConfig` is given, @@ -529,6 +530,7 @@ pub fn parsed_to_ast( .map(|x| x.experimental) .unwrap_or(ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }); let lsp_config = build_config.map(|x| x.lsp_mode.clone()).unwrap_or_default(); @@ -630,6 +632,7 @@ pub fn parsed_to_ast( engines.se(), sway_ir::ExperimentalFlags { new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids, }, ); let mut md_mgr = MetadataManager::default(); diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs index cc0f2cce114..fc8ebff64f1 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs @@ -2748,6 +2748,7 @@ mod tests { ), ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ) } @@ -2895,6 +2896,7 @@ mod tests { ), ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ); let (errors, warnings) = handler.consume(); diff --git a/sway-core/src/semantic_analysis/program.rs b/sway-core/src/semantic_analysis/program.rs index d6705717e6e..4fd8f6b9645 100644 --- a/sway-core/src/semantic_analysis/program.rs +++ b/sway-core/src/semantic_analysis/program.rs @@ -54,6 +54,7 @@ impl TyProgram { .map(|x| x.experimental) .unwrap_or(crate::ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }); let mut namespace = Namespace::init_root(initial_namespace); diff --git a/sway-ir/src/bin/opt.rs b/sway-ir/src/bin/opt.rs index b4b1bc1a5a1..598a9b5dae3 100644 --- a/sway-ir/src/bin/opt.rs +++ b/sway-ir/src/bin/opt.rs @@ -31,6 +31,7 @@ fn main() -> Result<(), anyhow::Error> { &source_engine, ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, )?; diff --git a/sway-ir/src/context.rs b/sway-ir/src/context.rs index 50588505382..d265c734ff9 100644 --- a/sway-ir/src/context.rs +++ b/sway-ir/src/context.rs @@ -42,6 +42,7 @@ pub struct Context<'eng> { #[derive(Copy, Clone)] pub struct ExperimentalFlags { pub new_encoding: bool, + pub abi_hash_ids: bool, } impl<'eng> Context<'eng> { diff --git a/sway-ir/src/irtype.rs b/sway-ir/src/irtype.rs index 3bca2ace003..071664c5e12 100644 --- a/sway-ir/src/irtype.rs +++ b/sway-ir/src/irtype.rs @@ -959,6 +959,7 @@ mod tests { &SOURCE_ENGINE, ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ) } diff --git a/sway-ir/src/optimize.rs b/sway-ir/src/optimize.rs index 925431dbc3c..d5532ea434d 100644 --- a/sway-ir/src/optimize.rs +++ b/sway-ir/src/optimize.rs @@ -83,6 +83,7 @@ pub mod tests { &source_engine, ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ) .unwrap(); diff --git a/sway-ir/tests/tests.rs b/sway-ir/tests/tests.rs index 9f18e30103c..214f005d737 100644 --- a/sway-ir/tests/tests.rs +++ b/sway-ir/tests/tests.rs @@ -28,6 +28,7 @@ fn run_tests bool>(sub_dir: &str, opt_fn: F) { &source_engine, ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ) .unwrap_or_else(|parse_err| { diff --git a/sway-lsp/benches/lsp_benchmarks/compile.rs b/sway-lsp/benches/lsp_benchmarks/compile.rs index 6916582e271..072f53cc4fa 100644 --- a/sway-lsp/benches/lsp_benchmarks/compile.rs +++ b/sway-lsp/benches/lsp_benchmarks/compile.rs @@ -9,6 +9,7 @@ const NUM_DID_CHANGE_ITERATIONS: usize = 10; fn benchmarks(c: &mut Criterion) { let experimental = ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }; // Load the test project diff --git a/sway-lsp/benches/lsp_benchmarks/mod.rs b/sway-lsp/benches/lsp_benchmarks/mod.rs index d8847eda1c3..0244685c2a6 100644 --- a/sway-lsp/benches/lsp_benchmarks/mod.rs +++ b/sway-lsp/benches/lsp_benchmarks/mod.rs @@ -13,6 +13,7 @@ use sway_lsp::core::{ pub async fn compile_test_project() -> (Url, Arc, Documents) { let experimental = ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }; let session = Arc::new(Session::new()); let documents = Documents::new(); diff --git a/sway-lsp/src/core/session.rs b/sway-lsp/src/core/session.rs index feccd818199..15ac2983a6d 100644 --- a/sway-lsp/src/core/session.rs +++ b/sway-lsp/src/core/session.rs @@ -517,6 +517,7 @@ mod tests { session, sway_core::ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }, ) .expect_err("expected ManifestFileNotFound"); diff --git a/sway-lsp/src/server_state.rs b/sway-lsp/src/server_state.rs index 2a7d6d34622..96cf74a6054 100644 --- a/sway-lsp/src/server_state.rs +++ b/sway-lsp/src/server_state.rs @@ -117,6 +117,7 @@ impl ServerState { let last_compilation_state = self.last_compilation_state.clone(); let experimental = sway_core::ExperimentalFlags { new_encoding: false, + abi_hash_ids: false, }; std::thread::spawn(move || { while let Ok(msg) = rx.recv() { diff --git a/test/src/e2e_vm_tests/harness.rs b/test/src/e2e_vm_tests/harness.rs index b9403cb31cc..a2ac4633658 100644 --- a/test/src/e2e_vm_tests/harness.rs +++ b/test/src/e2e_vm_tests/harness.rs @@ -291,6 +291,7 @@ pub(crate) async fn compile_to_bytes(file_name: &str, run_config: &RunConfig) -> }, experimental: ExperimentalFlags { new_encoding: run_config.experimental.new_encoding, + abi_hash_ids: run_config.experimental.abi_hash_ids, }, ..Default::default() }; diff --git a/test/src/ir_generation/mod.rs b/test/src/ir_generation/mod.rs index 90ca0f16477..0a9dceee8ce 100644 --- a/test/src/ir_generation/mod.rs +++ b/test/src/ir_generation/mod.rs @@ -230,7 +230,8 @@ pub(super) async fn run( PathBuf::from("/"), build_target, ).with_experimental(sway_core::ExperimentalFlags { - new_encoding: experimental.new_encoding + new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids }); // Include unit tests in the build. @@ -276,6 +277,7 @@ pub(super) async fn run( let include_tests = true; let mut ir = compile_program(typed_program, include_tests, &engines, sway_core::ExperimentalFlags { new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids, }) .unwrap_or_else(|e| { use sway_types::span::Spanned; @@ -374,6 +376,7 @@ pub(super) async fn run( engines.se(), sway_ir::ExperimentalFlags { new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids, } ) .unwrap_or_else(|e| panic!("{}: {e}\n{ir_output}", path.display())); @@ -470,7 +473,8 @@ pub(super) async fn run( // Parse the IR again, and print it yet again to make sure that IR de/serialisation works. let parsed_ir = sway_ir::parser::parse(&ir_output, engines.se(), sway_ir::ExperimentalFlags { - new_encoding: experimental.new_encoding + new_encoding: experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids }) .unwrap_or_else(|e| panic!("{}: {e}\n{ir_output}", path.display())); let parsed_ir_output = sway_ir::printer::to_string(&parsed_ir); @@ -543,6 +547,7 @@ fn compile_core( locked: false, ipfs_node: None, no_encoding_v1: !experimental.new_encoding, + abi_hash_ids: experimental.abi_hash_ids, }; let res = match forc::test::forc_check::check(check_cmd, engines) { diff --git a/test/src/main.rs b/test/src/main.rs index 50054bdae6d..2c11109bd6e 100644 --- a/test/src/main.rs +++ b/test/src/main.rs @@ -57,6 +57,10 @@ struct Cli { #[arg(long)] no_encoding_v1: bool, + /// Disable the abi hash ids feature + #[arg(long)] + no_abi_hash_ids: bool, + /// Update all output files #[arg(long)] update_output_files: bool, @@ -120,6 +124,7 @@ async fn main() -> Result<()> { build_target, experimental: sway_core::ExperimentalFlags { new_encoding: !cli.no_encoding_v1, + abi_hash_ids: !cli.no_abi_hash_ids, }, update_output_files: cli.update_output_files, print_ir: cli.print_ir, @@ -148,6 +153,7 @@ async fn main() -> Result<()> { cli.verbose, sway_ir::ExperimentalFlags { new_encoding: run_config.experimental.new_encoding, + abi_hash_ids: run_config.experimental.abi_hash_ids, }, ) .instrument(tracing::trace_span!("IR")) From b5cb0aa6b074649a4474e5a487a1c6b3baa20259 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 8 May 2024 08:57:48 +0100 Subject: [PATCH 3/9] Changes LogId to contain hash based on abi str. --- sway-core/src/abi_generation/fuel_abi.rs | 6 +++- sway-core/src/ir_generation/function.rs | 11 ++++++-- .../ty/expression/intrinsic_function.rs | 17 +++++++++-- sway-core/src/lib.rs | 2 +- sway-core/src/types/collect_types_metadata.rs | 28 ++++++++++++------- 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/sway-core/src/abi_generation/fuel_abi.rs b/sway-core/src/abi_generation/fuel_abi.rs index 28423bc2060..e86f74e49b4 100644 --- a/sway-core/src/abi_generation/fuel_abi.rs +++ b/sway-core/src/abi_generation/fuel_abi.rs @@ -109,7 +109,11 @@ fn generate_logged_types( .logged_types .iter() .map(|(log_id, type_id)| program_abi::LoggedType { - log_id: **log_id as u64, + log_id: if ctx.abi_with_hash_ids { + log_id.hash_id + } else { + log_id.index as u64 + }, application: program_abi::TypeApplication { name: "".to_string(), type_id: type_id.index(), diff --git a/sway-core/src/ir_generation/function.rs b/sway-core/src/ir_generation/function.rs index 485c8284f35..963b290a765 100644 --- a/sway-core/src/ir_generation/function.rs +++ b/sway-core/src/ir_generation/function.rs @@ -1171,9 +1171,14 @@ impl<'eng> FnCompiler<'eng> { span, )); } - Some(log_id) => { - convert_literal_to_value(context, &Literal::U64(**log_id as u64)) - } + Some(log_id) => convert_literal_to_value( + context, + &Literal::U64(if context.experimental.abi_hash_ids { + log_id.hash_id + } else { + log_id.index as u64 + }), + ), }; match log_val.get_type(context) { diff --git a/sway-core/src/language/ty/expression/intrinsic_function.rs b/sway-core/src/language/ty/expression/intrinsic_function.rs index 008090960e6..a9f69c7a101 100644 --- a/sway-core/src/language/ty/expression/intrinsic_function.rs +++ b/sway-core/src/language/ty/expression/intrinsic_function.rs @@ -3,7 +3,10 @@ use std::{ hash::{Hash, Hasher}, }; -use crate::{engine_threading::*, has_changes, language::ty::*, type_system::*, types::*}; +use crate::{ + abi_generation::abi_str::AbiStrContext, engine_threading::*, has_changes, language::ty::*, + type_system::*, types::*, +}; use itertools::Itertools; use sway_ast::Intrinsic; use sway_error::handler::{ErrorEmitted, Handler}; @@ -113,7 +116,17 @@ impl CollectTypesMetadata for TyIntrinsicFunctionKind { Intrinsic::Log => { let logged_type = self.get_logged_type(ctx.experimental.new_encoding).unwrap(); types_metadata.push(TypeMetadata::LoggedType( - LogId::new(ctx.log_id_counter()), + LogId::new( + ctx.log_id_counter(), + logged_type.get_abi_type_str( + &AbiStrContext { + program_name: Some(ctx.program_name.clone()), + abi_with_callpaths: true, + }, + ctx.engines, + logged_type, + ), + ), logged_type, )); *ctx.log_id_counter_mut() += 1; diff --git a/sway-core/src/lib.rs b/sway-core/src/lib.rs index 2f9d45453e9..2b42eb6afb5 100644 --- a/sway-core/src/lib.rs +++ b/sway-core/src/lib.rs @@ -579,7 +579,7 @@ pub fn parsed_to_ast( // Collect information about the types used in this program let types_metadata_result = typed_program.collect_types_metadata( handler, - &mut CollectTypesMetadataContext::new(engines, experimental), + &mut CollectTypesMetadataContext::new(engines, experimental, package_name.to_string()), ); let types_metadata = match types_metadata_result { Ok(types_metadata) => types_metadata, diff --git a/sway-core/src/types/collect_types_metadata.rs b/sway-core/src/types/collect_types_metadata.rs index 98f36a8ade9..b1097d9e55f 100644 --- a/sway-core/src/types/collect_types_metadata.rs +++ b/sway-core/src/types/collect_types_metadata.rs @@ -9,6 +9,7 @@ use std::{ }; use crate::{type_system::TypeId, Engines, ExperimentalFlags}; +use sha2::{Digest, Sha256}; use sway_error::handler::{ErrorEmitted, Handler}; use sway_types::{Ident, Span}; @@ -16,18 +17,18 @@ use sway_types::{Ident, Span}; /// error to signal to the user that more type information is needed. #[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] -pub struct LogId(usize); - -impl std::ops::Deref for LogId { - type Target = usize; - fn deref(&self) -> &Self::Target { - &self.0 - } +pub struct LogId { + pub index: usize, + pub hash_id: u64, } impl LogId { - pub fn new(index: usize) -> LogId { - LogId(index) + pub fn new(index: usize, string: String) -> LogId { + let mut hasher = Sha256::new(); + hasher.update(string); + let result = hasher.finalize(); + let hash_id = u64::from_be_bytes(result[0..8].try_into().unwrap()); + LogId { index, hash_id } } } @@ -71,6 +72,8 @@ pub struct CollectTypesMetadataContext<'cx> { call_site_spans: Vec>>>, pub(crate) engines: &'cx Engines, + pub(crate) program_name: String, + pub experimental: ExperimentalFlags, } @@ -119,13 +122,18 @@ impl<'cx> CollectTypesMetadataContext<'cx> { None } - pub fn new(engines: &'cx Engines, experimental: ExperimentalFlags) -> Self { + pub fn new( + engines: &'cx Engines, + experimental: ExperimentalFlags, + program_name: String, + ) -> Self { let mut ctx = Self { engines, log_id_counter: 0, message_id_counter: 0, call_site_spans: vec![], experimental, + program_name, }; ctx.call_site_push(); ctx From 66b53ce86710f62c9c1163fab8b4a5ec9f12c550 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Tue, 14 May 2024 12:00:23 +0100 Subject: [PATCH 4/9] Fixes cargo clippy. --- forc/src/ops/forc_check.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forc/src/ops/forc_check.rs b/forc/src/ops/forc_check.rs index 42c4d3097d1..84d09f18804 100644 --- a/forc/src/ops/forc_check.rs +++ b/forc/src/ops/forc_check.rs @@ -47,7 +47,7 @@ pub fn check(command: CheckCommand, engines: &Engines) -> Result<(Option Date: Tue, 14 May 2024 12:10:54 +0100 Subject: [PATCH 5/9] Fixes missing experimental abi-hash-ids flag. --- forc-pkg/tests/sections/Forc.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forc-pkg/tests/sections/Forc.toml b/forc-pkg/tests/sections/Forc.toml index 81a0899d16f..239cfd816f0 100644 --- a/forc-pkg/tests/sections/Forc.toml +++ b/forc-pkg/tests/sections/Forc.toml @@ -21,7 +21,7 @@ json-abi-with-callpaths = true error-on-warnings = true reverse-results = true optimization-level = 0 -experimental = { new-encoding = true } +experimental = { new-encoding = true, abi-hash-ids = true } [build-profile.custom] print-asm = { virtual = false, allocated = false, final = true } From c8cbe78c9b0ff7728f5243758423b920a3b62d29 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 15 May 2024 08:18:43 +0100 Subject: [PATCH 6/9] Removes duplicated log entries in json ABI. --- sway-core/src/abi_generation/fuel_abi.rs | 27 +++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/sway-core/src/abi_generation/fuel_abi.rs b/sway-core/src/abi_generation/fuel_abi.rs index e86f74e49b4..81d4b3d8ef3 100644 --- a/sway-core/src/abi_generation/fuel_abi.rs +++ b/sway-core/src/abi_generation/fuel_abi.rs @@ -1,4 +1,5 @@ use fuel_abi_types::abi::program as program_abi; +use std::collections::HashSet; use crate::{ language::ty::{TyConstantDecl, TyFunctionDecl, TyProgram, TyProgramKind}, @@ -105,20 +106,30 @@ fn generate_logged_types( types.extend(logged_types); // Generate the JSON data for the logged types + let mut log_ids: HashSet = HashSet::default(); ctx.program .logged_types .iter() - .map(|(log_id, type_id)| program_abi::LoggedType { - log_id: if ctx.abi_with_hash_ids { + .filter_map(|(log_id, type_id)| { + let log_id = if ctx.abi_with_hash_ids { log_id.hash_id } else { log_id.index as u64 - }, - application: program_abi::TypeApplication { - name: "".to_string(), - type_id: type_id.index(), - type_arguments: type_id.get_abi_type_arguments(ctx, engines, types, *type_id), - }, + }; + if log_ids.contains(&log_id) { + None + } else { + log_ids.insert(log_id); + Some(program_abi::LoggedType { + log_id, + application: program_abi::TypeApplication { + name: "".to_string(), + type_id: type_id.index(), + type_arguments: type_id + .get_abi_type_arguments(ctx, engines, types, *type_id), + }, + }) + } }) .collect() } From bf67753b45244d76a29d766e7c277f6d3e14d156 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 15 May 2024 09:25:36 +0100 Subject: [PATCH 7/9] Adds abi_with_fully_specified_types to abi_str ctx. ``` __log(1u32); // hashed: "u32" __log((1u32, 1u64)); // hashed: "(u32, u64)" __log([0u64]); // hashed: "[u64; 1]" __log(Some(0u64)); // hashed: "enum std::option::Option" __log(SS{ ss: 1u64 }); // hashed: "struct SS" ``` --- sway-core/src/abi_generation/abi_str.rs | 57 +++++++++++++++++-- sway-core/src/abi_generation/fuel_abi.rs | 43 +++++++++----- .../ty/expression/intrinsic_function.rs | 1 + 3 files changed, 81 insertions(+), 20 deletions(-) diff --git a/sway-core/src/abi_generation/abi_str.rs b/sway-core/src/abi_generation/abi_str.rs index 577a8bdc5d6..3c94fc3a731 100644 --- a/sway-core/src/abi_generation/abi_str.rs +++ b/sway-core/src/abi_generation/abi_str.rs @@ -5,6 +5,7 @@ use crate::{language::CallPath, Engines, TypeArgument, TypeId, TypeInfo}; pub struct AbiStrContext { pub program_name: Option, pub abi_with_callpaths: bool, + pub abi_with_fully_specified_types: bool, } impl TypeId { @@ -36,13 +37,24 @@ impl TypeId { assert_eq!(fields.len(), resolved_fields.len()); let field_strs = fields .iter() - .map(|_| "_".to_string()) + .map(|f| { + if ctx.abi_with_fully_specified_types { + type_engine.get(f.type_id).abi_str(ctx, engines) + } else { + "_".to_string() + } + }) .collect::>(); format!("({})", field_strs.join(", ")) } - (TypeInfo::Array(_, count), TypeInfo::Array(_, resolved_count)) => { + (TypeInfo::Array(type_arg, count), TypeInfo::Array(_, resolved_count)) => { assert_eq!(count.val(), resolved_count.val()); - format!("[_; {}]", count.val()) + let inner_type = if ctx.abi_with_fully_specified_types { + type_engine.get(type_arg.type_id).abi_str(ctx, engines) + } else { + "_".to_string() + }; + format!("[{}; {}]", inner_type, count.val()) } (TypeInfo::Custom { .. }, _) => { format!("generic {}", type_engine.get(*self).abi_str(ctx, engines)) @@ -57,6 +69,7 @@ impl TypeInfo { pub fn abi_str(&self, ctx: &AbiStrContext, engines: &Engines) -> String { use TypeInfo::*; let decl_engine = engines.de(); + let type_engine = engines.te(); match self { Unknown => "unknown".into(), Never => "never".into(), @@ -91,11 +104,45 @@ impl TypeInfo { ErrorRecovery(_) => "unknown due to error".into(), Enum(decl_ref) => { let decl = decl_engine.get_enum(decl_ref); - format!("enum {}", call_path_display(ctx, &decl.call_path)) + let type_params = + if !ctx.abi_with_fully_specified_types || decl.type_parameters.is_empty() { + "".into() + } else { + format!( + "<{}>", + decl.type_parameters + .iter() + .map(|p| type_engine.get(p.type_id).abi_str(ctx, engines)) + .collect::>() + .join(",") + ) + }; + format!( + "enum {}{}", + call_path_display(ctx, &decl.call_path), + type_params + ) } Struct(decl_ref) => { let decl = decl_engine.get_struct(decl_ref); - format!("struct {}", call_path_display(ctx, &decl.call_path)) + let type_params = + if !ctx.abi_with_fully_specified_types || decl.type_parameters.is_empty() { + "".into() + } else { + format!( + "<{}>", + decl.type_parameters + .iter() + .map(|p| type_engine.get(p.type_id).abi_str(ctx, engines)) + .collect::>() + .join(",") + ) + }; + format!( + "struct {}{}", + call_path_display(ctx, &decl.call_path), + type_params + ) } ContractCaller { abi_name, .. } => { format!("contract caller {abi_name}") diff --git a/sway-core/src/abi_generation/fuel_abi.rs b/sway-core/src/abi_generation/fuel_abi.rs index 81d4b3d8ef3..03bb5cddc4e 100644 --- a/sway-core/src/abi_generation/fuel_abi.rs +++ b/sway-core/src/abi_generation/fuel_abi.rs @@ -16,7 +16,11 @@ pub struct AbiContext<'a> { } impl<'a> AbiContext<'a> { - fn to_str_context(&self, engines: &Engines) -> AbiStrContext { + fn to_str_context( + &self, + engines: &Engines, + abi_with_fully_specified_types: bool, + ) -> AbiStrContext { AbiStrContext { program_name: self .program @@ -25,6 +29,7 @@ impl<'a> AbiContext<'a> { .module_id(engines) .read(engines, |m| m.name.clone().map(|v| v.as_str().to_string())), abi_with_callpaths: self.abi_with_callpaths, + abi_with_fully_specified_types, } } } @@ -96,7 +101,11 @@ fn generate_logged_types( .iter() .map(|(_, type_id)| program_abi::TypeDeclaration { type_id: type_id.index(), - type_field: type_id.get_abi_type_str(&ctx.to_str_context(engines), engines, *type_id), + type_field: type_id.get_abi_type_str( + &ctx.to_str_context(engines, false), + engines, + *type_id, + ), components: type_id.get_abi_type_components(ctx, engines, types, *type_id), type_parameters: type_id.get_abi_type_parameters(ctx, engines, types, *type_id), }) @@ -146,7 +155,11 @@ fn generate_messages_types( .iter() .map(|(_, type_id)| program_abi::TypeDeclaration { type_id: type_id.index(), - type_field: type_id.get_abi_type_str(&ctx.to_str_context(engines), engines, *type_id), + type_field: type_id.get_abi_type_str( + &ctx.to_str_context(engines, false), + engines, + *type_id, + ), components: type_id.get_abi_type_components(ctx, engines, types, *type_id), type_parameters: type_id.get_abi_type_parameters(ctx, engines, types, *type_id), }) @@ -186,7 +199,7 @@ fn generate_configurables( }| program_abi::TypeDeclaration { type_id: type_ascription.type_id.index(), type_field: type_ascription.type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, type_ascription.type_id, ), @@ -281,7 +294,7 @@ impl TypeId { .map(|x| program_abi::TypeDeclaration { type_id: x.type_argument.initial_type_id.index(), type_field: x.type_argument.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, x.type_argument.type_id, ), @@ -329,7 +342,7 @@ impl TypeId { .map(|x| program_abi::TypeDeclaration { type_id: x.type_argument.initial_type_id.index(), type_field: x.type_argument.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, x.type_argument.type_id, ), @@ -373,7 +386,7 @@ impl TypeId { let elem_abi_ty = program_abi::TypeDeclaration { type_id: elem_ty.initial_type_id.index(), type_field: elem_ty.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, elem_ty.type_id, ), @@ -416,7 +429,7 @@ impl TypeId { .map(|x| program_abi::TypeDeclaration { type_id: x.initial_type_id.index(), type_field: x.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, x.type_id, ), @@ -465,7 +478,7 @@ impl TypeId { .map(|(v, p)| program_abi::TypeDeclaration { type_id: v.initial_type_id.index(), type_field: v.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, p.type_id, ), @@ -530,7 +543,7 @@ impl TypeId { .map(|(v, p)| program_abi::TypeDeclaration { type_id: v.initial_type_id.index(), type_field: v.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, p.type_id, ), @@ -567,7 +580,7 @@ impl TypeId { .map(|v| program_abi::TypeDeclaration { type_id: v.type_id.index(), type_field: v.type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, v.type_id, ), @@ -607,7 +620,7 @@ impl TypeId { .map(|v| program_abi::TypeDeclaration { type_id: v.type_id.index(), type_field: v.type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, v.type_id, ), @@ -656,7 +669,7 @@ impl TyFunctionDecl { .map(|x| program_abi::TypeDeclaration { type_id: x.type_argument.initial_type_id.index(), type_field: x.type_argument.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, x.type_argument.type_id, ), @@ -679,7 +692,7 @@ impl TyFunctionDecl { let output_type = program_abi::TypeDeclaration { type_id: self.return_type.initial_type_id.index(), type_field: self.return_type.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, self.return_type.type_id, ), @@ -763,7 +776,7 @@ impl TypeParameter { let type_parameter = program_abi::TypeDeclaration { type_id: self.initial_type_id.index(), type_field: self.initial_type_id.get_abi_type_str( - &ctx.to_str_context(engines), + &ctx.to_str_context(engines, false), engines, self.type_id, ), diff --git a/sway-core/src/language/ty/expression/intrinsic_function.rs b/sway-core/src/language/ty/expression/intrinsic_function.rs index a9f69c7a101..e068b53be00 100644 --- a/sway-core/src/language/ty/expression/intrinsic_function.rs +++ b/sway-core/src/language/ty/expression/intrinsic_function.rs @@ -122,6 +122,7 @@ impl CollectTypesMetadata for TyIntrinsicFunctionKind { &AbiStrContext { program_name: Some(ctx.program_name.clone()), abi_with_callpaths: true, + abi_with_fully_specified_types: true, }, ctx.engines, logged_type, From bb5c9fb5b2760f1f3daf983bbdfcc737ad9656e7 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 15 May 2024 10:13:26 +0100 Subject: [PATCH 8/9] Adds missing abi_hash_ids flag. --- forc-plugins/forc-doc/tests/lib.rs | 1 + test/src/e2e_vm_tests/harness.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/forc-plugins/forc-doc/tests/lib.rs b/forc-plugins/forc-doc/tests/lib.rs index 158a6c2613e..e714bab49e4 100644 --- a/forc-plugins/forc-doc/tests/lib.rs +++ b/forc-plugins/forc-doc/tests/lib.rs @@ -14,6 +14,7 @@ fn builds_lib_std_docs() { &get_doc_dir, sway_core::ExperimentalFlags { new_encoding: !build_instructions.no_encoding_v1, + abi_hash_ids: build_instructions.abi_hash_ids, }, ); assert!(res.is_ok()); diff --git a/test/src/e2e_vm_tests/harness.rs b/test/src/e2e_vm_tests/harness.rs index a2ac4633658..68150323e89 100644 --- a/test/src/e2e_vm_tests/harness.rs +++ b/test/src/e2e_vm_tests/harness.rs @@ -337,6 +337,7 @@ pub(crate) async fn compile_and_run_unit_tests( }, experimental: ExperimentalFlags { new_encoding: run_config.experimental.new_encoding, + abi_hash_ids: run_config.experimental.abi_hash_ids, }, ..Default::default() }) From 06edbcaa734b9471f37ef6b5ed8f3e0f131c4a99 Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Wed, 15 May 2024 12:27:04 +0100 Subject: [PATCH 9/9] Updates json ABIs. --- .../json_abi_oracle_new_encoding.json | 16 +- .../language/logging/json_abi_oracle.json | 95 +++------- .../logging/json_abi_oracle_new_encoding.json | 16 +- .../json_abi_oracle.json | 3 +- .../json_abi_oracle_new_encoding.json | 2 +- .../language/smo/json_abi_oracle.json | 5 +- .../smo/json_abi_oracle_new_encoding.json | 4 +- .../json_abi_oracle_new_encoding.json | 4 +- .../json_abi_oracle_new_encoding.json | 116 +----------- .../assert_eq_revert/json_abi_oracle.json | 11 +- .../json_abi_oracle_new_encoding.json | 10 +- .../stdlib/assert_ne/json_abi_oracle.json | 117 ++---------- .../json_abi_oracle_new_encoding.json | 116 +----------- .../assert_ne_revert/json_abi_oracle.json | 11 +- .../json_abi_oracle_new_encoding.json | 10 +- .../require/json_abi_oracle_new_encoding.json | 36 +--- .../basic_storage/json_abi_oracle.json | 79 +------- .../json_abi_oracle_new_encoding.json | 174 +----------------- .../multiple_impl/json_abi_oracle.json | 3 +- .../json_abi_oracle_new_encoding.json | 10 +- .../json_abi_oracle_new_encoding.json | 10 +- .../storage_namespace/json_abi_oracle.json | 79 +------- .../json_abi_oracle_new_encoding.json | 174 +----------------- 23 files changed, 109 insertions(+), 992 deletions(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json index 8f1fef819d2..9dccb5382bc 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json @@ -88,7 +88,7 @@ "typeArguments": null }, "name": "BOOL", - "offset": 13544 + "offset": 13552 }, { "configurableType": { @@ -97,7 +97,7 @@ "typeArguments": null }, "name": "U8", - "offset": 13552 + "offset": 13560 }, { "configurableType": { @@ -106,7 +106,7 @@ "typeArguments": null }, "name": "ANOTHERU8", - "offset": 13568 + "offset": 13576 }, { "configurableType": { @@ -115,7 +115,7 @@ "typeArguments": null }, "name": "U16", - "offset": 13576 + "offset": 13584 }, { "configurableType": { @@ -124,7 +124,7 @@ "typeArguments": null }, "name": "U32", - "offset": 13584 + "offset": 13592 }, { "configurableType": { @@ -133,7 +133,7 @@ "typeArguments": null }, "name": "U64", - "offset": 13600 + "offset": 13608 }, { "configurableType": { @@ -142,7 +142,7 @@ "typeArguments": null }, "name": "U256", - "offset": 13616 + "offset": 13624 }, { "configurableType": { @@ -178,7 +178,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 3330666440490685604, "loggedType": { "name": "", "type": 0, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle.json index 018c52f800b..9387c445576 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": null, @@ -7,44 +8,36 @@ "name": "main", "output": { "name": "", - "type": 14, + "type": 13, "typeArguments": null } } ], "loggedTypes": [ { - "logId": 0, + "logId": 4579537983717831593, "loggedType": { "name": "", - "type": 7, + "type": 6, "typeArguments": [] } }, { - "logId": 1, + "logId": 16566583104751091389, "loggedType": { "name": "", - "type": 8, + "type": 7, "typeArguments": [ { "name": "", - "type": 14, + "type": 13, "typeArguments": null } ] } }, { - "logId": 2, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": [] - } - }, - { - "logId": 3, + "logId": 5087777005172090899, "loggedType": { "name": "", "type": 1, @@ -52,28 +45,12 @@ } }, { - "logId": 4, + "logId": 5555909392781521367, "loggedType": { "name": "", "type": 5, "typeArguments": [] } - }, - { - "logId": 5, - "loggedType": { - "name": "", - "type": 6, - "typeArguments": [] - } - }, - { - "logId": 6, - "loggedType": { - "name": "", - "type": 6, - "typeArguments": [] - } } ], "messagesTypes": [], @@ -88,11 +65,11 @@ "components": [ { "name": "A", - "type": 8, + "type": 7, "typeArguments": [ { "name": "", - "type": 14, + "type": 13, "typeArguments": null } ] @@ -131,47 +108,35 @@ "typeId": 5, "typeParameters": null }, - { - "components": [ - { - "name": "p", - "type": 3, - "typeArguments": null - } - ], - "type": "struct NotAutoEncodable", - "typeId": 6, - "typeParameters": null - }, { "components": [ { "name": "a", - "type": 14, + "type": 13, "typeArguments": null }, { "name": "b", - "type": 13, + "type": 12, "typeArguments": null }, { "name": "c", - "type": 11, + "type": 10, "typeArguments": null }, { "name": "d", - "type": 15, + "type": 14, "typeArguments": null }, { "name": "e", - "type": 10, + "type": 9, "typeArguments": [ { "name": "", - "type": 14, + "type": 13, "typeArguments": null } ] @@ -183,12 +148,12 @@ }, { "name": "g", - "type": 12, + "type": 11, "typeArguments": null } ], "type": "struct S", - "typeId": 7, + "typeId": 6, "typeParameters": null }, { @@ -200,7 +165,7 @@ } ], "type": "struct SS", - "typeId": 8, + "typeId": 7, "typeParameters": [ 2 ] @@ -214,12 +179,12 @@ }, { "name": "cap", - "type": 14, + "type": 13, "typeArguments": null } ], "type": "struct std::vec::RawVec", - "typeId": 9, + "typeId": 8, "typeParameters": [ 2 ] @@ -228,7 +193,7 @@ "components": [ { "name": "buf", - "type": 9, + "type": 8, "typeArguments": [ { "name": "", @@ -239,12 +204,12 @@ }, { "name": "len", - "type": 14, + "type": 13, "typeArguments": null } ], "type": "struct std::vec::Vec", - "typeId": 10, + "typeId": 9, "typeParameters": [ 2 ] @@ -252,31 +217,31 @@ { "components": null, "type": "u16", - "typeId": 11, + "typeId": 10, "typeParameters": null }, { "components": null, "type": "u256", - "typeId": 12, + "typeId": 11, "typeParameters": null }, { "components": null, "type": "u32", - "typeId": 13, + "typeId": 12, "typeParameters": null }, { "components": null, "type": "u64", - "typeId": 14, + "typeId": 13, "typeParameters": null }, { "components": null, "type": "u8", - "typeId": 15, + "typeId": 14, "typeParameters": null } ] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle_new_encoding.json index e40a96bc5cd..9387c445576 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/json_abi_oracle_new_encoding.json @@ -15,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 4579537983717831593, "loggedType": { "name": "", "type": 6, @@ -23,7 +23,7 @@ } }, { - "logId": 1, + "logId": 16566583104751091389, "loggedType": { "name": "", "type": 7, @@ -37,7 +37,7 @@ } }, { - "logId": 2, + "logId": 5087777005172090899, "loggedType": { "name": "", "type": 1, @@ -45,15 +45,7 @@ } }, { - "logId": 3, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": [] - } - }, - { - "logId": 4, + "logId": 5555909392781521367, "loggedType": { "name": "", "type": 5, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle.json index ca8991fbf65..4987a17c8c8 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": null, @@ -20,7 +21,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 3647243719605075626, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle_new_encoding.json index 92681de946c..4987a17c8c8 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_various_types/json_abi_oracle_new_encoding.json @@ -21,7 +21,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 3647243719605075626, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle.json index 4b572063fd2..e0341730252 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": null, @@ -14,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 10098701174489624218, "loggedType": { "name": "", "type": 7, @@ -22,7 +23,7 @@ } }, { - "logId": 1, + "logId": 3297216108266379291, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle_new_encoding.json index 4a00b89fd1d..e0341730252 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/smo/json_abi_oracle_new_encoding.json @@ -15,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 10098701174489624218, "loggedType": { "name": "", "type": 7, @@ -23,7 +23,7 @@ } }, { - "logId": 1, + "logId": 3297216108266379291, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/u256/u256_abi/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/u256/u256_abi/json_abi_oracle_new_encoding.json index d68f43dda09..aef77102452 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/u256/u256_abi/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/u256/u256_abi/json_abi_oracle_new_encoding.json @@ -7,7 +7,7 @@ "typeArguments": null }, "name": "SOME_U256", - "offset": 752 + "offset": 768 } ], "encoding": "1", @@ -25,7 +25,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1970142151624111756, "loggedType": { "name": "", "type": 0, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq/json_abi_oracle_new_encoding.json index 435df816f34..c4cfa2fc47b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq/json_abi_oracle_new_encoding.json @@ -15,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 12, @@ -23,15 +23,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 12, - "typeArguments": null - } - }, - { - "logId": 2, + "logId": 15520703124961489725, "loggedType": { "name": "", "type": 11, @@ -39,23 +31,7 @@ } }, { - "logId": 3, - "loggedType": { - "name": "", - "type": 11, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 10, - "typeArguments": null - } - }, - { - "logId": 5, + "logId": 2992671284987479467, "loggedType": { "name": "", "type": 10, @@ -63,7 +39,7 @@ } }, { - "logId": 6, + "logId": 14454674236531057292, "loggedType": { "name": "", "type": 13, @@ -71,15 +47,7 @@ } }, { - "logId": 7, - "loggedType": { - "name": "", - "type": 13, - "typeArguments": null - } - }, - { - "logId": 8, + "logId": 8961848586872524460, "loggedType": { "name": "", "type": 1, @@ -87,23 +55,7 @@ } }, { - "logId": 9, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 10, - "loggedType": { - "name": "", - "type": 5, - "typeArguments": [] - } - }, - { - "logId": 11, + "logId": 17696813611398264200, "loggedType": { "name": "", "type": 5, @@ -111,7 +63,7 @@ } }, { - "logId": 12, + "logId": 3008693953818743129, "loggedType": { "name": "", "type": 9, @@ -119,15 +71,7 @@ } }, { - "logId": 13, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": [] - } - }, - { - "logId": 14, + "logId": 14832741149864513620, "loggedType": { "name": "", "type": 7, @@ -135,23 +79,7 @@ } }, { - "logId": 15, - "loggedType": { - "name": "", - "type": 7, - "typeArguments": [] - } - }, - { - "logId": 16, - "loggedType": { - "name": "", - "type": 6, - "typeArguments": [] - } - }, - { - "logId": 17, + "logId": 8385180437869151632, "loggedType": { "name": "", "type": 6, @@ -159,31 +87,7 @@ } }, { - "logId": 18, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 19, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 20, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 21, + "logId": 12356980511120185571, "loggedType": { "name": "", "type": 3, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle.json index bf820505563..9f282c7d122 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": null, @@ -14,15 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 1, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle_new_encoding.json index c8c9679a38f..9f282c7d122 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_eq_revert/json_abi_oracle_new_encoding.json @@ -15,15 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 1, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle.json index 57d2aa0915a..c4cfa2fc47b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": null, @@ -14,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 12, @@ -22,15 +23,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 12, - "typeArguments": null - } - }, - { - "logId": 2, + "logId": 15520703124961489725, "loggedType": { "name": "", "type": 11, @@ -38,23 +31,7 @@ } }, { - "logId": 3, - "loggedType": { - "name": "", - "type": 11, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 10, - "typeArguments": null - } - }, - { - "logId": 5, + "logId": 2992671284987479467, "loggedType": { "name": "", "type": 10, @@ -62,7 +39,7 @@ } }, { - "logId": 6, + "logId": 14454674236531057292, "loggedType": { "name": "", "type": 13, @@ -70,15 +47,7 @@ } }, { - "logId": 7, - "loggedType": { - "name": "", - "type": 13, - "typeArguments": null - } - }, - { - "logId": 8, + "logId": 8961848586872524460, "loggedType": { "name": "", "type": 1, @@ -86,23 +55,7 @@ } }, { - "logId": 9, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 10, - "loggedType": { - "name": "", - "type": 5, - "typeArguments": [] - } - }, - { - "logId": 11, + "logId": 17696813611398264200, "loggedType": { "name": "", "type": 5, @@ -110,7 +63,7 @@ } }, { - "logId": 12, + "logId": 3008693953818743129, "loggedType": { "name": "", "type": 9, @@ -118,15 +71,7 @@ } }, { - "logId": 13, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": [] - } - }, - { - "logId": 14, + "logId": 14832741149864513620, "loggedType": { "name": "", "type": 7, @@ -134,23 +79,7 @@ } }, { - "logId": 15, - "loggedType": { - "name": "", - "type": 7, - "typeArguments": [] - } - }, - { - "logId": 16, - "loggedType": { - "name": "", - "type": 6, - "typeArguments": [] - } - }, - { - "logId": 17, + "logId": 8385180437869151632, "loggedType": { "name": "", "type": 6, @@ -158,31 +87,7 @@ } }, { - "logId": 18, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 19, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 20, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 21, + "logId": 12356980511120185571, "loggedType": { "name": "", "type": 3, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle_new_encoding.json index 435df816f34..c4cfa2fc47b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne/json_abi_oracle_new_encoding.json @@ -15,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 12, @@ -23,15 +23,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 12, - "typeArguments": null - } - }, - { - "logId": 2, + "logId": 15520703124961489725, "loggedType": { "name": "", "type": 11, @@ -39,23 +31,7 @@ } }, { - "logId": 3, - "loggedType": { - "name": "", - "type": 11, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 10, - "typeArguments": null - } - }, - { - "logId": 5, + "logId": 2992671284987479467, "loggedType": { "name": "", "type": 10, @@ -63,7 +39,7 @@ } }, { - "logId": 6, + "logId": 14454674236531057292, "loggedType": { "name": "", "type": 13, @@ -71,15 +47,7 @@ } }, { - "logId": 7, - "loggedType": { - "name": "", - "type": 13, - "typeArguments": null - } - }, - { - "logId": 8, + "logId": 8961848586872524460, "loggedType": { "name": "", "type": 1, @@ -87,23 +55,7 @@ } }, { - "logId": 9, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 10, - "loggedType": { - "name": "", - "type": 5, - "typeArguments": [] - } - }, - { - "logId": 11, + "logId": 17696813611398264200, "loggedType": { "name": "", "type": 5, @@ -111,7 +63,7 @@ } }, { - "logId": 12, + "logId": 3008693953818743129, "loggedType": { "name": "", "type": 9, @@ -119,15 +71,7 @@ } }, { - "logId": 13, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": [] - } - }, - { - "logId": 14, + "logId": 14832741149864513620, "loggedType": { "name": "", "type": 7, @@ -135,23 +79,7 @@ } }, { - "logId": 15, - "loggedType": { - "name": "", - "type": 7, - "typeArguments": [] - } - }, - { - "logId": 16, - "loggedType": { - "name": "", - "type": 6, - "typeArguments": [] - } - }, - { - "logId": 17, + "logId": 8385180437869151632, "loggedType": { "name": "", "type": 6, @@ -159,31 +87,7 @@ } }, { - "logId": 18, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 19, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 20, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": [] - } - }, - { - "logId": 21, + "logId": 12356980511120185571, "loggedType": { "name": "", "type": 3, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle.json index bf820505563..9f282c7d122 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": null, @@ -14,15 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 1, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle_new_encoding.json index c8c9679a38f..9f282c7d122 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/assert_ne_revert/json_abi_oracle_new_encoding.json @@ -15,15 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 1, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/require/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/require/json_abi_oracle_new_encoding.json index 03f8af9b2a6..070842173f1 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/require/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/require/json_abi_oracle_new_encoding.json @@ -15,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 3, @@ -23,39 +23,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": null - } - }, - { - "logId": 2, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": null - } - }, - { - "logId": 3, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 3, - "typeArguments": null - } - }, - { - "logId": 5, + "logId": 12587658342658067091, "loggedType": { "name": "", "type": 2, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle.json index 290d04e8b24..b9bf3fe0ff9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": [ @@ -198,7 +199,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 9, @@ -206,39 +207,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 2, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 3, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 5, + "logId": 1970142151624111756, "loggedType": { "name": "", "type": 8, @@ -246,47 +215,7 @@ } }, { - "logId": 6, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 7, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 8, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 9, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 10, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 11, + "logId": 8961848586872524460, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle_new_encoding.json index dca47a96d72..b9bf3fe0ff9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/basic_storage/json_abi_oracle_new_encoding.json @@ -199,7 +199,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 9, @@ -207,55 +207,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 2, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 3, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 5, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 6, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 7, + "logId": 1970142151624111756, "loggedType": { "name": "", "type": 8, @@ -263,127 +215,7 @@ } }, { - "logId": 8, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 9, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 10, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 11, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 12, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 13, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 14, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 15, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 16, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 17, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 18, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 19, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 20, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 21, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 22, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 23, + "logId": 8961848586872524460, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle.json index 3c8224f070c..e1858c5b0da 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": null, @@ -14,7 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle_new_encoding.json index 409e362c736..e1858c5b0da 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/multiple_impl/json_abi_oracle_new_encoding.json @@ -15,15 +15,7 @@ ], "loggedTypes": [ { - "logId": 0, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 1, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/json_abi_oracle_new_encoding.json index d153349d1ad..ee7b21bb31c 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_access_contract/json_abi_oracle_new_encoding.json @@ -822,15 +822,7 @@ ], "loggedTypes": [ { - "logId": 0, - "loggedType": { - "name": "", - "type": 2, - "typeArguments": null - } - }, - { - "logId": 1, + "logId": 13213829929622723620, "loggedType": { "name": "", "type": 2, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle.json index 290d04e8b24..b9bf3fe0ff9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle.json @@ -1,5 +1,6 @@ { "configurables": [], + "encoding": "1", "functions": [ { "attributes": [ @@ -198,7 +199,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 9, @@ -206,39 +207,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 2, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 3, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 5, + "logId": 1970142151624111756, "loggedType": { "name": "", "type": 8, @@ -246,47 +215,7 @@ } }, { - "logId": 6, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 7, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 8, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 9, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 10, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 11, + "logId": 8961848586872524460, "loggedType": { "name": "", "type": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle_new_encoding.json index dca47a96d72..b9bf3fe0ff9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/storage_namespace/json_abi_oracle_new_encoding.json @@ -199,7 +199,7 @@ ], "loggedTypes": [ { - "logId": 0, + "logId": 1515152261580153489, "loggedType": { "name": "", "type": 9, @@ -207,55 +207,7 @@ } }, { - "logId": 1, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 2, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 3, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 4, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 5, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 6, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 7, + "logId": 1970142151624111756, "loggedType": { "name": "", "type": 8, @@ -263,127 +215,7 @@ } }, { - "logId": 8, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 9, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 10, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 11, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 12, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 13, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 14, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 15, - "loggedType": { - "name": "", - "type": 9, - "typeArguments": null - } - }, - { - "logId": 16, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 17, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 18, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 19, - "loggedType": { - "name": "", - "type": 8, - "typeArguments": null - } - }, - { - "logId": 20, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 21, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 22, - "loggedType": { - "name": "", - "type": 1, - "typeArguments": null - } - }, - { - "logId": 23, + "logId": 8961848586872524460, "loggedType": { "name": "", "type": 1,