Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::webassembly::interface Class Reference

#include <interface.hpp>

Public Member Functions

 interface (apply_context &ctx)
 
apply_contextget_context ()
 
const apply_contextget_context () const
 
int32_t get_context_free_data (uint32_t index, legacy_span< char > buffer) const
 
int32_t is_feature_active (int64_t feature_name) const
 
void activate_feature (int64_t feature_name) const
 
void preactivate_feature (legacy_ptr< const digest_type > feature_digest)
 
void set_resource_limits (account_name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight)
 
void get_resource_limits (account_name account, legacy_ptr< int64_t, 8 > ram_bytes, legacy_ptr< int64_t, 8 > net_weight, legacy_ptr< int64_t, 8 > cpu_weight) const
 
uint32_t get_wasm_parameters_packed (span< char > packed_parameters, uint32_t max_version) const
 
void set_wasm_parameters_packed (span< const char > packed_parameters)
 
int64_t set_proposed_producers (legacy_span< const char > packed_producer_schedule)
 
int64_t set_proposed_producers_ex (uint64_t packed_producer_format, legacy_span< const char > packed_producer_schedule)
 
uint32_t get_blockchain_parameters_packed (legacy_span< char > packed_blockchain_parameters) const
 
void set_blockchain_parameters_packed (legacy_span< const char > packed_blockchain_parameters)
 
uint32_t get_parameters_packed (span< const char > packed_parameter_ids, span< char > packed_parameters) const
 Retrieve the blockchain config parameters.
 
void set_parameters_packed (span< const char > packed_parameters)
 Set the blockchain parameters in a flexible manner.
 
bool is_privileged (account_name account) const
 
void set_privileged (account_name account, bool is_priv)
 
float _sysio_f32_add (float, float) const
 
float _sysio_f32_sub (float, float) const
 
float _sysio_f32_div (float, float) const
 
float _sysio_f32_mul (float, float) const
 
float _sysio_f32_min (float, float) const
 
float _sysio_f32_max (float, float) const
 
float _sysio_f32_copysign (float, float) const
 
float _sysio_f32_abs (float) const
 
float _sysio_f32_neg (float) const
 
float _sysio_f32_sqrt (float) const
 
float _sysio_f32_ceil (float) const
 
float _sysio_f32_floor (float) const
 
float _sysio_f32_trunc (float) const
 
float _sysio_f32_nearest (float) const
 
bool _sysio_f32_eq (float, float) const
 
bool _sysio_f32_ne (float, float) const
 
bool _sysio_f32_lt (float, float) const
 
bool _sysio_f32_le (float, float) const
 
bool _sysio_f32_gt (float, float) const
 
bool _sysio_f32_ge (float, float) const
 
double _sysio_f64_add (double, double) const
 
double _sysio_f64_sub (double, double) const
 
double _sysio_f64_div (double, double) const
 
double _sysio_f64_mul (double, double) const
 
double _sysio_f64_min (double, double) const
 
double _sysio_f64_max (double, double) const
 
double _sysio_f64_copysign (double, double) const
 
double _sysio_f64_abs (double) const
 
double _sysio_f64_neg (double) const
 
double _sysio_f64_sqrt (double) const
 
double _sysio_f64_ceil (double) const
 
double _sysio_f64_floor (double) const
 
double _sysio_f64_trunc (double) const
 
double _sysio_f64_nearest (double) const
 
bool _sysio_f64_eq (double, double) const
 
bool _sysio_f64_ne (double, double) const
 
bool _sysio_f64_lt (double, double) const
 
bool _sysio_f64_le (double, double) const
 
bool _sysio_f64_gt (double, double) const
 
bool _sysio_f64_ge (double, double) const
 
double _sysio_f32_promote (float) const
 
float _sysio_f64_demote (double) const
 
int32_t _sysio_f32_trunc_i32s (float) const
 
int32_t _sysio_f64_trunc_i32s (double) const
 
uint32_t _sysio_f32_trunc_i32u (float) const
 
uint32_t _sysio_f64_trunc_i32u (double) const
 
int64_t _sysio_f32_trunc_i64s (float) const
 
int64_t _sysio_f64_trunc_i64s (double) const
 
uint64_t _sysio_f32_trunc_i64u (float) const
 
uint64_t _sysio_f64_trunc_i64u (double) const
 
float _sysio_i32_to_f32 (int32_t) const
 
float _sysio_i64_to_f32 (int64_t) const
 
float _sysio_ui32_to_f32 (uint32_t) const
 
float _sysio_ui64_to_f32 (uint64_t) const
 
double _sysio_i32_to_f64 (int32_t) const
 
double _sysio_i64_to_f64 (int64_t) const
 
double _sysio_ui32_to_f64 (uint32_t) const
 
double _sysio_ui64_to_f64 (uint64_t) const
 
int32_t get_active_producers (legacy_span< account_name > producers) const
 
void assert_recover_key (legacy_ptr< const fc::sha256 > digest, legacy_span< const char > sig, legacy_span< const char > pub) const
 
int32_t recover_key (legacy_ptr< const fc::sha256 > digest, legacy_span< const char > sig, legacy_span< char > pub) const
 
void assert_sha256 (legacy_span< const char > data, legacy_ptr< const fc::sha256 > hash_val) const
 
void assert_sha1 (legacy_span< const char > data, legacy_ptr< const fc::sha1 > hash_val) const
 
void assert_sha512 (legacy_span< const char > data, legacy_ptr< const fc::sha512 > hash_val) const
 
void assert_ripemd160 (legacy_span< const char > data, legacy_ptr< const fc::ripemd160 > hash_val) const
 
void sha256 (legacy_span< const char > data, legacy_ptr< fc::sha256 > hash_val) const
 
void sha1 (legacy_span< const char > data, legacy_ptr< fc::sha1 > hash_val) const
 
void sha512 (legacy_span< const char > data, legacy_ptr< fc::sha512 > hash_val) const
 
void ripemd160 (legacy_span< const char > data, legacy_ptr< fc::ripemd160 > hash_val) const
 
bool check_transaction_authorization (legacy_span< const char > trx_data, legacy_span< const char > pubkeys_data, legacy_span< const char > perms_data) const
 
bool check_permission_authorization (account_name account, permission_name permission, legacy_span< const char > pubkeys_data, legacy_span< const char > perms_data, uint64_t delay_us) const
 
int64_t get_permission_last_used (account_name account, permission_name permission) const
 
int64_t get_account_creation_time (account_name account) const
 
void require_auth (account_name account) const
 
void require_auth2 (account_name account, permission_name permission) const
 
bool has_auth (account_name account) const
 
void require_recipient (account_name recipient)
 
bool is_account (account_name account) const
 
uint32_t get_code_hash (account_name account, uint32_t struct_version, vm::span< char > packed_result) const
 
uint64_t current_time () const
 
uint32_t get_block_num () const
 
uint64_t publication_time () const
 
bool is_feature_activated (legacy_ptr< const digest_type > feature_digest) const
 
name get_sender () const
 
void abort () const
 
void sysio_assert (bool condition, null_terminated_ptr msg) const
 
void sysio_assert_message (bool condition, legacy_span< const char > msg) const
 
void sysio_assert_code (bool condition, uint64_t error_code) const
 
void sysio_exit (int32_t code) const
 
int32_t read_action_data (legacy_span< char > memory) const
 
int32_t action_data_size () const
 
name current_receiver () const
 
void set_action_return_value (span< const char > packed_blob)
 
void prints (null_terminated_ptr str)
 
void prints_l (legacy_span< const char > str)
 
void printi (int64_t val)
 
void printui (uint64_t val)
 
void printi128 (legacy_ptr< const __int128 > val)
 
void printui128 (legacy_ptr< const unsigned __int128 > val)
 
void printsf (float32_t val)
 
void printdf (float64_t val)
 
void printqf (legacy_ptr< const float128_t > val)
 
void printn (name value)
 
void printhex (legacy_span< const char > data)
 
int32_t db_store_i64 (uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_span< const char > buffer)
 
void db_update_i64 (int32_t itr, uint64_t payer, legacy_span< const char > buffer)
 
void db_remove_i64 (int32_t itr)
 
int32_t db_get_i64 (int32_t itr, legacy_span< char > buffer)
 
int32_t db_next_i64 (int32_t itr, legacy_ptr< uint64_t > primary)
 
int32_t db_previous_i64 (int32_t itr, legacy_ptr< uint64_t > primary)
 
int32_t db_find_i64 (uint64_t code, uint64_t scope, uint64_t table, uint64_t id)
 
int32_t db_lowerbound_i64 (uint64_t code, uint64_t scope, uint64_t table, uint64_t id)
 
int32_t db_upperbound_i64 (uint64_t code, uint64_t scope, uint64_t table, uint64_t id)
 
int32_t db_end_i64 (uint64_t code, uint64_t scope, uint64_t table)
 
int32_t db_idx64_store (uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const uint64_t > secondary)
 
void db_idx64_update (int32_t iterator, uint64_t payer, legacy_ptr< const uint64_t > secondary)
 
void db_idx64_remove (int32_t iterator)
 
int32_t db_idx64_find_secondary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const uint64_t > secondary, legacy_ptr< uint64_t > primary)
 
int32_t db_idx64_find_primary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint64_t > secondary, uint64_t primary)
 
int32_t db_idx64_lowerbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx64_upperbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx64_end (uint64_t code, uint64_t scope, uint64_t table)
 
int32_t db_idx64_next (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx64_previous (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx128_store (uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const uint128_t > secondary)
 
void db_idx128_update (int32_t iterator, uint64_t payer, legacy_ptr< const uint128_t > secondary)
 
void db_idx128_remove (int32_t iterator)
 
int32_t db_idx128_find_secondary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const uint128_t > secondary, legacy_ptr< uint64_t > primary)
 
int32_t db_idx128_find_primary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint128_t > secondary, uint64_t primary)
 
int32_t db_idx128_lowerbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint128_t, 16 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx128_upperbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint128_t, 16 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx128_end (uint64_t code, uint64_t scope, uint64_t table)
 
