mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-27 16:17:59 +00:00
initial SELFDESTRUCT support (#400)
Note: - The unstable interface in `v2509.0.0` of `polkadot-sdk` is required. - The differential test fails against EVM in `v2509.0.0` of `polkadot-sdk`. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -60,3 +60,16 @@ pub fn invalid(context: &mut Context) -> anyhow::Result<()> {
|
||||
context.build_call(context.intrinsics().trap, &[], "invalid_trap");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Translates the `selfdestruct` instruction.
|
||||
pub fn selfdestruct<'ctx>(
|
||||
context: &mut Context<'ctx>,
|
||||
address: inkwell::values::IntValue<'ctx>,
|
||||
) -> anyhow::Result<()> {
|
||||
let address_pointer = context.build_address_argument_store(address)?;
|
||||
context.build_runtime_call(
|
||||
revive_runtime_api::polkavm_imports::TERMINATE,
|
||||
&[address_pointer.to_int(context).into()],
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user