Use Block chain id for sys_chainid

This commit is contained in:
Hamy Ratoanina 2023-04-12 11:40:40 -04:00
parent f424bd3644
commit 92d94dc60d
No known key found for this signature in database
GPG Key ID: 054683A21827F7C4
2 changed files with 13 additions and 9 deletions

View File

@ -6,15 +6,6 @@ global sys_blockhash:
global sys_prevrandao:
// TODO: What semantics will this have for Edge?
PANIC
global sys_chainid:
// TODO: Return the block's chain ID instead of the txn's, even though they should match.
// stack: kexit_info
%charge_gas_const(@GAS_BASE)
// stack: kexit_info
%mload_txn_field(@TXN_FIELD_CHAIN_ID)
// stack: chain_id, kexit_info
SWAP1
EXIT_KERNEL
global sys_log0:
PANIC
global sys_log1:

View File

@ -200,6 +200,19 @@ global sys_gaslimit:
SWAP1
EXIT_KERNEL
%macro blockchainid
%mload_global_metadata(@GLOBAL_METADATA_BLOCK_CHAIN_ID)
%endmacro
global sys_chainid:
// stack: kexit_info
%charge_gas_const(@GAS_BASE)
// stack: kexit_info
%blockchainid
// stack: chain_id, kexit_info
SWAP1
EXIT_KERNEL
%macro basefee
%mload_global_metadata(@GLOBAL_METADATA_BLOCK_BASE_FEE)
%endmacro