diff --git a/sway-core/src/abi_generation/fuel_abi.rs b/sway-core/src/abi_generation/fuel_abi.rs index d43066e7a75..e02187f49ca 100644 --- a/sway-core/src/abi_generation/fuel_abi.rs +++ b/sway-core/src/abi_generation/fuel_abi.rs @@ -44,14 +44,8 @@ pub fn generate_program_abi( configurables: Some(configurables), } } - TyProgramKind::Script { - entry_function: main_function, - .. - } - | TyProgramKind::Predicate { - entry_function: main_function, - .. - } => { + TyProgramKind::Script { main_function, .. } + | TyProgramKind::Predicate { main_function, .. } => { let main_function = decl_engine.get_function(main_function); let functions = vec![main_function.generate_abi_function(ctx, type_engine, decl_engine, types)]; diff --git a/sway-core/src/control_flow_analysis/dead_code_analysis.rs b/sway-core/src/control_flow_analysis/dead_code_analysis.rs index aa22d379cb5..0e6c4067488 100644 --- a/sway-core/src/control_flow_analysis/dead_code_analysis.rs +++ b/sway-core/src/control_flow_analysis/dead_code_analysis.rs @@ -3,7 +3,10 @@ use crate::{ decl_engine::*, language::{ parsed::TreeType, - ty::{self, TyAstNodeContent, TyImplItem}, + ty::{ + self, ConstantDecl, FunctionDecl, StructDecl, TraitDecl, TyAstNode, TyAstNodeContent, + TyDecl, TyImplItem, TypeAliasDecl, + }, CallPath, Visibility, }, transform::{self, AttributesMap}, @@ -24,6 +27,88 @@ use sway_types::{ Ident, Named, Spanned, }; +// Defines if this node starts the dca graph or not +fn is_entry_point(node: &TyAstNode, decl_engine: &DeclEngine, tree_type: &TreeType) -> bool { + match tree_type { + TreeType::Predicate | TreeType::Script => { + // Predicates and scripts have main and test functions as entry points. + match node { + TyAstNode { + span: _, + content: + TyAstNodeContent::Declaration(TyDecl::FunctionDecl(FunctionDecl { + decl_id, + .. + })), + .. + } => { + let decl = decl_engine.get_function(decl_id); + decl.is_entry() || decl.is_main() || decl.is_test() + } + _ => false, + } + } + TreeType::Contract | TreeType::Library { .. } => match node { + TyAstNode { + content: + TyAstNodeContent::Declaration(TyDecl::FunctionDecl(FunctionDecl { + decl_id, + decl_span: _, + .. + })), + .. + } => { + let decl = decl_engine.get_function(decl_id); + decl.visibility == Visibility::Public || decl.is_test() + } + TyAstNode { + content: + TyAstNodeContent::Declaration(TyDecl::TraitDecl(TraitDecl { + decl_id, + decl_span: _, + .. + })), + .. + } => decl_engine.get_trait(decl_id).visibility.is_public(), + TyAstNode { + content: + TyAstNodeContent::Declaration(TyDecl::StructDecl(StructDecl { decl_id, .. })), + .. + } => { + let struct_decl = decl_engine.get_struct(decl_id); + struct_decl.visibility == Visibility::Public + } + TyAstNode { + content: TyAstNodeContent::Declaration(TyDecl::ImplTrait { .. }), + .. + } => true, + TyAstNode { + content: + TyAstNodeContent::Declaration(TyDecl::ConstantDecl(ConstantDecl { + decl_id, + decl_span: _, + .. + })), + .. + } => { + let decl = decl_engine.get_constant(decl_id); + decl.visibility.is_public() + } + TyAstNode { + content: + TyAstNodeContent::Declaration(TyDecl::TypeAliasDecl(TypeAliasDecl { + decl_id, .. + })), + .. + } => { + let decl = decl_engine.get_type_alias(decl_id); + decl.visibility.is_public() + } + _ => false, + }, + } +} + impl<'cfg> ControlFlowGraph<'cfg> { pub(crate) fn find_dead_code(&self, decl_engine: &DeclEngine) -> Vec { // Dead code is code that has no path from the entry point. @@ -287,13 +372,15 @@ impl<'cfg> ControlFlowGraph<'cfg> { let mut entry_points = vec![]; let mut non_entry_points = vec![]; + for ast_node in module_nodes { - if ast_node.is_entry_point(decl_engine, tree_type) { + if is_entry_point(ast_node, decl_engine, tree_type) { entry_points.push(ast_node); } else { non_entry_points.push(ast_node); } } + for ast_entrypoint in non_entry_points.into_iter().chain(entry_points) { let (_l_leaves, _new_exit_node) = connect_node( engines, @@ -320,7 +407,7 @@ fn collect_entry_points( for i in graph.node_indices() { let is_entry = match &graph[i] { ControlFlowGraphNode::ProgramNode { node, .. } => { - node.is_entry_point(decl_engine, tree_type) + is_entry_point(node, decl_engine, tree_type) } _ => false, }; diff --git a/sway-core/src/ir_generation.rs b/sway-core/src/ir_generation.rs index c5b596deeb9..936ca0ca9f7 100644 --- a/sway-core/src/ir_generation.rs +++ b/sway-core/src/ir_generation.rs @@ -63,7 +63,7 @@ pub fn compile_program<'eng>( match kind { // predicates and scripts have the same codegen, their only difference is static // type-check time checks. - ty::TyProgramKind::Script { entry_function } => compile::compile_script( + ty::TyProgramKind::Script { entry_function, .. } => compile::compile_script( engines, &mut ctx, entry_function, @@ -73,7 +73,7 @@ pub fn compile_program<'eng>( &messages_types, &test_fns, ), - ty::TyProgramKind::Predicate { entry_function } => compile::compile_predicate( + ty::TyProgramKind::Predicate { entry_function, .. } => compile::compile_predicate( engines, &mut ctx, entry_function, diff --git a/sway-core/src/ir_generation/compile.rs b/sway-core/src/ir_generation/compile.rs index 66b8a8c2126..60b0f9b15b1 100644 --- a/sway-core/src/ir_generation/compile.rs +++ b/sway-core/src/ir_generation/compile.rs @@ -24,7 +24,7 @@ use std::{collections::HashMap, sync::Arc}; pub(super) fn compile_script( engines: &Engines, context: &mut Context, - main_function: &DeclId, + entry_function: &DeclId, namespace: &namespace::Module, declarations: &[ty::TyDecl], logged_types_map: &HashMap, @@ -49,7 +49,7 @@ pub(super) fn compile_script( context, &mut md_mgr, module, - main_function, + entry_function, logged_types_map, messages_types_map, None, @@ -71,7 +71,7 @@ pub(super) fn compile_script( pub(super) fn compile_predicate( engines: &Engines, context: &mut Context, - main_function: &DeclId, + entry_function: &DeclId, namespace: &namespace::Module, declarations: &[ty::TyDecl], logged_types: &HashMap, @@ -96,7 +96,7 @@ pub(super) fn compile_predicate( context, &mut md_mgr, module, - main_function, + entry_function, &HashMap::new(), &HashMap::new(), None, @@ -117,7 +117,7 @@ pub(super) fn compile_predicate( #[allow(clippy::too_many_arguments)] pub(super) fn compile_contract( context: &mut Context, - main_function: Option<&DeclId>, + entry_function: Option<&DeclId>, abi_entries: &[DeclId], namespace: &namespace::Module, declarations: &[ty::TyDecl], @@ -140,7 +140,7 @@ pub(super) fn compile_contract( ) .map_err(|err| vec![err])?; - if let Some(main_function) = main_function { + if let Some(main_function) = entry_function { compile_entry_function( engines, context, diff --git a/sway-core/src/language/parsed/declaration/function.rs b/sway-core/src/language/parsed/declaration/function.rs index c28ff4b633e..87bab881df0 100644 --- a/sway-core/src/language/parsed/declaration/function.rs +++ b/sway-core/src/language/parsed/declaration/function.rs @@ -10,6 +10,7 @@ use sway_types::{ident::Ident, span::Span}; pub enum FunctionDeclarationKind { Default, Entry, + Main, Test, } diff --git a/sway-core/src/language/ty/ast_node.rs b/sway-core/src/language/ty/ast_node.rs index 8d2b08fdb14..5cb7fa34374 100644 --- a/sway-core/src/language/ty/ast_node.rs +++ b/sway-core/src/language/ty/ast_node.rs @@ -9,7 +9,7 @@ use sway_types::{Ident, Span}; use crate::{ decl_engine::*, engine_threading::*, - language::{parsed::TreeType, ty::*, Visibility}, + language::ty::*, semantic_analysis::{ TypeCheckAnalysis, TypeCheckAnalysisContext, TypeCheckContext, TypeCheckFinalization, TypeCheckFinalizationContext, @@ -192,90 +192,6 @@ impl TyAstNode { } } - pub(crate) fn is_entry_point(&self, decl_engine: &DeclEngine, tree_type: &TreeType) -> bool { - match tree_type { - TreeType::Predicate | TreeType::Script => { - // Predicates and scripts have main and test functions as entry points. - match self { - TyAstNode { - span: _, - content: - TyAstNodeContent::Declaration(TyDecl::FunctionDecl(FunctionDecl { - decl_id, - .. - })), - .. - } => { - let decl = decl_engine.get_function(decl_id); - decl.is_entry_or_test() - } - _ => false, - } - } - TreeType::Contract | TreeType::Library { .. } => match self { - TyAstNode { - content: - TyAstNodeContent::Declaration(TyDecl::FunctionDecl(FunctionDecl { - decl_id, - decl_span: _, - .. - })), - .. - } => { - let decl = decl_engine.get_function(decl_id); - decl.visibility == Visibility::Public || decl.is_test() - } - TyAstNode { - content: - TyAstNodeContent::Declaration(TyDecl::TraitDecl(TraitDecl { - decl_id, - decl_span: _, - .. - })), - .. - } => decl_engine.get_trait(decl_id).visibility.is_public(), - TyAstNode { - content: - TyAstNodeContent::Declaration(TyDecl::StructDecl(StructDecl { - decl_id, .. - })), - .. - } => { - let struct_decl = decl_engine.get_struct(decl_id); - struct_decl.visibility == Visibility::Public - } - TyAstNode { - content: TyAstNodeContent::Declaration(TyDecl::ImplTrait { .. }), - .. - } => true, - TyAstNode { - content: - TyAstNodeContent::Declaration(TyDecl::ConstantDecl(ConstantDecl { - decl_id, - decl_span: _, - .. - })), - .. - } => { - let decl = decl_engine.get_constant(decl_id); - decl.visibility.is_public() - } - TyAstNode { - content: - TyAstNodeContent::Declaration(TyDecl::TypeAliasDecl(TypeAliasDecl { - decl_id, - .. - })), - .. - } => { - let decl = decl_engine.get_type_alias(decl_id); - decl.visibility.is_public() - } - _ => false, - }, - } - } - pub(crate) fn type_info(&self, type_engine: &TypeEngine) -> TypeInfo { // return statement should be () match &self.content { diff --git a/sway-core/src/language/ty/declaration/function.rs b/sway-core/src/language/ty/declaration/function.rs index f1cd4eaafb0..b1baae66b31 100644 --- a/sway-core/src/language/ty/declaration/function.rs +++ b/sway-core/src/language/ty/declaration/function.rs @@ -31,6 +31,7 @@ use sway_types::{ pub enum TyFunctionDeclKind { Default, Entry, + Main, Test, } @@ -336,6 +337,7 @@ impl TyFunctionDecl { FunctionDeclarationKind::Default => TyFunctionDeclKind::Default, FunctionDeclarationKind::Entry => TyFunctionDeclKind::Entry, FunctionDeclarationKind::Test => TyFunctionDeclKind::Test, + FunctionDeclarationKind::Main => TyFunctionDeclKind::Main, }, } } @@ -412,6 +414,10 @@ impl TyFunctionDecl { matches!(self.kind, TyFunctionDeclKind::Entry) } + pub fn is_main(&self) -> bool { + matches!(self.kind, TyFunctionDeclKind::Main) + } + /// Whether or not this function is a unit test, i.e. decorated with `#[test]`. pub fn is_test(&self) -> bool { //TODO match kind to Test @@ -435,11 +441,6 @@ impl TyFunctionDecl { } } - /// Whether or not this function describes a program entry point. - pub fn is_entry_or_test(&self) -> bool { - self.is_entry() || self.is_test() - } - /// Whether or not this function is a constructor for the type given by `type_id`. /// /// Returns `Some(true)` if the function is surely the constructor and `Some(false)` if diff --git a/sway-core/src/language/ty/program.rs b/sway-core/src/language/ty/program.rs index faa8d0c6015..d15bda1deea 100644 --- a/sway-core/src/language/ty/program.rs +++ b/sway-core/src/language/ty/program.rs @@ -77,6 +77,7 @@ impl TyProgram { } let mut entries = Vec::new(); + let mut mains = Vec::new(); let mut declarations = Vec::::new(); let mut abi_entries = Vec::new(); let mut fn_declarations = std::collections::HashSet::new(); @@ -91,8 +92,10 @@ impl TyProgram { })) => { let func = decl_engine.get_function(decl_id); - if matches!(func.kind, TyFunctionDeclKind::Entry) { - entries.push(*decl_id); + match func.kind { + TyFunctionDeclKind::Main => mains.push(*decl_id), + TyFunctionDeclKind::Entry => entries.push(*decl_id), + _ => {} } if !fn_declarations.insert(func.name.clone()) { @@ -253,56 +256,81 @@ impl TyProgram { } } parsed::TreeType::Predicate => { - // A predicate must have a main function and that function must return a boolean. - if entries.is_empty() { + if mains.is_empty() { return Err( handler.emit_err(CompileError::NoPredicateMainFunction(root.span.clone())) ); } - if entries.len() > 1 { - let mains_last = decl_engine.get_function(entries.last().unwrap()); - handler.emit_err(CompileError::MultipleDefinitionsOfFunction { - name: mains_last.name.clone(), - span: mains_last.name.span(), - }); - } - let main_func_id = entries.remove(0); - let main_func = decl_engine.get_function(&main_func_id); - match &*ty_engine.get(main_func.return_type.type_id) { - TypeInfo::Boolean => (), - _ => { - handler.emit_err(CompileError::PredicateMainDoesNotReturnBool( - main_func.span.clone(), + + if mains.len() > 1 { + let mut last_error = None; + for m in mains.iter().skip(1) { + let mains_last = decl_engine.get_function(m); + last_error = Some(handler.emit_err( + CompileError::MultipleDefinitionsOfFunction { + name: mains_last.name.clone(), + span: mains_last.name.span(), + }, )); } + return Err(last_error.unwrap()); + } + + let (entry_fn_id, main_fn_id) = if experimental.new_encoding { + assert!(entries.len() == 1); + (entries[0], mains[0]) + } else { + assert!(entries.is_empty()); + (mains[0], mains[0]) + }; + + let main_fn = decl_engine.get(&main_fn_id); + if !ty_engine.get(main_fn.return_type.type_id).is_bool() { + handler.emit_err(CompileError::PredicateMainDoesNotReturnBool( + main_fn.span.clone(), + )); } + TyProgramKind::Predicate { - entry_function: main_func_id, + entry_function: entry_fn_id, + main_function: main_fn_id, } } parsed::TreeType::Script => { // A script must have exactly one main function - if entries.is_empty() { + if mains.is_empty() { return Err( handler.emit_err(CompileError::NoScriptMainFunction(root.span.clone())) ); } - if entries.len() > 1 { - let mains_last = decl_engine.get_function(entries.last().unwrap()); - handler.emit_err(CompileError::MultipleDefinitionsOfFunction { - name: mains_last.name.clone(), - span: mains_last.name.span(), - }); + if mains.len() > 1 { + let mut last_error = None; + for m in mains.iter().skip(1) { + let mains_last = decl_engine.get_function(m); + last_error = Some(handler.emit_err( + CompileError::MultipleDefinitionsOfFunction { + name: mains_last.name.clone(), + span: mains_last.name.span(), + }, + )); + } + return Err(last_error.unwrap()); } + let (entry_fn_id, main_fn_id) = if experimental.new_encoding { + assert!(entries.len() == 1); + (entries[0], mains[0]) + } else { + assert!(entries.is_empty()); + (mains[0], mains[0]) + }; + // A script must not return a `raw_ptr` or any type aggregating a `raw_slice`. // Directly returning a `raw_slice` is allowed, which will be just mapped to a RETD. // TODO: Allow returning nested `raw_slice`s when our spec supports encoding DSTs. - let main_func_decl_id = entries.remove(0); - let main_func = decl_engine.get_function(&main_func_decl_id); - - for p in main_func.parameters() { + let main_fn = decl_engine.get(&main_fn_id); + for p in main_fn.parameters() { if let Some(error) = get_type_not_allowed_error( engines, p.type_argument.type_id, @@ -324,8 +352,8 @@ impl TyProgram { // Check main return type is valid if let Some(error) = get_type_not_allowed_error( engines, - main_func.return_type.type_id, - &main_func.return_type, + main_fn.return_type.type_id, + &main_fn.return_type, |t| match t { TypeInfo::StringSlice => { Some(TypeNotAllowedReason::StringSliceInMainReturn) @@ -338,7 +366,7 @@ impl TyProgram { ) { // Let main return `raw_slice` directly if !matches!( - &*engines.te().get(main_func.return_type.type_id), + &*engines.te().get(main_fn.return_type.type_id), TypeInfo::RawUntypedSlice ) { handler.emit_err(error); @@ -346,20 +374,16 @@ impl TyProgram { } TyProgramKind::Script { - entry_function: main_func_decl_id, + entry_function: entry_fn_id, + main_function: main_fn_id, } } }; + // check if no ref mut arguments passed to a `main()` in a `script` or `predicate`. match &typed_program_kind { - TyProgramKind::Script { - entry_function: main_function, - .. - } - | TyProgramKind::Predicate { - entry_function: main_function, - .. - } => { + TyProgramKind::Script { main_function, .. } + | TyProgramKind::Predicate { main_function, .. } => { let main_function = decl_engine.get_function(main_function); for param in &main_function.parameters { if param.is_reference && param.is_mutable { @@ -532,9 +556,11 @@ pub enum TyProgramKind { }, Predicate { entry_function: DeclId, + main_function: DeclId, }, Script { entry_function: DeclId, + main_function: DeclId, }, } diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/function.rs b/sway-core/src/semantic_analysis/ast_node/declaration/function.rs index 743e12c64de..40637e39fc8 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/function.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/function.rs @@ -162,6 +162,7 @@ impl ty::TyFunctionDecl { FunctionDeclarationKind::Default => ty::TyFunctionDeclKind::Default, FunctionDeclarationKind::Entry => ty::TyFunctionDeclKind::Entry, FunctionDeclarationKind::Test => ty::TyFunctionDeclKind::Test, + FunctionDeclarationKind::Main => ty::TyFunctionDeclKind::Main, }, }; diff --git a/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs b/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs index 4404585980e..f0b664d8056 100644 --- a/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs +++ b/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs @@ -516,12 +516,10 @@ pub fn item_fn_to_function_declaration( } }; - let kind = match ( - context.experimental.new_encoding, - item_fn.fn_signature.name.as_str() == "main", - ) { - (false, true) => FunctionDeclarationKind::Entry, - _ => FunctionDeclarationKind::Default, + let kind = if item_fn.fn_signature.name.as_str() == "main" { + FunctionDeclarationKind::Main + } else { + FunctionDeclarationKind::Default }; let kind = override_kind.unwrap_or(kind); diff --git a/sway-core/src/type_system/info.rs b/sway-core/src/type_system/info.rs index 1c1a15954b9..812ca32461b 100644 --- a/sway-core/src/type_system/info.rs +++ b/sway-core/src/type_system/info.rs @@ -782,6 +782,10 @@ impl TypeInfo { } } + pub(crate) fn is_bool(&self) -> bool { + matches!(self, TypeInfo::Boolean) + } + /// maps a type to a name that is used when constructing function selectors pub(crate) fn to_selector_name( &self, 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_copy/json_abi_oracle_new_encoding.json index fd53929d11d..11eabcab880 100644 --- 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_copy/json_abi_oracle_new_encoding.json @@ -4,8 +4,14 @@ "functions": [ { "attributes": null, - "inputs": [], - "name": "__entry", + "inputs": [ + { + "name": "baba", + "type": 0, + "typeArguments": null + } + ], + "name": "main", "output": { "name": "", "type": 0, @@ -18,7 +24,7 @@ "types": [ { "components": null, - "type": "raw untyped slice", + "type": "u64", "typeId": 0, "typeParameters": null } 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_copy_copy/json_abi_oracle_new_encoding.json index fd53929d11d..7379bbd3b90 100644 --- 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_copy_copy/json_abi_oracle_new_encoding.json @@ -4,8 +4,19 @@ "functions": [ { "attributes": null, - "inputs": [], - "name": "__entry", + "inputs": [ + { + "name": "baba", + "type": 0, + "typeArguments": null + }, + { + "name": "keke", + "type": 0, + "typeArguments": null + } + ], + "name": "main", "output": { "name": "", "type": 0, @@ -18,7 +29,7 @@ "types": [ { "components": null, - "type": "raw untyped slice", + "type": "u64", "typeId": 0, "typeParameters": null } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_empty/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_empty/json_abi_oracle_new_encoding.json index fd53929d11d..068da3305ab 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_empty/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_empty/json_abi_oracle_new_encoding.json @@ -5,7 +5,7 @@ { "attributes": null, "inputs": [], - "name": "__entry", + "name": "main", "output": { "name": "", "type": 0, @@ -18,7 +18,7 @@ "types": [ { "components": null, - "type": "raw untyped slice", + "type": "u64", "typeId": 0, "typeParameters": null } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref/json_abi_oracle_new_encoding.json index fd53929d11d..ec82fc196ce 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref/json_abi_oracle_new_encoding.json @@ -4,11 +4,17 @@ "functions": [ { "attributes": null, - "inputs": [], - "name": "__entry", + "inputs": [ + { + "name": "baba", + "type": 0, + "typeArguments": null + } + ], + "name": "main", "output": { "name": "", - "type": 0, + "type": 1, "typeArguments": null } } @@ -17,10 +23,22 @@ "messagesTypes": [], "types": [ { - "components": null, - "type": "raw untyped slice", + "components": [ + { + "name": "val", + "type": 1, + "typeArguments": null + } + ], + "type": "struct TestStruct", "typeId": 0, "typeParameters": null + }, + { + "components": null, + "type": "u64", + "typeId": 1, + "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_ref_copy/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref_copy/json_abi_oracle_new_encoding.json index fd53929d11d..cc3f79bbc62 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref_copy/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref_copy/json_abi_oracle_new_encoding.json @@ -4,11 +4,22 @@ "functions": [ { "attributes": null, - "inputs": [], - "name": "__entry", + "inputs": [ + { + "name": "baba", + "type": 0, + "typeArguments": null + }, + { + "name": "keke", + "type": 1, + "typeArguments": null + } + ], + "name": "main", "output": { "name": "", - "type": 0, + "type": 1, "typeArguments": null } } @@ -17,10 +28,22 @@ "messagesTypes": [], "types": [ { - "components": null, - "type": "raw untyped slice", + "components": [ + { + "name": "val", + "type": 1, + "typeArguments": null + } + ], + "type": "struct TestStruct", "typeId": 0, "typeParameters": null + }, + { + "components": null, + "type": "u64", + "typeId": 1, + "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_ref_ref/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref_ref/json_abi_oracle_new_encoding.json index fd53929d11d..b22a72cff8e 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref_ref/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_ref_ref/json_abi_oracle_new_encoding.json @@ -4,11 +4,22 @@ "functions": [ { "attributes": null, - "inputs": [], - "name": "__entry", + "inputs": [ + { + "name": "baba", + "type": 0, + "typeArguments": null + }, + { + "name": "keke", + "type": 0, + "typeArguments": null + } + ], + "name": "main", "output": { "name": "", - "type": 0, + "type": 1, "typeArguments": null } } @@ -17,10 +28,22 @@ "messagesTypes": [], "types": [ { - "components": null, - "type": "raw untyped slice", + "components": [ + { + "name": "val", + "type": 1, + "typeArguments": null + } + ], + "type": "struct TestStruct", "typeId": 0, "typeParameters": null + }, + { + "components": null, + "type": "u64", + "typeId": 1, + "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_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 d5959d460ac..92681de946c 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 @@ -4,11 +4,17 @@ "functions": [ { "attributes": null, - "inputs": [], - "name": "__entry", + "inputs": [ + { + "name": "ops", + "type": 1, + "typeArguments": null + } + ], + "name": "main", "output": { "name": "", - "type": 3, + "type": 5, "typeArguments": null } } @@ -29,7 +35,7 @@ "components": [ { "name": "__tuple_element", - "type": 5, + "type": 4, "typeArguments": null }, { @@ -58,12 +64,12 @@ "components": [ { "name": "Positive", - "type": 6, + "type": 5, "typeArguments": null }, { "name": "Negative", - "type": 6, + "type": 5, "typeArguments": null } ], @@ -71,34 +77,28 @@ "typeId": 2, "typeParameters": null }, - { - "components": null, - "type": "raw untyped slice", - "typeId": 3, - "typeParameters": null - }, { "components": null, "type": "str[3]", - "typeId": 4, + "typeId": 3, "typeParameters": null }, { "components": [ { "name": "val", - "type": 4, + "type": 3, "typeArguments": null } ], "type": "struct OpName", - "typeId": 5, + "typeId": 4, "typeParameters": null }, { "components": null, "type": "u64", - "typeId": 6, + "typeId": 5, "typeParameters": null } ]