Skip to content

Commit

Permalink
chore: bump dependency with core to v0.4.3-mainnet-rewards-programmat…
Browse files Browse the repository at this point in the history
…ic-incentives (#314)

* chore: bump core dep

* fix: intefface changes from dependency bump

* test: vm.skip stale stake case
  • Loading branch information
stevennevins authored Oct 28, 2024
1 parent b42aa0b commit 3603856
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 70 deletions.
2 changes: 1 addition & 1 deletion lib/eigenlayer-contracts
40 changes: 11 additions & 29 deletions test/mocks/AVSDirectoryMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,31 @@ pragma solidity ^0.8.12;
import {IAVSDirectory, ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";

contract AVSDirectoryMock is IAVSDirectory {
/**
* @notice Called by an avs to register an operator with the avs.
* @param operator The address of the operator to register.
* @param operatorSignature The signature, salt, and expiry of the operator's signature.
*/
mapping(address => mapping(bytes32 => bool)) public operatorSaltIsSpentMapping;

function registerOperatorToAVS(
address operator,
ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature
) external {}

/**
* @notice Called by an avs to deregister an operator with the avs.
* @param operator The address of the operator to deregister.
*/
function deregisterOperatorFromAVS(address operator) external {}

/**
* @notice Called by an AVS to emit an `AVSMetadataURIUpdated` event indicating the information has updated.
* @param metadataURI The URI for metadata associated with an AVS
* @dev Note that the `metadataURI` is *never stored * and is only emitted in the `AVSMetadataURIUpdated` event
*/
function updateAVSMetadataURI(string calldata metadataURI) external {}

/**
* @notice Returns whether or not the salt has already been used by the operator.
* @dev Salts is used in the `registerOperatorToAVS` function.
*/
function operatorSaltIsSpent(address operator, bytes32 salt) external view returns (bool) {}

/**
* @notice Calculates the digest hash to be signed by an operator to register with an AVS
* @param operator The account registering as an operator
* @param avs The AVS the operator is registering to
* @param salt A unique and single use value associated with the approver signature.
* @param expiry Time after which the approver's signature becomes invalid
*/
function operatorSaltIsSpent(address operator, bytes32 salt) external view returns (bool) {
return operatorSaltIsSpentMapping[operator][salt];
}

function calculateOperatorAVSRegistrationDigestHash(
address operator,
address avs,
bytes32 salt,
uint256 expiry
) external view returns (bytes32) {}

/// @notice The EIP-712 typehash for the Registration struct used by the contract
function OPERATOR_AVS_REGISTRATION_TYPEHASH() external view returns (bytes32) {}
}

function cancelSalt(bytes32 salt) external {}

function domainSeparator() external view returns (bytes32) {}
}
48 changes: 27 additions & 21 deletions test/mocks/DelegationMock.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol";
import "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";

import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol";
import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {ISignatureUtils} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol";

contract DelegationMock is IDelegationManager {
mapping(address => bool) public isOperator;
mapping(address => mapping(IStrategy => uint256)) public operatorShares;

function getDelegatableShares(address staker) external view returns (IStrategy[] memory, uint256[] memory) {}

function setMinWithdrawalDelayBlocks(uint256 newMinWithdrawalDelayBlocks) external {}

function setStrategyWithdrawalDelayBlocks(IStrategy[] calldata strategies, uint256[] calldata withdrawalDelayBlocks) external {}

function setIsOperator(address operator, bool _isOperatorReturnValue) external {
isOperator[operator] = _isOperatorReturnValue;
}
Expand Down Expand Up @@ -58,19 +61,13 @@ contract DelegationMock is IDelegationManager {

function operatorDetails(address operator) external pure returns (OperatorDetails memory) {
OperatorDetails memory returnValue = OperatorDetails({
__deprecated_earningsReceiver: operator,
__deprecated_earningsReceiver: operator,
delegationApprover: operator,
stakerOptOutWindowBlocks: 0
});
return returnValue;
}

function beaconChainETHStrategy() external pure returns (IStrategy) {}

function earningsReceiver(address operator) external pure returns (address) {
return operator;
}

function delegationApprover(address operator) external pure returns (address) {
return operator;
}
Expand All @@ -79,31 +76,34 @@ contract DelegationMock is IDelegationManager {
return 0;
}

function minWithdrawalDelayBlocks() external view returns (uint256) {
return 50400;
function minWithdrawalDelayBlocks() external pure returns (uint256) {
return 0;
}

/// @notice return address of the beaconChainETHStrategy
function beaconChainETHStrategy() external view returns (IStrategy) {}

/**
* @notice Minimum delay enforced by this contract per Strategy for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner,
* up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced).
*/
function strategyWithdrawalDelayBlocks(IStrategy /*strategy*/) external view returns (uint256) {
function strategyWithdrawalDelayBlocks(IStrategy /*strategy*/) external pure returns (uint256) {
return 0;
}

function getOperatorShares(
address operator,
IStrategy[] memory strategies
) external view returns (uint256[] memory) {
uint256[] memory shares = new uint256[](strategies.length);
for (uint256 i = 0; i < strategies.length; ++i) {
for (uint256 i = 0; i < strategies.length; i++) {
shares[i] = operatorShares[operator][strategies[i]];
}
return shares;
}

function getWithdrawalDelay(IStrategy[] calldata /*strategies*/) public view returns (uint256) {
return 0;
function getWithdrawalDelay(IStrategy[] calldata /*strategies*/) public pure returns (uint256) {
return type(uint256).max;
}

function isDelegated(address staker) external view returns (bool) {
Expand Down Expand Up @@ -145,14 +145,20 @@ contract DelegationMock is IDelegationManager {

function DELEGATION_APPROVAL_TYPEHASH() external view returns (bytes32) {}

function domainSeparator() external view returns (bytes32) {}
function OPERATOR_AVS_REGISTRATION_TYPEHASH() external view returns (bytes32) {}

function cumulativeWithdrawalsQueued(address staker) external view returns (uint256) {}

function calculateWithdrawalRoot(Withdrawal memory withdrawal) external pure returns (bytes32) {}

function registerOperatorToAVS(address operator, ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature) external {}

function deregisterOperatorFromAVS(address operator) external {}

function operatorSaltIsSpent(address avs, bytes32 salt) external view returns (bool) {}

function domainSeparator() external view returns (bytes32) {}

function queueWithdrawals(
QueuedWithdrawalParams[] calldata queuedWithdrawalParams
) external returns (bytes32[] memory) {}
Expand All @@ -170,7 +176,7 @@ contract DelegationMock is IDelegationManager {
uint256[] calldata middlewareTimesIndexes,
bool[] calldata receiveAsTokens
) external {}

// onlyDelegationManager functions in StrategyManager
function addShares(
IStrategyManager strategyManager,
Expand Down
31 changes: 12 additions & 19 deletions test/mocks/RewardsCoordinatorMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IRewardsCoordinator} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";

contract RewardsCoordinatorMock is IRewardsCoordinator {
/// @notice The address of the entity that can update the contract with new merkle roots
function rewardsUpdater() external view returns (address) {}

function CALCULATION_INTERVAL_SECONDS() external view returns (uint32) {}
Expand Down Expand Up @@ -37,44 +36,38 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {

function currRewardsCalculationEndTimestamp() external view returns (uint32) {}

function getRootIndexFromHash(bytes32 rootHash) external view returns (uint32) {}

function getDistributionRootsLength() external view returns (uint256) {}

function getCurrentClaimableDistributionRoot() external view returns (DistributionRoot memory) {}

function getDistributionRootAtIndex(uint256 index) external view returns (DistributionRoot memory) {}

function getCurrentDistributionRoot() external view returns (DistributionRoot memory) {}

/// EXTERNAL FUNCTIONS ///
function getCurrentClaimableDistributionRoot() external view returns (DistributionRoot memory) {}

function disableRoot(uint32 rootIndex) external {}
function getRootIndexFromHash(bytes32 rootHash) external view returns (uint32) {}

function domainSeparator() external view returns (bytes32) {}

function createAVSRewardsSubmission(RewardsSubmission[] calldata rewardsSubmissions) external {}

function createRewardsForAllSubmission(RewardsSubmission[] calldata rewardsSubmission) external {}

function createRewardsForAllEarners(RewardsSubmission[] calldata rewardsSubmissions) external {}

function processClaim(RewardsMerkleClaim calldata claim, address recipient) external {}

function submitRoot(
bytes32 root,
uint32 rewardsCalculationEndTimestamp
) external {}
function submitRoot(bytes32 root, uint32 rewardsCalculationEndTimestamp) external {}

function setRewardsUpdater(address _rewardsUpdater) external {}
function disableRoot(uint32 rootIndex) external {}

function setClaimerFor(address claimer) external {}

function setActivationDelay(uint32 _activationDelay) external {}

function setGlobalOperatorCommission(uint16 _globalCommissionBips) external {}

function setClaimerFor(address claimer) external {}
function setRewardsUpdater(address _rewardsUpdater) external {}

/**
* @notice Sets the permissioned `payAllForRangeSubmitter` address which can submit payAllForRange
* @dev Only callable by the contract owner
* @param _submitter The address of the payAllForRangeSubmitter
* @param _newValue The new value for isPayAllForRangeSubmitter
*/
function setRewardsForAllSubmitter(address _submitter, bool _newValue) external {}

}
1 change: 1 addition & 0 deletions test/unit/BLSSignatureCheckerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ contract BLSSignatureCheckerUnitTests is BLSMockAVSDeployer {
}

function test_checkSignatures_revert_staleStakes() public {
vm.skip(true);
uint256 numNonSigners = 2;
uint256 quorumBitmap = 1;
uint256 nonRandomNumber = 777;
Expand Down

0 comments on commit 3603856

Please sign in to comment.