10namespace sysio {
namespace chain {
namespace wasm_validations {
19 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract initial memory size must be less than or equal to ${k}KiB",
25 if ( ds.baseOffset.type != InitializerExpression::Type::i32_const )
26 FC_THROW_EXCEPTION( wasm_execution_error,
"Smart contract has unexpected memory base offset type" );
29 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract data segments must lie in first ${k}KiB",
36 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract table limited to ${t} elements",
41 unsigned mutable_globals_total_size = 0;
48 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract has unexpected global definition value type");
51 mutable_globals_total_size += 4;
54 mutable_globals_total_size += 4;
58 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract has more than ${k} bytes of mutable globals",
64 unsigned function_stack_usage = 0;
65 for(
const ValueType& local : func.nonParameterLocalTypes)
71 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract function has more than ${k} bytes of stack usage",
77 bool found_it =
false;
80 if(exprt.
kind != ObjectKind::function)
82 if(exprt.
name !=
"apply")
91 FC_THROW_EXCEPTION(wasm_execution_error,
"Smart contract's apply function not exported; non-existent; or wrong type");
Defines exception's used by fc.
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
U8 getTypeBitWidth(ValueType type)
constexpr unsigned maximum_linear_memory
constexpr unsigned maximum_table_elements
constexpr unsigned maximum_mutable_globals
constexpr unsigned maximum_func_local_bytes
constexpr unsigned maximum_linear_memory_init
static IR_API const FunctionType * get(ResultType ret, const std::initializer_list< ValueType > ¶meters)
IndexSpace< MemoryDef, MemoryType > memories
IndexSpace< TableDef, TableType > tables
IndexSpace< FunctionDef, IndexedFunctionType > functions
std::vector< const FunctionType * > types
IndexSpace< GlobalDef, GlobalType > globals
std::vector< DataSegment > dataSegments
std::vector< Export > exports
static void validate(const IR::Module &m)
static void validate(const IR::Module &m)
static void validate(const IR::Module &m)
static void validate(const IR::Module &m)
static void validate(const IR::Module &m)
static void validate(const IR::Module &m)
static void validate(const IR::Module &m)