Apply suggestions from code review #2838

Co-authored-by: jMyles <justin@justinholmes.com>
pull/2861/head
vzotova 2022-01-24 12:13:41 +03:00 committed by Kieran Prasch
parent 03556258c0
commit d0917bd21e
2 changed files with 7 additions and 3 deletions

View File

@ -56,6 +56,10 @@ contract ThresholdStakingForPREApplicationMock {
info.authorizer = _authorizer;
}
/**
* @dev If the function is called with only the _operator parameter,
* we presume that the caller wants that address set for the other roles as well.
*/
function setRoles(address _operator) external {
OperatorInfo storage info = operatorInfo[_operator];
info.owner = _operator;

View File

@ -78,10 +78,10 @@ def test_bond_worker(testerchain, threshold_staking, pre_application, token_econ
# Only operator or stake owner can bond worker
with pytest.raises((TransactionFailed, ValueError)):
tx = pre_application.functions.bondWorker(operator3, worker1).transact({'from': everyone_else[0]})
tx = pre_application.functions.bondWorker(operator3, worker1).transact({'from': beneficiary})
testerchain.wait_for_receipt(tx)
with pytest.raises((TransactionFailed, ValueError)):
tx = pre_application.functions.bondWorker(operator3, worker1).transact({'from': everyone_else[1]})
tx = pre_application.functions.bondWorker(operator3, worker1).transact({'from': authorizer})
testerchain.wait_for_receipt(tx)
# Operator bonds worker and now worker can make a confirmation
@ -222,7 +222,7 @@ def test_bond_worker(testerchain, threshold_staking, pre_application, token_econ
assert event_args['worker'] == worker1
assert event_args['startTimestamp'] == timestamp
# # The first worker still can't be a staker
# # The first worker still can't be an operator
# tx = threshold_staking.functions.setRoles(worker1).transact()
# testerchain.wait_for_receipt(tx)
# tx = threshold_staking.functions.setStakes(worker1, min_authorization, 0, 0).transact()