From 68ec8be49f20bca77ed10457a4c1fd36bfe4013b Mon Sep 17 00:00:00 2001 From: xermicus Date: Wed, 5 Jun 2024 10:34:53 +0200 Subject: [PATCH] Implement the PUSHDEPLOYADDRESS instruction. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduction and raison d'ĂȘtre in solc: https://github.com/ethereum/solidity/pull/3203 TL;DR: Exists to guard libraries from being called directly. Hence we substitute PUSHDEPLOYADDRESS (the zero address) via a call to the address API to let the library constructor fetch its own address. In the zkSync target they do exactly the same. Signed-off-by: xermicus --- .../src/evmla/ethereal_ir/function/block/element/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs b/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs index 917eb76..0af649c 100644 --- a/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs +++ b/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs @@ -168,7 +168,9 @@ where crate::evmla::assembly::instruction::stack::push(context, value).map(Some) } } - InstructionName::PUSHDEPLOYADDRESS => todo!(), + InstructionName::PUSHDEPLOYADDRESS => { + revive_llvm_context::polkavm_evm_contract_context::address(context).map(Some) + } InstructionName::DUP1 => crate::evmla::assembly::instruction::stack::dup( context,