Kagome
Polkadot Runtime Engine in C++17
kagome::runtime::binaryen::RuntimeExternalInterface Class Reference

#include <runtime_external_interface.hpp>

Inheritance diagram for kagome::runtime::binaryen::RuntimeExternalInterface:
Collaboration diagram for kagome::runtime::binaryen::RuntimeExternalInterface:

Public Member Functions

 RuntimeExternalInterface (std::shared_ptr< host_api::HostApi > host_api)
 
wasm::Literal callImport (wasm::Function *import, wasm::LiteralList &arguments) override
 
wasm::ShellExternalInterface::Memory * getMemory ()
 
void trap (const char *why) override
 

Private Types

using ImportFuncPtr = wasm::Literal(*)(RuntimeExternalInterface &this_, wasm::Function *import, wasm::LiteralList &arguments)
 

Private Member Functions

void checkArguments (std::string_view extern_name, size_t expected, size_t actual)
 
void methodsRegistration ()
 

Static Private Member Functions

template<auto mf>
static wasm::Literal importCall (RuntimeExternalInterface &this_, wasm::Function *import, wasm::LiteralList &arguments)
 

Private Attributes

std::shared_ptr< host_api::HostApihost_api_
 
boost::unordered_map< std::string, ImportFuncPtrimports_
 
log::Logger logger_
 

Detailed Description

Definition at line 33 of file runtime_external_interface.hpp.

Member Typedef Documentation

using kagome::runtime::binaryen::RuntimeExternalInterface::ImportFuncPtr = wasm::Literal (*)(RuntimeExternalInterface &this_, wasm::Function *import, wasm::LiteralList &arguments)
private

Definition at line 68 of file runtime_external_interface.hpp.

Constructor & Destructor Documentation

kagome::runtime::binaryen::RuntimeExternalInterface::RuntimeExternalInterface ( std::shared_ptr< host_api::HostApi host_api)
explicit

Definition at line 246 of file runtime_external_interface.cpp.

Member Function Documentation

wasm::Literal kagome::runtime::binaryen::RuntimeExternalInterface::callImport ( wasm::Function *  import,
wasm::LiteralList &  arguments 
)
override

Definition at line 259 of file runtime_external_interface.cpp.

void kagome::runtime::binaryen::RuntimeExternalInterface::checkArguments ( std::string_view  extern_name,
size_t  expected,
size_t  actual 
)
private

Checks that the number of arguments is as expected and terminates the program if it is not

Definition at line 275 of file runtime_external_interface.cpp.

wasm::ShellExternalInterface::Memory * kagome::runtime::binaryen::RuntimeExternalInterface::getMemory ( )

Definition at line 255 of file runtime_external_interface.cpp.

template<auto mf>
wasm::Literal kagome::runtime::binaryen::RuntimeExternalInterface::importCall ( RuntimeExternalInterface this_,
wasm::Function *  import,
wasm::LiteralList &  arguments 
)
staticprivate

Definition at line 290 of file runtime_external_interface.cpp.

void kagome::runtime::binaryen::RuntimeExternalInterface::methodsRegistration ( )
private
Note
: some implementation details were taken from https://github.com/WebAssembly/binaryen/blob/master/src/shell-interface.h

memory externals

secp256k1 recovery algorithms version_1 and version_2 are not different for our bitcoin secp256k1 library. They have difference only for rust implementation and it is use of parse_standard instead of parse_overflowing. In comment,

See also
https://github.com/paritytech/libsecp256k1/blob/d2ca104ea2cbda8f0708a6d80eb1da63e0cc0e69/src/lib.rs#L461 it is said that parse_overflowing is implementation specific and won't be used in any other standard libraries

Definition at line 131 of file runtime_external_interface.cpp.

void kagome::runtime::binaryen::RuntimeExternalInterface::trap ( const char *  why)
inlineoverride

Definition at line 43 of file runtime_external_interface.hpp.

Member Data Documentation

std::shared_ptr<host_api::HostApi> kagome::runtime::binaryen::RuntimeExternalInterface::host_api_
private

Definition at line 64 of file runtime_external_interface.hpp.

boost::unordered_map<std::string, ImportFuncPtr> kagome::runtime::binaryen::RuntimeExternalInterface::imports_
private

Definition at line 70 of file runtime_external_interface.hpp.

log::Logger kagome::runtime::binaryen::RuntimeExternalInterface::logger_
private

Definition at line 71 of file runtime_external_interface.hpp.


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