diff --git a/packages/protocol/contracts/governance/Validators.sol b/packages/protocol/contracts/governance/Validators.sol index 6f8e3cd60c6..e99c4670b54 100644 --- a/packages/protocol/contracts/governance/Validators.sol +++ b/packages/protocol/contracts/governance/Validators.sol @@ -8,7 +8,7 @@ import "solidity-bytes-utils/contracts/BytesLib.sol"; import "./interfaces/IValidators.sol"; import "../common/CalledByVm.sol"; -import "../common/Initializable.sol"; +import "../common/InitializableV2.sol"; import "../common/FixidityLib.sol"; import "../common/linkedlists/AddressLinkedList.sol"; import "../common/UsingRegistry.sol"; @@ -24,7 +24,7 @@ contract Validators is ICeloVersionedContract, Ownable, ReentrancyGuard, - Initializable, + InitializableV2, UsingRegistry, UsingPrecompiles, CalledByVm @@ -163,7 +163,7 @@ contract Validators is * @return The storage, major, minor, and patch version of the contract. */ function getVersionNumber() external pure returns (uint256, uint256, uint256, uint256) { - return (1, 2, 0, 0); + return (1, 2, 0, 1); } /** @@ -207,6 +207,12 @@ contract Validators is setDowntimeGracePeriod(_downtimeGracePeriod); } + /** + * @notice Sets initialized == true on implementation contracts + * @param test Set to true to skip implementation initialization + */ + constructor(bool test) public InitializableV2(test) {} + /** * @notice Updates the block delay for a ValidatorGroup's commission udpdate * @param delay Number of blocks to delay the update @@ -1167,7 +1173,7 @@ contract Validators is history.lastRemovedFromGroupTimestamp = now; } - if (history.entries[head].epochNumber == epochNumber) { + if (history.numEntries > 0 && history.entries[head].epochNumber == epochNumber) { // There have been no elections since the validator last changed membership, overwrite the // previous entry. history.entries[head] = MembershipHistoryEntry(epochNumber, group); diff --git a/packages/protocol/contracts/governance/test/ValidatorsTest.sol b/packages/protocol/contracts/governance/test/ValidatorsTest.sol index da51a58b95e..d6169085013 100644 --- a/packages/protocol/contracts/governance/test/ValidatorsTest.sol +++ b/packages/protocol/contracts/governance/test/ValidatorsTest.sol @@ -6,7 +6,7 @@ import "../../common/FixidityLib.sol"; /** * @title A wrapper around Validators that exposes onlyVm functions for testing. */ -contract ValidatorsTest is Validators { +contract ValidatorsTest is Validators(true) { function updateValidatorScoreFromSigner(address signer, uint256 uptime) external { return _updateValidatorScoreFromSigner(signer, uptime); }