From 5cdc2e686bc3bc8791a4e98823c2c705b3194f21 Mon Sep 17 00:00:00 2001 From: Piotr Dyraga Date: Thu, 30 Apr 2020 11:35:44 +0200 Subject: [PATCH] Use groupSelectionStarterContract to reimburse for failed DKG In startGroupSelection we return the costs of the previous - failed - group selection to the service contract. We were obtaining the service contract reference with `ServiceContract(msg.sender)`. It works fine only when `msg.sender` is a service contract which is not a case for genesis. Instead of `msg.sender` we should use `groupSelectionStarterContract` that is set for this exact purpose in `genesis` and `createGroup` both calling the internal `startGroupSelection`. --- solidity/contracts/KeepRandomBeaconOperator.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solidity/contracts/KeepRandomBeaconOperator.sol b/solidity/contracts/KeepRandomBeaconOperator.sol index 590d249da9..50c2f2fca3 100644 --- a/solidity/contracts/KeepRandomBeaconOperator.sol +++ b/solidity/contracts/KeepRandomBeaconOperator.sol @@ -238,7 +238,7 @@ contract KeepRandomBeaconOperator is ReentrancyGuard { if (dkgSubmitterReimbursementFee > 0) { uint256 surplus = dkgSubmitterReimbursementFee; dkgSubmitterReimbursementFee = 0; - ServiceContract(msg.sender).fundDkgFeePool.value(surplus)(); + ServiceContract(groupSelectionStarterContract).fundDkgFeePool.value(surplus)(); } groupSelection.minimumStake = stakingContract.minimumStake();