diff --git a/src/core/ExoCapsule.sol b/src/core/ExoCapsule.sol index 7e450604..c7255fbc 100644 --- a/src/core/ExoCapsule.sol +++ b/src/core/ExoCapsule.sol @@ -182,10 +182,6 @@ contract ExoCapsule is ReentrancyGuardUpgradeable, ExoCapsuleStorage, IExoCapsul revert StaleValidatorContainer(validatorPubkey, proof.beaconBlockTimestamp); } - if (!_isActivatedAtEpoch(validatorContainer, proof.beaconBlockTimestamp)) { - revert InactiveValidatorContainer(validatorPubkey); - } - if (withdrawalCredentials != bytes32(capsuleWithdrawalCredentials())) { revert WithdrawalCredentialsNotMatch(); } @@ -400,20 +396,6 @@ contract ExoCapsule is ReentrancyGuardUpgradeable, ExoCapsuleStorage, IExoCapsul } } - /// @dev Checks if the validator is activated at the given epoch. - /// @param validatorContainer The validator container. - /// @param atTimestamp The timestamp at which the activation is checked. - function _isActivatedAtEpoch(bytes32[] calldata validatorContainer, uint256 atTimestamp) - internal - pure - returns (bool) - { - uint64 atEpoch = _timestampToEpoch(atTimestamp); - uint64 activationEpoch = validatorContainer.getActivationEpoch(); - - return atEpoch >= activationEpoch; - } - /// @dev Checks if the proof is stale (too old). /// @param validator The validator to check. /// @param proofTimestamp The timestamp of the proof. diff --git a/test/foundry/unit/ExoCapsule.t.sol b/test/foundry/unit/ExoCapsule.t.sol index 71884007..8edb206f 100644 --- a/test/foundry/unit/ExoCapsule.t.sol +++ b/test/foundry/unit/ExoCapsule.t.sol @@ -221,7 +221,7 @@ contract VerifyDepositProof is DepositSetup { capsule.verifyDepositProof(validatorContainer, validatorProof); } - function test_verifyDepositProof_revert_inactiveValidatorContainer() public { + function test_verifyDepositProof_success_inactiveValidatorContainer() public { uint256 activationTimestamp = BEACON_CHAIN_GENESIS_TIME + _getActivationEpoch(validatorContainer) * SECONDS_PER_EPOCH; @@ -236,10 +236,15 @@ contract VerifyDepositProof is DepositSetup { mockCurrentBlockTimestamp = mockProofTimestamp + SECONDS_PER_SLOT; vm.warp(mockCurrentBlockTimestamp); validatorProof.beaconBlockTimestamp = mockProofTimestamp; - vm.expectRevert( - abi.encodeWithSelector(ExoCapsule.InactiveValidatorContainer.selector, _getPubkey(validatorContainer)) - ); + capsule.verifyDepositProof(validatorContainer, validatorProof); + + ExoCapsuleStorage.Validator memory validator = + capsule.getRegisteredValidatorByPubkey(_getPubkey(validatorContainer)); + assertEq(uint8(validator.status), uint8(ExoCapsuleStorage.VALIDATOR_STATUS.REGISTERED)); + assertEq(validator.validatorIndex, validatorProof.validatorIndex); + assertEq(validator.mostRecentBalanceUpdateTimestamp, validatorProof.beaconBlockTimestamp); + assertEq(validator.restakedBalanceGwei, _getEffectiveBalance(validatorContainer)); } function test_verifyDepositProof_revert_mismatchWithdrawalCredentials() public {