Skip to content

Commit

Permalink
Use eosio/authority.hpp rather than tester equivalent
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Mart committed Feb 1, 2022
1 parent 0ccc405 commit fe93c3d
Showing 1 changed file with 4 additions and 36 deletions.
40 changes: 4 additions & 36 deletions libraries/eosiolib/tester/tester.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <eosio/abi.hpp>
#include <eosio/from_string.hpp>
#include <eosio/tester.hpp>
#include <eosio/authority.hpp>

namespace
{
Expand Down Expand Up @@ -91,39 +92,6 @@ eosio::asset eosio::string_to_asset(const char* s)
return eosio::convert_from_string<asset>(s);
}

namespace
{
// TODO: move
struct tester_permission_level_weight
{
eosio::permission_level permission = {};
uint16_t weight = {};
};

EOSIO_REFLECT(tester_permission_level_weight, permission, weight);

// TODO: move
struct tester_wait_weight
{
uint32_t wait_sec = {};
uint16_t weight = {};
};

EOSIO_REFLECT(tester_wait_weight, wait_sec, weight);

// TODO: move
struct tester_authority
{
uint32_t threshold = {};
std::vector<eosio::key_weight> keys = {};
std::vector<tester_permission_level_weight> accounts = {};
std::vector<tester_wait_weight> waits = {};
};

EOSIO_REFLECT(tester_authority, threshold, keys, accounts, waits);

} // namespace

/**
* Validates the status of a transaction. If expected_except is nullptr, then the
* transaction should succeed. Otherwise it represents a string which should be
Expand Down Expand Up @@ -442,7 +410,7 @@ eosio::transaction_trace eosio::test_chain::create_account(name ac,
const public_key& pub_key,
const char* expected_except)
{
tester_authority simple_auth{
authority simple_auth{
.threshold = 1,
.keys = {{pub_key, 1}},
};
Expand All @@ -463,11 +431,11 @@ eosio::transaction_trace eosio::test_chain::create_code_account(name account,
bool is_priv,
const char* expected_except)
{
tester_authority simple_auth{
authority simple_auth{
.threshold = 1,
.keys = {{pub_key, 1}},
};
tester_authority code_auth{
authority code_auth{
.threshold = 1,
.keys = {{pub_key, 1}},
.accounts = {{{account, "eosio.code"_n}, 1}},
Expand Down

0 comments on commit fe93c3d

Please sign in to comment.