提交 38ec5f00 编写于 作者: M Matias Romeo

add wasm_test: test wasm that does not export the start function

上级 5bd8600c
......@@ -143,6 +143,41 @@ static const char entry_wast[] = R"=====(
)
)=====";
static const char entry_wast_2[] = R"=====(
(module
(import "env" "require_auth" (func $require_auth (param i64)))
(import "env" "eosio_assert" (func $eosio_assert (param i32 i32)))
(import "env" "current_time" (func $current_time (result i64)))
(table 0 anyfunc)
(memory $0 1)
(export "memory" (memory $0))
(export "apply" (func $apply))
(start $entry)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(block
(call $require_auth (i64.const 6121376101093867520))
(call $eosio_assert
(i64.eq
(i64.load offset=4
(i32.const 0)
)
(call $current_time)
)
(i32.const 0)
)
)
)
(func $entry
(block
(i64.store offset=4
(i32.const 0)
(call $current_time)
)
)
)
)
)=====";
static const char simple_no_memory_wast[] = R"=====(
(module
(import "env" "require_auth" (func $require_auth (param i64)))
......
......@@ -670,6 +670,31 @@ BOOST_FIXTURE_TEST_CASE( check_entry_behavior, TESTER ) try {
BOOST_CHECK_EQUAL(transaction_receipt::executed, receipt.status);
} FC_LOG_AND_RETHROW()
BOOST_FIXTURE_TEST_CASE( check_entry_behavior_2, TESTER ) try {
produce_blocks(2);
create_accounts( {N(entrycheck)} );
produce_block();
set_code(N(entrycheck), entry_wast_2);
produce_blocks(10);
signed_transaction trx;
action act;
act.account = N(entrycheck);
act.name = N();
act.authorization = vector<permission_level>{{N(entrycheck),config::active_name}};
trx.actions.push_back(act);
set_transaction_headers(trx);
trx.sign(get_private_key( N(entrycheck), "active" ), chain_id_type());
push_transaction(trx);
produce_blocks(1);
BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
const auto& receipt = get_transaction_receipt(trx.id());
BOOST_CHECK_EQUAL(transaction_receipt::executed, receipt.status);
} FC_LOG_AND_RETHROW()
/**
* Ensure we can load a wasm w/o memory
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册