提交 f093ba8c 编写于 作者: M Matias Romeo

Fix tests after rebase

issue #1701
上级 4c38f674
......@@ -64,8 +64,8 @@ namespace eosio {
#define EOSIO_ABI( TYPE, MEMBERS ) \
extern "C" { \
void apply( uint64_t code, uint64_t action ) { \
auto self = current_receiver(); \
void apply( uint64_t receiver, uint64_t code, uint64_t action ) { \
auto self = receiver; \
if( code == self ) { \
TYPE thiscontract( self ); \
switch( action ) { \
......
......@@ -170,7 +170,7 @@ struct limit_order {
namespace multi_index_test {
extern "C" {
/// The apply method implements the dispatch of events to this contract
void apply( uint64_t code, uint64_t action ) {
void apply( uint64_t receiver, uint64_t code, uint64_t action ) {
eosio_assert(eosio::dispatch<multi_index_test, multi_index_test::trigger>(code, action),
"Could not dispatch");
}
......
......@@ -141,22 +141,23 @@ struct test_multi_index {
static void idx128_autoincrement_test_part1(uint64_t receiver, uint64_t code, uint64_t action);
static void idx128_autoincrement_test_part2(uint64_t receiver, uint64_t code, uint64_t action);
static void idx256_general(uint64_t receiver, uint64_t code, uint64_t action);
static void idx_double_general(uint64_t receiver, uint64_t code, uint64_t action); static void idx64_pk_iterator_exceed_end();
static void idx64_sk_iterator_exceed_end();
static void idx64_pk_iterator_exceed_begin();
static void idx64_sk_iterator_exceed_begin();
static void idx64_pass_pk_ref_to_other_table();
static void idx64_pass_sk_ref_to_other_table();
static void idx64_pass_pk_end_itr_to_iterator_to();
static void idx64_pass_pk_end_itr_to_modify();
static void idx64_pass_pk_end_itr_to_erase();
static void idx64_pass_sk_end_itr_to_iterator_to();
static void idx64_pass_sk_end_itr_to_modify();
static void idx64_pass_sk_end_itr_to_erase();
static void idx64_modify_primary_key();
static void idx64_run_out_of_avl_pk();
static void idx64_sk_cache_pk_lookup();
static void idx64_pk_cache_sk_lookup();
static void idx_double_general(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pk_iterator_exceed_end(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_sk_iterator_exceed_end(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pk_iterator_exceed_begin(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_sk_iterator_exceed_begin(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_pk_ref_to_other_table(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_sk_ref_to_other_table(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_pk_end_itr_to_iterator_to(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_pk_end_itr_to_modify(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_pk_end_itr_to_erase(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_sk_end_itr_to_iterator_to(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_sk_end_itr_to_modify(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pass_sk_end_itr_to_erase(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_modify_primary_key(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_run_out_of_avl_pk(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_sk_cache_pk_lookup(uint64_t receiver, uint64_t code, uint64_t action);
static void idx64_pk_cache_sk_lookup(uint64_t receiver, uint64_t code, uint64_t action);
};
......
......@@ -14,7 +14,7 @@ extern "C" {
}
void apply( unsigned long long, unsigned long long action ) {
void apply( uint64_t receiver, uint64_t code, uint64_t action ) {
//eosio::print("==> CONTRACT: ", code, " ", action, "\n");
......
......@@ -26,22 +26,22 @@ extern "C" {
WASM_TEST_HANDLER_EX(test_multi_index, idx128_autoincrement_test_part2);
WASM_TEST_HANDLER_EX(test_multi_index, idx256_general);
WASM_TEST_HANDLER_EX(test_multi_index, idx_double_general);
WASM_TEST_HANDLER(test_multi_index, idx64_pk_iterator_exceed_end);
WASM_TEST_HANDLER(test_multi_index, idx64_sk_iterator_exceed_end);
WASM_TEST_HANDLER(test_multi_index, idx64_pk_iterator_exceed_begin);
WASM_TEST_HANDLER(test_multi_index, idx64_sk_iterator_exceed_begin);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_pk_ref_to_other_table);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_sk_ref_to_other_table);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_pk_end_itr_to_iterator_to);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_pk_end_itr_to_modify);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_pk_end_itr_to_erase);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_sk_end_itr_to_iterator_to);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_sk_end_itr_to_modify);
WASM_TEST_HANDLER(test_multi_index, idx64_pass_sk_end_itr_to_erase);
WASM_TEST_HANDLER(test_multi_index, idx64_modify_primary_key);
WASM_TEST_HANDLER(test_multi_index, idx64_run_out_of_avl_pk);
WASM_TEST_HANDLER(test_multi_index, idx64_sk_cache_pk_lookup);
WASM_TEST_HANDLER(test_multi_index, idx64_pk_cache_sk_lookup);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pk_iterator_exceed_end);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_sk_iterator_exceed_end);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pk_iterator_exceed_begin);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_sk_iterator_exceed_begin);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_pk_ref_to_other_table);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_sk_ref_to_other_table);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_pk_end_itr_to_iterator_to);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_pk_end_itr_to_modify);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_pk_end_itr_to_erase);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_sk_end_itr_to_iterator_to);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_sk_end_itr_to_modify);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pass_sk_end_itr_to_erase);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_modify_primary_key);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_run_out_of_avl_pk);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_sk_cache_pk_lookup);
WASM_TEST_HANDLER_EX(test_multi_index, idx64_pk_cache_sk_lookup);
//unhandled test call
eosio_assert(false, "Unknown Test");
......
......@@ -5,6 +5,9 @@
#include <limits>
#include <cmath>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
namespace _test_multi_index {
using eosio::key256;
......@@ -241,14 +244,14 @@ namespace _test_multi_index {
}
template<uint64_t TableName, uint64_t SecondaryIndex>
auto idx64_table()
auto idx64_table(uint64_t receiver)
{
using namespace eosio;
typedef record_idx64 record;
// Load table using multi_index
multi_index<TableName, record,
indexed_by<SecondaryIndex, const_mem_fun<record, uint64_t, &record::get_secondary> >
> table( current_receiver(), current_receiver() );
> table( receiver, receiver );
return table;
}
......@@ -256,45 +259,38 @@ namespace _test_multi_index {
void test_multi_index::idx64_store_only(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
_test_multi_index::idx64_store_only<N(indextable1)>(receiver);
}
void test_multi_index::idx64_check_without_storing(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
_test_multi_index::idx64_check_without_storing<N(indextable1)>(receiver);
}
void test_multi_index::idx64_general(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
_test_multi_index::idx64_store_only<N(indextable2)>(receiver);
_test_multi_index::idx64_check_without_storing<N(indextable2)>(receiver);
}
void test_multi_index::idx128_store_only(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
_test_multi_index::idx128_store_only<N(indextable3)>(receiver);
}
void test_multi_index::idx128_check_without_storing(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
_test_multi_index::idx128_check_without_storing<N(indextable3)>(receiver);
}
void test_multi_index::idx128_general(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
_test_multi_index::idx128_store_only<N(indextable4)>(receiver);
_test_multi_index::idx128_check_without_storing<N(indextable4)>(receiver);
}
void test_multi_index::idx128_autoincrement_test(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
using namespace eosio;
using namespace _test_multi_index;
......@@ -343,7 +339,6 @@ void test_multi_index::idx128_autoincrement_test(uint64_t receiver, uint64_t cod
void test_multi_index::idx128_autoincrement_test_part1(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
using namespace eosio;
using namespace _test_multi_index;
......@@ -377,7 +372,6 @@ void test_multi_index::idx128_autoincrement_test_part1(uint64_t receiver, uint64
void test_multi_index::idx128_autoincrement_test_part2(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
using namespace eosio;
using namespace _test_multi_index;
......@@ -434,7 +428,6 @@ void test_multi_index::idx128_autoincrement_test_part2(uint64_t receiver, uint64
void test_multi_index::idx256_general(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
using namespace eosio;
using namespace _test_multi_index;
......@@ -541,7 +534,6 @@ void test_multi_index::idx256_general(uint64_t receiver, uint64_t code, uint64_t
void test_multi_index::idx_double_general(uint64_t receiver, uint64_t code, uint64_t action)
{
(void)code;(void)action;
using namespace eosio;
using namespace _test_multi_index;
......@@ -594,42 +586,42 @@ void test_multi_index::idx_double_general(uint64_t receiver, uint64_t code, uint
}
void test_multi_index::idx64_pk_iterator_exceed_end()
void test_multi_index::idx64_pk_iterator_exceed_end(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto end_itr = table.end();
// Should fail
++end_itr;
}
void test_multi_index::idx64_sk_iterator_exceed_end()
void test_multi_index::idx64_sk_iterator_exceed_end(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto end_itr = table.get_index<N(bysecondary)>().end();
// Should fail
++end_itr;
}
void test_multi_index::idx64_pk_iterator_exceed_begin()
void test_multi_index::idx64_pk_iterator_exceed_begin(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto begin_itr = table.begin();
// Should fail
--begin_itr;
}
void test_multi_index::idx64_sk_iterator_exceed_begin()
void test_multi_index::idx64_sk_iterator_exceed_begin(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto begin_itr = table.get_index<N(bysecondary)>().begin();
// Should fail
--begin_itr;
}
void test_multi_index::idx64_pass_pk_ref_to_other_table()
void test_multi_index::idx64_pass_pk_ref_to_other_table(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table1 = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table2 = _test_multi_index::idx64_table<N(indextable2), N(bysecondary)>();
auto table1 = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto table2 = _test_multi_index::idx64_table<N(indextable2), N(bysecondary)>(receiver);
auto table1_pk_itr = table1.find(781);
eosio_assert(table1_pk_itr != table1.end() && table1_pk_itr->sec == N(bob), "idx64_pass_pk_ref_to_other_table - table.find() of existing primary key");
......@@ -638,10 +630,10 @@ void test_multi_index::idx64_pass_pk_ref_to_other_table()
table2.iterator_to(*table1_pk_itr);
}
void test_multi_index::idx64_pass_sk_ref_to_other_table()
void test_multi_index::idx64_pass_sk_ref_to_other_table(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table1 = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table2 = _test_multi_index::idx64_table<N(indextable2), N(bysecondary)>();
auto table1 = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto table2 = _test_multi_index::idx64_table<N(indextable2), N(bysecondary)>(receiver);
auto table1_pk_itr = table1.find(781);
eosio_assert(table1_pk_itr != table1.end() && table1_pk_itr->sec == N(bob), "idx64_pass_sk_ref_to_other_table - table.find() of existing primary key");
......@@ -651,37 +643,37 @@ void test_multi_index::idx64_pass_sk_ref_to_other_table()
table2_sec_index.iterator_to(*table1_pk_itr);
}
void test_multi_index::idx64_pass_pk_end_itr_to_iterator_to()
void test_multi_index::idx64_pass_pk_end_itr_to_iterator_to(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto end_itr = table.end();
// Should fail
table.iterator_to(*end_itr);
}
void test_multi_index::idx64_pass_pk_end_itr_to_modify()
void test_multi_index::idx64_pass_pk_end_itr_to_modify(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto end_itr = table.end();
auto payer = current_receiver();
auto payer = receiver;
// Should fail
table.modify(end_itr, payer, [](auto&){});
}
void test_multi_index::idx64_pass_pk_end_itr_to_erase()
void test_multi_index::idx64_pass_pk_end_itr_to_erase(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto end_itr = table.end();
// Should fail
table.erase(end_itr);
}
void test_multi_index::idx64_pass_sk_end_itr_to_iterator_to()
void test_multi_index::idx64_pass_sk_end_itr_to_iterator_to(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto sec_index = table.get_index<N(bysecondary)>();
auto end_itr = sec_index.end();
......@@ -689,21 +681,21 @@ void test_multi_index::idx64_pass_sk_end_itr_to_iterator_to()
sec_index.iterator_to(*end_itr);
}
void test_multi_index::idx64_pass_sk_end_itr_to_modify()
void test_multi_index::idx64_pass_sk_end_itr_to_modify(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto sec_index = table.get_index<N(bysecondary)>();
auto end_itr = sec_index.end();
auto payer = current_receiver();
auto payer = receiver;
// Should fail
sec_index.modify(end_itr, payer, [](auto&){});
}
void test_multi_index::idx64_pass_sk_end_itr_to_erase()
void test_multi_index::idx64_pass_sk_end_itr_to_erase(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto sec_index = table.get_index<N(bysecondary)>();
auto end_itr = sec_index.end();
......@@ -711,14 +703,14 @@ void test_multi_index::idx64_pass_sk_end_itr_to_erase()
sec_index.erase(end_itr);
}
void test_multi_index::idx64_modify_primary_key()
void test_multi_index::idx64_modify_primary_key(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto pk_itr = table.find(781);
eosio_assert(pk_itr != table.end() && pk_itr->sec == N(bob), "idx64_modify_primary_key - table.find() of existing primary key");
auto payer = current_receiver();
auto payer = receiver;
// Should fail
table.modify(pk_itr, payer, [](auto& r){
......@@ -726,14 +718,14 @@ void test_multi_index::idx64_modify_primary_key()
});
}
void test_multi_index::idx64_run_out_of_avl_pk()
void test_multi_index::idx64_run_out_of_avl_pk(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto pk_itr = table.find(781);
eosio_assert(pk_itr != table.end() && pk_itr->sec == N(bob), "idx64_modify_primary_key - table.find() of existing primary key");
auto payer = current_receiver();
auto payer = receiver;
table.emplace( payer, [&]( auto& r ) {
r.id = static_cast<uint64_t>(-4);
......@@ -750,9 +742,9 @@ void test_multi_index::idx64_run_out_of_avl_pk()
table.available_primary_key();
}
void test_multi_index::idx64_sk_cache_pk_lookup()
void test_multi_index::idx64_sk_cache_pk_lookup(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto sec_index = table.get_index<N(bysecondary)>();
auto sk_itr = sec_index.find(N(bob));
......@@ -763,9 +755,9 @@ void test_multi_index::idx64_sk_cache_pk_lookup()
eosio_assert(prev_itr->id == 265 && prev_itr->sec == N(alice), "idx64_sk_cache_pk_lookup - previous record");
}
void test_multi_index::idx64_pk_cache_sk_lookup()
void test_multi_index::idx64_pk_cache_sk_lookup(uint64_t receiver, uint64_t code, uint64_t action)
{
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>();
auto table = _test_multi_index::idx64_table<N(indextable1), N(bysecondary)>(receiver);
auto pk_itr = table.find(540);
......@@ -777,3 +769,4 @@ void test_multi_index::idx64_pk_cache_sk_lookup()
eosio_assert(next_itr->id == 781 && next_itr->sec == N(bob), "idx64_pk_cache_sk_lookup - next record");
}
#pragma GCC diagnostic pop
\ No newline at end of file
......@@ -79,7 +79,7 @@ void ensure_apply_exported_visitor::validate( const IR::Module& m ) {
for(const Export& exprt : m.exports) {
if(exprt.name != "apply" && exprt.kind != ObjectKind::function)
continue;
if(m.types[m.functions.getType(exprt.index).index] == FunctionType::get(ResultType::none, {ValueType::i64, ValueType::i64})) {
if(m.types[m.functions.getType(exprt.index).index] == FunctionType::get(ResultType::none, {ValueType::i64, ValueType::i64, ValueType::i64})) {
found_it = true;
break;
}
......
......@@ -36,10 +36,10 @@ namespace eosio { namespace chain {
FC_ASSERT( !"error parsing wast", "${msg}", ("msg",ss.str()) );
}
for(auto sectionIt = module.userSections.begin();sectionIt != module.userSections.end();++sectionIt)
{
if(sectionIt->name == "name") { module.userSections.erase(sectionIt); break; }
}
for(auto sectionIt = module.userSections.begin();sectionIt != module.userSections.end();++sectionIt)
{
if(sectionIt->name == "name") { module.userSections.erase(sectionIt); break; }
}
try
{
......
......@@ -602,8 +602,7 @@ BOOST_FIXTURE_TEST_CASE(transaction_tests, tester) { try {
// test send_action_large
BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_large", {}), fc::assert_exception,
[](const fc::assert_exception& e) {
return expect_assert_message(e, "abort()");
//return expect_assert_message(e, "data_len < config::default_max_inline_action_size: inline action too big");
return expect_assert_message(e, "data_len < config::default_max_inline_action_size: inline action too big");
}
);
......
......@@ -2544,7 +2544,7 @@ static const char f32_test_wast[] = R"=====(
(func $floor (param $0 f32) (result f32) (f32.floor (get_local $0)))
(func $trunc (param $0 f32) (result f32) (f32.trunc (get_local $0)))
(func $nearest (param $0 f32) (result f32) (f32.nearest (get_local $0)))
(func $apply (param $0 i64)(param $1 i64)
(func $apply (param $0 i64)(param $1 i64)(param $2 i64)
(call $assert_return (call $add (f32.const -0x0p+0) (f32.const -0x0p+0)) (f32.const -0x0p+0) (i32.const 20))
(call $assert_return (call $add (f32.const -0x0p+0) (f32.const 0x0p+0)) (f32.const 0x0p+0) (i32.const 24))
(call $assert_return (call $add (f32.const 0x0p+0) (f32.const -0x0p+0)) (f32.const 0x0p+0) (i32.const 28))
......@@ -7467,7 +7467,7 @@ static const char f32_cmp_test_wast[] = R"=====(
(func $flt (param $0 f32) (param $1 f32) (result i32) (f32.lt (get_local $0) (get_local $1)))
(func $fge (param $0 f32) (param $1 f32) (result i32) (f32.ge (get_local $0) (get_local $1)))
(func $fle (param $0 f32) (param $1 f32) (result i32) (f32.le (get_local $0) (get_local $1)))
(func $apply (param $0 i64)(param $1 i64)
(func $apply (param $0 i64)(param $1 i64)(param $2 i64)
(call $assert_return (call $feq (f32.const -0x0p+0) (f32.const -0x0p+0)) (i32.const 1) (i32.const 20))
(call $assert_return (call $feq (f32.const -0x0p+0) (f32.const 0x0p+0)) (i32.const 1) (i32.const 24))
(call $assert_return (call $feq (f32.const 0x0p+0) (f32.const -0x0p+0)) (i32.const 1) (i32.const 28))
......@@ -10259,7 +10259,7 @@ static const char f32_bitwise_test_wast[] = R"=====(
(func $abs (param $0 f32) (result f32) (f32.abs (get_local $0)))
(func $neg (param $0 f32) (result f32) (f32.neg (get_local $0)))
(func $copysign (param $0 f32) (param $1 f32) (result f32) (f32.copysign (get_local $0) (get_local $1)))
(func $apply (param $0 i64)(param $1 i64)
(func $apply (param $0 i64)(param $1 i64)(param $2 i64)
(call $assert_return (call $copysign (f32.const -0x0p+0) (f32.const -0x0p+0)) (f32.const -0x0p+0) (i32.const 20))
(call $assert_return (call $copysign (f32.const -0x0p+0) (f32.const 0x0p+0)) (f32.const 0x0p+0) (i32.const 24))
(call $assert_return (call $copysign (f32.const 0x0p+0) (f32.const -0x0p+0)) (f32.const -0x0p+0) (i32.const 28))
......@@ -13166,7 +13166,7 @@ static const char f64_test_wast[] = R"=====(
(func $floor (param $0 f64) (result f64) (f64.floor (get_local $0)))
(func $trunc (param $0 f64) (result f64) (f64.trunc (get_local $0)))
(func $nearest (param $0 f64) (result f64) (f64.nearest (get_local $0)))
(func $apply (param $0 i64)(param $1 i64)
(func $apply (param $0 i64)(param $1 i64)(param $2 i64)
(call $assert_return (call $add (f64.const -0x0p+0) (f64.const -0x0p+0)) (f64.const -0x0p+0) (i32.const 20))
(call $assert_return (call $add (f64.const -0x0p+0) (f64.const 0x0p+0)) (f64.const 0x0p+0) (i32.const 24))
(call $assert_return (call $add (f64.const 0x0p+0) (f64.const -0x0p+0)) (f64.const 0x0p+0) (i32.const 28))
......@@ -16043,7 +16043,7 @@ static const char f64_bitwise_test_wast[] = R"=====(
(func $abs (param $0 f64) (result f64) (f64.abs (get_local $0)))
(func $neg (param $0 f64) (result f64) (f64.neg (get_local $0)))
(func $copysign (param $0 f64) (param $1 f64) (result f64) (f64.copysign (get_local $0) (get_local $1)))
(func $apply (param $0 i64)(param $1 i64)
(func $apply (param $0 i64)(param $1 i64)(param $2 i64)
(call $assert_return (call $copysign (f64.const -0x0p+0) (f64.const -0x0p+0)) (f64.const -0x0p+0) (i32.const 20))
(call $assert_return (call $copysign (f64.const -0x0p+0) (f64.const 0x0p+0)) (f64.const 0x0p+0) (i32.const 24))
(call $assert_return (call $copysign (f64.const 0x0p+0) (f64.const -0x0p+0)) (f64.const -0x0p+0) (i32.const 28))
......@@ -18827,7 +18827,7 @@ static const char f64_cmp_test_wast[] = R"=====(
(func $lt (param $0 f64) (param $1 f64) (result i32) (f64.lt (get_local $0) (get_local $1)))
(func $ge (param $0 f64) (param $1 f64) (result i32) (f64.ge (get_local $0) (get_local $1)))
(func $le (param $0 f64) (param $1 f64) (result i32) (f64.le (get_local $0) (get_local $1)))
(func $apply (param $0 i64)(param $1 i64)
(func $apply (param $0 i64)(param $1 i64)(param $2 i64)
(call $assert_return (call $eq (f64.const -0x0p+0) (f64.const -0x0p+0)) (i32.const 1) (i32.const 20))
(call $assert_return (call $eq (f64.const -0x0p+0) (f64.const 0x0p+0)) (i32.const 1) (i32.const 24))
(call $assert_return (call $eq (f64.const 0x0p+0) (f64.const -0x0p+0)) (i32.const 1) (i32.const 28))
......@@ -21342,7 +21342,7 @@ static const char f32_f64_conv_wast[] = R"=====(
)
(func $assert_return_nan32 (param $0 f32) (param $1 i32)( call $eosio_assert (call $is_nan32 (get_local $0)) (get_local $1)))
(func $assert_return_nan64 (param $0 f64) (param $1 i32)( call $eosio_assert (call $is_nan64 (get_local $0)) (get_local $1)))
(func $apply (param $0 i64)(param $1 i64)
(func $apply (param $0 i64)(param $1 i64)(param $2 i64)
(call $assert_returnf64 (call $f64_promote_f32 (f32.const 0.0)) (f64.const 0.0) (i32.const 20))
(call $assert_returnf64 (call $f64_promote_f32 (f32.const -0.0)) (f64.const -0.0) (i32.const 24))
(call $assert_returnf64 (call $f64_promote_f32 (f32.const 0x1p-149)) (f64.const 0x1p-149) (i32.const 28))
......@@ -31,7 +31,7 @@ static const char entry_wast[] = R"=====(
(call $now)
)
)
(func $apply (param $0 i64) (param $1 i64)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(call $eosio_assert
(i32.eq
(i32.load offset=4
......@@ -51,7 +51,7 @@ static const char simple_no_memory_wast[] = R"=====(
(import "env" "memcpy" (func $memcpy (param i32 i32 i32) (result i32)))
(table 0 anyfunc)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(drop
(call $memcpy
(i32.const 0)
......@@ -70,12 +70,12 @@ static const char mutable_global_wast[] = R"=====(
(memory $0 1)
(export "memory" (memory $0))
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(if (i64.eq (get_local $1) (i64.const 0)) (then
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(if (i64.eq (get_local $2) (i64.const 0)) (then
(set_global $g0 (i64.const 444))
(return)
))
(if (i64.eq (get_local $1) (i64.const 1)) (then
(if (i64.eq (get_local $2) (i64.const 1)) (then
(call $eosio_assert (i64.eq (get_global $g0) (i64.const 2)) (i32.const 0))
(return)
))
......@@ -93,7 +93,7 @@ static const char biggest_memory_wast[] = R"=====(
(export "memory" (memory $$0))
(export "apply" (func $$apply))
(func $$apply (param $$0 i64) (param $$1 i64)
(func $$apply (param $$0 i64) (param $$1 i64) (param $$2 i64)
(call $$eosio_assert
(i32.eq
(grow_memory (i32.const 1))
......@@ -111,7 +111,7 @@ static const char too_big_memory_wast[] = R"=====(
(memory $$0 ${MAX_WASM_PAGES_PLUS_ONE})
(export "memory" (memory $$0))
(export "apply" (func $$apply))
(func $$apply (param $$0 i64) (param $$1 i64))
(func $$apply (param $$0 i64) (param $$1 i64) (param $$2 i64))
)
)=====";
......@@ -119,7 +119,7 @@ static const char valid_sparse_table[] = R"=====(
(module
(table 1024 anyfunc)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
(elem (i32.const 0) $apply)
(elem (i32.const 1022) $apply $apply)
)
......@@ -129,7 +129,7 @@ static const char too_big_table[] = R"=====(
(module
(table 1025 anyfunc)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
(elem (i32.const 0) $apply)
(elem (i32.const 1022) $apply $apply)
)
......@@ -139,7 +139,7 @@ static const char memory_init_borderline[] = R"=====(
(module
(memory $0 16)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
(data (i32.const 65532) "sup!")
)
)=====";
......@@ -148,7 +148,7 @@ static const char memory_init_toolong[] = R"=====(
(module
(memory $0 16)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
(data (i32.const 65533) "sup!")
)
)=====";
......@@ -157,7 +157,7 @@ static const char memory_init_negative[] = R"=====(
(module
(memory $0 16)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
(data (i32.const -1) "sup!")
)
)=====";
......@@ -167,26 +167,25 @@ static const char memory_table_import[] = R"=====(
(table (import "foo" "table") 10 anyfunc)
(memory (import "nom" "memory") 0)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
)
)=====";
static const char table_checker_wast[] = R"=====(
(module
(import "env" "eosio_assert" (func $assert (param i32 i32)))
(import "env" "printi" (func $printi (param i64)))
(type $SIG$vj (func (param i64)))
(table 1024 anyfunc)
(memory $0 1)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(call_indirect $SIG$vj
(i64.shr_u
(get_local $1)
(get_local $2)
(i64.const 32)
)
(i32.wrap/i64
(get_local $1)
(get_local $2)
)
)
)
......@@ -221,14 +220,14 @@ static const char table_checker_proper_syntax_wast[] = R"=====(
(table 1024 anyfunc)
(memory $0 1)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(call_indirect (type $SIG$vj)
(i64.shr_u
(get_local $1)
(get_local $2)
(i64.const 32)
)
(i32.wrap/i64
(get_local $1)
(get_local $2)
)
)
)
......@@ -263,14 +262,14 @@ static const char table_checker_small_wast[] = R"=====(
(table 128 anyfunc)
(memory $0 1)
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(call_indirect (type $SIG$vj)
(i64.shr_u
(get_local $1)
(get_local $2)
(i64.const 32)
)
(i32.wrap/i64
(get_local $1)
(get_local $2)
)
)
)
......@@ -290,7 +289,7 @@ static const char table_checker_small_wast[] = R"=====(
static const char global_protection_none_get_wast[] = R"=====(
(module
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(drop (get_global 0))
)
)
......@@ -301,7 +300,7 @@ static const char global_protection_some_get_wast[] = R"=====(
(global i32 (i32.const -11))
(global i32 (i32.const 56))
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(drop (get_global 1))
(drop (get_global 2))
)
......@@ -311,8 +310,8 @@ static const char global_protection_some_get_wast[] = R"=====(
static const char global_protection_none_set_wast[] = R"=====(
(module
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(set_global 0 (get_local 0))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(set_global 0 (get_local 1))
)
)
)=====";
......@@ -322,15 +321,15 @@ static const char global_protection_some_set_wast[] = R"=====(
(global i64 (i64.const -11))
(global i64 (i64.const 56))
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64)
(set_global 2 (get_local 0))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64)
(set_global 2 (get_local 1))
)
)
)=====";
static const std::vector<uint8_t> global_protection_okay_get_wasm{
0x00, 'a', 's', 'm', 0x01, 0x00, 0x00, 0x00,
0x01, 0x06, 0x01, 0x60, 0x02, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64)
0x01, 0x07, 0x01, 0x60, 0x03, 0x7e, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64,i64)
0x03, 0x02, 0x01, 0x00, //a function
0x06, 0x06, 0x01, 0x7f, 0x00, 0x41, 0x75, 0x0b, //global
......@@ -345,7 +344,7 @@ static const std::vector<uint8_t> global_protection_okay_get_wasm{
static const std::vector<uint8_t> global_protection_none_get_wasm{
0x00, 'a', 's', 'm', 0x01, 0x00, 0x00, 0x00,
0x01, 0x06, 0x01, 0x60, 0x02, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64)
0x01, 0x07, 0x01, 0x60, 0x03, 0x7e, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64,i64)
0x03, 0x02, 0x01, 0x00, //a function
0x07, 0x09, 0x01, 0x05, 'a', 'p', 'p', 'l', 'y', 0x00, 0x00, //export function 0 as "apply"
......@@ -358,7 +357,7 @@ static const std::vector<uint8_t> global_protection_none_get_wasm{
static const std::vector<uint8_t> global_protection_some_get_wasm{
0x00, 'a', 's', 'm', 0x01, 0x00, 0x00, 0x00,
0x01, 0x06, 0x01, 0x60, 0x02, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64)
0x01, 0x07, 0x01, 0x60, 0x03, 0x7e, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64,i64)
0x03, 0x02, 0x01, 0x00, //a function
0x06, 0x06, 0x01, 0x7f, 0x00, 0x41, 0x75, 0x0b, //global
......@@ -373,7 +372,7 @@ static const std::vector<uint8_t> global_protection_some_get_wasm{
static const std::vector<uint8_t> global_protection_okay_set_wasm{
0x00, 'a', 's', 'm', 0x01, 0x00, 0x00, 0x00,
0x01, 0x06, 0x01, 0x60, 0x02, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64)
0x01, 0x07, 0x01, 0x60, 0x03, 0x7e, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64,i64)
0x03, 0x02, 0x01, 0x00, //a function
0x06, 0x06, 0x01, 0x7e, 0x01, 0x42, 0x75, 0x0b, //global.. this time with i64 & global mutablity
......@@ -388,7 +387,7 @@ static const std::vector<uint8_t> global_protection_okay_set_wasm{
static const std::vector<uint8_t> global_protection_some_set_wasm{
0x00, 'a', 's', 'm', 0x01, 0x00, 0x00, 0x00,
0x01, 0x06, 0x01, 0x60, 0x02, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64)
0x01, 0x07, 0x01, 0x60, 0x03, 0x7e, 0x7e, 0x7e, 0x00, //type section containing a function as void(i64,i64,i64)
0x03, 0x02, 0x01, 0x00, //a function
0x06, 0x06, 0x01, 0x7e, 0x01, 0x42, 0x75, 0x0b, //global.. this time with i64 & global mutablity
......@@ -403,7 +402,7 @@ static const std::vector<uint8_t> global_protection_some_set_wasm{
static const char no_apply_wast[] = R"=====(
(module
(func $apply (param $0 i64) (param $1 i64))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
)
)=====";
......@@ -418,5 +417,5 @@ static const char import_injected_wast[] =
"(module" \
" (export \"apply\" (func $apply))" \
" (import \"" EOSIO_INJECTED_MODULE_NAME "\" \"checktime\" (func $inj (param i32)))" \
" (func $apply (param $0 i64) (param $1 i64))" \
" (func $apply (param $0 i64) (param $1 i64) (param $2 i64))" \
")";
\ No newline at end of file
......@@ -566,7 +566,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_globals, tester ) try {
produce_block();
std::stringstream ss;
ss << "(module (export \"apply\" (func $apply)) (func $apply (param $0 i64) (param $1 i64))";
ss << "(module (export \"apply\" (func $apply)) (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
for(unsigned int i = 0; i < 85; ++i)
ss << "(global $g" << i << " (mut i32) (i32.const 0))" << "(global $g" << i+100 << " (mut i64) (i64.const 0))";
//that gives us 1020 bytes of mutable globals
......@@ -613,7 +613,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check, tester ) try {
for(const string& s : loadops) {
std::stringstream ss;
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) ";
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) (param $2 i64)";
ss << "(drop (" << s << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory-2 << " (i32.const 0)))";
ss << ") (export \"apply\" (func $apply)) )";
......@@ -622,7 +622,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check, tester ) try {
}
for(const vector<string>& o : storeops) {
std::stringstream ss;
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) ";
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) (param $2 i64)";
ss << "(" << o[0] << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory-2 << " (i32.const 0) (" << o[1] << ".const 0))";
ss << ") (export \"apply\" (func $apply)) )";
......@@ -632,7 +632,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check, tester ) try {
for(const string& s : loadops) {
std::stringstream ss;
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) ";
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) (param $2 i64)";
ss << "(drop (" << s << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory+4 << " (i32.const 0)))";
ss << ") (export \"apply\" (func $apply)) )";
......@@ -641,7 +641,7 @@ BOOST_FIXTURE_TEST_CASE( offset_check, tester ) try {
}
for(const vector<string>& o : storeops) {
std::stringstream ss;
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) ";
ss << "(module (memory $0 " << eosio::chain::wasm_constraints::maximum_linear_memory/(64*1024) << ") (func $apply (param $0 i64) (param $1 i64) (param $2 i64)";
ss << "(" << o[0] << " offset=" << eosio::chain::wasm_constraints::maximum_linear_memory+4 << " (i32.const 0) (" << o[1] << ".const 0))";
ss << ") (export \"apply\" (func $apply)) )";
......@@ -951,7 +951,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_stack, tester ) try {
std::stringstream ss;
ss << "(module ";
ss << "(export \"apply\" (func $apply))";
ss << " (func $apply (param $0 i64) (param $1 i64))";
ss << " (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
ss << " (func ";
for(unsigned int i = 0; i < wasm_constraints::maximum_func_local_bytes; i+=4)
ss << "(local i32)";
......@@ -964,7 +964,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_stack, tester ) try {
std::stringstream ss;
ss << "(module ";
ss << "(export \"apply\" (func $apply))";
ss << " (func $apply (param $0 i64) (param $1 i64))";
ss << " (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
ss << " (func ";
for(unsigned int i = 0; i < wasm_constraints::maximum_func_local_bytes; i+=8)
ss << "(local f64)";
......@@ -995,7 +995,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_stack, tester ) try {
std::stringstream ss;
ss << "(module ";
ss << "(export \"apply\" (func $apply))";
ss << " (func $apply (param $0 i64) (param $1 i64))";
ss << " (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
ss << " (func ";
for(unsigned int i = 0; i < wasm_constraints::maximum_func_local_bytes+4; i+=4)
ss << "(local i32)";
......@@ -1010,7 +1010,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_stack, tester ) try {
std::stringstream ss;
ss << "(module ";
ss << "(export \"apply\" (func $apply))";
ss << " (func $apply (param $0 i64) (param $1 i64))";
ss << " (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
ss << " (func ";
for(unsigned int i = 0; i < wasm_constraints::maximum_func_local_bytes; i+=4)
ss << "(param i32)";
......@@ -1038,7 +1038,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_stack, tester ) try {
std::stringstream ss;
ss << "(module ";
ss << "(export \"apply\" (func $apply))";
ss << " (func $apply (param $0 i64) (param $1 i64))";
ss << " (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
ss << " (func ";
for(unsigned int i = 0; i < wasm_constraints::maximum_func_local_bytes+4; i+=4)
ss << "(param i32)";
......@@ -1053,7 +1053,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_stack, tester ) try {
std::stringstream ss;
ss << "(module ";
ss << "(export \"apply\" (func $apply))";
ss << " (func $apply (param $0 i64) (param $1 i64))";
ss << " (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
ss << " (func (param i64) (param f32) ";
for(unsigned int i = 12; i < wasm_constraints::maximum_func_local_bytes; i+=4)
ss << "(local i32)";
......@@ -1066,7 +1066,7 @@ BOOST_FIXTURE_TEST_CASE( lotso_stack, tester ) try {
std::stringstream ss;
ss << "(module ";
ss << "(export \"apply\" (func $apply))";
ss << " (func $apply (param $0 i64) (param $1 i64))";
ss << " (func $apply (param $0 i64) (param $1 i64) (param $2 i64))";
ss << " (func (param i64) (param f32) ";
for(unsigned int i = 12; i < wasm_constraints::maximum_func_local_bytes+4; i+=4)
ss << "(local f32)";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册