Skip to content

Commit

Permalink
Stop using errors
Browse files Browse the repository at this point in the history
error is not yet supported by abigen: ethereum/go-ethereum#23161
  • Loading branch information
nkuba committed Oct 8, 2021
1 parent e8b7f55 commit 6c04340
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
5 changes: 1 addition & 4 deletions solidity/random-beacon/contracts/RandomBeacon.sol
Expand Up @@ -156,8 +156,6 @@ contract RandomBeacon is Ownable {
// TODO: Can we really make it public along with the library functions?
DKG.Data public dkg;

error NotAwaitingGenesis(uint256 groupCount);

event RelayEntryParametersUpdated(
uint256 relayRequestFee,
uint256 relayEntrySubmissionEligibilityDelay,
Expand Down Expand Up @@ -328,8 +326,7 @@ contract RandomBeacon is Ownable {
}

function genesis() external {
// if (groups.groupCount > 0)
// revert NotAwaitingGenesis(dkg.groupCount, dkg.currentState);
// require(groups.groupCount == 0, "not awaiting genesis");

createGroup(GENESIS_SEED);
}
Expand Down
13 changes: 4 additions & 9 deletions solidity/random-beacon/contracts/libraries/DKG.sol
Expand Up @@ -31,16 +31,11 @@ library DKG {
uint256 signatureThreshold;
}

/// DKG is in an invalid state. Expected in progress: `expectedInProgress`,
/// but actual in progress: `actualInProgress`.
error InvalidInProgressState(
bool expectedInProgress,
bool actualInProgress
);

modifier assertInProgress(Data storage self, bool expectedValue) {
if (isInProgress(self) != expectedValue)
revert InvalidInProgressState(expectedValue, isInProgress(self));
require(
isInProgress(self) == expectedValue,
"invalid in progress state"
);
_;
}

Expand Down

0 comments on commit 6c04340

Please sign in to comment.