-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Epoch manager enabler tests (#11213)
* ++ basic test * -- celoToken balance check * cleanup comments * use celoToken instead of native token for `initializeSystem` balance check * ++ more test * removed additional epochs
- Loading branch information
Showing
6 changed files
with
197 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/protocol/test-sol/mocks/EpochManagerEnablerMock.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
pragma solidity ^0.8.0; | ||
|
||
import "../../contracts-0.8/common/EpochManagerEnabler.sol"; | ||
|
||
/** | ||
* @title A wrapper around EpochManagerEnabler that exposes internal functions for testing. | ||
*/ | ||
contract EpochManagerEnablerMock is EpochManagerEnabler(true) { | ||
address[] validatorSet; | ||
|
||
function setFirstBlockOfEpoch() external { | ||
return _setFirstBlockOfEpoch(); | ||
} | ||
|
||
function addValidator(address validator) external { | ||
validatorSet.push(validator); | ||
} | ||
|
||
// Minimally override core functions from UsingPrecompiles | ||
function numberValidatorsInCurrentSet() public view override returns (uint256) { | ||
return validatorSet.length; | ||
} | ||
|
||
function numberValidatorsInSet(uint256) public view override returns (uint256) { | ||
return validatorSet.length; | ||
} | ||
|
||
function validatorSignerAddressFromCurrentSet( | ||
uint256 index | ||
) public view override returns (address) { | ||
return validatorSet[index]; | ||
} | ||
} |
171 changes: 152 additions & 19 deletions
171
packages/protocol/test-sol/unit/common/EpochManagerEnabler.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters