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

Resolve #649: [HF] Check authorities on custom_operation #657

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions libraries/chain/include/graphene/chain/protocol/custom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ namespace graphene { namespace chain {
account_id_type fee_payer()const { return payer; }
void validate()const;
share_type calculate_fee(const fee_parameters_type& k)const;
void get_required_active_authorities( flat_set<account_id_type>& auths )const {
auths.insert(required_auths.begin(), required_auths.end());
}
};

} } // namespace graphene::chain
Expand Down
23 changes: 23 additions & 0 deletions tests/tests/authority_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,4 +1313,27 @@ BOOST_FIXTURE_TEST_CASE( nonminimal_sig_test, database_fixture )
}
}

BOOST_AUTO_TEST_CASE( custom_operation_required_auths ) {
try {
ACTORS((alice)(bob));
fund(alice);
enable_fees();

signed_transaction trx;
custom_operation op;
op.payer = alice_id;
op.required_auths.insert(bob_id);
op.fee = op.calculate_fee(db.current_fee_schedule().get<custom_operation>());
trx.operations.emplace_back(op);
trx.set_expiration(db.head_block_time() + 30);
sign(trx, alice_private_key);
GRAPHENE_REQUIRE_THROW(db.push_transaction(trx), tx_missing_active_auth);
sign(trx, bob_private_key);
PUSH_TX(db, trx);
} catch (fc::exception& e) {
edump((e.to_detail_string()));
throw;
}
}

BOOST_AUTO_TEST_SUITE_END()