diff --git a/crates/llvm-context/src/polkavm/context/function/mod.rs b/crates/llvm-context/src/polkavm/context/function/mod.rs index 5c801b8..1a63631 100644 --- a/crates/llvm-context/src/polkavm/context/function/mod.rs +++ b/crates/llvm-context/src/polkavm/context/function/mod.rs @@ -48,12 +48,6 @@ pub struct Function<'ctx> { } impl<'ctx> Function<'ctx> { - /// The near call ABI function prefix. - pub const ZKSYNC_NEAR_CALL_ABI_PREFIX: &'static str = "ZKSYNC_NEAR_CALL"; - - /// The near call ABI exception handler name. - pub const ZKSYNC_NEAR_CALL_ABI_EXCEPTION_HANDLER: &'static str = "ZKSYNC_CATCH_NEAR_CALL"; - /// The stack hashmap default capacity. const STACK_HASHMAP_INITIAL_CAPACITY: usize = 64; diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index 0d501ad..411d41f 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -433,12 +433,6 @@ where let pointer = self.build_alloca(self.word_type(), "return_pointer"); FunctionReturn::primitive(pointer) } - size if name.starts_with(Function::ZKSYNC_NEAR_CALL_ABI_PREFIX) => { - let first_argument = value.get_first_param().expect("Always exists"); - let r#type = self.structure_type(vec![self.word_type(); size].as_slice()); - let pointer = first_argument.into_pointer_value(); - FunctionReturn::compound(Pointer::new(r#type, AddressSpace::Stack, pointer), size) - } size => { self.set_basic_block(entry_block); let pointer = self.build_alloca( diff --git a/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs b/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs index 58ad5fa..8a16a48 100644 --- a/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs +++ b/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs @@ -125,13 +125,6 @@ impl FunctionCall { let location = self.location; match self.name { - Name::UserDefined(name) - if name.starts_with( - revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX, - ) => - { - unimplemented!(); - } Name::UserDefined(name) => { let mut values = Vec::with_capacity(self.arguments.len()); for argument in self.arguments.into_iter().rev() { diff --git a/crates/solidity/src/yul/parser/statement/function_definition.rs b/crates/solidity/src/yul/parser/statement/function_definition.rs index e69efd8..7ff9775 100644 --- a/crates/solidity/src/yul/parser/statement/function_definition.rs +++ b/crates/solidity/src/yul/parser/statement/function_definition.rs @@ -92,37 +92,7 @@ impl FunctionDefinition { } } - let (mut arguments, next) = Identifier::parse_typed_list(lexer, None)?; - if identifier - .inner - .contains(revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX) - { - if arguments.is_empty() { - return Err(ParserError::InvalidNumberOfArguments { - location, - identifier: identifier.inner, - expected: 1, - found: arguments.len(), - } - .into()); - } - - arguments.remove(0); - } - if identifier - .inner - .contains(revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_EXCEPTION_HANDLER) - && !arguments.is_empty() - { - return Err(ParserError::InvalidNumberOfArguments { - location, - identifier: identifier.inner, - expected: 0, - found: arguments.len(), - } - .into()); - } - + let (arguments, next) = Identifier::parse_typed_list(lexer, None)?; match crate::yul::parser::take_or_next(next, lexer)? { Token { lexeme: Lexeme::Symbol(Symbol::ParenthesisRight), @@ -305,22 +275,12 @@ where yul_type.into_llvm(context) }) .collect(); - for (mut index, argument) in self.arguments.iter().enumerate() { + for (index, argument) in self.arguments.iter().enumerate() { let pointer = context.build_alloca(argument_types[index], argument.inner.as_str()); context .current_function() .borrow_mut() .insert_stack_pointer(argument.inner.clone(), pointer); - if self - .identifier - .starts_with(revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX) - && matches!( - context.current_function().borrow().r#return(), - revive_llvm_context::PolkaVMFunctionReturn::Compound { .. } - ) - { - index += 1; - } context.build_store( pointer, context.current_function().borrow().get_nth_param(index), @@ -348,13 +308,6 @@ where let return_value = context.build_load(pointer, "return_value")?; context.build_return(Some(&return_value)); } - revive_llvm_context::PolkaVMFunctionReturn::Compound { pointer, .. } - if context.current_function().borrow().name().starts_with( - revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX, - ) => - { - context.build_return(Some(&pointer.value)); - } revive_llvm_context::PolkaVMFunctionReturn::Compound { pointer, .. } => { let return_value = context.build_load(pointer, "return_value")?; context.build_return(Some(&return_value)); @@ -518,80 +471,6 @@ object "Test" { ); } - #[test] - fn error_invalid_number_of_arguments_near_call_abi() { - let input = r#" -object "Test" { - code { - { - return(0, 0) - } - } - object "Test_deployed" { - code { - { - return(0, 0) - } - - function ZKSYNC_NEAR_CALL_test() -> result { - result := 42 - } - } - } -} - "#; - - let mut lexer = Lexer::new(input.to_owned()); - let result = Object::parse(&mut lexer, None); - assert_eq!( - result, - Err(Error::InvalidNumberOfArguments { - location: Location::new(14, 22), - identifier: "ZKSYNC_NEAR_CALL_test".to_owned(), - expected: 1, - found: 0, - } - .into()) - ); - } - - #[test] - fn error_invalid_number_of_arguments_near_call_abi_catch() { - let input = r#" -object "Test" { - code { - { - return(0, 0) - } - } - object "Test_deployed" { - code { - { - return(0, 0) - } - - function ZKSYNC_CATCH_NEAR_CALL(length) { - revert(0, length) - } - } - } -} - "#; - - let mut lexer = Lexer::new(input.to_owned()); - let result = Object::parse(&mut lexer, None); - assert_eq!( - result, - Err(Error::InvalidNumberOfArguments { - location: Location::new(14, 22), - identifier: "ZKSYNC_CATCH_NEAR_CALL".to_owned(), - expected: 0, - found: 1, - } - .into()) - ); - } - #[test] fn error_reserved_identifier() { let input = r#"