mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-03-02 10:43:09 +00:00
Implement syscalls for BALANCE and SELFBALANCE (#922)
* Implement syscalls for BALANCE and SELFBALANCE * Remove stubs
This commit is contained in:
parent
fc6487cac0
commit
893b88c309
@ -1,3 +1,20 @@
|
||||
global sys_balance:
|
||||
// stack: kexit_info, address
|
||||
// TODO: assuming a cold account access for now.
|
||||
%charge_gas_const(@GAS_COLDACCOUNTACCESS)
|
||||
SWAP1
|
||||
// stack: address, kexit_info
|
||||
%balance
|
||||
// stack: balance, kexit_info
|
||||
SWAP1
|
||||
EXIT_KERNEL
|
||||
|
||||
%macro balance
|
||||
%stack (address) -> (address, %%after)
|
||||
%jump(balance)
|
||||
%%after:
|
||||
%endmacro
|
||||
|
||||
global balance:
|
||||
// stack: address, retdest
|
||||
%mpt_read_state_trie
|
||||
@ -13,11 +30,17 @@ retzero:
|
||||
%stack (account_ptr, retdest) -> (retdest, 0)
|
||||
JUMP
|
||||
|
||||
global sys_selfbalance:
|
||||
// stack: kexit_info
|
||||
%charge_gas_const(@GAS_LOW)
|
||||
%selfbalance
|
||||
// stack: balance, kexit_info
|
||||
SWAP1
|
||||
EXIT_KERNEL
|
||||
|
||||
global selfbalance:
|
||||
// stack: retdest
|
||||
%macro selfbalance
|
||||
PUSH %%after
|
||||
%address
|
||||
PUSH balance
|
||||
// stack: balance, address, retdest
|
||||
JUMP
|
||||
|
||||
%jump(balance)
|
||||
%%after:
|
||||
%endmacro
|
||||
@ -13,8 +13,6 @@ global sys_sgt:
|
||||
PANIC
|
||||
global sys_sar:
|
||||
PANIC
|
||||
global sys_balance:
|
||||
PANIC
|
||||
global sys_origin:
|
||||
PANIC
|
||||
global sys_calldatasize:
|
||||
@ -50,8 +48,6 @@ global sys_chainid:
|
||||
// stack: chain_id, kexit_info
|
||||
SWAP1
|
||||
EXIT_KERNEL
|
||||
global sys_selfbalance:
|
||||
PANIC
|
||||
global sys_basefee:
|
||||
PANIC
|
||||
global sys_log0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user