From d0917bd21ebbc3017afe07e427daaead23caba13 Mon Sep 17 00:00:00 2001 From: vzotova Date: Mon, 24 Jan 2022 12:13:41 +0300 Subject: [PATCH] Apply suggestions from code review #2838 Co-authored-by: jMyles --- tests/contracts/contracts/PREApplicationTestSet.sol | 4 ++++ tests/contracts/main/application/test_worker.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/contracts/contracts/PREApplicationTestSet.sol b/tests/contracts/contracts/PREApplicationTestSet.sol index 6c65bfefc..c2e8c8c09 100644 --- a/tests/contracts/contracts/PREApplicationTestSet.sol +++ b/tests/contracts/contracts/PREApplicationTestSet.sol @@ -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; diff --git a/tests/contracts/main/application/test_worker.py b/tests/contracts/main/application/test_worker.py index 5b24071a7..5484b7ba1 100644 --- a/tests/contracts/main/application/test_worker.py +++ b/tests/contracts/main/application/test_worker.py @@ -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()