add simulated evm math opcode syscalls

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
Cyrill Leutwiler
2025-07-04 15:45:59 +02:00
parent ed608699af
commit 939a8f2f78
4 changed files with 109 additions and 61 deletions
+16
View File
@@ -104,3 +104,19 @@ POLKAVM_IMPORT(uint64_t, set_storage, uint32_t, uint32_t, uint32_t, uint32_t, ui
POLKAVM_IMPORT(void, value_transferred, uint32_t)
POLKAVM_IMPORT(void, weight_to_fee, uint64_t, uint64_t, uint32_t);
POLKAVM_IMPORT(void, div, uint32_t, uint32_t, uint32_t);
POLKAVM_IMPORT(void, sdiv, uint32_t, uint32_t, uint32_t);
POLKAVM_IMPORT(void, addmod, uint32_t, uint32_t, uint32_t, uint32_t);
POLKAVM_IMPORT(void, mulmod, uint32_t, uint32_t, uint32_t, uint32_t);
POLKAVM_IMPORT(void, mod, uint32_t, uint32_t, uint32_t);
POLKAVM_IMPORT(void, smod, uint32_t, uint32_t, uint32_t);
POLKAVM_IMPORT(void, exp, uint32_t, uint32_t, uint32_t);
POLKAVM_IMPORT(void, signext, uint32_t, uint32_t, uint32_t);
+19 -1
View File
@@ -68,9 +68,27 @@ pub static VALUE_TRANSFERRED: &str = "value_transferred";
pub static WEIGHT_TO_FEE: &str = "weight_to_fee";
pub static DIV: &str = "div";
pub static SDIV: &str = "sdiv";
pub static ADDMOD: &str = "addmod";
pub static MULMOD: &str = "mulmod";
pub static MOD: &str = "mod";
pub static SMOD: &str = "smod";
pub static EXP: &str = "exp";
pub static SIGNEXT: &str = "signext";
/// All imported runtime API symbols.
/// Useful for configuring common attributes and linkage.
pub static IMPORTS: [&str; 33] = [
pub static IMPORTS: [&str; 41] = [
DIV,
SDIV,
ADDMOD,
MULMOD,
MOD,
SMOD,
EXP,
SIGNEXT,
//
ADDRESS,
BALANCE,
BALANCE_OF,