Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::wasm_validations::maximum_function_stack_visitor Struct Reference

#include <wasm_sysio_validation.hpp>

Static Public Member Functions

static void validate (const IR::Module &m)
 

Detailed Description

Definition at line 38 of file wasm_sysio_validation.hpp.

Member Function Documentation

◆ validate()

void sysio::chain::wasm_validations::maximum_function_stack_visitor::validate ( const IR::Module & m)
static

Definition at line 62 of file wasm_sysio_validation.cpp.

62 {
63 for(const FunctionDef& func : m.functions.defs) {
64 unsigned function_stack_usage = 0;
65 for(const ValueType& local : func.nonParameterLocalTypes)
66 function_stack_usage += getTypeBitWidth(local)/8;
67 for(const ValueType& params : m.types[func.type.index]->parameters)
68 function_stack_usage += getTypeBitWidth(params)/8;
69
70 if(function_stack_usage > wasm_constraints::maximum_func_local_bytes)
71 FC_THROW_EXCEPTION(wasm_execution_error, "Smart contract function has more than ${k} bytes of stack usage",
73 }
74}
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
ValueType
Definition Types.h:14
U8 getTypeBitWidth(ValueType type)
Definition Types.h:101
IndexSpace< FunctionDef, IndexedFunctionType > functions
Definition Module.h:133
std::vector< const FunctionType * > types
Definition Module.h:131
account_query_db::get_accounts_by_authorizers_params params
Here is the call graph for this function:

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