diff --git a/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol b/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol index 5251ba8b8..30f945695 100644 --- a/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol +++ b/protocol-units/settlement/mcr/contracts/src/staking/MovementStaking.sol @@ -60,7 +60,8 @@ contract MovementStaking is function acceptGenesisCeremony() public { address domain = msg.sender; - + if (domainGenesisAccepted[domain]) revert GenesisAlreadyAccepted(); + domainGenesisAccepted[domain] = true; // roll over from 0 (genesis) to current epoch by block time currentEpochByDomain[domain] = getEpochByBlockTime(domain); diff --git a/protocol-units/settlement/mcr/contracts/src/staking/MovementStakingStorage.sol b/protocol-units/settlement/mcr/contracts/src/staking/MovementStakingStorage.sol index 399fc522f..6f96ff3a0 100644 --- a/protocol-units/settlement/mcr/contracts/src/staking/MovementStakingStorage.sol +++ b/protocol-units/settlement/mcr/contracts/src/staking/MovementStakingStorage.sol @@ -35,6 +35,8 @@ contract MovementStakingStorage { mapping(uint256 epoch => mapping(address attester => uint256 stake))) public epochTotalStakeByDomain; + mapping(address domain => bool) public domainGenesisAccepted; + // the whitelist role needed to stake/unstake bytes32 public constant WHITELIST_ROLE = keccak256("WHITELIST_ROLE"); } \ No newline at end of file diff --git a/protocol-units/settlement/mcr/contracts/src/staking/interfaces/IMovementStaking.sol b/protocol-units/settlement/mcr/contracts/src/staking/interfaces/IMovementStaking.sol index 9c70704e9..68466d279 100644 --- a/protocol-units/settlement/mcr/contracts/src/staking/interfaces/IMovementStaking.sol +++ b/protocol-units/settlement/mcr/contracts/src/staking/interfaces/IMovementStaking.sol @@ -97,6 +97,8 @@ interface IMovementStaking { ); event EpochRolledOver(address indexed domain, uint256 epoch); + error StakeExceedsGenesisStake(); error CustodianTransferAmountMismatch(); + error GenesisAlreadyAccepted(); } diff --git a/protocol-units/settlement/mcr/contracts/test/staking/MovementStaking.t.sol b/protocol-units/settlement/mcr/contracts/test/staking/MovementStaking.t.sol index 88aad1ba0..9b2052f85 100644 --- a/protocol-units/settlement/mcr/contracts/test/staking/MovementStaking.t.sol +++ b/protocol-units/settlement/mcr/contracts/test/staking/MovementStaking.t.sol @@ -122,6 +122,10 @@ contract MovementStakingTest is Test { staking.getCurrentEpochStake(domain, address(moveToken), staker), 100 ); + + vm.expectRevert(IMovementStaking.GenesisAlreadyAccepted.selector); + vm.prank(domain); + staking.acceptGenesisCeremony(); } function testSimpleRolloverEpoch() public {