int32_t db_idx128_next (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx128_previous (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx256_store (uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_span< const uint128_t > data)
 
void db_idx256_update (int32_t iterator, uint64_t payer, legacy_span< const uint128_t > data)
 
void db_idx256_remove (int32_t iterator)
 
int32_t db_idx256_find_secondary (uint64_t code, uint64_t scope, uint64_t table, legacy_span< const uint128_t > data, legacy_ptr< uint64_t > primary)
 
int32_t db_idx256_find_primary (uint64_t code, uint64_t scope, uint64_t table, legacy_span< uint128_t > data, uint64_t primary)
 
int32_t db_idx256_lowerbound (uint64_t code, uint64_t scope, uint64_t table, legacy_span< uint128_t, 16 > data, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx256_upperbound (uint64_t code, uint64_t scope, uint64_t table, legacy_span< uint128_t, 16 > data, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx256_end (uint64_t code, uint64_t scope, uint64_t table)
 
int32_t db_idx256_next (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx256_previous (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx_double_store (uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const float64_t > secondary)
 
void db_idx_double_update (int32_t iterator, uint64_t payer, legacy_ptr< const float64_t > secondary)
 
void db_idx_double_remove (int32_t iterator)
 
int32_t db_idx_double_find_secondary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const float64_t > secondary, legacy_ptr< uint64_t > primary)
 
int32_t db_idx_double_find_primary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float64_t > secondary, uint64_t primary)
 
int32_t db_idx_double_lowerbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx_double_upperbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx_double_end (uint64_t code, uint64_t scope, uint64_t table)
 
int32_t db_idx_double_next (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx_double_previous (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx_long_double_store (uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const float128_t > secondary)
 
void db_idx_long_double_update (int32_t iterator, uint64_t payer, legacy_ptr< const float128_t > secondary)
 
void db_idx_long_double_remove (int32_t iterator)
 
int32_t db_idx_long_double_find_secondary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const float128_t > secondary, legacy_ptr< uint64_t > primary)
 
int32_t db_idx_long_double_find_primary (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float128_t > secondary, uint64_t primary)
 
int32_t db_idx_long_double_lowerbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float128_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx_long_double_upperbound (uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float128_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
 
int32_t db_idx_long_double_end (uint64_t code, uint64_t scope, uint64_t table)
 
int32_t db_idx_long_double_next (int32_t iterator, legacy_ptr< uint64_t > primary)
 
int32_t db_idx_long_double_previous (int32_t iterator, legacy_ptr< uint64_t > primary)
 
void * memcpy (memcpy_params) const
 
void * memmove (memcpy_params) const
 
int32_t memcmp (memcmp_params) const
 
void * memset (memset_params) const
 
void send_inline (legacy_span< const char > data)
 
void send_context_free_inline (legacy_span< const char > data)
 
void send_deferred (legacy_ptr< const uint128_t > sender_id, account_name payer, legacy_span< const char > data, uint32_t replace_existing)
 
bool cancel_deferred (legacy_ptr< const uint128_t > val)
 
int32_t read_transaction (legacy_span< char > data) const
 
int32_t transaction_size () const
 
int32_t expiration () const
 
int32_t tapos_block_num () const
 
int32_t tapos_block_prefix () const
 
int32_t get_action (uint32_t type, uint32_t index, legacy_span< char > buffer) const
 
int32_t alt_bn128_add (span< const char > op1, span< const char > op2, span< char > result) const
 
int32_t alt_bn128_mul (span< const char > g1_point, span< const char > scalar, span< char > result) const
 
int32_t alt_bn128_pair (span< const char > g1_g2_pairs) const
 
int32_t mod_exp (span< const char > base, span< const char > exp, span< const char > modulus, span< char > out) const
 
int32_t blake2_f (uint32_t rounds, span< const char > state, span< const char > message, span< const char > t0_offset, span< const char > t1_offset, int32_t final, span< char > result) const
 
void sha3 (span< const char > data, span< char > hash_val, int32_t keccak) const
 
int32_t k1_recover (span< const char > signature, span< const char > digest, span< char > pub) const
 
void __ashlti3 (legacy_ptr< int128_t >, uint64_t, uint64_t, uint32_t) const
 
void __ashrti3 (legacy_ptr< int128_t >, uint64_t, uint64_t, uint32_t) const
 
void __lshlti3 (legacy_ptr< int128_t >, uint64_t, uint64_t, uint32_t) const
 
void __lshrti3 (legacy_ptr< int128_t >, uint64_t, uint64_t, uint32_t) const
 
void __divti3 (legacy_ptr< int128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __udivti3 (legacy_ptr< uint128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __multi3 (legacy_ptr< int128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __modti3 (legacy_ptr< int128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __umodti3 (legacy_ptr< uint128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __addtf3 (legacy_ptr< float128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __subtf3 (legacy_ptr< float128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __multf3 (legacy_ptr< float128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __divtf3 (legacy_ptr< float128_t >, uint64_t, uint64_t, uint64_t, uint64_t) const
 
void __negtf2 (legacy_ptr< float128_t >, uint64_t, uint64_t) const
 
void __extendsftf2 (legacy_ptr< float128_t >, float) const
 
void __extenddftf2 (legacy_ptr< float128_t >, double) const
 
double __trunctfdf2 (uint64_t, uint64_t) const
 
float __trunctfsf2 (uint64_t, uint64_t) const
 
int32_t __fixtfsi (uint64_t, uint64_t) const
 
int64_t __fixtfdi (uint64_t, uint64_t) const
 
void __fixtfti (legacy_ptr< int128_t >, uint64_t, uint64_t) const
 
uint32_t __fixunstfsi (uint64_t, uint64_t) const
 
uint64_t __fixunstfdi (uint64_t, uint64_t) const
 
void __fixunstfti (legacy_ptr< uint128_t >, uint64_t, uint64_t) const
 
void __fixsfti (legacy_ptr< int128_t >, float) const
 
void __fixdfti (legacy_ptr< int128_t >, double) const
 
void __fixunssfti (legacy_ptr< uint128_t >, float) const
 
void __fixunsdfti (legacy_ptr< uint128_t >, double) const
 
double __floatsidf (int32_t) const
 
void __floatsitf (legacy_ptr< float128_t >, int32_t) const
 
void __floatditf (legacy_ptr< float128_t >, uint64_t) const
 
void __floatunsitf (legacy_ptr< float128_t >, uint32_t) const
 
void __floatunditf (legacy_ptr< float128_t >, uint64_t) const
 
double __floattidf (uint64_t, uint64_t) const
 
double __floatuntidf (uint64_t, uint64_t) const
 
int32_t __cmptf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 
int32_t __eqtf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 
int32_t __netf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 
int32_t __getf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 
int32_t __gttf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 
int32_t __letf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 
int32_t __lttf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 
int32_t __unordtf2 (uint64_t, uint64_t, uint64_t, uint64_t) const
 

Detailed Description

Definition at line 13 of file interface.hpp.

Constructor & Destructor Documentation

◆ interface()

sysio::chain::webassembly::interface::interface ( apply_context & ctx)
inline

Definition at line 15 of file interface.hpp.

15: context(ctx) {}

Member Function Documentation

◆ __addtf3()

void sysio::chain::webassembly::interface::__addtf3 ( legacy_ptr< float128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 116 of file compiler_builtins.cpp.

116 {
117 float128_t a = {{ la, ha }};
118 float128_t b = {{ lb, hb }};
119 *ret = f128_add( a, b );
120 }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
float128_t f128_add(float128_t a, float128_t b)
Definition f128_add.c:43
CK_RV ret
Here is the call graph for this function:

◆ __ashlti3()

void sysio::chain::webassembly::interface::__ashlti3 ( legacy_ptr< int128_t > ret,
uint64_t low,
uint64_t high,
uint32_t shift ) const

Definition at line 10 of file compiler_builtins.cpp.

10 {
11 fc::uint128 i(high, low);
12 i <<= shift;
13 *ret = (unsigned __int128)i;
14 }
an implementation of 128 bit unsigned integer
Definition uint128.hpp:22

◆ __ashrti3()

void sysio::chain::webassembly::interface::__ashrti3 ( legacy_ptr< int128_t > ret,
uint64_t low,
uint64_t high,
uint32_t shift ) const

Definition at line 16 of file compiler_builtins.cpp.

16 {
17 // retain the signedness
18 *ret = high;
19 *ret <<= 64;
20 *ret |= low;
21 *ret >>= shift;
22 }

◆ __cmptf2()

int sysio::chain::webassembly::interface::__cmptf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 245 of file compiler_builtins.cpp.

245 {
246 return cmptf2_impl(*this, la, ha, lb, hb, 1);
247 }

◆ __divtf3()

void sysio::chain::webassembly::interface::__divtf3 ( legacy_ptr< float128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 131 of file compiler_builtins.cpp.

131 {
132 float128_t a = {{ la, ha }};
133 float128_t b = {{ lb, hb }};
134 *ret = f128_div( a, b );
135 }
float128_t f128_div(float128_t a, float128_t b)
Definition f128_div.c:44
Here is the call graph for this function:

◆ __divti3()

void sysio::chain::webassembly::interface::__divti3 ( legacy_ptr< int128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 36 of file compiler_builtins.cpp.

36 {
37 __int128 lhs = ha;
38 __int128 rhs = hb;
39
40 lhs <<= 64;
41 lhs |= la;
42
43 rhs <<= 64;
44 rhs |= lb;
45
46 SYS_ASSERT(rhs != 0, arithmetic_exception, "divide by zero");
47
48 lhs /= rhs;
49
50 *ret = lhs;
51 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7

◆ __eqtf2()

int sysio::chain::webassembly::interface::__eqtf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 227 of file compiler_builtins.cpp.

227 {
228 return cmptf2_impl(*this, la, ha, lb, hb, 1);
229 }

◆ __extenddftf2()

void sysio::chain::webassembly::interface::__extenddftf2 ( legacy_ptr< float128_t > ret,
double d ) const

Definition at line 144 of file compiler_builtins.cpp.

144 {
146 }
float128_t f64_to_f128(float64_t a)
Definition f64_to_f128.c:44
float64_t to_softfloat64(double d)
Here is the call graph for this function:

◆ __extendsftf2()

void sysio::chain::webassembly::interface::__extendsftf2 ( legacy_ptr< float128_t > ret,
float f ) const

Definition at line 141 of file compiler_builtins.cpp.

141 {
143 }
float128_t f32_to_f128(float32_t a)
Definition f32_to_f128.c:44
float32_t to_softfloat32(float f)
Here is the call graph for this function:

◆ __fixdfti()

void sysio::chain::webassembly::interface::__fixdfti ( legacy_ptr< int128_t > ret,
double a ) const

Definition at line 182 of file compiler_builtins.cpp.

182 {
184 }
__int128 ___fixdfti(uint64_t)
Definition fixdfti.c:16
Here is the call graph for this function:

◆ __fixsfti()

void sysio::chain::webassembly::interface::__fixsfti ( legacy_ptr< int128_t > ret,
float a ) const

Definition at line 179 of file compiler_builtins.cpp.

179 {
181 }
__int128 ___fixsfti(uint32_t)
Definition fixsfti.c:16
Here is the call graph for this function:

◆ __fixtfdi()

int64_t sysio::chain::webassembly::interface::__fixtfdi ( uint64_t l,
uint64_t h ) const

Definition at line 159 of file compiler_builtins.cpp.

159 {
160 float128_t f = {{ l, h }};
161 return f128_to_i64( f, 0, false );
162 }
int_fast64_t f128_to_i64(float128_t a, uint_fast8_t roundingMode, bool exact)
Definition f128_to_i64.c:44
int l
Here is the call graph for this function:

◆ __fixtfsi()

int32_t sysio::chain::webassembly::interface::__fixtfsi ( uint64_t l,
uint64_t h ) const

Definition at line 155 of file compiler_builtins.cpp.

155 {
156 float128_t f = {{ l, h }};
157 return f128_to_i32( f, 0, false );
158 }
int_fast32_t f128_to_i32(float128_t a, uint_fast8_t roundingMode, bool exact)
Definition f128_to_i32.c:44
Here is the call graph for this function:

◆ __fixtfti()

void sysio::chain::webassembly::interface::__fixtfti ( legacy_ptr< int128_t > ret,
uint64_t l,
uint64_t h ) const

Definition at line 163 of file compiler_builtins.cpp.

163 {
164 float128_t f = {{ l, h }};
165 *ret = ___fixtfti( f );
166 }
__int128 ___fixtfti(float128_t)
Definition fixtfti.c:13
Here is the call graph for this function:

◆ __fixunsdfti()

void sysio::chain::webassembly::interface::__fixunsdfti ( legacy_ptr< uint128_t > ret,
double a ) const

Definition at line 188 of file compiler_builtins.cpp.

188 {
190 }
unsigned __int128 ___fixunsdfti(uint64_t)
Definition fixunsdfti.c:15
Here is the call graph for this function:

◆ __fixunssfti()

void sysio::chain::webassembly::interface::__fixunssfti ( legacy_ptr< uint128_t > ret,
float a ) const

Definition at line 185 of file compiler_builtins.cpp.

185 {
187 }
unsigned __int128 ___fixunssfti(uint32_t)
Definition fixunssfti.c:19
Here is the call graph for this function:

◆ __fixunstfdi()

uint64_t sysio::chain::webassembly::interface::__fixunstfdi ( uint64_t l,
uint64_t h ) const

Definition at line 171 of file compiler_builtins.cpp.

171 {
172 float128_t f = {{ l, h }};
173 return f128_to_ui64( f, 0, false );
174 }
uint_fast64_t f128_to_ui64(float128_t a, uint_fast8_t roundingMode, bool exact)
Here is the call graph for this function:

◆ __fixunstfsi()

uint32_t sysio::chain::webassembly::interface::__fixunstfsi ( uint64_t l,
uint64_t h ) const

Definition at line 167 of file compiler_builtins.cpp.

167 {
168 float128_t f = {{ l, h }};
169 return f128_to_ui32( f, 0, false );
170 }
uint_fast32_t f128_to_ui32(float128_t a, uint_fast8_t roundingMode, bool exact)
Here is the call graph for this function:

◆ __fixunstfti()

void sysio::chain::webassembly::interface::__fixunstfti ( legacy_ptr< uint128_t > ret,
uint64_t l,
uint64_t h ) const

Definition at line 175 of file compiler_builtins.cpp.

175 {
176 float128_t f = {{ l, h }};
177 *ret = ___fixunstfti( f );
178 }
unsigned __int128 ___fixunstfti(float128_t)
Definition fixunstfti.c:18
Here is the call graph for this function:

◆ __floatditf()

void sysio::chain::webassembly::interface::__floatditf ( legacy_ptr< float128_t > ret,
uint64_t a ) const

Definition at line 197 of file compiler_builtins.cpp.

197 {
198 *ret = i64_to_f128( a );
199 }
float128_t i64_to_f128(int64_t a)
Definition i64_to_f128.c:42
Here is the call graph for this function:

◆ __floatsidf()

double sysio::chain::webassembly::interface::__floatsidf ( int32_t i) const

Definition at line 191 of file compiler_builtins.cpp.

191 {
192 return from_softfloat64(i32_to_f64(i));
193 }
float64_t i32_to_f64(int32_t a)
Definition i32_to_f64.c:43
double from_softfloat64(float64_t d)
Here is the call graph for this function:

◆ __floatsitf()

void sysio::chain::webassembly::interface::__floatsitf ( legacy_ptr< float128_t > ret,
int32_t i ) const

Definition at line 194 of file compiler_builtins.cpp.

194 {
195 *ret = i32_to_f128(i);
196 }
float128_t i32_to_f128(int32_t a)
Definition i32_to_f128.c:42
Here is the call graph for this function:

◆ __floattidf()

double sysio::chain::webassembly::interface::__floattidf ( uint64_t l,
uint64_t h ) const

Definition at line 206 of file compiler_builtins.cpp.

206 {
207 fc::uint128 v(h, l);
208 unsigned __int128 val = (unsigned __int128)v;
209 return ___floattidf( *(__int128*)&val );
210 }
double ___floattidf(__int128)
Definition floattidf.c:26
Here is the call graph for this function:

◆ __floatunditf()

void sysio::chain::webassembly::interface::__floatunditf ( legacy_ptr< float128_t > ret,
uint64_t a ) const

Definition at line 203 of file compiler_builtins.cpp.

203 {
204 *ret = ui64_to_f128( a );
205 }
float128_t ui64_to_f128(uint64_t)
Here is the call graph for this function:

◆ __floatunsitf()

void sysio::chain::webassembly::interface::__floatunsitf ( legacy_ptr< float128_t > ret,
uint32_t i ) const

Definition at line 200 of file compiler_builtins.cpp.

200 {
201 *ret = ui32_to_f128(i);
202 }
float128_t ui32_to_f128(uint32_t)
Here is the call graph for this function:

◆ __floatuntidf()

double sysio::chain::webassembly::interface::__floatuntidf ( uint64_t l,
uint64_t h ) const

Definition at line 211 of file compiler_builtins.cpp.

211 {
212 fc::uint128 v(h, l);
213 return ___floatuntidf( (unsigned __int128)v );
214 }
double ___floatuntidf(unsigned __int128)
Here is the call graph for this function:

◆ __getf2()

int sysio::chain::webassembly::interface::__getf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 233 of file compiler_builtins.cpp.

233 {
234 return cmptf2_impl(*this, la, ha, lb, hb, -1);
235 }

◆ __gttf2()

int sysio::chain::webassembly::interface::__gttf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 236 of file compiler_builtins.cpp.

236 {
237 return cmptf2_impl(*this, la, ha, lb, hb, 0);
238 }

◆ __letf2()

int sysio::chain::webassembly::interface::__letf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 239 of file compiler_builtins.cpp.

239 {
240 return cmptf2_impl(*this, la, ha, lb, hb, 1);
241 }

◆ __lshlti3()

void sysio::chain::webassembly::interface::__lshlti3 ( legacy_ptr< int128_t > ret,
uint64_t low,
uint64_t high,
uint32_t shift ) const

Definition at line 24 of file compiler_builtins.cpp.

24 {
25 fc::uint128 i(high, low);
26 i <<= shift;
27 *ret = (unsigned __int128)i;
28 }

◆ __lshrti3()

void sysio::chain::webassembly::interface::__lshrti3 ( legacy_ptr< int128_t > ret,
uint64_t low,
uint64_t high,
uint32_t shift ) const

Definition at line 30 of file compiler_builtins.cpp.

30 {
31 fc::uint128 i(high, low);
32 i >>= shift;
33 *ret = (unsigned __int128)i;
34 }

◆ __lttf2()

int sysio::chain::webassembly::interface::__lttf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 242 of file compiler_builtins.cpp.

242 {
243 return cmptf2_impl(*this, la, ha, lb, hb, 0);
244 }

◆ __modti3()

void sysio::chain::webassembly::interface::__modti3 ( legacy_ptr< int128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 83 of file compiler_builtins.cpp.

83 {
84 __int128 lhs = ha;
85 __int128 rhs = hb;
86
87 lhs <<= 64;
88 lhs |= la;
89
90 rhs <<= 64;
91 rhs |= lb;
92
93 SYS_ASSERT(rhs != 0, arithmetic_exception, "divide by zero");
94
95 lhs %= rhs;
96 *ret = lhs;
97 }

◆ __multf3()

void sysio::chain::webassembly::interface::__multf3 ( legacy_ptr< float128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 126 of file compiler_builtins.cpp.

126 {
127 float128_t a = {{ la, ha }};
128 float128_t b = {{ lb, hb }};
129 *ret = f128_mul( a, b );
130 }
float128_t f128_mul(float128_t a, float128_t b)
Definition f128_mul.c:44
Here is the call graph for this function:

◆ __multi3()

void sysio::chain::webassembly::interface::__multi3 ( legacy_ptr< int128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 69 of file compiler_builtins.cpp.

69 {
70 __int128 lhs = ha;
71 __int128 rhs = hb;
72
73 lhs <<= 64;
74 lhs |= la;
75
76 rhs <<= 64;
77 rhs |= lb;
78
79 lhs *= rhs;
80 *ret = lhs;
81 }

◆ __negtf2()

void sysio::chain::webassembly::interface::__negtf2 ( legacy_ptr< float128_t > ret,
uint64_t la,
uint64_t ha ) const

Definition at line 136 of file compiler_builtins.cpp.

136 {
137 *ret = {{ la, (ha ^ (uint64_t)1 << 63) }};
138 }
unsigned __int64 uint64_t
Definition stdint.h:136

◆ __netf2()

int sysio::chain::webassembly::interface::__netf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 230 of file compiler_builtins.cpp.

230 {
231 return cmptf2_impl(*this, la, ha, lb, hb, 1);
232 }

◆ __subtf3()

void sysio::chain::webassembly::interface::__subtf3 ( legacy_ptr< float128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 121 of file compiler_builtins.cpp.

121 {
122 float128_t a = {{ la, ha }};
123 float128_t b = {{ lb, hb }};
124 *ret = f128_sub( a, b );
125 }
float128_t f128_sub(float128_t a, float128_t b)
Definition f128_sub.c:43
Here is the call graph for this function:

◆ __trunctfdf2()

double sysio::chain::webassembly::interface::__trunctfdf2 ( uint64_t l,
uint64_t h ) const

Definition at line 147 of file compiler_builtins.cpp.

147 {
148 float128_t f = {{ l, h }};
149 return from_softfloat64(f128_to_f64( f ));
150 }
float64_t f128_to_f64(float128_t a)
Definition f128_to_f64.c:44
Here is the call graph for this function:

◆ __trunctfsf2()

float sysio::chain::webassembly::interface::__trunctfsf2 ( uint64_t l,
uint64_t h ) const

Definition at line 151 of file compiler_builtins.cpp.

151 {
152 float128_t f = {{ l, h }};
153 return from_softfloat32(f128_to_f32( f ));
154 }
float32_t f128_to_f32(float128_t a)
Definition f128_to_f32.c:44
float from_softfloat32(float32_t f)
Here is the call graph for this function:

◆ __udivti3()

void sysio::chain::webassembly::interface::__udivti3 ( legacy_ptr< uint128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 53 of file compiler_builtins.cpp.

53 {
54 unsigned __int128 lhs = ha;
55 unsigned __int128 rhs = hb;
56
57 lhs <<= 64;
58 lhs |= la;
59
60 rhs <<= 64;
61 rhs |= lb;
62
63 SYS_ASSERT(rhs != 0, arithmetic_exception, "divide by zero");
64
65 lhs /= rhs;
66 *ret = lhs;
67 }

◆ __umodti3()

void sysio::chain::webassembly::interface::__umodti3 ( legacy_ptr< uint128_t > ret,
uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 99 of file compiler_builtins.cpp.

99 {
100 unsigned __int128 lhs = ha;
101 unsigned __int128 rhs = hb;
102
103 lhs <<= 64;
104 lhs |= la;
105
106 rhs <<= 64;
107 rhs |= lb;
108
109 SYS_ASSERT(rhs != 0, arithmetic_exception, "divide by zero");
110
111 lhs %= rhs;
112 *ret = lhs;
113 }

◆ __unordtf2()

int sysio::chain::webassembly::interface::__unordtf2 ( uint64_t la,
uint64_t ha,
uint64_t lb,
uint64_t hb ) const

Definition at line 248 of file compiler_builtins.cpp.

248 {
249 float128_t a = {{ la, ha }};
250 float128_t b = {{ lb, hb }};
251 if ( f128_is_nan(a) || f128_is_nan(b) )
252 return 1;
253 return 0;
254 }
bool f128_is_nan(const float128_t &f)
Here is the call graph for this function:

◆ _sysio_f32_abs()

float sysio::chain::webassembly::interface::_sysio_f32_abs ( float af) const

Definition at line 71 of file softfloat.cpp.

71 {
73 a.v &= ~(1 << 31);
74 return from_softfloat32(a);
75 }
Here is the call graph for this function:

◆ _sysio_f32_add()

float sysio::chain::webassembly::interface::_sysio_f32_add ( float a,
float b ) const

Definition at line 10 of file softfloat.cpp.

10 {
12 float ret;
13 std::memcpy((char*)&ret, (char*)&r, sizeof(ret));
14 return ret;
15 }
const mie::Vuint & r
Definition bn.cpp:28
float32_t f32_add(float32_t a, float32_t b)
Definition f32_add.c:43
Here is the call graph for this function:

◆ _sysio_f32_ceil()

float sysio::chain::webassembly::interface::_sysio_f32_ceil ( float af) const

Definition at line 88 of file softfloat.cpp.

88 {
90 int e = (int)(a.v >> 23 & 0xFF) - 0X7F;
91 uint32_t m;
92 if (e >= 23)
93 return af;
94 if (e >= 0) {
95 m = 0x007FFFFF >> e;
96 if ((a.v & m) == 0)
97 return af;
98 if (a.v >> 31 == 0)
99 a.v += m;
100 a.v &= ~m;
101 } else {
102 if (a.v >> 31)
103 a.v = 0x80000000; // return -0.0f
104 else if (a.v << 1)
105 a.v = 0x3F800000; // return 1.0f
106 }
107
108 return from_softfloat32(a);
109 }
unsigned int uint32_t
Definition stdint.h:126
Here is the call graph for this function:

◆ _sysio_f32_copysign()

float sysio::chain::webassembly::interface::_sysio_f32_copysign ( float af,
float bf ) const

Definition at line 62 of file softfloat.cpp.

62 {
65 uint32_t sign_of_b = b.v >> 31;
66 a.v &= ~(1 << 31); // clear the sign bit
67 a.v = a.v | (sign_of_b << 31); // add the sign of b
68 return from_softfloat32(a);
69 }
Here is the call graph for this function:

◆ _sysio_f32_div()

float sysio::chain::webassembly::interface::_sysio_f32_div ( float a,
float b ) const

Definition at line 22 of file softfloat.cpp.

22 {
24 float ret;
25 std::memcpy((char*)&ret, (char*)&r, sizeof(ret));
26 return ret;
27 }
float32_t f32_div(float32_t a, float32_t b)
Definition f32_div.c:44
Here is the call graph for this function:

◆ _sysio_f32_eq()

bool sysio::chain::webassembly::interface::_sysio_f32_eq ( float a,
float b ) const

Definition at line 162 of file softfloat.cpp.

162{ return ::f32_eq( to_softfloat32(a), to_softfloat32(b) ); }
Here is the call graph for this function:

◆ _sysio_f32_floor()

float sysio::chain::webassembly::interface::_sysio_f32_floor ( float af) const

Definition at line 110 of file softfloat.cpp.

110 {
112 int e = (int)(a.v >> 23 & 0xFF) - 0X7F;
113 uint32_t m;
114 if (e >= 23)
115 return af;
116 if (e >= 0) {
117 m = 0x007FFFFF >> e;
118 if ((a.v & m) == 0)
119 return af;
120 if (a.v >> 31)
121 a.v += m;
122 a.v &= ~m;
123 } else {
124 if (a.v >> 31 == 0)
125 a.v = 0;
126 else if (a.v << 1)
127 a.v = 0xBF800000; // return -1.0f
128 }
129 return from_softfloat32(a);
130 }
Here is the call graph for this function:

◆ _sysio_f32_ge()

bool sysio::chain::webassembly::interface::_sysio_f32_ge ( float af,
float bf ) const

Definition at line 175 of file softfloat.cpp.

175 {
178 if (is_nan(a))
179 return false;
180 if (is_nan(b))
181 return false;
182 return !::f32_lt( a, b );
183 }
bool f32_lt(float32_t a, float32_t b)
Definition f32_lt.c:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f32_gt()

bool sysio::chain::webassembly::interface::_sysio_f32_gt ( float af,
float bf ) const

Definition at line 166 of file softfloat.cpp.

166 {
169 if (is_nan(a))
170 return false;
171 if (is_nan(b))
172 return false;
173 return !::f32_le( a, b );
174 }
bool f32_le(float32_t a, float32_t b)
Definition f32_le.c:43
Here is the call graph for this function:

◆ _sysio_f32_le()

bool sysio::chain::webassembly::interface::_sysio_f32_le ( float a,
float b ) const

Definition at line 165 of file softfloat.cpp.

165{ return ::f32_le( to_softfloat32(a), to_softfloat32(b) ); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f32_lt()

bool sysio::chain::webassembly::interface::_sysio_f32_lt ( float a,
float b ) const

Definition at line 164 of file softfloat.cpp.

164{ return ::f32_lt( to_softfloat32(a), to_softfloat32(b) ); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f32_max()

float sysio::chain::webassembly::interface::_sysio_f32_max ( float af,
float bf ) const

Definition at line 48 of file softfloat.cpp.

48 {
51 if (is_nan(a)) {
52 return af;
53 }
54 if (is_nan(b)) {
55 return bf;
56 }
57 if ( f32_sign_bit(a) != f32_sign_bit(b) ) {
58 return f32_sign_bit(a) ? bf : af;
59 }
60 return ::f32_lt( a, b ) ? bf : af;
61 }
bool f32_sign_bit(float32_t f)
Here is the call graph for this function:

◆ _sysio_f32_min()

float sysio::chain::webassembly::interface::_sysio_f32_min ( float af,
float bf ) const

Definition at line 34 of file softfloat.cpp.

34 {
37 if (is_nan(a)) {
38 return af;
39 }
40 if (is_nan(b)) {
41 return bf;
42 }
43 if ( f32_sign_bit(a) != f32_sign_bit(b) ) {
44 return f32_sign_bit(a) ? af : bf;
45 }
46 return ::f32_lt(a,b) ? af : bf;
47 }
Here is the call graph for this function:

◆ _sysio_f32_mul()

float sysio::chain::webassembly::interface::_sysio_f32_mul ( float a,
float b ) const

Definition at line 28 of file softfloat.cpp.

28 {
30 float ret;
31 std::memcpy((char*)&ret, (char*)&r, sizeof(ret));
32 return ret;
33 }
float32_t f32_mul(float32_t a, float32_t b)
Definition f32_mul.c:44
Here is the call graph for this function:

◆ _sysio_f32_ne()

bool sysio::chain::webassembly::interface::_sysio_f32_ne ( float a,
float b ) const

Definition at line 163 of file softfloat.cpp.

163{ return !::f32_eq( to_softfloat32(a), to_softfloat32(b) ); }
bool f32_eq(float32_t a, float32_t b)
Definition f32_eq.c:44
Here is the call graph for this function:

◆ _sysio_f32_nearest()

float sysio::chain::webassembly::interface::_sysio_f32_nearest ( float af) const

Definition at line 145 of file softfloat.cpp.

145 {
147 int e = a.v>>23 & 0xff;
148 int s = a.v>>31;
149 float32_t y;
150 if (e >= 0x7f+23)
151 return af;
152 if (s)
153 y = ::f32_add( ::f32_sub( a, float32_t{inv_float_eps} ), float32_t{inv_float_eps} );
154 else
155 y = ::f32_sub( ::f32_add( a, float32_t{inv_float_eps} ), float32_t{inv_float_eps} );
156 if (::f32_eq( y, {0} ) )
157 return s ? -0.0f : 0.0f;
158 return from_softfloat32(y);
159 }
uint64_t y
Definition sha3.cpp:34
float32_t f32_sub(float32_t a, float32_t b)
Definition f32_sub.c:43
char * s
Here is the call graph for this function:

◆ _sysio_f32_neg()

float sysio::chain::webassembly::interface::_sysio_f32_neg ( float af) const

Definition at line 76 of file softfloat.cpp.

76 {
78 uint32_t sign = a.v >> 31;
79 a.v &= ~(1 << 31);
80 a.v |= (!sign << 31);
81 return from_softfloat32(a);
82 }
Here is the call graph for this function:

◆ _sysio_f32_promote()

double sysio::chain::webassembly::interface::_sysio_f32_promote ( float a) const

Definition at line 355 of file softfloat.cpp.

355 {
357 }
float64_t f32_to_f64(float32_t a)
Definition f32_to_f64.c:44
Here is the call graph for this function:

◆ _sysio_f32_sqrt()

float sysio::chain::webassembly::interface::_sysio_f32_sqrt ( float a) const

Definition at line 83 of file softfloat.cpp.

83 {
85 return from_softfloat32(ret);
86 }
float32_t f32_sqrt(float32_t a)
Definition f32_sqrt.c:44
Here is the call graph for this function:

◆ _sysio_f32_sub()

float sysio::chain::webassembly::interface::_sysio_f32_sub ( float a,
float b ) const

Definition at line 16 of file softfloat.cpp.

16 {
18 float ret;
19 std::memcpy((char*)&ret, (char*)&r, sizeof(ret));
20 return ret;
21 }
Here is the call graph for this function:

◆ _sysio_f32_trunc()

float sysio::chain::webassembly::interface::_sysio_f32_trunc ( float af) const

Definition at line 131 of file softfloat.cpp.

131 {
133 int e = (int)(a.v >> 23 & 0xff) - 0x7f + 9;
134 uint32_t m;
135 if (e >= 23 + 9)
136 return af;
137 if (e < 9)
138 e = 1;
139 m = -1U >> e;
140 if ((a.v & m) == 0)
141 return af;
142 a.v &= ~m;
143 return from_softfloat32(a);
144 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f32_trunc_i32s()

int32_t sysio::chain::webassembly::interface::_sysio_f32_trunc_i32s ( float af) const

Definition at line 361 of file softfloat.cpp.

361 {
363 if (_sysio_f32_ge(af, 2147483648.0f) || _sysio_f32_lt(af, -2147483648.0f))
364 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_s/i32 overflow" );
365
366 if (is_nan(a))
367 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_s/i32 unrepresentable");
368 return f32_to_i32( to_softfloat32(_sysio_f32_trunc( af )), 0, false );
369 }
bool _sysio_f32_lt(float, float) const
bool _sysio_f32_ge(float, float) const
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
int_fast32_t f32_to_i32(float32_t a, uint_fast8_t roundingMode, bool exact)
Definition f32_to_i32.c:44
Here is the call graph for this function:

◆ _sysio_f32_trunc_i32u()

uint32_t sysio::chain::webassembly::interface::_sysio_f32_trunc_i32u ( float af) const

Definition at line 378 of file softfloat.cpp.

378 {
380 if (_sysio_f32_ge(af, 4294967296.0f) || _sysio_f32_le(af, -1.0f))
381 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_u/i32 overflow");
382 if (is_nan(a))
383 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_u/i32 unrepresentable");
384 return f32_to_ui32( to_softfloat32(_sysio_f32_trunc( af )), 0, false );
385 }
bool _sysio_f32_le(float, float) const
uint_fast32_t f32_to_ui32(float32_t a, uint_fast8_t roundingMode, bool exact)
Definition f32_to_ui32.c:44
Here is the call graph for this function:

◆ _sysio_f32_trunc_i64s()

int64_t sysio::chain::webassembly::interface::_sysio_f32_trunc_i64s ( float af) const

Definition at line 394 of file softfloat.cpp.

394 {
396 if (_sysio_f32_ge(af, 9223372036854775808.0f) || _sysio_f32_lt(af, -9223372036854775808.0f))
397 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_s/i64 overflow");
398 if (is_nan(a))
399 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_s/i64 unrepresentable");
400 return f32_to_i64( to_softfloat32(_sysio_f32_trunc( af )), 0, false );
401 }
int_fast64_t f32_to_i64(float32_t a, uint_fast8_t roundingMode, bool exact)
Definition f32_to_i64.c:44
Here is the call graph for this function:

◆ _sysio_f32_trunc_i64u()

uint64_t sysio::chain::webassembly::interface::_sysio_f32_trunc_i64u ( float af) const

Definition at line 411 of file softfloat.cpp.

411 {
413 if (_sysio_f32_ge(af, 18446744073709551616.0f) || _sysio_f32_le(af, -1.0f))
414 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_u/i64 overflow");
415 if (is_nan(a))
416 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f32.convert_u/i64 unrepresentable");
417 return f32_to_ui64( to_softfloat32(_sysio_f32_trunc( af )), 0, false );
418 }
uint_fast64_t f32_to_ui64(float32_t a, uint_fast8_t roundingMode, bool exact)
Definition f32_to_ui64.c:44
Here is the call graph for this function:

◆ _sysio_f64_abs()

double sysio::chain::webassembly::interface::_sysio_f64_abs ( double af) const

Definition at line 234 of file softfloat.cpp.

234 {
236 a.v &= ~(uint64_t(1) << 63);
237 return from_softfloat64(a);
238 }
Here is the call graph for this function:

◆ _sysio_f64_add()

double sysio::chain::webassembly::interface::_sysio_f64_add ( double a,
double b ) const

Definition at line 186 of file softfloat.cpp.

186 {
188 return from_softfloat64(ret);
189 }
float64_t f64_add(float64_t a, float64_t b)
Definition f64_add.c:43
Here is the call graph for this function:

◆ _sysio_f64_ceil()

double sysio::chain::webassembly::interface::_sysio_f64_ceil ( double af) const

Definition at line 251 of file softfloat.cpp.

251 {
252 float64_t a = to_softfloat64( af );
254 int e = a.v >> 52 & 0x7ff;
255 float64_t y;
256 if (e >= 0x3ff+52 || ::f64_eq( a, { 0 } ))
257 return af;
258 /* y = int(x) - x, where int(x) is an integer neighbor of x */
259 if (a.v >> 63)
260 y = ::f64_sub( ::f64_add( ::f64_sub( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
261 else
262 y = ::f64_sub( ::f64_sub( ::f64_add( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
263 /* special case because of non-nearest rounding modes */
264 if (e <= 0x3ff-1) {
265 return a.v >> 63 ? -0.0 : 1.0; //float64_t{0x8000000000000000} : float64_t{0xBE99999A3F800000}; //either -0.0 or 1
266 }
267 if (::f64_lt( y, to_softfloat64(0) )) {
268 ret = ::f64_add( ::f64_add( a, y ), to_softfloat64(1) ); // 0xBE99999A3F800000 } ); // plus 1
269 return from_softfloat64(ret);
270 }
271 ret = ::f64_add( a, y );
272 return from_softfloat64(ret);
273 }
bool f64_eq(float64_t a, float64_t b)
Definition f64_eq.c:44
bool f64_lt(float64_t a, float64_t b)
Definition f64_lt.c:43
float64_t f64_sub(float64_t a, float64_t b)
Definition f64_sub.c:43
Here is the call graph for this function:

◆ _sysio_f64_copysign()

double sysio::chain::webassembly::interface::_sysio_f64_copysign ( double af,
double bf ) const

Definition at line 224 of file softfloat.cpp.

224 {
227 uint64_t sign_of_b = b.v >> 63;
228 a.v &= ~(uint64_t(1) << 63); // clear the sign bit
229 a.v = a.v | (sign_of_b << 63); // add the sign of b
230 return from_softfloat64(a);
231 }
Here is the call graph for this function:

◆ _sysio_f64_demote()

float sysio::chain::webassembly::interface::_sysio_f64_demote ( double a) const

Definition at line 358 of file softfloat.cpp.

358 {
360 }
float32_t f64_to_f32(float64_t a)
Definition f64_to_f32.c:44
Here is the call graph for this function:

◆ _sysio_f64_div()

double sysio::chain::webassembly::interface::_sysio_f64_div ( double a,
double b ) const

Definition at line 194 of file softfloat.cpp.

194 {
196 return from_softfloat64(ret);
197 }
float64_t f64_div(float64_t a, float64_t b)
Definition f64_div.c:44
Here is the call graph for this function:

◆ _sysio_f64_eq()

bool sysio::chain::webassembly::interface::_sysio_f64_eq ( double a,
double b ) const

Definition at line 331 of file softfloat.cpp.

331{ return ::f64_eq( to_softfloat64(a), to_softfloat64(b) ); }
Here is the call graph for this function:

◆ _sysio_f64_floor()

double sysio::chain::webassembly::interface::_sysio_f64_floor ( double af) const

Definition at line 274 of file softfloat.cpp.

274 {
275 float64_t a = to_softfloat64( af );
277 int e = a.v >> 52 & 0x7FF;
278 float64_t y;
279 if ( a.v == 0x8000000000000000) {
280 return af;
281 }
282 if (e >= 0x3FF+52 || a.v == 0) {
283 return af;
284 }
285 if (a.v >> 63)
286 y = ::f64_sub( ::f64_add( ::f64_sub( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
287 else
288 y = ::f64_sub( ::f64_sub( ::f64_add( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} ), a );
289 if (e <= 0x3FF-1) {
290 return a.v>>63 ? -1.0 : 0.0; //float64_t{0xBFF0000000000000} : float64_t{0}; // -1 or 0
291 }
292 if ( !::f64_le( y, float64_t{0} ) ) {
294 return from_softfloat64(ret);
295 }
296 ret = ::f64_add( a, y );
297 return from_softfloat64(ret);
298 }
bool f64_le(float64_t a, float64_t b)
Definition f64_le.c:43
Here is the call graph for this function:

◆ _sysio_f64_ge()

bool sysio::chain::webassembly::interface::_sysio_f64_ge ( double af,
double bf ) const

Definition at line 344 of file softfloat.cpp.

344 {
347 if (is_nan(a))
348 return false;
349 if (is_nan(b))
350 return false;
351 return !::f64_lt( a, b );
352 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f64_gt()

bool sysio::chain::webassembly::interface::_sysio_f64_gt ( double af,
double bf ) const

Definition at line 335 of file softfloat.cpp.

335 {
338 if (is_nan(a))
339 return false;
340 if (is_nan(b))
341 return false;
342 return !::f64_le( a, b );
343 }
Here is the call graph for this function:

◆ _sysio_f64_le()

bool sysio::chain::webassembly::interface::_sysio_f64_le ( double a,
double b ) const

Definition at line 334 of file softfloat.cpp.

334{ return ::f64_le( to_softfloat64(a), to_softfloat64(b) ); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f64_lt()

bool sysio::chain::webassembly::interface::_sysio_f64_lt ( double a,
double b ) const

Definition at line 333 of file softfloat.cpp.

333{ return ::f64_lt( to_softfloat64(a), to_softfloat64(b) ); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f64_max()

double sysio::chain::webassembly::interface::_sysio_f64_max ( double af,
double bf ) const

Definition at line 213 of file softfloat.cpp.

213 {
216 if (is_nan(a))
217 return af;
218 if (is_nan(b))
219 return bf;
220 if (f64_sign_bit(a) != f64_sign_bit(b))
221 return f64_sign_bit(a) ? bf : af;
222 return ::f64_lt( a, b ) ? bf : af;
223 }
bool f64_sign_bit(float64_t f)
Here is the call graph for this function:

◆ _sysio_f64_min()

double sysio::chain::webassembly::interface::_sysio_f64_min ( double af,
double bf ) const

Definition at line 202 of file softfloat.cpp.

202 {
205 if (is_nan(a))
206 return af;
207 if (is_nan(b))
208 return bf;
209 if (f64_sign_bit(a) != f64_sign_bit(b))
210 return f64_sign_bit(a) ? af : bf;
211 return ::f64_lt( a, b ) ? af : bf;
212 }
Here is the call graph for this function:

◆ _sysio_f64_mul()

double sysio::chain::webassembly::interface::_sysio_f64_mul ( double a,
double b ) const

Definition at line 198 of file softfloat.cpp.

198 {
200 return from_softfloat64(ret);
201 }
float64_t f64_mul(float64_t a, float64_t b)
Definition f64_mul.c:44
Here is the call graph for this function:

◆ _sysio_f64_ne()

bool sysio::chain::webassembly::interface::_sysio_f64_ne ( double a,
double b ) const

Definition at line 332 of file softfloat.cpp.

332{ return !::f64_eq( to_softfloat64(a), to_softfloat64(b) ); }
Here is the call graph for this function:

◆ _sysio_f64_nearest()

double sysio::chain::webassembly::interface::_sysio_f64_nearest ( double af) const

Definition at line 314 of file softfloat.cpp.

314 {
315 float64_t a = to_softfloat64( af );
316 int e = (a.v >> 52 & 0x7FF);
317 int s = a.v >> 63;
318 float64_t y;
319 if ( e >= 0x3FF+52 )
320 return af;
321 if ( s )
322 y = ::f64_add( ::f64_sub( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} );
323 else
324 y = ::f64_sub( ::f64_add( a, float64_t{inv_double_eps} ), float64_t{inv_double_eps} );
325 if ( ::f64_eq( y, float64_t{0} ) )
326 return s ? -0.0 : 0.0;
327 return from_softfloat64(y);
328 }
Here is the call graph for this function:

◆ _sysio_f64_neg()

double sysio::chain::webassembly::interface::_sysio_f64_neg ( double af) const

Definition at line 239 of file softfloat.cpp.

239 {
241 uint64_t sign = a.v >> 63;
242 a.v &= ~(uint64_t(1) << 63);
243 a.v |= (uint64_t(!sign) << 63);
244 return from_softfloat64(a);
245 }
Here is the call graph for this function:

◆ _sysio_f64_sqrt()

double sysio::chain::webassembly::interface::_sysio_f64_sqrt ( double a) const

Definition at line 246 of file softfloat.cpp.

246 {
248 return from_softfloat64(ret);
249 }
float64_t f64_sqrt(float64_t a)
Definition f64_sqrt.c:44
Here is the call graph for this function:

◆ _sysio_f64_sub()

double sysio::chain::webassembly::interface::_sysio_f64_sub ( double a,
double b ) const

Definition at line 190 of file softfloat.cpp.

190 {
192 return from_softfloat64(ret);
193 }
Here is the call graph for this function:

◆ _sysio_f64_trunc()

double sysio::chain::webassembly::interface::_sysio_f64_trunc ( double af) const

Definition at line 299 of file softfloat.cpp.

299 {
300 float64_t a = to_softfloat64( af );
301 int e = (int)(a.v >> 52 & 0x7ff) - 0x3ff + 12;
302 uint64_t m;
303 if (e >= 52 + 12)
304 return af;
305 if (e < 12)
306 e = 1;
307 m = -1ULL >> e;
308 if ((a.v & m) == 0)
309 return af;
310 a.v &= ~m;
311 return from_softfloat64(a);
312 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _sysio_f64_trunc_i32s()

int32_t sysio::chain::webassembly::interface::_sysio_f64_trunc_i32s ( double af) const

Definition at line 370 of file softfloat.cpp.

370 {
372 if (_sysio_f64_ge(af, 2147483648.0) || _sysio_f64_lt(af, -2147483648.0))
373 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_s/i32 overflow");
374 if (is_nan(a))
375 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_s/i32 unrepresentable");
376 return f64_to_i32( to_softfloat64(_sysio_f64_trunc( af )), 0, false );
377 }
bool _sysio_f64_ge(double, double) const
bool _sysio_f64_lt(double, double) const
double _sysio_f64_trunc(double) const
int_fast32_t f64_to_i32(float64_t a, uint_fast8_t roundingMode, bool exact)
Definition f64_to_i32.c:44
Here is the call graph for this function:

◆ _sysio_f64_trunc_i32u()

uint32_t sysio::chain::webassembly::interface::_sysio_f64_trunc_i32u ( double af) const

Definition at line 386 of file softfloat.cpp.

386 {
388 if (_sysio_f64_ge(af, 4294967296.0) || _sysio_f64_le(af, -1.0))
389 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_u/i32 overflow");
390 if (is_nan(a))
391 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_u/i32 unrepresentable");
392 return f64_to_ui32( to_softfloat64(_sysio_f64_trunc( af )), 0, false );
393 }
bool _sysio_f64_le(double, double) const
uint_fast32_t f64_to_ui32(float64_t a, uint_fast8_t roundingMode, bool exact)
Definition f64_to_ui32.c:44
Here is the call graph for this function:

◆ _sysio_f64_trunc_i64s()

int64_t sysio::chain::webassembly::interface::_sysio_f64_trunc_i64s ( double af) const

Definition at line 402 of file softfloat.cpp.

402 {
404 if (_sysio_f64_ge(af, 9223372036854775808.0) || _sysio_f64_lt(af, -9223372036854775808.0))
405 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_s/i64 overflow");
406 if (is_nan(a))
407 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_s/i64 unrepresentable");
408
409 return f64_to_i64( to_softfloat64(_sysio_f64_trunc( af )), 0, false );
410 }
int_fast64_t f64_to_i64(float64_t a, uint_fast8_t roundingMode, bool exact)
Definition f64_to_i64.c:44
Here is the call graph for this function:

◆ _sysio_f64_trunc_i64u()

uint64_t sysio::chain::webassembly::interface::_sysio_f64_trunc_i64u ( double af) const

Definition at line 419 of file softfloat.cpp.

419 {
421 if (_sysio_f64_ge(af, 18446744073709551616.0) || _sysio_f64_le(af, -1.0))
422 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_u/i64 overflow");
423 if (is_nan(a))
424 FC_THROW_EXCEPTION( sysio::chain::wasm_execution_error, "Error, f64.convert_u/i64 unrepresentable");
425 return f64_to_ui64( to_softfloat64(_sysio_f64_trunc( af )), 0, false );
426 }
uint_fast64_t f64_to_ui64(float64_t a, uint_fast8_t roundingMode, bool exact)
Definition f64_to_ui64.c:44
Here is the call graph for this function:

◆ _sysio_i32_to_f32()

float sysio::chain::webassembly::interface::_sysio_i32_to_f32 ( int32_t a) const

Definition at line 427 of file softfloat.cpp.

427 {
428 return from_softfloat32(i32_to_f32( a ));
429 }
float32_t i32_to_f32(int32_t a)
Definition i32_to_f32.c:43
Here is the call graph for this function:

◆ _sysio_i32_to_f64()

double sysio::chain::webassembly::interface::_sysio_i32_to_f64 ( int32_t a) const

Definition at line 439 of file softfloat.cpp.

439 {
440 return from_softfloat64(i32_to_f64( a ));
441 }
Here is the call graph for this function:

◆ _sysio_i64_to_f32()

float sysio::chain::webassembly::interface::_sysio_i64_to_f32 ( int64_t a) const

Definition at line 430 of file softfloat.cpp.

430 {
431 return from_softfloat32(i64_to_f32( a ));
432 }
float32_t i64_to_f32(int64_t a)
Definition i64_to_f32.c:43
Here is the call graph for this function:

◆ _sysio_i64_to_f64()

double sysio::chain::webassembly::interface::_sysio_i64_to_f64 ( int64_t a) const

Definition at line 442 of file softfloat.cpp.

442 {
443 return from_softfloat64(i64_to_f64( a ));
444 }
float64_t i64_to_f64(int64_t a)
Definition i64_to_f64.c:43
Here is the call graph for this function:

◆ _sysio_ui32_to_f32()

float sysio::chain::webassembly::interface::_sysio_ui32_to_f32 ( uint32_t a) const

Definition at line 433 of file softfloat.cpp.

433 {
434 return from_softfloat32(ui32_to_f32( a ));
435 }
float32_t ui32_to_f32(uint32_t)
Definition ui32_to_f32.c:42
Here is the call graph for this function:

◆ _sysio_ui32_to_f64()

double sysio::chain::webassembly::interface::_sysio_ui32_to_f64 ( uint32_t a) const

Definition at line 445 of file softfloat.cpp.

445 {
446 return from_softfloat64(ui32_to_f64( a ));
447 }
float64_t ui32_to_f64(uint32_t)
Definition ui32_to_f64.c:42
Here is the call graph for this function:

◆ _sysio_ui64_to_f32()

float sysio::chain::webassembly::interface::_sysio_ui64_to_f32 ( uint64_t a) const

Definition at line 436 of file softfloat.cpp.

436 {
437 return from_softfloat32(ui64_to_f32( a ));
438 }
float32_t ui64_to_f32(uint64_t)
Definition ui64_to_f32.c:42
Here is the call graph for this function:

◆ _sysio_ui64_to_f64()

double sysio::chain::webassembly::interface::_sysio_ui64_to_f64 ( uint64_t a) const

Definition at line 448 of file softfloat.cpp.

448 {
449 return from_softfloat64(ui64_to_f64( a ));
450 }
float64_t ui64_to_f64(uint64_t)
Definition ui64_to_f64.c:42
Here is the call graph for this function:

◆ abort()

void sysio::chain::webassembly::interface::abort ( ) const

Aborts processing of this action and unwinds all pending changes.

Definition at line 6 of file cf_system.cpp.

6 {
7 SYS_ASSERT( false, abort_called, "abort() called" );
8 }

◆ action_data_size()

int32_t sysio::chain::webassembly::interface::action_data_size ( ) const

Get the length of the current action's data field. This method is useful for dynamically sized actions.

Returns
the length of the current action's data field

Definition at line 16 of file action.cpp.

16 {
17 return context.get_action().data.size();
18 }

◆ activate_feature()

void sysio::chain::webassembly::interface::activate_feature ( int64_t feature_name) const

Activate a a consensus protocol upgrade.

Parameters
feature_name- 256-bit digest representing the feature to activate.
Deprecated

Definition at line 15 of file privileged.cpp.

15 {
16 SYS_ASSERT( false, unsupported_feature, "Unsupported Hardfork Detected" );
17 }

◆ alt_bn128_add()

int32_t sysio::chain::webassembly::interface::alt_bn128_add ( span< const char > op1,
span< const char > op2,
span< char > result ) const

Host function for addition on the elliptic curve alt_bn128

Parameters
op1- a span containing the first operand G1 point.
op2- a span containing the second operand G1 point.
[out]result- the result op1 + op2.
Returns
-1 if there was an error 0 otherwise

Definition at line 119 of file crypto.cpp.

119 {
120 bytes bop1(op1.data(), op1.data() + op1.size());
121 bytes bop2(op2.data(), op2.data() + op2.size());
122
123 auto maybe_err = fc::alt_bn128_add(bop1, bop2);
124 if(std::holds_alternative<fc::alt_bn128_error>(maybe_err)) {
126 }
127
128 const auto& res = std::get<bytes>(maybe_err);
129
130 if( result.size() < res.size() )
132
133 std::memcpy( result.data(), res.data(), res.size() );
135 }
std::variant< alt_bn128_error, bytes > alt_bn128_add(const bytes &op1, const bytes &op2)
vector< char > bytes
Definition types.hpp:243
Here is the call graph for this function:

◆ alt_bn128_mul()

int32_t sysio::chain::webassembly::interface::alt_bn128_mul ( span< const char > g1_point,
span< const char > scalar,
span< char > result ) const

Host function for scalar multiplication on the elliptic curve alt_bn128

Parameters
g1_point- a span containing G1 point.
scalar- a span containing the scalar.
[out]result- g1 * scalar.
Returns
-1 if there was an error 0 otherwise

Definition at line 137 of file crypto.cpp.

137 {
138 bytes bg1_point(g1_point.data(), g1_point.data() + g1_point.size());
139 bytes bscalar(scalar.data(), scalar.data() + scalar.size());
140
141 auto maybe_err = fc::alt_bn128_mul(bg1_point, bscalar);
142 if(std::holds_alternative<fc::alt_bn128_error>(maybe_err)) {
144 }
145
146 const auto& res = std::get<bytes>(maybe_err);
147
148 if( result.size() < res.size() )
150
151 std::memcpy( result.data(), res.data(), res.size() );
153 }
std::variant< alt_bn128_error, bytes > alt_bn128_mul(const bytes &g1_point, const bytes &scalar)
Here is the call graph for this function:

◆ alt_bn128_pair()

int32_t sysio::chain::webassembly::interface::alt_bn128_pair ( span< const char > g1_g2_pairs) const

Host function for optimal ate pairing check on the elliptic curve alt_bn128

Parameters
g1_g2_pairs- a span containing pairs of G1,G2 points. (2 * 32 bytes) + (2 * 64 bytes)
Returns
-1 if there was an error, 1 if false and 0 if true

Definition at line 155 of file crypto.cpp.

155 {
156 bytes bg1_g2_pairs(g1_g2_pairs.data(), g1_g2_pairs.data() + g1_g2_pairs.size());
157
158 auto checktime = [this]() { context.trx_context.checktime(); };
159 auto res = fc::alt_bn128_pair(bg1_g2_pairs, checktime);
160 if(std::holds_alternative<fc::alt_bn128_error>(res)) {
162 }
163
164 return !std::get<bool>(res);
165 }
std::variant< alt_bn128_error, bool > alt_bn128_pair(const bytes &g1_g2_pairs, const yield_function_t &yield)
Here is the call graph for this function:

◆ assert_recover_key()

void sysio::chain::webassembly::interface::assert_recover_key ( legacy_ptr< const fc::sha256 > digest,
legacy_span< const char > sig,
legacy_span< const char > pub ) const

Tests a given public key with the recovered public key from digest and signature.

Parameters
digest- digest of the message that was signed.
sig- signature.
pub- public key.

Definition at line 23 of file crypto.cpp.

25 {
28 datastream<const char*> ds( sig.data(), sig.size() );
29 datastream<const char*> pubds ( pub.data(), pub.size() );
30
31 fc::raw::unpack( ds, s );
32 fc::raw::unpack( pubds, p );
33
34 SYS_ASSERT(s.which() < context.db.get<protocol_state_object>().num_supported_key_types, unactivated_signature_type,
35 "Unactivated signature type used during assert_recover_key");
36 SYS_ASSERT(p.which() < context.db.get<protocol_state_object>().num_supported_key_types, unactivated_key_type,
37 "Unactivated key type used when creating assert_recover_key");
38
39 if(context.control.is_producing_block())
40 SYS_ASSERT(s.variable_size() <= context.control.configured_subjective_signature_length_limit(),
41 sig_variable_size_limit_exception, "signature variable length component size greater than subjective maximum");
42
43 auto check = fc::crypto::public_key( s, *digest, false );
44 SYS_ASSERT( check == p, crypto_api_exception, "Error expected key different than recovered key" );
45 }
const mie::Vuint & p
Definition bn.cpp:27
static const Segment ds(Segment::ds)
void unpack(Stream &s, std::deque< T > &value)
Definition raw.hpp:540
fc::sha256 digest(const T &value)
Definition digest.hpp:9
bool pub
Here is the call graph for this function:

◆ assert_ripemd160()

void sysio::chain::webassembly::interface::assert_ripemd160 ( legacy_span< const char > data,
legacy_ptr< const fc::ripemd160 > hash_val ) const

Tests if the ripemd160 hash generated from data matches the provided digest.

Parameters
data- a span containing the data you want to hash.
hash_val- digest to compare to.

Definition at line 98 of file crypto.cpp.

98 {
99 auto result = context.trx_context.hash_with_checktime<fc::ripemd160>( data.data(), data.size() );
100 SYS_ASSERT( result == *hash_val, crypto_api_exception, "hash mismatch" );
101 }

◆ assert_sha1()

void sysio::chain::webassembly::interface::assert_sha1 ( legacy_span< const char > data,
legacy_ptr< const fc::sha1 > hash_val ) const

Tests if the sha1 hash generated from data matches the provided digest.

Parameters
data- a span containing the data you want to hash.
hash_val- digest to compare to.

Definition at line 88 of file crypto.cpp.

88 {
89 auto result = context.trx_context.hash_with_checktime<fc::sha1>( data.data(), data.size() );
90 SYS_ASSERT( result == *hash_val, crypto_api_exception, "hash mismatch" );
91 }

◆ assert_sha256()

void sysio::chain::webassembly::interface::assert_sha256 ( legacy_span< const char > data,
legacy_ptr< const fc::sha256 > hash_val ) const

Tests if the sha256 hash generated from data matches the provided digest.

Parameters
data- a span containing the data you want to hash.
hash_val- digest to compare to.

Definition at line 83 of file crypto.cpp.

83 {
84 auto result = context.trx_context.hash_with_checktime<fc::sha256>( data.data(), data.size() );
85 SYS_ASSERT( result == *hash_val, crypto_api_exception, "hash mismatch" );
86 }

◆ assert_sha512()

void sysio::chain::webassembly::interface::assert_sha512 ( legacy_span< const char > data,
legacy_ptr< const fc::sha512 > hash_val ) const

Tests if the sha512 hash generated from data matches the provided digest.

Parameters
data- a span containing the data you want to hash.
hash_val- digest to compare to.

Definition at line 93 of file crypto.cpp.

93 {
94 auto result = context.trx_context.hash_with_checktime<fc::sha512>( data.data(), data.size() );
95 SYS_ASSERT( result == *hash_val, crypto_api_exception, "hash mismatch" );
96 }

◆ blake2_f()

int32_t sysio::chain::webassembly::interface::blake2_f ( uint32_t rounds,
span< const char > state,
span< const char > message,
span< const char > t0_offset,
span< const char > t1_offset,
int32_t final,
span< char > result ) const

BLAKE2 compression function F https://eips.ethereum.org/EIPS/eip-152 Precompiled contract which implements the compression function F used in the BLAKE2 cryptographic hashing algorithm.

Parameters
rounds- the number of rounds - 32-bit unsigned big-endian word
state- a span containing the state vector - 8 unsigned 64-bit little-endian words
message- a span containing the message block vector - 16 unsigned 64-bit little-endian words
t0_offset- offset counters - unsigned 64-bit little-endian word
t1_offset- offset counters - unsigned 64-bit little-endian word
final- the final block indicator flag - (1-true, all other values == false)
[out]result- the result
Returns
-1 if there was an error 0 otherwise

Definition at line 207 of file crypto.cpp.

213 {
214
215 bool _final = final == 1;
216 bytes bstate(state.data(), state.data() + state.size());
217 bytes bmessage(message.data(), message.data() + message.size());
218 bytes bt0_offset(t0_offset.data(), t0_offset.data() + t0_offset.size());
219 bytes bt1_offset(t1_offset.data(), t1_offset.data() + t1_offset.size());
220
221 auto checktime = [this]() { context.trx_context.checktime(); };
222
223 auto maybe_err = fc::blake2b(rounds, bstate, bmessage, bt0_offset, bt1_offset, _final, checktime);
224 if(std::holds_alternative<fc::blake2b_error>(maybe_err)) {
226 }
227
228 const auto& res = std::get<bytes>(maybe_err);
229
230 if( out.size() < res.size() )
232
233 std::memcpy( out.data(), res.data(), res.size() );
235 }
std::variant< blake2b_error, bytes > blake2b(uint32_t _rounds, const bytes &_h, const bytes &_m, const bytes &_t0_offset, const bytes &_t1_offset, bool _f, const yield_function_t &yield)
Definition blake2.cpp:105
Here is the call graph for this function:

◆ cancel_deferred()

bool sysio::chain::webassembly::interface::cancel_deferred ( legacy_ptr< const uint128_t > val)

Cancels a deferred transaction.

Parameters
val- The id of the sender.
Return values
falseif transaction was not found.
trueif transaction was canceled.

Definition at line 32 of file transaction.cpp.

32 {
33 return context.cancel_deferred_transaction( *val );
34 }

◆ check_permission_authorization()

bool sysio::chain::webassembly::interface::check_permission_authorization ( account_name account,
permission_name permission,
legacy_span< const char > pubkeys_data,
legacy_span< const char > perms_data,
uint64_t delay_us ) const

Checks if a permission is authorized by a provided delay and a provided set of keys and permissions.

Parameters
account- the account owner of the permission.
permission- the name of the permission to check for authorization.
pubkeys_data- serialized vector of provided public keys.
perms_data- serialized vector of provided permissions (empty permission name acts as wildcard).
delay_us- the provided delay in microseconds (cannot exceed INT64_MAX)
Return values
trueif permission is authorized.
falseotherwise.

Definition at line 48 of file permission.cpp.

51 {
52 SYS_ASSERT( delay_us <= static_cast<uint64_t>(std::numeric_limits<int64_t>::max()),
53 action_validate_exception, "provided delay is too large" );
54
55 flat_set<public_key_type> provided_keys;
56 unpack_provided_keys( provided_keys, pubkeys_data.data(), pubkeys_data.size() );
57
58 flat_set<permission_level> provided_permissions;
59 unpack_provided_permissions( provided_permissions, perms_data.data(), perms_data.size() );
60
61 try {
62 context.control
63 .get_authorization_manager()
64 .check_authorization( account,
65 permission,
66 provided_keys,
67 provided_permissions,
68 fc::microseconds(delay_us),
69 std::bind(&transaction_context::checktime, &context.trx_context),
70 false
71 );
72 return true;
73 } catch( const authorization_exception& e ) {}
74
75 return false;
76 }
void unpack_provided_permissions(flat_set< permission_level > &permissions, const char *perms_data, uint32_t perms_size)
void unpack_provided_keys(flat_set< public_key_type > &keys, const char *pubkeys_data, uint32_t pubkeys_size)
Definition permission.cpp:7
key Invalid authority Invalid transaction Invalid block ID Invalid packed transaction Invalid chain ID Invalid symbol Signature type is not a currently activated type Block can not be found Unlinkable block Block does not guarantee concurrent execution without conflicts Block exhausted allowed resources Block is from the future Block is not signed by expected producer Block includes an ill formed protocol feature activation extension Block includes an ill formed additional block signature extension Error decompressing transaction Transaction should have at least one required authority Expired Transaction Invalid Reference Block Duplicate deferred transaction The transaction can not be found Transaction is too big Invalid transaction extension Transaction includes disallowed Transaction exceeded transient resource limit action_validate_exception
Here is the call graph for this function:

◆ check_transaction_authorization()

bool sysio::chain::webassembly::interface::check_transaction_authorization ( legacy_span< const char > trx_data,
legacy_span< const char > pubkeys_data,
legacy_span< const char > perms_data ) const

Checks if a transaction is authorized by a provided set of keys and permissions.

Parameters
trx_data- serialized transaction.
pubkeys_data- serialized vector of provided public keys.
perms_data- serialized vector of provided permissions (empty permission name acts as wildcard).
Return values
trueif transaction is authorized.
falseotherwise.

Definition at line 21 of file permission.cpp.

23 {
24 transaction trx = fc::raw::unpack<transaction>( trx_data.data(), trx_data.size() );
25
26 flat_set<public_key_type> provided_keys;
27 unpack_provided_keys( provided_keys, pubkeys_data.data(), pubkeys_data.size() );
28
29 flat_set<permission_level> provided_permissions;
30 unpack_provided_permissions( provided_permissions, perms_data.data(), perms_data.size() );
31
32 try {
33 context.control
34 .get_authorization_manager()
35 .check_authorization( trx.actions,
36 provided_keys,
37 provided_permissions,
38 fc::seconds(trx.delay_sec),
39 std::bind(&transaction_context::checktime, &context.trx_context),
40 false
41 );
42 return true;
43 } catch( const authorization_exception& e ) {}
44
45 return false;
46 }
constexpr microseconds seconds(int64_t s)
Definition time.hpp:32
Here is the call graph for this function:

◆ current_receiver()

name sysio::chain::webassembly::interface::current_receiver ( ) const

Get the current receiver of the action.

Returns
the name of the receiver

Definition at line 20 of file action.cpp.

20 {
21 return context.get_receiver();
22 }

◆ current_time()

uint64_t sysio::chain::webassembly::interface::current_time ( ) const

Returns the time in microseconds from 1970 of the current block.

Returns
time in microseconds from 1970 of the current block.

Definition at line 7 of file system.cpp.

7 {
8 return static_cast<uint64_t>( context.control.pending_block_time().time_since_epoch().count() );
9 }
int * count

◆ db_end_i64()

int32_t sysio::chain::webassembly::interface::db_end_i64 ( uint64_t code,
uint64_t scope,
uint64_t table )

Get an iterator representing just-past-the-end of the last table row of a primary 64-bit integer index table.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
Returns
end iterator of the table.

Definition at line 35 of file database.cpp.

35 {
36 return context.db_end_i64( name(code), name(scope), name(table) );
37 }
std::string name

◆ db_find_i64()

int32_t sysio::chain::webassembly::interface::db_find_i64 ( uint64_t code,
uint64_t scope,
uint64_t table,
uint64_t id )

Find a table row in a primary 64-bit integer index table by primary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
id- the primary key of the record to look up.
Returns
iterator to the table row with a primary key equal to id or the end iterator of the table if the table row could not be found.

Definition at line 26 of file database.cpp.

26 {
27 return context.db_find_i64( name(code), name(scope), name(table), id );
28 }

◆ db_get_i64()

int32_t sysio::chain::webassembly::interface::db_get_i64 ( int32_t itr,
legacy_span< char > buffer )

Get a record in a primary 64-bit integer index table.

Parameters
itr- the iterator to the table row containing the record to retrieve.
[out]buffer- the buffer which will be filled with the retrieved record.
Returns
size of the data copied into the buffer if buffer is not empty, or size of the retrieved record if the buffer is empty.
Precondition
itr points to an existing table row in the table.
Postcondition
buffer will be filled with the retrieved record (truncated to the first len bytes if necessary).

Definition at line 17 of file database.cpp.

17 {
18 return context.db_get_i64( itr, buffer.data(), buffer.size() );
19 }

◆ db_idx128_end()

int32_t sysio::chain::webassembly::interface::db_idx128_end ( uint64_t code,
uint64_t scope,
uint64_t table )

Get an end iterator representing just-past-the-end of the last table row of a secondary 128-bit integer index table.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
Returns
end iterator of the table.

Definition at line 110 of file database.cpp.

110 {
111 return context.idx128.end_secondary(code, scope, table);
112 }

◆ db_idx128_find_primary()

int32_t sysio::chain::webassembly::interface::db_idx128_find_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< uint128_t > secondary,
uint64_t primary )

Find a table row in a secondary 128-bit integer index table by primary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to a 'uint128_t' variable which will have its value set to the secondary key of the found table row.
primary- the primary key of the table row to look up.
Returns
iterator to the table row with a primary key equal to primary or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *secondary will be replaced with the secondary key of the found table row.

Definition at line 95 of file database.cpp.

95 {
96 return context.idx128.find_primary(code, scope, table, *secondary, primary);
97 }

◆ db_idx128_find_secondary()

int32_t sysio::chain::webassembly::interface::db_idx128_find_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< const uint128_t > secondary,
legacy_ptr< uint64_t > primary )

Find a table row in a secondary 128-bit integer index table by secondary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
secondary- the pointer to the secondary index key.
[out]primary- pointer to a 'uint64_t' variable which will have its value set to the primary key of the found table row.
Returns
iterator to the first table row with a secondary key equal to *secondary or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 92 of file database.cpp.

92 {
93 return context.idx128.find_secondary(code, scope, table, *secondary, *primary);
94 }

◆ db_idx128_lowerbound()

int32_t sysio::chain::webassembly::interface::db_idx128_lowerbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< uint128_t, 16 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary 128-bit integer index table that matches the lowerbound condition for a given secondary key. Lowerbound secondary index is the first secondary index which key is <= the given secondary index key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to secondary key first used to determine the lowerbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *secondary will be replaced with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 98 of file database.cpp.

98 {
99 int32_t result = context.idx128.lowerbound_secondary(code, scope, table, *secondary, *primary);
100 (void)legacy_ptr<uint128_t>(std::move(secondary));
101 (void)legacy_ptr<uint64_t>(std::move(primary));
102 return result;
103 }
sysio::vm::argument_proxy< T *, Align > legacy_ptr
Definition common.hpp:29
signed int int32_t
Definition stdint.h:123

◆ db_idx128_next()

int32_t sysio::chain::webassembly::interface::db_idx128_next ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row following the referenced table row in a secondary 128-bit integer index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the next table row.
Returns
iterator to the table row following the referenced table row (or the end iterator of the table if the referenced table row is the last one in the table).
Precondition
iterator points to an existing table row in the table.
Postcondition
*primary will be replaced with the primary key of the table row following the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 113 of file database.cpp.

113 {
114 return context.idx128.next_secondary(iterator, *primary);
115 }

◆ db_idx128_previous()

int32_t sysio::chain::webassembly::interface::db_idx128_previous ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row preceding the referenced table row in a secondary 128-bit integer index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the previous table row.
Returns
iterator to the table row preceding the referenced table row assuming one exists (it will return -1 if the referenced table row is the first one in the table).
Precondition
iterator points to an existing table row in the table or it is the end iterator of the table.
Postcondition
*primary will be replaced with the primary key of the table row preceding the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 116 of file database.cpp.

116 {
117 return context.idx128.previous_secondary(iterator, *primary);
118 }

◆ db_idx128_remove()

void sysio::chain::webassembly::interface::db_idx128_remove ( int32_t iterator)

Remove a table row from a secondary 128-bit integer index table.

Parameters
iterator- iterator to the table row to remove.
Precondition
iterator points to an existing table row in the table.
Postcondition
the table row pointed to by iterator is removed and the associated storage costs are refunded to the payer.

Definition at line 89 of file database.cpp.

89 {
90 return context.idx128.remove( iterator );
91 }

◆ db_idx128_store()

int32_t sysio::chain::webassembly::interface::db_idx128_store ( uint64_t scope,
uint64_t table,
uint64_t payer,
uint64_t id,
legacy_ptr< const uint128_t > secondary )

Store an association of a 128-bit integer secondary key to a primary key in a secondary 128-bit integer index table.

Parameters
scope- the scope where the table resides (implied to be within the code of the current receiver).
table- the table name.
payer- the account that is paying for this storage.
id- the primary key to which to associate the secondary key.
secondary- the pointer to the key of the secondary index to store.
Returns
iterator to the newly created secondary index.
Postcondition
new secondary key association between primary key id and secondary key *secondary is created in the secondary 128-bit integer index table.

interface for uint128_t secondary

Definition at line 83 of file database.cpp.

83 {
84 return context.idx128.store( scope, table, account_name(payer), id, *secondary );
85 }
name account_name
Definition types.hpp:120

◆ db_idx128_update()

void sysio::chain::webassembly::interface::db_idx128_update ( int32_t iterator,
uint64_t payer,
legacy_ptr< const uint128_t > secondary )

Update an association for a 128-bit integer secondary key to a primary key in a secondary 128-bit integer index table.

Parameters
iterator- the iterator to the table row containing the secondary key association to update.
payer- the account that pays for the storage costs.
secondary- pointer to the new secondary key that will replace the existing one of the association.
Precondition
iterator points to an existing table row in the table.
Postcondition
the secondary key of the table row pointed to by iterator is replaced by *secondary.

Definition at line 86 of file database.cpp.

86 {
87 return context.idx128.update( iterator, account_name(payer), *secondary );
88 }

◆ db_idx128_upperbound()

int32_t sysio::chain::webassembly::interface::db_idx128_upperbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< uint128_t, 16 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary 128-bit integer index table that matches the upperbound condition for a given secondary key. The table row that matches the upperbound condition is the first table row in the table with the lowest secondary key that is > the given key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to secondary key first used to determine the upperbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.

Definition at line 104 of file database.cpp.

104 {
105 int32_t result = context.idx128.upperbound_secondary(code, scope, table, *secondary, *primary);
106 (void)legacy_ptr<uint128_t>(std::move(secondary));
107 (void)legacy_ptr<uint64_t>(std::move(primary));
108 return result;
109 }

◆ db_idx256_end()

int32_t sysio::chain::webassembly::interface::db_idx256_end ( uint64_t code,
uint64_t scope,
uint64_t table )

Get an end iterator representing just-past-the-end of the last table row of a secondary 256-bit integer index table.

256-

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
Returns
end iterator of the table.

Definition at line 175 of file database.cpp.

175 {
176 return context.idx256.end_secondary(code, scope, table);
177 }

◆ db_idx256_find_primary()

int32_t sysio::chain::webassembly::interface::db_idx256_find_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_span< uint128_t > data,
uint64_t primary )

Find a table row in a secondary 256-bit integer index table by primary key.

256-

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]data- pointer to the array of 2 uint128_t integers which will act as the buffer to hold the retrieved secondary key of the found table row.
primary- the primary key of the table row to look up.
Returns
iterator to the table row with a primary key equal to data or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, data will be replaced with the secondary key of the found table row.

Definition at line 148 of file database.cpp.

148 {
149 SYS_ASSERT( data.size() == idx256_array_size,
150 db_api_exception,
151 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
152 ("given",data.size())("expected", idx256_array_size) );
153 return context.idx256.find_primary(code, scope, table, data.data(), primary);
154 }

◆ db_idx256_find_secondary()

int32_t sysio::chain::webassembly::interface::db_idx256_find_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_span< const uint128_t > data,
legacy_ptr< uint64_t > primary )

Find a table row in a secondary 256-bit integer index table by secondary key.

256-

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
data- pointer to the secondary key data (which is stored as an array of 2 uint128_t integers) used to lookup the table row.
[out]primary- pointer to a 'uint64_t' variable which will have its value set to the primary key of the found table row.
Returns
iterator to the first table row with a secondary key equal to the specified secondary key or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 141 of file database.cpp.

141 {
142 SYS_ASSERT( data.size() == idx256_array_size,
143 db_api_exception,
144 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
145 ("given",data.size())("expected", idx256_array_size) );
146 return context.idx256.find_secondary(code, scope, table, data.data(), *primary);
147 }

◆ db_idx256_lowerbound()

int32_t sysio::chain::webassembly::interface::db_idx256_lowerbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_span< uint128_t, 16 > data,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary 256-bit integer index table that matches the lowerbound condition for a given secondary key. Lowerbound secondary index is the first secondary index which key is <= the given secondary index key.

256-

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]data- pointer to the secondary key data (which is stored as an array of 2 uint128_t integers) first used to determine the lowerbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, data will be replaced with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 155 of file database.cpp.

155 {
156 SYS_ASSERT( data.size() == idx256_array_size,
157 db_api_exception,
158 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
159 ("given",data.size())("expected", idx256_array_size) );
160 int32_t result = context.idx256.lowerbound_secondary(code, scope, table, data.data(), *primary);
161 (void)legacy_span<uint128_t>(std::move(data));
162 (void)legacy_ptr<uint64_t>(std::move(primary));
163 return result;
164 }
sysio::vm::argument_proxy< sysio::vm::span< T >, Align > legacy_span
Definition common.hpp:32

◆ db_idx256_next()

int32_t sysio::chain::webassembly::interface::db_idx256_next ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row following the referenced table row in a secondary 256-bit integer index table.

256-

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the next table row.
Returns
iterator to the table row following the referenced table row (or the end iterator of the table if the referenced table row is the last one in the table).
Precondition
iterator points to an existing table row in the table.
Postcondition
*primary will be replaced with the primary key of the table row following the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 178 of file database.cpp.

178 {
179 return context.idx256.next_secondary(iterator, *primary);
180 }

◆ db_idx256_previous()

int32_t sysio::chain::webassembly::interface::db_idx256_previous ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row preceding the referenced table row in a secondary 256-bit integer index table.

256-

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the previous table row.
Returns
iterator to the table row preceding the referenced table row assuming one exists (it will return -1 if the referenced table row is the first one in the table).
Precondition
iterator points to an existing table row in the table or it is the end iterator of the table.
Postcondition
*primary will be replaced with the primary key of the table row preceding the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 181 of file database.cpp.

181 {
182 return context.idx256.previous_secondary(iterator, *primary);
183 }

◆ db_idx256_remove()

void sysio::chain::webassembly::interface::db_idx256_remove ( int32_t iterator)

Remove a table row from a secondary 256-bit integer index table.

256-

Parameters
iterator- iterator to the table row to remove.
Precondition
iterator points to an existing table row in the table.
Postcondition
the table row pointed to by iterator is removed and the associated storage costs are refunded to the payer.

Definition at line 138 of file database.cpp.

138 {
139 return context.idx256.remove(iterator);
140 }

◆ db_idx256_store()

int32_t sysio::chain::webassembly::interface::db_idx256_store ( uint64_t scope,
uint64_t table,
uint64_t payer,
uint64_t id,
legacy_span< const uint128_t > data )

Store an association of a 256-bit integer secondary key to a primary key in a secondary 256-bit integer index table.

256-

Parameters
scope- the scope where the table resides (implied to be within the code of the current receiver).
table- the table name.
payer- the account that is paying for this storage.
id- the primary key to which to associate the secondary key.
data- pointer to the secondary key data stored as an array of 2 uint128_t integers.
Returns
iterator to the newly created secondary index.
Postcondition
new secondary key association between primary key id and secondary key *data is created in the secondary 256-bit integer index table.

Definition at line 124 of file database.cpp.

124 {
125 SYS_ASSERT( data.size() == idx256_array_size,
126 db_api_exception,
127 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
128 ("given",data.size())("expected", idx256_array_size) );
129 return context.idx256.store(scope, table, account_name(payer), id, data.data());
130 }

◆ db_idx256_update()

void sysio::chain::webassembly::interface::db_idx256_update ( int32_t iterator,
uint64_t payer,
legacy_span< const uint128_t > data )

Update an association for a 256-bit integer secondary key to a primary key in a secondary 256-bit integer index table.

256-

Parameters
iterator- the iterator to the table row containing the secondary key association to update.
payer- the account that pays for the storage costs.
data- pointer to the new secondary key data (which is stored as an array of 2 uint128_t integers) that will replace the existing one of the association.
Precondition
iterator points to an existing table row in the table.
Postcondition
the secondary key of the table row pointed to by iterator is replaced by the specified secondary key.

Definition at line 131 of file database.cpp.

131 {
132 SYS_ASSERT( data.size() == idx256_array_size,
133 db_api_exception,
134 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
135 ("given",data.size())("expected", idx256_array_size) );
136 return context.idx256.update(iterator, account_name(payer), data.data());
137 }

◆ db_idx256_upperbound()

int32_t sysio::chain::webassembly::interface::db_idx256_upperbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_span< uint128_t, 16 > data,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary 256-bit integer index table that matches the upperbound condition for a given secondary key. The table row that matches the upperbound condition is the first table row in the table with the lowest secondary key that is > the given key.

256-

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]data- pointer to the secondary key data (which is stored as an array of 2 uint128_t integers) first used to determine the upperbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, the buffer pointed to by data will be filled with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 165 of file database.cpp.

165 {
166 SYS_ASSERT( data.size() == idx256_array_size,
167 db_api_exception,
168 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
169 ("given",data.size())("expected", idx256_array_size) );
170 int32_t result = context.idx256.upperbound_secondary(code, scope, table, data.data(), *primary);
171 (void)legacy_span<uint128_t>(std::move(data));
172 (void)legacy_ptr<uint64_t>(std::move(primary));
173 return result;
174 }

◆ db_idx64_end()

int32_t sysio::chain::webassembly::interface::db_idx64_end ( uint64_t code,
uint64_t scope,
uint64_t table )

Get an end iterator representing just-past-the-end of the last table row of a secondary 64-bit integer index table.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
Returns
end iterator of the table.

Definition at line 69 of file database.cpp.

69 {
70 return context.idx64.end_secondary(code, scope, table);
71 }

◆ db_idx64_find_primary()

int32_t sysio::chain::webassembly::interface::db_idx64_find_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< uint64_t > secondary,
uint64_t primary )

Find a table row in a secondary 64-bit integer index table by primary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to a 'uint64_t' variable which will have its value set to the secondary key of the found table row.
primary- the primary key of the table row to look up.
Returns
iterator to the table row with a primary key equal to primary or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *secondary will be replaced with the secondary key of the found table row.

Definition at line 54 of file database.cpp.

54 {
55 return context.idx64.find_primary(code, scope, table, *secondary, primary);
56 }

◆ db_idx64_find_secondary()

int32_t sysio::chain::webassembly::interface::db_idx64_find_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< const uint64_t > secondary,
legacy_ptr< uint64_t > primary )

Find a table row in a secondary 64-bit integer index table by secondary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
secondary- the pointer to the secondary index key.
[out]primary- pointer to a 'uint64_t' variable which will have its value set to the primary key of the found table row.
Returns
iterator to the first table row with a secondary key equal to *secondary or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 51 of file database.cpp.

51 {
52 return context.idx64.find_secondary(code, scope, table, *secondary, *primary);
53 }

◆ db_idx64_lowerbound()

int32_t sysio::chain::webassembly::interface::db_idx64_lowerbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< uint64_t, 8 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary 64-bit integer index table that matches the lowerbound condition for a given secondary key. Lowerbound secondary index is the first secondary index which key is <= the given secondary index key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to secondary key first used to determine the lowerbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *secondary will be replaced with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 57 of file database.cpp.

57 {
58 const int32_t ret = context.idx64.lowerbound_secondary(code, scope, table, *secondary, *primary);
59 (void)legacy_ptr<uint64_t>(std::move(secondary));
60 (void)legacy_ptr<uint64_t>(std::move(primary));
61 return ret;
62 }

◆ db_idx64_next()

int32_t sysio::chain::webassembly::interface::db_idx64_next ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row following the referenced table row in a secondary 64-bit integer index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the next table row.
Returns
iterator to the table row following the referenced table row (or the end iterator of the table if the referenced table row is the last one in the table).
Precondition
iterator points to an existing table row in the table.
Postcondition
*primary will be replaced with the primary key of the table row following the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 72 of file database.cpp.

72 {
73 return context.idx64.next_secondary(iterator, *primary);
74 }

◆ db_idx64_previous()

int32_t sysio::chain::webassembly::interface::db_idx64_previous ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row preceding the referenced table row in a secondary 64-bit integer index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the previous table row.
Returns
iterator to the table row preceding the referenced table row assuming one exists (it will return -1 if the referenced table row is the first one in the table).
Precondition
iterator points to an existing table row in the table or it is the end iterator of the table.
Postcondition
*primary will be replaced with the primary key of the table row preceding the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 75 of file database.cpp.

75 {
76 return context.idx64.previous_secondary(iterator, *primary);
77 }

◆ db_idx64_remove()

void sysio::chain::webassembly::interface::db_idx64_remove ( int32_t iterator)

Remove a table row from a secondary 64-bit integer index table.

Parameters
iterator- iterator to the table row to remove.
Precondition
iterator points to an existing table row in the table.
Postcondition
the table row pointed to by iterator is removed and the associated storage costs are refunded to the payer.

Definition at line 48 of file database.cpp.

48 {
49 context.idx64.remove( iterator );
50 }

◆ db_idx64_store()

int32_t sysio::chain::webassembly::interface::db_idx64_store ( uint64_t scope,
uint64_t table,
uint64_t payer,
uint64_t id,
legacy_ptr< const uint64_t > secondary )

Store an association of a 64-bit integer secondary key to a primary key in a secondary 64-bit integer index table.

Parameters
scope- the scope where the table resides (implied to be within the code of the current receiver).
table- the table name.
payer- the account that is paying for this storage.
id- the primary key to which to associate the secondary key.
secondary- the pointer to the key of the secondary index to store.
Returns
iterator to the newly created secondary index.
Postcondition
new secondary key association between primary key id and secondary key *secondary is created in the secondary 64-bit integer index table.

interface for uint64_t secondary

Definition at line 42 of file database.cpp.

42 {
43 return context.idx64.store( scope, table, account_name(payer), id, *secondary );
44 }

◆ db_idx64_update()

void sysio::chain::webassembly::interface::db_idx64_update ( int32_t iterator,
uint64_t payer,
legacy_ptr< const uint64_t > secondary )

Update an association for a 64-bit integer secondary key to a primary key in a secondary 64-bit integer index table.

Parameters
iterator- the iterator to the table row containing the secondary key association to update.
payer- the account that pays for the storage costs.
secondary- pointer to the new secondary key that will replace the existing one of the association.
Precondition
iterator points to an existing table row in the table.
Postcondition
the secondary key of the table row pointed to by iterator is replaced by *secondary.

Definition at line 45 of file database.cpp.

45 {
46 context.idx64.update( iterator, account_name(payer), *secondary );
47 }

◆ db_idx64_upperbound()

int32_t sysio::chain::webassembly::interface::db_idx64_upperbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< uint64_t, 8 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary 64-bit integer index table that matches the upperbound condition for a given secondary key. The table row that matches the upperbound condition is the first table row in the table with the lowest secondary key that is > the given key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to secondary key first used to determine the upperbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.

Definition at line 63 of file database.cpp.

63 {
64 const int32_t ret = context.idx64.upperbound_secondary(code, scope, table, *secondary, *primary);
65 (void)legacy_ptr<uint64_t>(std::move(secondary));
66 (void)legacy_ptr<uint64_t>(std::move(primary));
67 return ret;
68 }

◆ db_idx_double_end()

int32_t sysio::chain::webassembly::interface::db_idx_double_end ( uint64_t code,
uint64_t scope,
uint64_t table )

Get an end iterator representing just-past-the-end of the last table row of a secondary double-precision floating-point index table.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
Returns
end iterator of the table.

Definition at line 215 of file database.cpp.

215 {
216 return context.idx_double.end_secondary(code, scope, table);
217 }

◆ db_idx_double_find_primary()

int32_t sysio::chain::webassembly::interface::db_idx_double_find_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< float64_t > secondary,
uint64_t primary )

Find a table row in a secondary double-precision floating-point index table by primary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to a double variable which will have its value set to the secondary key of the found table row.
primary- the primary key of the table row to look up.
Returns
iterator to the table row with a primary key equal to secondary or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, secondary will be replaced with the secondary key of the found table row.

Definition at line 200 of file database.cpp.

200 {
201 return context.idx_double.find_primary(code, scope, table, *secondary, primary);
202 }

◆ db_idx_double_find_secondary()

int32_t sysio::chain::webassembly::interface::db_idx_double_find_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< const float64_t > secondary,
legacy_ptr< uint64_t > primary )

Find a table row in a secondary double-precision floating-point index table by secondary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
secondary- Pointer to secondary key used to lookup the table row.
[out]primary- pointer to a 'uint64_t' variable which will have its value set to the primary key of the found table row.
Returns
iterator to the first table row with a secondary key equal to the specified secondary key or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 197 of file database.cpp.

197 {
198 return context.idx_double.find_secondary(code, scope, table, *secondary, *primary);
199 }

◆ db_idx_double_lowerbound()

int32_t sysio::chain::webassembly::interface::db_idx_double_lowerbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< float64_t, 8 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary double-precision floating-point index table that matches the lowerbound condition for a given secondary key. Lowerbound secondary index is the first secondary index which key is <= the given secondary index key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- Pointer to secondary key first used to determine the lowerbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *secondary will be replaced with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 203 of file database.cpp.

203 {
204 int32_t result = context.idx_double.lowerbound_secondary(code, scope, table, *secondary, *primary);
205 (void)legacy_ptr<float64_t>(std::move(secondary));
206 (void)legacy_ptr<uint64_t>(std::move(primary));
207 return result;
208 }

◆ db_idx_double_next()

int32_t sysio::chain::webassembly::interface::db_idx_double_next ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row following the referenced table row in a secondary double-precision floating-point index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the next table row.
Returns
iterator to the table row following the referenced table row (or the end iterator of the table if the referenced table row is the last one in the table).
Precondition
iterator points to an existing table row in the table.
Postcondition
*primary will be replaced with the primary key of the table row following the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 218 of file database.cpp.

218 {
219 return context.idx_double.next_secondary(iterator, *primary);
220 }

◆ db_idx_double_previous()

int32_t sysio::chain::webassembly::interface::db_idx_double_previous ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row preceding the referenced table row in a secondary double-precision floating-point index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the previous table row.
Returns
iterator to the table row preceding the referenced table row assuming one exists (it will return -1 if the referenced table row is the first one in the table).
Precondition
iterator points to an existing table row in the table or it is the end iterator of the table.
Postcondition
*primary will be replaced with the primary key of the table row preceding the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 221 of file database.cpp.

221 {
222 return context.idx_double.previous_secondary(iterator, *primary);
223 }

◆ db_idx_double_remove()

void sysio::chain::webassembly::interface::db_idx_double_remove ( int32_t iterator)

Remove a table row from a secondary double-precision floating-point index table.

Parameters
iterator- iterator to the table row to remove.
Precondition
iterator points to an existing table row in the table.
Postcondition
the table row pointed to by iterator is removed and the associated storage costs are refunded to the payer.

Definition at line 194 of file database.cpp.

194 {
195 return context.idx_double.remove( iterator );
196 }

◆ db_idx_double_store()

int32_t sysio::chain::webassembly::interface::db_idx_double_store ( uint64_t scope,
uint64_t table,
uint64_t payer,
uint64_t id,
legacy_ptr< const float64_t > secondary )

Store an association of a double-precision floating-point secondary key to a primary key in a secondary double-precision floating-point index table.

Parameters
scope- the scope where the table resides (implied to be within the code of the current receiver).
table- the table name.
payer- the account that is paying for this storage.
id- the primary key to which to associate the secondary key.
secondary- pointer to the secondary key.
Returns
iterator to the newly created secondary index.
Postcondition
new secondary key association between primary key id and secondary key *secondary is created in the secondary double-precision floating-point index table.

interface for double secondary

Definition at line 188 of file database.cpp.

188 {
189 return context.idx_double.store( scope, table, account_name(payer), id, *secondary );
190 }

◆ db_idx_double_update()

void sysio::chain::webassembly::interface::db_idx_double_update ( int32_t iterator,
uint64_t payer,
legacy_ptr< const float64_t > secondary )

Update an association for a double-precision floating-point secondary key to a primary key in a secondary double-precision floating-point index table.

Parameters
iterator- the iterator to the table row containing the secondary key association to update.
payer- the account that pays for the storage costs.
secondary- pointer to the new secondary key that will replace the existing one of the association.
Precondition
iterator points to an existing table row in the table.
Postcondition
the secondary key of the table row pointed to by iterator is replaced by the specified secondary key.

Definition at line 191 of file database.cpp.

191 {
192 return context.idx_double.update( iterator, account_name(payer), *secondary );
193 }

◆ db_idx_double_upperbound()

int32_t sysio::chain::webassembly::interface::db_idx_double_upperbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< float64_t, 8 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary double-precision floating-point index table that matches the upperbound condition for a given secondary key. The table row that matches the upperbound condition is the first table row in the table with the lowest secondary key that is > the given key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to secondary key first used to determine the upperbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, the buffer pointed to by *secondary will be filled with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 209 of file database.cpp.

209 {
210 int32_t result = context.idx_double.upperbound_secondary(code, scope, table, *secondary, *primary);
211 (void)legacy_ptr<float64_t>(std::move(secondary));
212 (void)legacy_ptr<uint64_t>(std::move(primary));
213 return result;
214 }

◆ db_idx_long_double_end()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_end ( uint64_t code,
uint64_t scope,
uint64_t table )

Get an end iterator representing just-past-the-end of the last table row of a secondary quadruple-precision floating-point index table.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
Returns
end iterator of the table.

Definition at line 255 of file database.cpp.

255 {
256 return context.idx_long_double.end_secondary(code, scope, table);
257 }

◆ db_idx_long_double_find_primary()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_find_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< float128_t > secondary,
uint64_t primary )

Find a table row in a secondary double-precision floating-point index table by primary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to a long double variable which will have its value set to the secondary key of the found table row.
primary- the primary key of the table row to look up.
Returns
iterator to the table row with a primary key equal to secondary or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, secondary will be replaced with the secondary key of the found table row.

Definition at line 240 of file database.cpp.

240 {
241 return context.idx_long_double.find_primary(code, scope, table, *secondary, primary);
242 }

◆ db_idx_long_double_find_secondary()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_find_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< const float128_t > secondary,
legacy_ptr< uint64_t > primary )

Find a table row in a secondary quadruple-precision floating-point index table by secondary key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
secondary- Pointer to secondary key used to lookup the table row.
[out]primary- pointer to a 'uint64_t' variable which will have its value set to the primary key of the found table row.
Returns
iterator to the first table row with a secondary key equal to the specified secondary key or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 237 of file database.cpp.

237 {
238 return context.idx_long_double.find_secondary(code, scope, table, *secondary, *primary);
239 }

◆ db_idx_long_double_lowerbound()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_lowerbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< float128_t, 8 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary quadruple-precision floating-point index table that matches the lowerbound condition for a given secondary key. Lowerbound secondary index is the first secondary index which key is <= the given secondary index key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- Pointer to secondary key first used to determine the lowerbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, *secondary will be replaced with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 243 of file database.cpp.

243 {
244 int32_t result = context.idx_long_double.lowerbound_secondary(code, scope, table, *secondary, *primary);
245 (void)legacy_ptr<float128_t>(std::move(secondary));
246 (void)legacy_ptr<uint64_t>(std::move(primary));
247 return result;
248 }

◆ db_idx_long_double_next()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_next ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row following the referenced table row in a secondary quadruple-precision floating-point index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the next table row.
Returns
iterator to the table row following the referenced table row (or the end iterator of the table if the referenced table row is the last one in the table).
Precondition
iterator points to an existing table row in the table.
Postcondition
*primary will be replaced with the primary key of the table row following the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 258 of file database.cpp.

258 {
259 return context.idx_long_double.next_secondary(iterator, *primary);
260 }

◆ db_idx_long_double_previous()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_previous ( int32_t iterator,
legacy_ptr< uint64_t > primary )

Find the table row preceding the referenced table row in a secondary quadruple-precision floating-point index table.

Parameters
iterator- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the previous table row.
Returns
iterator to the table row preceding the referenced table row assuming one exists (it will return -1 if the referenced table row is the first one in the table).
Precondition
iterator points to an existing table row in the table or it is the end iterator of the table.
Postcondition
*primary will be replaced with the primary key of the table row preceding the referenced table row if it exists, otherwise *primary will be left untouched.

Definition at line 261 of file database.cpp.

261 {
262 return context.idx_long_double.previous_secondary(iterator, *primary);
263 }

◆ db_idx_long_double_remove()

void sysio::chain::webassembly::interface::db_idx_long_double_remove ( int32_t iterator)

Remove a table row from a secondary quadruple-precision floating-point index table.

Parameters
iterator- iterator to the table row to remove.
Precondition
iterator points to an existing table row in the table.
Postcondition
the table row pointed to by iterator is removed and the associated storage costs are refunded to the payer.

Definition at line 234 of file database.cpp.

234 {
235 return context.idx_long_double.remove( iterator );
236 }

◆ db_idx_long_double_store()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_store ( uint64_t scope,
uint64_t table,
uint64_t payer,
uint64_t id,
legacy_ptr< const float128_t > secondary )

Store an association of a quadruple-precision floating-point secondary key to a primary key in a secondary quadruple-precision floating-point index table.

Parameters
scope- the scope where the table resides (implied to be within the code of the current receiver).
table- the table name.
payer- the account that is paying for this storage.
id- the primary key to which to associate the secondary key.
secondary- pointer to the secondary key.
Returns
iterator to the newly created secondary index.
Postcondition
new secondary key association between primary key id and secondary key *secondary is created in the quadruple-precision floating-point index table.

interface for long double secondary

Definition at line 228 of file database.cpp.

228 {
229 return context.idx_long_double.store( scope, table, account_name(payer), id, *secondary );
230 }

◆ db_idx_long_double_update()

void sysio::chain::webassembly::interface::db_idx_long_double_update ( int32_t iterator,
uint64_t payer,
legacy_ptr< const float128_t > secondary )

Update an association for a quadruple-precision floating-point secondary key to a primary key in a secondary quadruple-precision floating-point index table.

Parameters
iterator- the iterator to the table row containing the secondary key association to update.
payer- the account that pays for the storage costs.
secondary- pointer to the new secondary key that will replace the existing one of the association.
Precondition
iterator points to an existing table row in the table.
Postcondition
the secondary key of the table row pointed to by iterator is replaced by the specified secondary key.

Definition at line 231 of file database.cpp.

231 {
232 return context.idx_long_double.update( iterator, account_name(payer), *secondary );
233 }

◆ db_idx_long_double_upperbound()

int32_t sysio::chain::webassembly::interface::db_idx_long_double_upperbound ( uint64_t code,
uint64_t scope,
uint64_t table,
legacy_ptr< float128_t, 8 > secondary,
legacy_ptr< uint64_t, 8 > primary )

Find the table row in a secondary quadruple-precision floating-point index table that matches the upperbound condition for a given secondary key. The table row that matches the upperbound condition is the first table row in the table with the lowest secondary key that is > the given key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
[out]secondary- pointer to secondary key first used to determine the upperbound and which is then replaced with the secondary key of the found table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the found table row.
Returns
iterator to the found table row or the end iterator of the table if the table row could not be found.
Postcondition
If and only if the table row is found, the buffer pointed to by *secondary will be filled with the secondary key of the found table row.
If and only if the table row is found, *primary will be replaced with the primary key of the found table row.

Definition at line 249 of file database.cpp.

249 {
250 int32_t result = context.idx_long_double.upperbound_secondary(code, scope, table, *secondary, *primary);
251 (void)legacy_ptr<float128_t>(std::move(secondary));
252 (void)legacy_ptr<uint64_t>(std::move(primary));
253 return result;
254 }

◆ db_lowerbound_i64()

int32_t sysio::chain::webassembly::interface::db_lowerbound_i64 ( uint64_t code,
uint64_t scope,
uint64_t table,
uint64_t id )

Find the table row in a primary 64-bit integer index table that matches the lowerbound condition for a given primary key. Lowerbound record is the first nearest record which primary key is <= the given key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
id- the primary key used as a pivot to determine the lowerbound record.
Returns
iterator to the lowerbound record or the end iterator of the table if the table row could not be found.

Definition at line 29 of file database.cpp.

29 {
30 return context.db_lowerbound_i64( name(code), name(scope), name(table), id );
31 }

◆ db_next_i64()

int32_t sysio::chain::webassembly::interface::db_next_i64 ( int32_t itr,
legacy_ptr< uint64_t > primary )

Find the table row following the referenced table row in a primary 64-bit integer index table.

Parameters
itr- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the next table row.
Returns
iterator to the table row following the referenced table row (or the end iterator of the table if the referenced table row is the last one in the table).
Postcondition
'*primary' will be replaced with the primary key of the table row following the referenced table row if it exists, otherwise primary will be left untouched.

Definition at line 20 of file database.cpp.

20 {
21 return context.db_next_i64(itr, *primary);
22 }

◆ db_previous_i64()

int32_t sysio::chain::webassembly::interface::db_previous_i64 ( int32_t itr,
legacy_ptr< uint64_t > primary )

Find the table row preceding the referenced table row in a primary 64-bit integer index table.

Parameters
itr- the iterator to the referenced table row.
[out]primary- pointer to a uint64_t variable which will have its value set to the primary key of the next table row.
Returns
iterator to the table row preceding the referenced table row assuming one exists (it will return -1 if the referenced table row is the first one in the table).
Postcondition
'*primary' will be replaced with the primary key of the table row preceding the referenced table row if it exists, otherwise primary will be left untouched.

Definition at line 23 of file database.cpp.

23 {
24 return context.db_previous_i64(itr, *primary);
25 }

◆ db_remove_i64()

void sysio::chain::webassembly::interface::db_remove_i64 ( int32_t itr)

Remove a record inside a primary 64-bit integer index table.

Parameters
itr- the iterator to the table row to remove.
Precondition
itr points to an existing table row in the tab.

Definition at line 14 of file database.cpp.

14 {
15 context.db_remove_i64( itr );
16 }

◆ db_store_i64()

int32_t sysio::chain::webassembly::interface::db_store_i64 ( uint64_t scope,
uint64_t table,
uint64_t payer,
uint64_t id,
legacy_span< const char > buffer )

Store a record in a primary 64-bit integer index table.

Parameters
scope- the scope where the table resides (implied to be within the code of the current receiver).
table- the name of the table within the current scope context.
payer- the account that pays for the storage.
id- id of the entry.
buffer- record to store.
Returns
iterator to the newly created table row.
Postcondition
a new entry is created in the table.

interface for primary index

Definition at line 8 of file database.cpp.

8 {
9 return context.db_store_i64( name(scope), name(table), account_name(payer), id, buffer.data(), buffer.size() );
10 }

◆ db_update_i64()

void sysio::chain::webassembly::interface::db_update_i64 ( int32_t itr,
uint64_t payer,
legacy_span< const char > buffer )

Update a record in a primary 64-bit integer index table.

Parameters
itr- iterator to the table row containing the record to update.
payer- the account that pays for the storage costs.
buffer- new updated record.
Remarks
This function does not allow changing the primary key of a table row. The serialized data that is stored in the table row of a primary table may include a primary key and that primary key value could be changed by the contract calling the db_update_i64 intrinsic; but that does not change the actual primary key of the table row.
Precondition
itr points to an existing table row in the table.
Postcondition
the record contained in the table row pointed to by itr is replaced with the new updated record.

Definition at line 11 of file database.cpp.

11 {
12 context.db_update_i64( itr, account_name(payer), buffer.data(), buffer.size() );
13 }

◆ db_upperbound_i64()

int32_t sysio::chain::webassembly::interface::db_upperbound_i64 ( uint64_t code,
uint64_t scope,
uint64_t table,
uint64_t id )

Find the table row in a primary 64-bit integer index table that matches the upperbound condition for a given primary key. The table row that matches the upperbound condition is the first table row in the table with the lowest primary key that is > the given key.

Parameters
code- the name of the owner of the table.
scope- the scope where the table resides.
table- the table name.
id- the primary key used as a pivot to determine the upperbound record.
Returns
iterator to the upperbound record or the end iterator of the table if the table row could not be found.

Definition at line 32 of file database.cpp.

32 {
33 return context.db_upperbound_i64( name(code), name(scope), name(table), id );
34 }

◆ expiration()

int32_t sysio::chain::webassembly::interface::expiration ( ) const

Gets the expiration of the currently executing transaction.

Returns
expiration of the currently executing transaction in seconds since Unix epoch.

Definition at line 24 of file cf_transaction.cpp.

24 {
25 return context.trx_context.packed_trx.get_transaction().expiration.sec_since_epoch();
26 }

◆ get_account_creation_time()

int64_t sysio::chain::webassembly::interface::get_account_creation_time ( account_name account) const

Returns the creation time of an account.

Parameters
account- the account name.
Returns
the creation time (in microseconds since Unix epoch) of the account.

Definition at line 83 of file permission.cpp.

83 {
84 const auto* acct = context.db.find<account_object, by_name>(account);
85 SYS_ASSERT( acct != nullptr, action_validate_exception,
86 "account '${account}' does not exist", ("account", account) );
87 return time_point(acct->creation_date).time_since_epoch().count();
88 }
constexpr int64_t count() const
Definition time.hpp:26
constexpr const microseconds & time_since_epoch() const
Definition time.hpp:52
Here is the call graph for this function:

◆ get_action()

int32_t sysio::chain::webassembly::interface::get_action ( uint32_t type,
uint32_t index,
legacy_span< char > buffer ) const

Retrieve the indicated action from the active transaction.

Parameters
type- 0 for context free action, 1 for action.
index- the index of the requested action.
[out]buffer- the action we want (packed).
Returns
the number of bytes written on the buffer or -1 if there was an error.

Definition at line 36 of file cf_transaction.cpp.

36 {
37 return context.get_action( type, index, buffer.data(), buffer.size() );
38 }

◆ get_active_producers()

int32_t sysio::chain::webassembly::interface::get_active_producers ( legacy_span< account_name > producers) const

Get the list of active producer names.

Parameters
[out]producers- output buffer containing the names of the current active producer names.
Returns
number of bytes required (if the buffer is empty), or the number of bytes written to the buffer.

Definition at line 5 of file producer.cpp.

5 {
6 auto active_producers = context.get_active_producers();
7
8 size_t len = active_producers.size();
9 auto s = len * sizeof(chain::account_name);
10 if( producers.size_bytes() == 0 ) return s;
11
12 auto copy_size = std::min( producers.size(), s );
13 std::memcpy( producers.data(), active_producers.data(), copy_size );
14
15 return copy_size;
16 }
schedule config_dir_name data_dir_name p2p_port http_port file_size name name keys peers producers(dont_start)) FC_REFLECT(testnet_def
size_t len
Here is the call graph for this function:

◆ get_block_num()

uint32_t sysio::chain::webassembly::interface::get_block_num ( ) const

Returns the current block number.

Returns
current block number.

Definition at line 23 of file system.cpp.

23 {
24 return context.control.pending_block_num();
25 }

◆ get_blockchain_parameters_packed()

uint32_t sysio::chain::webassembly::interface::get_blockchain_parameters_packed ( legacy_span< char > packed_blockchain_parameters) const

Retrieve the blockchain config parameters.

Parameters
[out]packed_blockchain_parameters- output buffer of the blockchain parameters.

return the number of bytes copied to the buffer, or number of bytes required if the buffer is empty.

Definition at line 145 of file privileged.cpp.

145 {
146 auto& gpo = context.control.get_global_properties();
147
148 auto s = fc::raw::pack_size( gpo.configuration.v0() );
149 if( packed_blockchain_parameters.size() == 0 ) return s;
150
151 if ( s <= packed_blockchain_parameters.size() ) {
152 datastream<char*> ds( packed_blockchain_parameters.data(), s );
153 fc::raw::pack(ds, gpo.configuration.v0());
154 return s;
155 }
156 return 0;
157 }
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
size_t pack_size(const T &v)
Definition raw.hpp:671
Here is the call graph for this function:

◆ get_code_hash()

uint32_t sysio::chain::webassembly::interface::get_code_hash ( account_name account,
uint32_t struct_version,
vm::span< char > packed_result ) const

Retrieves the code hash for an account, if any.

The result is the packed version of this struct:

struct { varuint32 struct_version; uint64_t code_sequence; fc::sha256 code_hash; uint8_t vm_type; uint8_t vm_version; } result;

Parameters
account- name of the account to check.
struct_version- use 0.
packed_result- receives the packed result.
Returns
the size of the packed result.

Definition at line 34 of file authorization.cpp.

38 {
39 struct_version = std::min(uint32_t(0), struct_version);
40 get_code_hash_result result = {struct_version};
41 context.get_code_hash(account, result.code_sequence, result.code_hash, result.vm_type, result.vm_version);
42
43 auto s = fc::raw::pack_size(result);
44 if (s <= packed_result.size()) {
45 datastream<char*> ds(packed_result.data(), s);
46 fc::raw::pack(ds, result);
47 }
48 return s;
49 }
Here is the call graph for this function:

◆ get_context() [1/2]

apply_context & sysio::chain::webassembly::interface::get_context ( )
inline

Definition at line 17 of file interface.hpp.

17{ return context; }

◆ get_context() [2/2]

const apply_context & sysio::chain::webassembly::interface::get_context ( ) const
inline

Definition at line 18 of file interface.hpp.

18{ return context; }

◆ get_context_free_data()

int32_t sysio::chain::webassembly::interface::get_context_free_data ( uint32_t index,
legacy_span< char > buffer ) const

Retrieve the signed_transaction.context_free_data[index].

Parameters
index- the index of the context_free_data entry to retrieve.
[out]buffer- output buffer of the context_free_data entry.
Return values
-1if the index is not valid.
sizeof the cfd if the buffer is empty, otherwise return the amount of data copied onto the buffer.

Definition at line 5 of file context_free.cpp.

5 {
6 return context.get_context_free_data( index, buffer.data(), buffer.size() );
7 }

◆ get_parameters_packed()

uint32_t sysio::chain::webassembly::interface::get_parameters_packed ( span< const char > packed_parameter_ids,
span< char > packed_parameters ) const

Retrieve the blockchain config parameters. The input buffer is a packed data stream which represents an encoded sequence of parameter_id pairs with the following format: |varuint32:sequence_length | varuint32:parameter_id | ... The output buffer is a packed data stream which represents an encoded sequence of parameter_id:paramter_value pairs with the following format: |varuint32:sequence_length | varuint32:parameter_id | <various>:parameter_value | ... The encoding of parameter_values should be specific to the parameter being set The output buffer format should be valid input for set_parameters_packed. For each known parameter_id in the input sequence there should be an associated entry in the output sequence with the current encoded parameter_value.

Parameters
packed_parameter_ids- the input buffer with the format as described above.
[out]packed_parameters- the output buffer with the format as described above.

Definition at line 170 of file privileged.cpp.

170 {
171 datastream<const char*> ds_ids( packed_parameter_ids.data(), packed_parameter_ids.size() );
172
173 chain::chain_config cfg = context.control.get_global_properties().configuration;
174 std::vector<fc::unsigned_int> ids;
175 fc::raw::unpack(ds_ids, ids);
176 const config_range config_range(cfg, std::move(ids), {context.control});
177
178 auto size = fc::raw::pack_size( config_range );
179 if( packed_parameters.size() == 0 ) return size;
180
181 SYS_ASSERT(size <= packed_parameters.size(),
182 chain::config_parse_error,
183 "get_parameters_packed: buffer size is smaller than ${size}", ("size", size));
184
185 datastream<char*> ds( packed_parameters.data(), size );
187 return size;
188 }
data_range< chain_config, config_entry_validator > config_range
chain_config_v1 chain_config
Here is the call graph for this function:

◆ get_permission_last_used()

int64_t sysio::chain::webassembly::interface::get_permission_last_used ( account_name account,
permission_name permission ) const

Returns the last used time of a permission.

Parameters
account- the account owner of the permission.
permission- the name of the permission.
Returns
the last used time (in microseconds since Unix epoch) of the permission.

Definition at line 78 of file permission.cpp.

78 {
79 const auto& am = context.control.get_authorization_manager();
80 return am.get_permission_last_used( am.get_permission({account, permission}) ).time_since_epoch().count();
81 };

◆ get_resource_limits()

void sysio::chain::webassembly::interface::get_resource_limits ( account_name account,
legacy_ptr< int64_t, 8 > ram_bytes,
legacy_ptr< int64_t, 8 > net_weight,
legacy_ptr< int64_t, 8 > cpu_weight ) const

Get the resource limits of an account

Parameters
account- name of the account whose resource limit to get.
[out]ram_bytes- output to hold retrieved ram limit in absolute bytes.
[out]net_weight- output to hold net weight.
[out]cpu_weight- output to hold cpu weight.

Definition at line 32 of file privileged.cpp.

32 {
33 context.control.get_resource_limits_manager().get_account_limits( account, *ram_bytes, *net_weight, *cpu_weight);
34 (void)legacy_ptr<int64_t>(std::move(ram_bytes));
35 (void)legacy_ptr<int64_t>(std::move(net_weight));
36 (void)legacy_ptr<int64_t>(std::move(cpu_weight));
37 }

◆ get_sender()

name sysio::chain::webassembly::interface::get_sender ( ) const

Return the name of the account that sent the current inline action.

Returns
name of account that sent the current inline action (empty name if not called from inline action).

Definition at line 19 of file system.cpp.

19 {
20 return context.get_sender();
21 }

◆ get_wasm_parameters_packed()

uint32_t sysio::chain::webassembly::interface::get_wasm_parameters_packed ( span< char > packed_parameters,
uint32_t max_version ) const

Get the current wasm limits configuration.

The structure of the parameters is as follows:

  • max_mutable_global_bytes The maximum total size (in bytes) used for mutable globals. i32 and f32 consume 4 bytes and i64 and f64 consume 8 bytes. Const globals are not included in this count.
  • max_table_elements The maximum number of elements of a table.
  • max_section_elements The maximum number of elements in each section.
  • max_linear_memory_init The size (in bytes) of the range of memory that may be initialized. Data segments may use the range [0, max_linear_memory_init).
  • max_func_local_bytes The maximum total size (in bytes) used by parameters and local variables in a function.
  • max_nested_structures The maximum nesting depth of structured control instructions. The function itself is included in this count.
  • max_symbol_bytes The maximum size (in bytes) of names used for import and export.
  • max_module_bytes The maximum total size (in bytes) of a wasm module.
  • max_code_bytes The maximum size (in bytes) of each function body.
  • max_pages The maximum number of 64 KiB pages of linear memory that a contract can use. Enforced when an action is executed. The initial size of linear memory is also checked at setcode.
  • max_call_depth The maximum number of functions that may be on the stack. Enforced when an action is executed.
Parameters
[out]packed_parametersthe ouput for the parameters.
max_versionhas no effect, but should be 0.
Returns
the size of the packed parameters if packed_parameters is empty, otherwise it returns the amount of data written in packed_parameters.

Definition at line 85 of file privileged.cpp.

85 {
86 auto& gpo = context.control.get_global_properties();
87 auto& params = gpo.wasm_configuration;
88 uint32_t version = std::min( max_version, uint32_t(0) );
89
90 auto s = fc::raw::pack_size( version ) + fc::raw::pack_size( params );
91 if ( packed_parameters.size() == 0 )
92 return s;
93
94 if ( s <= packed_parameters.size() ) {
95 datastream<char*> ds( packed_parameters.data(), s );
96 fc::raw::pack(ds, version);
98 }
99 return s;
100 }
account_query_db::get_accounts_by_authorizers_params params
Here is the call graph for this function:

◆ has_auth()

bool sysio::chain::webassembly::interface::has_auth ( account_name account) const

Test whether an account exists in the set of provided auths on an action.

Parameters
account- name of the account to be tested.
Return values
trueif the action has an auth with the account name.
falseotherwise.

Definition at line 9 of file authorization.cpp.

9 {
10 return context.has_authorization( account );
11 }

◆ is_account()

bool sysio::chain::webassembly::interface::is_account ( account_name account) const

Verifies that n is an existing account.

Parameters
account- name of the account to check.
Returns
true if the account exists.
false otherwise.

Definition at line 22 of file authorization.cpp.

22 {
23 return context.is_account( account );
24 }

◆ is_feature_activated()

bool sysio::chain::webassembly::interface::is_feature_activated ( legacy_ptr< const digest_type > feature_digest) const

Check if specified protocol feature has been activated.

Parameters
feature_digest- digest of the protocol feature.
Return values
trueif the specified protocol feature has been activated.
falseotherwise.

Definition at line 15 of file system.cpp.

15 {
16 return context.control.is_protocol_feature_activated( *feature_digest );
17 }

◆ is_feature_active()

int sysio::chain::webassembly::interface::is_feature_active ( int64_t feature_name) const

Check if a feature is found on the activation set.

Parameters
feature_name- 256-bit digest representing the feature to query.
Returns
false (deprecated)
Deprecated

Definition at line 13 of file privileged.cpp.

13{ return false; }

◆ is_privileged()

bool sysio::chain::webassembly::interface::is_privileged ( account_name account) const

Check if an account is privileged.

Parameters
account- name of the account to be checked.
Return values
trueif the account is privileged
falseotherwise

Definition at line 205 of file privileged.cpp.

205 {
206 return context.db.get<account_metadata_object, by_name>( n ).is_privileged();
207 }
bool is_privileged(account_name account) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ k1_recover()

int32_t sysio::chain::webassembly::interface::k1_recover ( span< const char > signature,
span< const char > digest,
span< char > pub ) const

Calculates the uncompressed public key used for a given signature on a given digest.

Parameters
signatue- signature.
digest- digest of the message that was signed.
[out]pub- output buffer for the public key result.
Returns
-1 if there was an error 0 otherwise.

Definition at line 256 of file crypto.cpp.

256 {
257 bytes bsignature(signature.data(), signature.data() + signature.size());
258 bytes bdigest(digest.data(), digest.data() + digest.size());
259
260 auto maybe_err = fc::k1_recover(bsignature, bdigest);
261 if( std::holds_alternative<fc::k1_recover_error>(maybe_err)) {
263 }
264
265 const auto& res = std::get<bytes>(maybe_err);
266
267 if( pub.size() < res.size() )
269
270 std::memcpy( pub.data(), res.data(), res.size() );
272 }
const char * data() const
Definition sha256.cpp:31
bytes signature
Definition pke.hpp:17
std::variant< k1_recover_error, bytes > k1_recover(const bytes &signature, const bytes &digest)
Here is the call graph for this function:

◆ memcmp()

int32_t sysio::chain::webassembly::interface::memcmp ( memcmp_params args) const

Definition at line 16 of file memory.cpp.

16 {
17 auto [dest, src, length] = args;
18 int32_t ret = std::memcmp((const char*)dest, (const char*)src, length);
19 return ret < 0 ? -1 : ret > 0 ? 1 : 0;
20 }

◆ memcpy()

void * sysio::chain::webassembly::interface::memcpy ( memcpy_params args) const

Definition at line 4 of file memory.cpp.

4 {
5 auto [dest, src, length] = args;
6 SYS_ASSERT((size_t)(std::abs((ptrdiff_t)(char*)dest - (ptrdiff_t)(const char*)src)) >= length,
7 overlapping_memory_error, "memcpy can only accept non-aliasing pointers");
8 return (char *)std::memcpy((char*)dest, (const char*)src, length);
9 }

◆ memmove()

void * sysio::chain::webassembly::interface::memmove ( memcpy_params args) const

Definition at line 11 of file memory.cpp.

11 {
12 auto [dest, src, length] = args;
13 return (char *)std::memmove((char*)dest, (const char*)src, length);
14 }

◆ memset()

void * sysio::chain::webassembly::interface::memset ( memset_params args) const

Definition at line 22 of file memory.cpp.

22 {
23 auto [dest, value, length] = args;
24 return (char *)std::memset( (char*)dest, value, length );
25 }
#define value
Definition pkcs11.h:157

◆ mod_exp()

int32_t sysio::chain::webassembly::interface::mod_exp ( span< const char > base,
span< const char > exp,
span< const char > modulus,
span< char > out ) const

Big integer modular exponentiation

<BASE> <EXPONENT> <MODULUS> returns an output (BASE**EXPONENT) % MODULUS as a byte array {{{{ with the same length as the modulus }}}}

Parameters
base- a span containing BASE.
exp- a span containing EXPONENT.
modulus- a span containing MODULUS.
[out]out- the result (BASE**EXPONENT) % MODULUS
Returns
-1 if there was an error 0 otherwise

Definition at line 167 of file crypto.cpp.

170 {
171 if (context.control.is_producing_block()) {
172 unsigned int base_modulus_size = std::max(base.size(), modulus.size());
173
174 if (base_modulus_size < exp.size()) {
175 SYS_THROW(subjective_block_production_exception,
176 "mod_exp restriction: exponent bit size cannot exceed bit size of either base or modulus");
177 }
178
179 static constexpr uint64_t bit_calc_limit = 106;
180
181 uint64_t bit_calc = 5 * ceil_log2(exp.size()) + 8 * ceil_log2(base_modulus_size);
182
183 if (bit_calc_limit < bit_calc) {
184 SYS_THROW(subjective_block_production_exception,
185 "mod_exp restriction: bit size too large for input arguments");
186 }
187 }
188
189 bytes bbase(base.data(), base.data() + base.size());
190 bytes bexp(exp.data(), exp.data() + exp.size());
191 bytes bmod(modulus.data(), modulus.data() + modulus.size());
192
193 auto maybe_err = fc::modexp(bbase, bexp, bmod);
194 if(std::holds_alternative<fc::modular_arithmetic_error>(maybe_err)) {
196 }
197
198 const auto& res = std::get<bytes>(maybe_err);
199
200 if( out.size() < res.size() )
202
203 std::memcpy( out.data(), res.data(), res.size() );
205 }
#define SYS_THROW(exc_type, FORMAT,...)
std::variant< modular_arithmetic_error, bytes > modexp(const bytes &_base, const bytes &_exponent, const bytes &_modulus)
Here is the call graph for this function:

◆ preactivate_feature()

void sysio::chain::webassembly::interface::preactivate_feature ( legacy_ptr< const digest_type > feature_digest)

Allows a privileged smart contract, e.g. the system contract, to pre-activate a consensus protocol upgrade feature.

Parameters
feature_digest- 256-bit digest representing the feature to pre-activate.

Definition at line 19 of file privileged.cpp.

19 {
20 context.control.preactivate_feature( *feature_digest );
21 }

◆ printdf()

void sysio::chain::webassembly::interface::printdf ( float64_t val)

Prints value as double-precision floating point number.

Parameters
val- double-precision floating point number to be printed

Definition at line 86 of file console.cpp.

86 {
87 predicated_print(context,
88 [&]() {
89 // Assumes double representation on native side is the same as on the WASM side
90 std::ostringstream oss;
91 oss.setf( std::ios::scientific, std::ios::floatfield );
92 oss.precision( std::numeric_limits<double>::digits10 );
93 oss << ::from_softfloat64(val);
94 context.console_append( oss.str() );
95 });
96 }
Here is the call graph for this function:

◆ printhex()

void sysio::chain::webassembly::interface::printhex ( legacy_span< const char > data)

Prints a 64 bit names as base32 encoded string

Parameters
data- Hex name to be printed.

Definition at line 136 of file console.cpp.

136 {
137 predicated_print(context, [&]() { context.console_append(fc::to_hex(data.data(), data.size())); });
138 }
fc::string to_hex(const char *d, uint32_t s)
Definition hex.cpp:17
Here is the call graph for this function:

◆ printi()

void sysio::chain::webassembly::interface::printi ( int64_t val)

Prints value as a 64 bit signed integer.

Parameters
val- 64 bit signed integer to be printed.

Definition at line 25 of file console.cpp.

25 {
26 predicated_print(context,
27 [&]() {
28 std::ostringstream oss;
29 oss << val;
30 context.console_append( oss.str() );
31 });
32 }

◆ printi128()

void sysio::chain::webassembly::interface::printi128 ( legacy_ptr< const __int128 > val)

Prints value as a 128 bit signed integer.

Parameters
val- 128 bit signed integer to be printed.

Definition at line 43 of file console.cpp.

43 {
44 predicated_print(context,
45 [&]() {
46 bool is_negative = (*val < 0);
47 unsigned __int128 val_magnitude;
48
49 if( is_negative )
50 val_magnitude = static_cast<unsigned __int128>(-*val); // Works even if val is at the lowest possible value of a int128_t
51 else
52 val_magnitude = static_cast<unsigned __int128>(*val);
53
54 fc::uint128 v(val_magnitude>>64, static_cast<uint64_t>(val_magnitude) );
55
56 string s;
57 if( is_negative ) {
58 s += '-';
59 }
60 s += fc::variant(v).get_string();
61
62 context.console_append( s );
63 });
64 }
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
const string & get_string() const
Definition variant.cpp:606
Here is the call graph for this function:

◆ printn()

void sysio::chain::webassembly::interface::printn ( name value)

Prints a 64 bit names as base32 encoded string.

Parameters
value- 64 bit name to be printed

Definition at line 132 of file console.cpp.

132 {
133 predicated_print(context, [&]() { context.console_append(value.to_string()); });
134 }

◆ printqf()

void sysio::chain::webassembly::interface::printqf ( legacy_ptr< const float128_t > val)

Prints value as quadruple-precision floating point number.

Parameters
val- a pointer to the quadruple-precision floating point number to be printed

Definition at line 98 of file console.cpp.

98 {
99 /*
100 * Native-side long double uses an 80-bit extended-precision floating-point number.
101 * The easiest solution for now was to use the Berkeley softfloat library to round the 128-bit
102 * quadruple-precision floating-point number to an 80-bit extended-precision floating-point number
103 * (losing precision) which then allows us to simply cast it into a long double for printing purposes.
104 *
105 * Later we might find a better solution to print the full quadruple-precision floating-point number.
106 * Maybe with some compilation flag that turns long double into a quadruple-precision floating-point number,
107 * or maybe with some library that allows us to print out quadruple-precision floating-point numbers without
108 * having to deal with long doubles at all.
109 */
110
111 predicated_print(context,
112 [&]() {
113 std::ostringstream oss;
114 oss.setf( std::ios::scientific, std::ios::floatfield );
115
116#ifdef __x86_64__
117 oss.precision( std::numeric_limits<long double>::digits10 );
118 extFloat80_t val_approx;
119 f128M_to_extF80M(val.get(), &val_approx);
120 long double _val;
121 std::memcpy((char*)&_val, (char*)&val_approx, sizeof(long double));
122 oss << _val;
123#else
124 oss.precision( std::numeric_limits<double>::digits10 );
125 double val_approx = from_softfloat64( f128M_to_f64(val.get()) );
126 oss << val_approx;
127#endif
128 context.console_append( oss.str() );
129 });
130 }
void f128M_to_extF80M(const float128_t *aPtr, extFloat80_t *zPtr)
float64_t f128M_to_f64(const float128_t *aPtr)
Here is the call graph for this function:

◆ prints()

void sysio::chain::webassembly::interface::prints ( null_terminated_ptr str)

Print a string.

Parameters
str- the string to print

Definition at line 15 of file console.cpp.

15 {
16 predicated_print(context,
17 [&]() { context.console_append( static_cast<const char*>(str.data()) ); });
18 }
return str
Definition CLI11.hpp:1359

◆ prints_l()

void sysio::chain::webassembly::interface::prints_l ( legacy_span< const char > str)

Prints string up to given length.

Parameters
str- the string to print.

Definition at line 20 of file console.cpp.

20 {
21 predicated_print(context,
22 [&]() { context.console_append(std::string_view(str.data(), str.size())); });
23 }

◆ printsf()

void sysio::chain::webassembly::interface::printsf ( float32_t val)

Prints value as single-precision floating point number.

Parameters
val- single-precision floating point number to be printed.

Definition at line 74 of file console.cpp.

74 {
75 predicated_print(context,
76 [&]() {
77 // Assumes float representation on native side is the same as on the WASM side
78 std::ostringstream oss;
79 oss.setf( std::ios::scientific, std::ios::floatfield );
80 oss.precision( std::numeric_limits<float>::digits10 );
81 oss << ::from_softfloat32(val);
82 context.console_append( oss.str() );
83 });
84 }
Here is the call graph for this function:

◆ printui()

void sysio::chain::webassembly::interface::printui ( uint64_t val)

Prints value as a 64 bit unsigned integer.

Parameters
val- 64 bit unsigned integer to be printed.

Definition at line 34 of file console.cpp.

34 {
35 predicated_print(context,
36 [&]() {
37 std::ostringstream oss;
38 oss << val;
39 context.console_append( oss.str() );
40 });
41 }

◆ printui128()

void sysio::chain::webassembly::interface::printui128 ( legacy_ptr< const unsigned __int128 > val)

Prints value as a 128 bit unsigned integer.

Parameters
val- 128 bit unsigned integer to be printed.

Definition at line 66 of file console.cpp.

66 {
67 predicated_print(context,
68 [&]() {
69 fc::uint128 v(*val>>64, static_cast<uint64_t>(*val) );
70 context.console_append(fc::variant(v).get_string());
71 });
72 }
std::string get_string(value code)
Return a human readable interpretation of a WebSocket close code.
Definition close.hpp:227

◆ publication_time()

uint64_t sysio::chain::webassembly::interface::publication_time ( ) const

Returns the transaction's publication time.

Returns
time in microseconds from 1970 of the publication_time.

Definition at line 11 of file system.cpp.

11 {
12 return static_cast<uint64_t>( context.trx_context.published.time_since_epoch().count() );
13 }

◆ read_action_data()

int32_t sysio::chain::webassembly::interface::read_action_data ( legacy_span< char > memory) const

Copy up to length bytes of the current action data to the specified location.

Parameters
memory- a pointer where up to length bytes of the current action data will be copied.
Returns
the number of bytes copied to msg, or number of bytes that can be copied if an empty span is passed.

Definition at line 6 of file action.cpp.

6 {
7 auto s = context.get_action().data.size();
8 if( memory.size() == 0 ) return s;
9
10 auto copy_size = std::min( static_cast<size_t>(memory.size()), s );
11 std::memcpy( memory.data(), context.get_action().data.data(), copy_size );
12
13 return copy_size;
14 }

◆ read_transaction()

int32_t sysio::chain::webassembly::interface::read_transaction ( legacy_span< char > data) const

Access a copy of the currently executing transaction.

Parameters
[out]data- the currently executing transaction (packed).
Return values
falseif transaction was not found.
trueif transaction was canceled.

Definition at line 6 of file cf_transaction.cpp.

6 {
7 if( data.size() == 0 ) return transaction_size();
8
9 // always pack the transaction here as exact pack format is part of consensus
10 // and an alternative packed format could be stored in get_packed_transaction()
11 const packed_transaction& packed_trx = context.trx_context.packed_trx;
12 bytes trx = fc::raw::pack( static_cast<const transaction&>( packed_trx.get_transaction() ) );
13 size_t copy_size = std::min( static_cast<size_t>(data.size()), trx.size() );
14 std::memcpy( data.data(), trx.data(), copy_size );
15
16 return copy_size;
17 }
Here is the call graph for this function:

◆ recover_key()

int32_t sysio::chain::webassembly::interface::recover_key ( legacy_ptr< const fc::sha256 > digest,
legacy_span< const char > sig,
legacy_span< char > pub ) const

Calculates the public key used for a given signature on a given digest.

Parameters
digest- digest of the message that was signed.
sig- signature.
[out]pub- output buffer for the public key result.
Returns
size of data written on the buffer.

Definition at line 47 of file crypto.cpp.

49 {
51 datastream<const char*> ds( sig.data(), sig.size() );
52 fc::raw::unpack(ds, s);
53
54 SYS_ASSERT(s.which() < context.db.get<protocol_state_object>().num_supported_key_types, unactivated_signature_type,
55 "Unactivated signature type used during recover_key");
56
57 if(context.control.is_producing_block())
58 SYS_ASSERT(s.variable_size() <= context.control.configured_subjective_signature_length_limit(),
59 sig_variable_size_limit_exception, "signature variable length component size greater than subjective maximum");
60
61
62 auto recovered = fc::crypto::public_key(s, *digest, false);
63
64 // the key types newer than the first 2 may be varible in length
65 if (s.which() >= config::genesis_num_supported_key_types ) {
66 SYS_ASSERT(pub.size() >= 33, wasm_execution_error,
67 "destination buffer must at least be able to hold an ECC public key");
68 auto packed_pubkey = fc::raw::pack(recovered);
69 auto copy_size = std::min<size_t>(pub.size(), packed_pubkey.size());
70 std::memcpy(pub.data(), packed_pubkey.data(), copy_size);
71 return packed_pubkey.size();
72 } else {
73 // legacy behavior, key types 0 and 1 always pack to 33 bytes.
74 // this will do one less copy for those keys while maintaining the rules of
75 // [0..33) dest sizes: assert (asserts in fc::raw::pack)
76 // [33..inf) dest sizes: return packed size (always 33)
77 datastream<char*> out_ds( pub.data(), pub.size() );
78 fc::raw::pack(out_ds, recovered);
79 return out_ds.tellp();
80 }
81 }
Here is the call graph for this function:

◆ require_auth()

void sysio::chain::webassembly::interface::require_auth ( account_name account) const

Verifies that an account exists in the set of provided auths on an action. Fails if not found.

Parameters
account- the name of the account to be verified.

Definition at line 5 of file authorization.cpp.

5 {
6 context.require_authorization( account );
7 }

◆ require_auth2()

void sysio::chain::webassembly::interface::require_auth2 ( account_name account,
permission_name permission ) const

Verifies that an account with a specific permission exists in the set of provided auths on an action,

Parameters
account- the name of the account to be verified.
permission- the name of the permission to be verified.

Definition at line 13 of file authorization.cpp.

14 {
15 context.require_authorization( account, permission );
16 }

◆ require_recipient()

void sysio::chain::webassembly::interface::require_recipient ( account_name recipient)

Add the specified account to set of accounts to be notified.

Parameters
recipient- account to be notified.

Definition at line 18 of file authorization.cpp.

18 {
19 context.require_recipient( recipient );
20 }

◆ ripemd160()

void sysio::chain::webassembly::interface::ripemd160 ( legacy_span< const char > data,
legacy_ptr< fc::ripemd160 > hash_val ) const

Hashes data using RIPEMD160.

Parameters
data- a span containing the data.
[out]hash_val- computed digest.

Definition at line 115 of file crypto.cpp.

115 {
116 *hash_val = context.trx_context.hash_with_checktime<fc::ripemd160>( data.data(), data.size() );
117 }

◆ send_context_free_inline()

void sysio::chain::webassembly::interface::send_context_free_inline ( legacy_span< const char > data)

Send a context free inline action in the context of the parent transaction of this operation.

Parameters
data- the packed free inline action to be sent.

Definition at line 16 of file transaction.cpp.

16 {
17 //TODO: Why is this limit even needed? And why is it not consistently checked on actions in input or deferred transactions
18 SYS_ASSERT( data.size() < context.control.get_global_properties().configuration.max_inline_action_size, inline_action_too_big,
19 "inline action too big" );
20
21 action act;
22 fc::raw::unpack<action>(data.data(), data.size(), act);
23 context.execute_context_free_inline(std::move(act));
24 }
Here is the call graph for this function:

◆ send_deferred()

void sysio::chain::webassembly::interface::send_deferred ( legacy_ptr< const uint128_t > sender_id,
account_name payer,
legacy_span< const char > data,
uint32_t replace_existing )

Send a deferred transaction.

Parameters
sender_id- account name of the sender of this deferred transaction.
payer- account name responsible for paying the RAM for this deferred transaction.
data- the packed transaction to be deferred.
replace_existing- if true, it will replace an existing transaction.

Definition at line 26 of file transaction.cpp.

26 {
27 transaction trx;
28 fc::raw::unpack<transaction>(data.data(), data.size(), trx);
29 context.schedule_deferred_transaction(*sender_id, payer, std::move(trx), replace_existing);
30 }
Here is the call graph for this function:

◆ send_inline()

void sysio::chain::webassembly::interface::send_inline ( legacy_span< const char > data)

Send an inline action in the context of the parent transaction of this operation.

Parameters
data- the inline action to be sent.

Definition at line 6 of file transaction.cpp.

6 {
7 //TODO: Why is this limit even needed? And why is it not consistently checked on actions in input or deferred transactions
8 SYS_ASSERT( data.size() < context.control.get_global_properties().configuration.max_inline_action_size, inline_action_too_big,
9 "inline action too big" );
10
11 action act;
12 fc::raw::unpack<action>(data.data(), data.size(), act);
13 context.execute_inline(std::move(act));
14 }
Here is the call graph for this function:

◆ set_action_return_value()

void sysio::chain::webassembly::interface::set_action_return_value ( span< const char > packed_blob)

Sets a value (packed blob char array) to be included in the action receipt.

Parameters
packed_blob- the packed blob

Definition at line 24 of file action.cpp.

24 {
25 auto max_action_return_value_size =
26 context.control.get_global_properties().configuration.max_action_return_value_size;
27 SYS_ASSERT(packed_blob.size() <= max_action_return_value_size,
28 action_return_value_exception,
29 "action return value size must be less or equal to ${s} bytes", ("s", max_action_return_value_size));
30 context.action_return_value.assign( packed_blob.data(), packed_blob.data() + packed_blob.size() );
31 }
Here is the call graph for this function:

◆ set_blockchain_parameters_packed()

void sysio::chain::webassembly::interface::set_blockchain_parameters_packed ( legacy_span< const char > packed_blockchain_parameters)

Set the blockchain parameters.

Parameters
packed_blockchain_parameters- a span containing the packed blockchain config parameters.

Definition at line 159 of file privileged.cpp.

159 {
160 datastream<const char*> ds( packed_blockchain_parameters.data(), packed_blockchain_parameters.size() );
161 chain::chain_config_v0 cfg;
162 fc::raw::unpack(ds, cfg);
163 cfg.validate();
164 context.db.modify( context.control.get_global_properties(),
165 [&]( auto& gprops ) {
166 gprops.configuration = cfg;
167 });
168 }
Here is the call graph for this function:

◆ set_parameters_packed()

void sysio::chain::webassembly::interface::set_parameters_packed ( span< const char > packed_parameters)

Set the blockchain parameters. It allows a system contract the ability to set parameters in a flexible manner. The input buffer is a packed data stream which represents an encoded sequence of parameter_id:paramter_value pairs with the following format: |varuint32:sequence_length | varuint32:parameter_id | <various>:parameter_value | ... The encoding of parameter_values should be specific to the parameter being set. Having duplicate parameter_ids encoded in the sequence should result in aborting the transaction context. The presence of a parameter_id which is unknown OR which is known but tied to an unactivated consensus protocol should result in aborting the transaction context. There are no requirement for the ordering of items in the sequence.

Parameters
packed_parameters- buffer to hold the packed data with the format described above.

Definition at line 190 of file privileged.cpp.

190 {
191 datastream<const char*> ds( packed_parameters.data(), packed_parameters.size() );
192
193 chain::chain_config cfg = context.control.get_global_properties().configuration;
194 config_range config_range(cfg, {context.control});
195
197
198 config_range.config.validate();
199 context.db.modify( context.control.get_global_properties(),
200 [&]( auto& gprops ) {
201 gprops.configuration = config_range.config;
202 });
203 }
Here is the call graph for this function:

◆ set_privileged()

void sysio::chain::webassembly::interface::set_privileged ( account_name account,
bool is_priv )

Set the privileged status of an account.

Parameters
account- name of the account that we want to give the privileged status.
is_priv- privileged status (true or false).

Definition at line 209 of file privileged.cpp.

209 {
210 const auto& a = context.db.get<account_metadata_object, by_name>( n );
211 context.db.modify( a, [&]( auto& ma ){
212 ma.set_privileged( is_priv );
213 });
214 }

◆ set_proposed_producers()

int64_t sysio::chain::webassembly::interface::set_proposed_producers ( legacy_span< const char > packed_producer_schedule)

Proposes a schedule change using the legacy producer key format.

Parameters
packed_producer_schedule- vector of producer keys
Returns
-1 if proposing a new producer schedule was unsuccessful, otherwise returns the version of the new proposed schedule.

Definition at line 115 of file privileged.cpp.

115 {
116 datastream<const char*> ds( packed_producer_schedule.data(), packed_producer_schedule.size() );
117 std::vector<producer_authority> producers;
118 std::vector<legacy::producer_key> old_version;
119 fc::raw::unpack(ds, old_version);
120
121 /*
122 * Up-convert the producers
123 */
124 for ( const auto& p : old_version ) {
125 producers.emplace_back( producer_authority{ p.producer_name, block_signing_authority_v0{ 1, {{p.block_signing_key, 1}} } } );
126 }
127
128 return set_proposed_producers_common( context, std::move(producers), true );
129 }
int64_t set_proposed_producers_common(apply_context &context, vector< producer_authority > &&producers, bool validate_keys)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_proposed_producers_ex()

int64_t sysio::chain::webassembly::interface::set_proposed_producers_ex ( uint64_t packed_producer_format,
legacy_span< const char > packed_producer_schedule )

Proposes a schedule change with extended features.

Valid formats: 0 : serialized array of producer_keys. Using this format is exactly equivalent to set_proposed_producers. 1 : serialized array of producer_authority's.

Parameters
packed_producer_format- format of the producer data blob.
packed_producer_schedule- packed data of representing the producer schedule in the format indicated.
Returns
-1 if proposing a new producer schedule was unsuccessful, otherwise returns the version of the new proposed schedule.

Definition at line 131 of file privileged.cpp.

131 {
132 if (packed_producer_format == 0) {
133 return set_proposed_producers(std::move(packed_producer_schedule));
134 } else if (packed_producer_format == 1) {
135 datastream<const char*> ds( packed_producer_schedule.data(), packed_producer_schedule.size() );
136 vector<producer_authority> producers;
137
139 return set_proposed_producers_common( context, std::move(producers), false);
140 } else {
141 SYS_THROW(wasm_execution_error, "Producer schedule is in an unknown format!");
142 }
143 }
int64_t set_proposed_producers(legacy_span< const char > packed_producer_schedule)
Here is the call graph for this function:

◆ set_resource_limits()

void sysio::chain::webassembly::interface::set_resource_limits ( account_name account,
int64_t ram_bytes,
int64_t net_weight,
int64_t cpu_weight )

Set the resource limits of an account.

Parameters
account- name of the account whose resource limit to be set.
ram_bytes- ram limit in absolute bytes.
net_weight- fractionally proportionate net limit of available resources based on (weight / total_weight_of_all_accounts).
cpu_weight- fractionally proportionate cpu limit of available resources based on (weight / total_weight_of_all_accounts).

Definition at line 23 of file privileged.cpp.

23 {
24 SYS_ASSERT(ram_bytes >= -1, wasm_execution_error, "invalid value for ram resource limit expected [-1,INT64_MAX]");
25 SYS_ASSERT(net_weight >= -1, wasm_execution_error, "invalid value for net resource weight expected [-1,INT64_MAX]");
26 SYS_ASSERT(cpu_weight >= -1, wasm_execution_error, "invalid value for cpu resource weight expected [-1,INT64_MAX]");
27 if( context.control.get_mutable_resource_limits_manager().set_account_limits(account, ram_bytes, net_weight, cpu_weight) ) {
28 context.trx_context.validate_ram_usage.insert( account );
29 }
30 }

◆ set_wasm_parameters_packed()

void sysio::chain::webassembly::interface::set_wasm_parameters_packed ( span< const char > packed_parameters)

Set the configuration for wasm limits.

See get_wasm_parameters_packed documentation for more details on the structure of the packed_parameters.

Parameters
packed_parameters- a span containing the packed configuration to set.

Definition at line 101 of file privileged.cpp.

101 {
102 datastream<const char*> ds( packed_parameters.data(), packed_parameters.size() );
104 chain::wasm_config cfg;
105 fc::raw::unpack(ds, version);
106 SYS_ASSERT(version == 0, wasm_config_unknown_version, "set_wasm_parameters_packed: Unknown version: ${version}", ("version", version));
107 fc::raw::unpack(ds, cfg);
108 cfg.validate();
109 context.db.modify( context.control.get_global_properties(),
110 [&]( auto& gprops ) {
111 gprops.wasm_configuration = cfg;
112 }
113 );
114 }
Here is the call graph for this function:

◆ sha1()

void sysio::chain::webassembly::interface::sha1 ( legacy_span< const char > data,
legacy_ptr< fc::sha1 > hash_val ) const

Hashes data using SHA1.

Parameters
data- a span containing the data.
[out]hash_val- the resulting digest.

Definition at line 103 of file crypto.cpp.

103 {
104 *hash_val = context.trx_context.hash_with_checktime<fc::sha1>( data.data(), data.size() );
105 }

◆ sha256()

void sysio::chain::webassembly::interface::sha256 ( legacy_span< const char > data,
legacy_ptr< fc::sha256 > hash_val ) const

Hashes data using SHA256.

Parameters
data- a span containing the data.
[out]hash_val- the resulting digest.

Definition at line 107 of file crypto.cpp.

107 {
108 *hash_val = context.trx_context.hash_with_checktime<fc::sha256>( data.data(), data.size() );
109 }

◆ sha3()

void sysio::chain::webassembly::interface::sha3 ( span< const char > data,
span< char > hash_val,
int32_t keccak ) const

Hashes data using SHA3.

Parameters
data- a span containing the data.
[out]hash_val- the resulting digest.
keccak- use keccak version (1-true, all other values == false).

Definition at line 237 of file crypto.cpp.

237 {
238 bool _keccak = keccak == 1;
239 const size_t bs = sysio::chain::config::hashing_checktime_block_size;
240 const char* data = input.data();
241 uint32_t datalen = input.size();
243 while ( datalen > bs ) {
244 enc.write( data, bs);
245 data += bs;
246 datalen -= bs;
247 context.trx_context.checktime();
248 }
249 enc.write( data, datalen);
250 auto res = enc.result(!_keccak);
251
252 auto copy_size = std::min( output.size(), res.data_size() );
253 std::memcpy( output.data(), res.data(), copy_size );
254 }
sha3 result(bool is_nist=true)
Definition sha3.cpp:217
void write(const char *d, uint32_t dlen)
Definition sha3.cpp:213
CK_ULONG datalen
Here is the call graph for this function:

◆ sha512()

void sysio::chain::webassembly::interface::sha512 ( legacy_span< const char > data,
legacy_ptr< fc::sha512 > hash_val ) const

Hashes data using SHA512.

Parameters
data- a span containing the data.
[out]hash_val- the hash

Definition at line 111 of file crypto.cpp.

111 {
112 *hash_val = context.trx_context.hash_with_checktime<fc::sha512>( data.data(), data.size() );
113 }

◆ sysio_assert()

void sysio::chain::webassembly::interface::sysio_assert ( bool condition,
null_terminated_ptr msg ) const

Aborts processing of this action if the test condition is false.

Parameters
condition- test condition.
msg- string explaining the reason for failure.

Definition at line 10 of file cf_system.cpp.

10 {
11 if( BOOST_UNLIKELY( !condition ) ) {
12 const size_t sz = strnlen( msg.data(), max_assert_message );
13 std::string message( msg.data(), sz );
14 SYS_THROW( sysio_assert_message_exception, "assertion failure with message: ${s}", ("s",message) );
15 }
16 }
Here is the call graph for this function:

◆ sysio_assert_code()

void sysio::chain::webassembly::interface::sysio_assert_code ( bool condition,
uint64_t error_code ) const

Aborts processing of this action if the test condition is false. It can be used to provide an error code rather than a message string on assertion checks. If the assertion fails, the provided error code will be made available through the exception message.

Parameters
condition- test condition.
error_code- the error code associated.

Definition at line 26 of file cf_system.cpp.

26 {
27 if( BOOST_UNLIKELY( !condition ) ) {
28 if( error_code >= static_cast<uint64_t>(system_error_code::generic_system_error) ) {
29 restricted_error_code_exception e( FC_LOG_MESSAGE(
30 error,
31 "sysio_assert_code called with reserved error code: ${error_code}",
32 ("error_code", error_code)
33 ) );
35 throw e;
36 } else {
37 sysio_assert_code_exception e( FC_LOG_MESSAGE(
38 error,
39 "assertion failure with error code: ${error_code}",
40 ("error_code", error_code)
41 ) );
42 e.error_code = error_code;
43 throw e;
44 }
45 }
46 }
#define FC_LOG_MESSAGE(LOG_LEVEL, FORMAT,...)
A helper method for generating log messages.

◆ sysio_assert_message()

void sysio::chain::webassembly::interface::sysio_assert_message ( bool condition,
legacy_span< const char > msg ) const

Aborts processing of this action if the test condition is false.

Parameters
condition- test condition.
msg- string explaining the reason for failure.

Definition at line 18 of file cf_system.cpp.

18 {
19 if( BOOST_UNLIKELY( !condition ) ) {
20 const size_t sz = msg.size() > max_assert_message ? max_assert_message : msg.size();
21 std::string message( msg.data(), sz );
22 SYS_THROW( sysio_assert_message_exception, "assertion failure with message: ${s}", ("s",message) );
23 }
24 }

◆ sysio_exit()

void sysio::chain::webassembly::interface::sysio_exit ( int32_t code) const

This method will abort execution of wasm without failing the contract.

Parameters
code- the exit code

Definition at line 48 of file cf_system.cpp.

48 {
49 context.control.get_wasm_interface().exit();
50 }

◆ tapos_block_num()

int32_t sysio::chain::webassembly::interface::tapos_block_num ( ) const

Gets the block number used for TAPOS on the currently executing transaction.

Returns
block number used for TAPOS on the currently executing transaction.

Definition at line 28 of file cf_transaction.cpp.

28 {
29 return context.trx_context.packed_trx.get_transaction().ref_block_num;
30 }

◆ tapos_block_prefix()

int32_t sysio::chain::webassembly::interface::tapos_block_prefix ( ) const

Gets the block prefix used for TAPOS on the currently executing transaction.

Returns
block prefix used for TAPOS on the currently executing transaction.

Definition at line 32 of file cf_transaction.cpp.

32 {
33 return context.trx_context.packed_trx.get_transaction().ref_block_prefix;
34 }

◆ transaction_size()

int32_t sysio::chain::webassembly::interface::transaction_size ( ) const

Gets the size of the currently executing transaction.

Returns
size of the currently executing transaction.

Definition at line 19 of file cf_transaction.cpp.

19 {
20 const packed_transaction& packed_trx = context.trx_context.packed_trx;
21 return fc::raw::pack_size( static_cast<const transaction&>( packed_trx.get_transaction() ) );
22 }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: