Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use eosio/authority.hpp rather than tester equivalent #665

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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