diff --git a/libraries/chain/wasm_interface.cpp b/libraries/chain/wasm_interface.cpp index 95c4bf64983cfa2885460a212544a101d7184263..b392d10423ef344a965f3e0fcfde0f772706d5a8 100644 --- a/libraries/chain/wasm_interface.cpp +++ b/libraries/chain/wasm_interface.cpp @@ -295,8 +295,8 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) { void wasm_interface::vm_call( std::string name ) { try { try { - name += std::string( current_validate_context->msg.type ) + "_"; - name += std::string( current_validate_context->msg.recipient ); + name += "_" + std::string( current_validate_context->msg.recipient ); + name += std::string( current_validate_context->msg.type ); FunctionInstance* apply = asFunctionNullable(getInstanceExport(current_module,name.c_str())); if( !apply ) return; /// if not found then it is a no-op @@ -326,7 +326,7 @@ DEFINE_INTRINSIC_FUNCTION1(env,toUpper,toUpper,none,i32,charptr) { { try { try { // wlog( "on_init" ); - FunctionInstance* apply = asFunctionNullable(getInstanceExport(current_module,"on_init")); + FunctionInstance* apply = asFunctionNullable(getInstanceExport(current_module,"init")); if( !apply ) { wlog( "no onInit method found" ); return; /// if not found then it is a no-op diff --git a/tests/tests/block_tests.cpp b/tests/tests/block_tests.cpp index 0359bb2d2a2a45c557666218aab9763ffe77273e..f58f0326ee86fcfcc47d320bbc6bff9e9b9c22cd 100644 --- a/tests/tests/block_tests.cpp +++ b/tests/tests/block_tests.cpp @@ -113,7 +113,7 @@ BOOST_FIXTURE_TEST_CASE(order_dependent_transactions, testing_fixture) vector assemble_wast( const std::string& wast ) { - std::cout << "\n" << wast << "\n"; +// std::cout << "\n" << wast << "\n"; IR::Module module; std::vector parseErrors; WAST::parseModule(wast.c_str(),wast.size(),module,parseErrors); @@ -153,7 +153,7 @@ BOOST_FIXTURE_TEST_CASE(create_script, testing_fixture) Make_Account(chain, simplecoin); chain.produce_blocks(1); -#include "simplecoin.wast" +#include "wast/simplecoin.wast" types::setcode handler; handler.account = "simplecoin"; diff --git a/tests/tests/simplecoin.cpp b/tests/tests/wast/simplecoin.cpp similarity index 99% rename from tests/tests/simplecoin.cpp rename to tests/tests/wast/simplecoin.cpp index f06bb60467f3897933534c232a36f3cd6a46d194..1d680ca4bfe0615f29e5a21792d9ce9542a3b522 100644 --- a/tests/tests/simplecoin.cpp +++ b/tests/tests/wast/simplecoin.cpp @@ -51,7 +51,7 @@ struct Balance { uint64_t balance; }; -void onInit() { +void init() { static Balance initial = { 1000*1000 }; static AccountName simplecoin; simplecoin = name_to_int64( "simplecoin" ); diff --git a/tests/tests/simplecoin.wast b/tests/tests/wast/simplecoin.wast similarity index 98% rename from tests/tests/simplecoin.wast rename to tests/tests/wast/simplecoin.wast index 54353dd38cba551231e10fc9017d4c60f6ed58ad..bf0a7b8425cd28eef5fde715301fb428d589f4ae 100644 --- a/tests/tests/simplecoin.wast +++ b/tests/tests/wast/simplecoin.wast @@ -22,9 +22,9 @@ const char* simplecoin_wast = R"====((module (data (i32.const 80) "\n\00") (data (i32.const 128) "insufficient funds\00") (export "memory" (memory $0)) - (export "on_init" (func $on_init)) + (export "init" (func $init)) (export "apply_simplecoin_transfer" (func $apply_simplecoin_transfer)) - (func $on_init + (func $init (i64.store offset=24 (i32.const 0) (call $name_to_int64