Skip to content

Commit 728c040

Browse files
authored
Merge pull request #1624 from keep-network/terminated-group-tracking-cleanup
Document operator contract statistics functions and remove unused test code
2 parents b60833e + 97b1d87 commit 728c040

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

solidity/contracts/statistics/KeepRandomBeaconOperatorStatistics.sol

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,31 @@ contract KeepRandomBeaconOperatorStatistics {
3333
}
3434

3535

36-
/**
37-
* @dev Gets all indices in the provided group for a member.
38-
*/
36+
/// @notice Gets all indices in the provided group for a member.
37+
/// If the given operator is not a member, returns an empty array.
3938
function getGroupMemberIndices(
4039
bytes memory groupPubKey,
41-
address member
40+
address operator
4241
) public view returns (uint256[] memory indices) {
43-
uint256 count = countGroupMembership(groupPubKey, member);
42+
uint256 count = countGroupMembership(groupPubKey, operator);
4443
address[] memory members = operatorContract.getGroupMembers(groupPubKey);
4544

4645
indices = new uint256[](count);
4746
uint256 counter = 0;
4847
for (uint i = 0; i < members.length; i++) {
49-
if (members[i] == member) {
48+
if (members[i] == operator) {
5049
indices[counter] = i;
5150
counter++;
5251
}
5352
}
5453
}
5554

55+
/// @notice Get the amount of group rewards
56+
/// allocated to the given operator in the given group.
57+
/// The rewards may or may not be withdrawable.
58+
/// @param operator Address of the operator.
59+
/// @param groupIndex Index of the group.
60+
/// @return The total allocated rewards.
5661
function awaitingRewards(
5762
address operator,
5863
uint256 groupIndex
@@ -68,6 +73,12 @@ contract KeepRandomBeaconOperatorStatistics {
6873
return memberRewards.mul(memberCount);
6974
}
7075

76+
/// @notice Get the amount of group rewards
77+
/// withdrawable by the given operator in the given group.
78+
/// The group must be stale for any group rewards to be withdrawn.
79+
/// @param operator Address of the operator.
80+
/// @param groupIndex Index of the group.
81+
/// @return The total withdrawable rewards.
7182
function withdrawableRewards(
7283
address operator,
7384
uint256 groupIndex

solidity/test/random_beacon_operator/TestPricingRewardsWithdraw.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ describe('KeepRandomBeaconOperator/PricingRewardsWithdraw', function() {
128128
// Register new group and request new entry so we can expire the previous two groups
129129
await operatorContract.registerNewGroup(group3)
130130
await serviceContract.methods['requestRelayEntry()']({value: entryFeeEstimate, from: requestor})
131-
let beneficiary2balance = web3.utils.toBN(await web3.eth.getBalance(beneficiary2))
132131

133132
await time.advanceBlockTo(web3.utils.toBN(10).addn(await web3.eth.getBlockNumber()))
134133
assert.isTrue(await operatorContract.isStaleGroup('0x' + group1.toString('hex')), "Group should be stale")

0 commit comments

Comments
 (0)