Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #348 from EOSIO/change-eosio-dependency
Browse files Browse the repository at this point in the history
Update minimum EOSIO dependency to 2.0.x
  • Loading branch information
arhag authored Oct 2, 2019
2 parents c9b1333 + 1f46094 commit 5986058
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 112 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The following unprivileged contract(s) are also part of the system.

Dependencies:
* [eosio.cdt v1.7.x](https://github.com/EOSIO/eosio.cdt/releases/tag/v1.7.0-rc1)
* [eosio v1.8.x](https://github.com/EOSIO/eos/releases/tag/v1.8.1) (optional dependency only needed to build unit tests)
* [eosio v2.0.x](https://github.com/EOSIO/eos/releases/tag/v2.0.0-rc1) (optional dependency only needed to build unit tests)

To build contracts alone:
1. Ensure an appropriate version of eosio.cdt is installed. Installing eosio.cdt from binaries is sufficient.
Expand Down
2 changes: 1 addition & 1 deletion pipeline.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pipeline-branch": "master",
"dependencies": // dependencies to pull for a build of contracts, by branch, tag, or commit hash
{
"eosio": "release/1.8.x",
"eosio": "89166b5a314fa2bcda664329efcc13f505bd8eac", // eventually update to release/2.0.x
"eosio.cdt": "0e9b9b0ca5244d0caae4ea1c23ebcd3e7c7398fc" // eventually update to release/1.7.x
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required( VERSION 3.5 )

set(EOSIO_VERSION_MIN "1.8")
set(EOSIO_VERSION_SOFT_MAX "1.8")
set(EOSIO_VERSION_MIN "2.0")
set(EOSIO_VERSION_SOFT_MAX "2.0")
#set(EOSIO_VERSION_HARD_MAX "")

find_package(eosio)
Expand Down
62 changes: 38 additions & 24 deletions tests/eosio.msig_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ transaction eosio_msig_tester::reqauth( account_name from, const vector<permissi
BOOST_AUTO_TEST_SUITE(eosio_msig_tests)

BOOST_FIXTURE_TEST_CASE( propose_approve_execute, eosio_msig_tester ) try {
auto trx = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );

push_action( N(alice), N(propose), mvo()
("proposer", "alice")
Expand Down Expand Up @@ -226,7 +226,7 @@ BOOST_FIXTURE_TEST_CASE( propose_approve_execute, eosio_msig_tester ) try {


BOOST_FIXTURE_TEST_CASE( propose_approve_unapprove, eosio_msig_tester ) try {
auto trx = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );

push_action( N(alice), N(propose), mvo()
("proposer", "alice")
Expand Down Expand Up @@ -260,7 +260,7 @@ BOOST_FIXTURE_TEST_CASE( propose_approve_unapprove, eosio_msig_tester ) try {


BOOST_FIXTURE_TEST_CASE( propose_approve_by_two, eosio_msig_tester ) try {
auto trx = reqauth("alice", vector<permission_level>{ { N(alice), config::active_name }, { N(bob), config::active_name } }, abi_serializer_max_time );
auto trx = reqauth( N(alice), vector<permission_level>{ { N(alice), config::active_name }, { N(bob), config::active_name } }, abi_serializer_max_time );
push_action( N(alice), N(propose), mvo()
("proposer", "alice")
("proposal_name", "first")
Expand Down Expand Up @@ -313,7 +313,7 @@ BOOST_FIXTURE_TEST_CASE( propose_approve_by_two, eosio_msig_tester ) try {


BOOST_FIXTURE_TEST_CASE( propose_with_wrong_requested_auth, eosio_msig_tester ) try {
auto trx = reqauth("alice", vector<permission_level>{ { N(alice), config::active_name }, { N(bob), config::active_name } }, abi_serializer_max_time );
auto trx = reqauth( N(alice), vector<permission_level>{ { N(alice), config::active_name }, { N(bob), config::active_name } }, abi_serializer_max_time );
//try with not enough requested auth
BOOST_REQUIRE_EXCEPTION( push_action( N(alice), N(propose), mvo()
("proposer", "alice")
Expand Down Expand Up @@ -406,10 +406,17 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_all_approve, eosio_msig_tester )
// / | \ <--- implicitly updated in onblock action
// alice active bob active carol active

set_authority(N(eosio), "active", authority(1,
vector<key_weight>{{get_private_key("eosio", "active").get_public_key(), 1}},
vector<permission_level_weight>{{{N(eosio.prods), config::active_name}, 1}}), "owner",
{ { N(eosio), "active" } }, { get_private_key( N(eosio), "active" ) });
set_authority(
config::system_account_name,
config::active_name,
authority( 1,
vector<key_weight>{{get_private_key(config::system_account_name, "active").get_public_key(), 1}},
vector<permission_level_weight>{{{N(eosio.prods), config::active_name}, 1}}
),
config::owner_name,
{{config::system_account_name, config::active_name}},
{get_private_key(config::system_account_name, "active")}
);

set_producers( {N(alice),N(bob),N(carol)} );
produce_blocks(50);
Expand All @@ -421,7 +428,7 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_all_approve, eosio_msig_tester )
create_currency( N(eosio.token), config::system_account_name, core_sym::from_string("10000000000.0000") );
issue(config::system_account_name, core_sym::from_string("1000000000.0000"));
BOOST_REQUIRE_EQUAL( core_sym::from_string("1000000000.0000"),
get_balance("eosio") + get_balance("eosio.ramfee") + get_balance("eosio.stake") + get_balance("eosio.ram") );
get_balance(config::system_account_name) + get_balance(N(eosio.ramfee)) + get_balance(N(eosio.stake)) + get_balance(N(eosio.ram)) );

set_code( config::system_account_name, contracts::system_wasm() );
set_abi( config::system_account_name, contracts::system_abi().data() );
Expand All @@ -436,7 +443,7 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_all_approve, eosio_msig_tester )
create_account_with_resources( N(carol1111111), N(eosio), core_sym::from_string("1.0000"), false );

BOOST_REQUIRE_EQUAL( core_sym::from_string("1000000000.0000"),
get_balance("eosio") + get_balance("eosio.ramfee") + get_balance("eosio.stake") + get_balance("eosio.ram") );
get_balance(config::system_account_name) + get_balance(N(eosio.ramfee)) + get_balance(N(eosio.stake)) + get_balance(N(eosio.ram)) );

vector<permission_level> perm = { { N(alice), config::active_name }, { N(bob), config::active_name },
{N(carol), config::active_name} };
Expand Down Expand Up @@ -524,10 +531,17 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_all_approve, eosio_msig_tester )
BOOST_FIXTURE_TEST_CASE( update_system_contract_major_approve, eosio_msig_tester ) try {

// set up the link between (eosio active) and (eosio.prods active)
set_authority(N(eosio), "active", authority(1,
vector<key_weight>{{get_private_key("eosio", "active").get_public_key(), 1}},
vector<permission_level_weight>{{{N(eosio.prods), config::active_name}, 1}}), "owner",
{ { N(eosio), "active" } }, { get_private_key( N(eosio), "active" ) });
set_authority(
config::system_account_name,
config::active_name,
authority( 1,
vector<key_weight>{{get_private_key(config::system_account_name, "active").get_public_key(), 1}},
vector<permission_level_weight>{{{N(eosio.prods), config::active_name}, 1}}
),
config::owner_name,
{{config::system_account_name, config::active_name}},
{get_private_key(config::system_account_name, "active")}
);

create_accounts( { N(apple) } );
set_producers( {N(alice),N(bob),N(carol), N(apple)} );
Expand All @@ -539,7 +553,7 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_major_approve, eosio_msig_tester

create_currency( N(eosio.token), config::system_account_name, core_sym::from_string("10000000000.0000") );
issue(config::system_account_name, core_sym::from_string("1000000000.0000"));
BOOST_REQUIRE_EQUAL( core_sym::from_string("1000000000.0000"), get_balance( "eosio" ) );
BOOST_REQUIRE_EQUAL( core_sym::from_string("1000000000.0000"), get_balance( config::system_account_name ) );

set_code( config::system_account_name, contracts::system_wasm() );
set_abi( config::system_account_name, contracts::system_abi().data() );
Expand All @@ -555,7 +569,7 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_major_approve, eosio_msig_tester
create_account_with_resources( N(carol1111111), N(eosio), core_sym::from_string("1.0000"), false );

BOOST_REQUIRE_EQUAL( core_sym::from_string("1000000000.0000"),
get_balance("eosio") + get_balance("eosio.ramfee") + get_balance("eosio.stake") + get_balance("eosio.ram") );
get_balance(config::system_account_name) + get_balance(N(eosio.ramfee)) + get_balance(N(eosio.stake)) + get_balance(N(eosio.ram)) );

vector<permission_level> perm = { { N(alice), config::active_name }, { N(bob), config::active_name },
{N(carol), config::active_name}, {N(apple), config::active_name}};
Expand Down Expand Up @@ -653,7 +667,7 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_major_approve, eosio_msig_tester
} FC_LOG_AND_RETHROW()

BOOST_FIXTURE_TEST_CASE( propose_approve_invalidate, eosio_msig_tester ) try {
auto trx = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );

push_action( N(alice), N(propose), mvo()
("proposer", "alice")
Expand Down Expand Up @@ -696,7 +710,7 @@ BOOST_FIXTURE_TEST_CASE( propose_approve_invalidate, eosio_msig_tester ) try {
} FC_LOG_AND_RETHROW()

BOOST_FIXTURE_TEST_CASE( propose_invalidate_approve, eosio_msig_tester ) try {
auto trx = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );

push_action( N(alice), N(propose), mvo()
("proposer", "alice")
Expand Down Expand Up @@ -752,7 +766,7 @@ BOOST_FIXTURE_TEST_CASE( approve_execute_old, eosio_msig_tester ) try {
produce_blocks();

//propose with old version of eosio.msig
auto trx = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
push_action( N(alice), N(propose), mvo()
("proposer", "alice")
("proposal_name", "first")
Expand Down Expand Up @@ -797,7 +811,7 @@ BOOST_FIXTURE_TEST_CASE( approve_unapprove_old, eosio_msig_tester ) try {
produce_blocks();

//propose with old version of eosio.msig
auto trx = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
push_action( N(alice), N(propose), mvo()
("proposer", "alice")
("proposal_name", "first")
Expand Down Expand Up @@ -839,7 +853,7 @@ BOOST_FIXTURE_TEST_CASE( approve_by_two_old, eosio_msig_tester ) try {
set_abi( N(eosio.msig), contracts::util::msig_abi_old().data() );
produce_blocks();

auto trx = reqauth("alice", vector<permission_level>{ { N(alice), config::active_name }, { N(bob), config::active_name } }, abi_serializer_max_time );
auto trx = reqauth( N(alice), vector<permission_level>{ { N(alice), config::active_name }, { N(bob), config::active_name } }, abi_serializer_max_time );
push_action( N(alice), N(propose), mvo()
("proposer", "alice")
("proposal_name", "first")
Expand Down Expand Up @@ -895,7 +909,7 @@ BOOST_FIXTURE_TEST_CASE( approve_by_two_old, eosio_msig_tester ) try {
} FC_LOG_AND_RETHROW()

BOOST_FIXTURE_TEST_CASE( approve_with_hash, eosio_msig_tester ) try {
auto trx = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx_hash = fc::sha256::hash( trx );
auto not_trx_hash = fc::sha256::hash( trx_hash );

Expand Down Expand Up @@ -944,7 +958,7 @@ BOOST_FIXTURE_TEST_CASE( approve_with_hash, eosio_msig_tester ) try {
} FC_LOG_AND_RETHROW()

BOOST_FIXTURE_TEST_CASE( switch_proposal_and_fail_approve_with_hash, eosio_msig_tester ) try {
auto trx1 = reqauth("alice", {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx1 = reqauth( N(alice), {permission_level{N(alice), config::active_name}}, abi_serializer_max_time );
auto trx1_hash = fc::sha256::hash( trx1 );

push_action( N(alice), N(propose), mvo()
Expand All @@ -954,7 +968,7 @@ BOOST_FIXTURE_TEST_CASE( switch_proposal_and_fail_approve_with_hash, eosio_msig_
("requested", vector<permission_level>{{ N(alice), config::active_name }})
);

auto trx2 = reqauth("alice",
auto trx2 = reqauth( N(alice),
{ permission_level{N(alice), config::active_name},
permission_level{N(alice), config::owner_name} },
abi_serializer_max_time );
Expand Down
Loading

0 comments on commit 5986058

Please sign in to comment.