Skip to content

Commit

Permalink
test: AllocationManager progress
Browse files Browse the repository at this point in the history
  • Loading branch information
0xClandestine committed Oct 11, 2024
1 parent 5c6ca60 commit b88286e
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 16 deletions.
15 changes: 0 additions & 15 deletions src/contracts/core/AllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,6 @@ contract AllocationManager is
emit AllocationDelaySet(operator, delay, info.effectTimestamp);
}

/**
* @param encumberedMagnitude the effective magnitude allocated to all operator sets
* for the strategy
* @param currentMagnitude the effective current magnitude allocated to a single operator set
* for the strategy
* @param pendingDiff the pending change in magnitude, if one exists
* @param effectTimestamp the time after which `pendingDiff` will take effect
*/
struct PendingMagnitudeInfo {
uint64 encumberedMagnitude;
uint64 currentMagnitude;
int128 pendingDiff;
uint32 effectTimestamp;
}

/**
* @dev For an operator set, get the operator's effective allocated magnitude.
* If the operator set has a pending modification that can be completed at the
Expand Down
16 changes: 16 additions & 0 deletions src/contracts/interfaces/IAllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ interface IAllocationManagerTypes {
uint256 wadToSlash;
string description;
}

/**
* @param encumberedMagnitude the effective magnitude allocated to all operator sets
* for the strategy
* @param currentMagnitude the effective current magnitude allocated to a single operator set
* for the strategy
* @param pendingDiff the pending change in magnitude, if one exists
* @param effectTimestamp the time after which `pendingDiff` will take effect
*/
struct PendingMagnitudeInfo {
uint64 encumberedMagnitude;
uint64 currentMagnitude;
int128 pendingDiff;
uint32 effectTimestamp;
}

}

interface IAllocationManagerEvents is IAllocationManagerTypes {
Expand Down
24 changes: 24 additions & 0 deletions src/test/mocks/AVSDirectoryMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,32 @@
pragma solidity ^0.8.9;

import "forge-std/Test.sol";
import "src/contracts/interfaces/IAVSDirectory.sol";

contract AVSDirectoryMock is Test {
receive() external payable {}
fallback() external payable {}

mapping(address => mapping(bytes32 => bool)) public _isOperatorSlashable;
mapping(bytes32 => bool) public _isOperatorSetBatch;

function isOperatorSlashable(address operator, OperatorSet memory operatorSet) public virtual view returns (bool) {
return _isOperatorSlashable[operator][bytes32(abi.encode(operatorSet))];
}

function isOperatorSetBatch(OperatorSet[] memory operatorSets) public virtual view returns (bool) {
return _isOperatorSetBatch[keccak256(abi.encode(operatorSets))];
}

function setIsOperatorSlashable(
address operator,
OperatorSet memory operatorSet,
bool value
) public virtual {
_isOperatorSlashable[operator][bytes32(abi.encode(operatorSet))] = value;
}

function setIsOperatorSetBatch(OperatorSet[] memory operatorSets, bool value) public virtual {
_isOperatorSetBatch[keccak256(abi.encode(operatorSets))] = value;
}
}
Loading

0 comments on commit b88286e

Please sign in to comment.