Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more tests about owner and active authority
- Loading branch information
Showing
1 changed file
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1449,6 +1449,7 @@ BOOST_FIXTURE_TEST_CASE( parent_owner_test, database_fixture ) | |
} | ||
|
||
/// This test case reproduces https://github.com/bitshares/bitshares-core/issues/944 | ||
/// and https://github.com/bitshares/bitshares-core/issues/580 | ||
BOOST_FIXTURE_TEST_CASE( missing_owner_auth_test, database_fixture ) | ||
{ | ||
try | ||
|
@@ -1493,16 +1494,57 @@ BOOST_FIXTURE_TEST_CASE( missing_owner_auth_test, database_fixture ) | |
public_key_type alice_owner_pub( alice_owner_key.get_public_key() ); | ||
set_auth( alice_id, authority( 1, alice_active_pub, 1 ), authority( 1, alice_owner_pub, 1 ) ); | ||
|
||
// creating a transaction that needs owner permission | ||
signed_transaction tx; | ||
account_update_operation op; | ||
op.account = alice_id; | ||
op.owner = authority( 1, alice_active_pub, 1 ); | ||
tx.operations.push_back( op ); | ||
|
||
// https://github.com/bitshares/bitshares-core/issues/944 | ||
// not signed, should throw tx_missing_owner_auth | ||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner ), | ||
graphene::chain::tx_missing_owner_auth ); | ||
|
||
// signed with alice's active key, should throw tx_missing_owner_auth | ||
sign( tx, alice_active_key ); | ||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner ), | ||
graphene::chain::tx_missing_owner_auth ); | ||
|
||
// signed with alice's owner key, should not throw | ||
tx.signatures.clear(); | ||
sign( tx, alice_owner_key ); | ||
tx.verify_authority( db.get_chain_id(), get_active, get_owner ); | ||
|
||
// signed with both alice's owner key and active key, | ||
// it does not throw due to https://github.com/bitshares/bitshares-core/issues/580 | ||
sign( tx, alice_active_key ); | ||
tx.verify_authority( db.get_chain_id(), get_active, get_owner ); | ||
|
||
// creating a transaction that needs active permission | ||
tx.signatures.clear(); | ||
tx.operations.clear(); | ||
op.owner.reset(); | ||
op.active = authority( 1, alice_owner_pub, 1 ); | ||
tx.operations.push_back( op ); | ||
|
||
// not signed, should throw tx_missing_active_auth | ||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner ), | ||
graphene::chain::tx_missing_active_auth ); | ||
|
||
// signed with alice's active key, should not throw | ||
sign( tx, alice_active_key ); | ||
tx.verify_authority( db.get_chain_id(), get_active, get_owner ); | ||
|
||
// signed with alice's owner key, should not throw | ||
tx.signatures.clear(); | ||
sign( tx, alice_owner_key ); | ||
tx.verify_authority( db.get_chain_id(), get_active, get_owner ); | ||
|
||
// signed with both alice's owner key and active key, should throw tx_irrelevant_sig | ||
sign( tx, alice_active_key ); | ||
GRAPHENE_REQUIRE_THROW( tx.verify_authority( db.get_chain_id(), get_active, get_owner ), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jmjatlanta
Contributor
|
||
graphene::chain::tx_irrelevant_sig ); | ||
|
||
} | ||
catch(fc::exception& e) | ||
{ | ||
|
I do not see how this situation is different than line 1521. One is expecting a throw and the other is not. How would both of these pass?