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:
xermicus
2025-11-03 15:04:04 +01:00
committed by GitHub
parent c0cdde5a5a
commit 70037e1136
8 changed files with 97 additions and 31 deletions
@@ -661,6 +661,14 @@ impl FunctionCall {
Name::Invalid => {
revive_llvm_context::polkavm_evm_return::invalid(context).map(|_| None)
}
Name::SelfDestruct => {
let arguments = self.pop_arguments_llvm::<1>(context)?;
revive_llvm_context::polkavm_evm_return::selfdestruct(
context,
arguments[0].into_int_value(),
)
.map(|_| None)
}
Name::Log0 => {
let arguments = self.pop_arguments_llvm::<2>(context)?;
@@ -962,13 +970,6 @@ impl FunctionCall {
location
)
}
Name::SelfDestruct => {
let _arguments = self.pop_arguments_llvm::<1>(context)?;
anyhow::bail!(
"{} The `SELFDESTRUCT` instruction is not supported",
location
)
}
}
}