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

#include <wasm_sysio_validation.hpp>

Static Public Member Functions

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

Detailed Description

Definition at line 26 of file wasm_sysio_validation.hpp.

Member Function Documentation

◆ validate()

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

Definition at line 23 of file wasm_sysio_validation.cpp.

23 {
24 for ( const DataSegment& ds : m.dataSegments ) {
25 if ( ds.baseOffset.type != InitializerExpression::Type::i32_const )
26 FC_THROW_EXCEPTION( wasm_execution_error, "Smart contract has unexpected memory base offset type" );
27
28 if ( static_cast<uint32_t>( ds.baseOffset.i32 ) + ds.data.size() > wasm_constraints::maximum_linear_memory_init )
29 FC_THROW_EXCEPTION(wasm_execution_error, "Smart contract data segments must lie in first ${k}KiB",
31 }
32}
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
static const Segment ds(Segment::ds)
unsigned int uint32_t
Definition stdint.h:126
std::vector< DataSegment > dataSegments
Definition Module.h:139

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