mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Return 0 if account doesn't exist
This commit is contained in:
parent
6ed6574272
commit
ff4210ea78
@ -1,21 +1,23 @@
|
|||||||
%macro balance
|
global balance:
|
||||||
// stack: address
|
// stack: address, retdest
|
||||||
%mpt_read_state_trie
|
%mpt_read_state_trie
|
||||||
// stack: account_ptr
|
// stack: account_ptr, retdest
|
||||||
|
DUP1 ISZERO %jumpi(retzero) // If the account pointer is null, return 0.
|
||||||
%add_const(1)
|
%add_const(1)
|
||||||
// stack: balance_ptr
|
// stack: balance_ptr
|
||||||
%mload_trie_data
|
%mload_trie_data
|
||||||
// stack: balance
|
|
||||||
%endmacro
|
|
||||||
|
|
||||||
global balance:
|
|
||||||
// stack: address, retdest
|
|
||||||
%balance
|
|
||||||
// stack: balance, retdest
|
// stack: balance, retdest
|
||||||
SWAP1 JUMP
|
SWAP1 JUMP
|
||||||
|
|
||||||
%macro selfbalance
|
retzero:
|
||||||
// stack: (empty)
|
%stack (account_ptr, retdest) -> (retdest, 0)
|
||||||
ADDRESS
|
JUMP
|
||||||
%balance
|
|
||||||
%endmacro
|
|
||||||
|
global selfbalance:
|
||||||
|
// stack: retdest
|
||||||
|
%address
|
||||||
|
PUSH balance
|
||||||
|
// stack: balance, address, retdest
|
||||||
|
JUMP
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user