datahaven/contracts/test/utils/AVSDeployer.sol

393 lines
16 KiB
Solidity
Raw Permalink Normal View History

feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import {
TransparentUpgradeableProxy,
ITransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
import {PauserRegistry} from "eigenlayer-contracts/src/contracts/permissions/PauserRegistry.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {RewardsCoordinator} from "eigenlayer-contracts/src/contracts/core/RewardsCoordinator.sol";
import {AllocationManager} from "eigenlayer-contracts/src/contracts/core/AllocationManager.sol";
import {
IRewardsCoordinator,
IRewardsCoordinatorTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {EmptyContract} from "eigenlayer-contracts/src/test/mocks/EmptyContract.sol";
import {StrategyBase} from "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol";
import {EigenStrategy} from "eigenlayer-contracts/src/contracts/strategies/EigenStrategy.sol";
import {EigenPodManagerMock} from "eigenlayer-contracts/src/test/mocks/EigenPodManagerMock.sol";
import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol";
import {IEigenPodManager} from "eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol";
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
import {ERC20FixedSupply} from "./ERC20FixedSupply.sol";
import {DataHavenServiceManager} from "../../src/DataHavenServiceManager.sol";
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// Mocks
import {RewardsCoordinatorMock} from "../mocks/RewardsCoordinatorMock.sol";
import {PermissionControllerMock} from "../mocks/PermissionControllerMock.sol";
refactor(contracts): Harden DataHavenServiceManager with input validation and code cleanup (#395) ## Summary - Add zero address validation across all functions that accept address parameters to prevent misconfiguration - Fix race condition in `buildNewValidatorSetMessage()` that could cause reverts during validator deregistration - Refactor contract for improved readability and reduced code duplication - Update AVS metadata URL to point to the correct hosted JSON file ## Changes ### Security & Validation - Add `ZeroAddress` error and validate all address inputs in `initialize`, `setRewardsInitiator`, `setSnowbridgeGateway`, `addValidatorToAllowlist`, `registerOperator`, and `updateSolochainAddressForValidator` - Fix race condition: filter out zero solochain addresses in `buildNewValidatorSetMessage()` to prevent reverts when a validator is mid-deregistration ### Refactoring - Replace verbose `if/revert` patterns with `require` statements for consistency - Inline single-use internal functions (`_createDataHavenOperatorSets`, `_setRewardsInitiator`) - Consolidate duplicate error types into single `ZeroAddress` error - Rename `initialise` → `initialize` to maintain consistency with the transparent upgradability pattern - Optimize validator set message encoding by removing redundant wrapper function ### Observability - Add `SolochainAddressUpdated` event for tracking validator address changes ### Cleanup - Remove unused remappings from `foundry.toml` - Fix typo in metadata description --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2026-01-20 10:32:32 +00:00
import {SnowbridgeGatewayMock} from "../mocks/SnowbridgeGatewayMock.sol";
import {DelegationManager} from "eigenlayer-contracts/src/contracts/core/DelegationManager.sol";
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
import {Test, console, Vm} from "forge-std/Test.sol";
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
contract AVSDeployer is Test {
using SafeCast for uint256;
Vm public cheats = Vm(VM_ADDRESS);
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
ProxyAdmin public proxyAdmin;
PauserRegistry public pauserRegistry;
EmptyContract public emptyContract;
// AVS contracts
DataHavenServiceManager public serviceManager;
DataHavenServiceManager public serviceManagerImplementation;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// EigenLayer contracts
StrategyManager public strategyManager;
StrategyManager public strategyManagerImplementation;
DelegationManager public delegationManager;
DelegationManager public delegationManagerImplementation;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
EigenPodManagerMock public eigenPodManagerMock;
AllocationManager public allocationManager;
AllocationManager public allocationManagerImplementation;
IStrategy public eigenStrategy;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
RewardsCoordinator public rewardsCoordinator;
RewardsCoordinator public rewardsCoordinatorImplementation;
RewardsCoordinatorMock public rewardsCoordinatorMock;
PermissionControllerMock public permissionControllerMock;
refactor(contracts): Harden DataHavenServiceManager with input validation and code cleanup (#395) ## Summary - Add zero address validation across all functions that accept address parameters to prevent misconfiguration - Fix race condition in `buildNewValidatorSetMessage()` that could cause reverts during validator deregistration - Refactor contract for improved readability and reduced code duplication - Update AVS metadata URL to point to the correct hosted JSON file ## Changes ### Security & Validation - Add `ZeroAddress` error and validate all address inputs in `initialize`, `setRewardsInitiator`, `setSnowbridgeGateway`, `addValidatorToAllowlist`, `registerOperator`, and `updateSolochainAddressForValidator` - Fix race condition: filter out zero solochain addresses in `buildNewValidatorSetMessage()` to prevent reverts when a validator is mid-deregistration ### Refactoring - Replace verbose `if/revert` patterns with `require` statements for consistency - Inline single-use internal functions (`_createDataHavenOperatorSets`, `_setRewardsInitiator`) - Consolidate duplicate error types into single `ZeroAddress` error - Rename `initialise` → `initialize` to maintain consistency with the transparent upgradability pattern - Optimize validator set message encoding by removing redundant wrapper function ### Observability - Add `SolochainAddressUpdated` event for tracking validator address changes ### Cleanup - Remove unused remappings from `foundry.toml` - Fix typo in metadata description --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2026-01-20 10:32:32 +00:00
SnowbridgeGatewayMock public snowbridgeGatewayMock;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// Addresses
address public proxyAdminOwner = address(uint160(uint256(keccak256("proxyAdminOwner"))));
address public regularDeployer = address(uint160(uint256(keccak256("regularDeployer"))));
address public avsOwner = address(uint160(uint256(keccak256("avsOwner"))));
address public rewardsInitiator = address(uint160(uint256(keccak256("rewardsInitiator"))));
address public pauser = address(uint160(uint256(keccak256("pauser"))));
address public unpauser = address(uint160(uint256(keccak256("unpauser"))));
address public rewardsUpdater = address(uint160(uint256(keccak256("rewardsUpdater"))));
address public strategyOwner = address(uint160(uint256(keccak256("strategyOwner"))));
// RewardsCoordinator constants
uint32 public constant CALCULATION_INTERVAL_SECONDS = 7 days;
uint32 public constant MAX_REWARDS_DURATION = 70 days;
uint32 public constant MAX_RETROACTIVE_LENGTH = 84 days;
uint32 public constant MAX_FUTURE_LENGTH = 28 days;
uint32 public constant GENESIS_REWARDS_TIMESTAMP = 1712188800;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
/// @notice Delay in timestamp before a posted root can be claimed against
uint32 public activationDelay = 7 days;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
/// @notice the commission for all operators across all AVSs
uint16 public globalCommissionBips = 1000;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// Mock strategies
IERC20[] public rewardTokens;
uint256 public mockTokenInitialSupply = 10e50;
IStrategy[] public deployedStrategies;
StrategyBase public strategyImplementation;
IRewardsCoordinator.StrategyAndMultiplier[] public defaultStrategyAndMultipliers;
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
function _deployMockEigenLayerAndAVS() internal {
emptyContract = new EmptyContract();
// Deploy EigenLayer core contracts.
cheats.startPrank(proxyAdminOwner);
proxyAdmin = new ProxyAdmin();
cheats.stopPrank();
console.log("ProxyAdmin deployed");
cheats.startPrank(regularDeployer);
address[] memory pausers = new address[](1);
pausers[0] = pauser;
pauserRegistry = new PauserRegistry(pausers, unpauser);
eigenPodManagerMock = new EigenPodManagerMock(pauserRegistry);
permissionControllerMock = new PermissionControllerMock();
rewardsCoordinatorMock = new RewardsCoordinatorMock();
refactor(contracts): Harden DataHavenServiceManager with input validation and code cleanup (#395) ## Summary - Add zero address validation across all functions that accept address parameters to prevent misconfiguration - Fix race condition in `buildNewValidatorSetMessage()` that could cause reverts during validator deregistration - Refactor contract for improved readability and reduced code duplication - Update AVS metadata URL to point to the correct hosted JSON file ## Changes ### Security & Validation - Add `ZeroAddress` error and validate all address inputs in `initialize`, `setRewardsInitiator`, `setSnowbridgeGateway`, `addValidatorToAllowlist`, `registerOperator`, and `updateSolochainAddressForValidator` - Fix race condition: filter out zero solochain addresses in `buildNewValidatorSetMessage()` to prevent reverts when a validator is mid-deregistration ### Refactoring - Replace verbose `if/revert` patterns with `require` statements for consistency - Inline single-use internal functions (`_createDataHavenOperatorSets`, `_setRewardsInitiator`) - Consolidate duplicate error types into single `ZeroAddress` error - Rename `initialise` → `initialize` to maintain consistency with the transparent upgradability pattern - Optimize validator set message encoding by removing redundant wrapper function ### Observability - Add `SolochainAddressUpdated` event for tracking validator address changes ### Cleanup - Remove unused remappings from `foundry.toml` - Fix typo in metadata description --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2026-01-20 10:32:32 +00:00
snowbridgeGatewayMock = new SnowbridgeGatewayMock();
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
cheats.stopPrank();
console.log("Mock EigenLayer contracts deployed");
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// Deploying proxy contracts for AllocationManager and StrategyManager.
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// The `proxyAdmin` contract is set as the admin of the proxy contracts,
// which will be later upgraded to the actual implementation.
cheats.prank(regularDeployer);
allocationManager = AllocationManager(
address(
new TransparentUpgradeableProxy(address(emptyContract), address(proxyAdmin), "")
)
);
strategyManager = StrategyManager(
address(
new TransparentUpgradeableProxy(address(emptyContract), address(proxyAdmin), "")
)
);
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
console.log("AllocationManager and StrategyManager proxy contracts deployed");
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
cheats.prank(regularDeployer);
eigenStrategy =
IStrategy(address(new EigenStrategy(strategyManager, pauserRegistry, "v-mock")));
console.log("EigenStrategy deployed");
// Deploying DelegationManager implementation and its proxy.
cheats.prank(regularDeployer);
delegationManagerImplementation = new DelegationManager(
strategyManager,
IEigenPodManager(address(eigenPodManagerMock)),
allocationManager,
pauserRegistry,
permissionControllerMock,
uint32(10), // MIN_WITHDRAWAL_DELAY_BLOCKS
"v-mock"
);
cheats.prank(regularDeployer);
delegationManager = DelegationManager(
address(
new TransparentUpgradeableProxy(
address(delegationManagerImplementation), address(proxyAdmin), ""
)
)
);
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// Deploying AllocationManager implementation and upgrading the proxy.
cheats.prank(regularDeployer);
allocationManagerImplementation = new AllocationManager(
delegationManager,
eigenStrategy,
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
pauserRegistry,
permissionControllerMock,
uint32(7 days), // DEALLOCATION_DELAY
uint32(1 days), // ALLOCATION_CONFIGURATION_DELAY
"v-mock"
);
cheats.prank(proxyAdminOwner);
proxyAdmin.upgrade(
ITransparentUpgradeableProxy(address(allocationManager)),
address(allocationManagerImplementation)
);
console.log("AllocationManager implementation deployed");
// Deploying StrategyManager implementation and its proxy.
cheats.prank(regularDeployer);
strategyManagerImplementation =
new StrategyManager(allocationManager, delegationManager, pauserRegistry, "v-mock");
cheats.prank(proxyAdminOwner);
uint256 allUnpaused = 0;
proxyAdmin.upgradeAndCall(
ITransparentUpgradeableProxy(address(strategyManager)),
address(strategyManagerImplementation),
abi.encodeWithSelector(
StrategyManager.initialize.selector, strategyOwner, strategyOwner, allUnpaused
)
);
console.log("StrategyManager implementation deployed");
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// Deploying RewardsCoordinator implementation and its proxy.
// When the proxy is deployed, the `initialize` function is called.
cheats.startPrank(regularDeployer);
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams memory params =
fix: Resolve Foundry build errors and apply code formatting (#241) ## Summary Fixes the CI build failure in the `task-ts-build` workflow caused by Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's context-specific import remappings. ## Problem The Snowbridge submodule uses context-specific remappings (prefixed with `:`) for its dependencies: - `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts - `lib/snowbridge/contracts/:prb/math/` → PRB Math library Foundry v1.4.2's Solar linter doesn't understand these context-specific remappings and fails with errors like: ``` error: file openzeppelin/utils/cryptography/MerkleProof.sol not found error: file prb/math/src/UD60x18.sol not found ``` ## Solution Added global remappings that the linter can understand: ```toml "openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/", "prb/math/=lib/snowbridge/contracts/lib/prb-math/", ``` ### Why This Works - The linter can now resolve `openzeppelin/` and `prb/math/` imports globally - These global remappings take **lower precedence** than context-specific ones during compilation - The compiler still uses the context-specific remappings (with `:`) when compiling Snowbridge contracts - The linter uses the global remappings when checking all files ## Changes ### Commit 1: Add global remappings - `contracts/foundry.toml`: Added 2 global remapping entries ### Commit 2: Apply forge fmt - Applied automatic formatting via `forge fmt` to ensure code style consistency - Multi-line formatting for long import statements and function signatures - No functional changes - purely formatting updates ## Testing ✅ Local build succeeds with `forge build` ✅ No Snowbridge import resolution errors ✅ `forge fmt --check` passes with no formatting issues ✅ Only linting notes/warnings remain (not errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
2025-10-20 08:20:59 +00:00
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams({
delegationManager: delegationManager,
strategyManager: IStrategyManager(address(strategyManager)),
allocationManager: allocationManager,
pauserRegistry: pauserRegistry,
permissionController: permissionControllerMock,
CALCULATION_INTERVAL_SECONDS: CALCULATION_INTERVAL_SECONDS,
MAX_REWARDS_DURATION: MAX_REWARDS_DURATION,
MAX_RETROACTIVE_LENGTH: MAX_RETROACTIVE_LENGTH,
MAX_FUTURE_LENGTH: MAX_FUTURE_LENGTH,
GENESIS_REWARDS_TIMESTAMP: GENESIS_REWARDS_TIMESTAMP,
version: "v-mock"
});
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
rewardsCoordinatorImplementation = new RewardsCoordinator(params);
rewardsCoordinator = RewardsCoordinator(
address(
new TransparentUpgradeableProxy(
address(rewardsCoordinatorImplementation),
address(proxyAdmin),
abi.encodeWithSelector(
RewardsCoordinator.initialize.selector,
msg.sender,
0, /*initialPausedStatus*/
rewardsUpdater,
activationDelay,
globalCommissionBips
)
)
)
);
cheats.stopPrank();
console.log("RewardsCoordinator implementation deployed");
// Set up strategies before deploying the ServiceManager
_setUpDefaultStrategiesAndMultipliers();
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
// Deploying ServiceManager implementation and its proxy.
// When the proxy is deployed, the `initialize` function is called.
cheats.startPrank(regularDeployer);
refactor: Remove eigenlayer-middleware and flatten ServiceManagerBase (#389) ## Summary - Flatten `ServiceManagerBase` middleware layer directly into `DataHavenServiceManager` - Remove all unused EigenLayer integration code to keep the contract minimal - Fix access control on `deregisterOperatorFromOperatorSets` (was missing `onlyOwner`) ## Motivation The `ServiceManagerBase` from eigenlayer-middleware was designed for the old `AVSDirectory` model and included many generic functions DataHaven doesn't use. This refactor: - Reduces code complexity and contract size - Removes ~200 lines of unused code - Makes the codebase easier to audit and maintain - Keeps only what DataHaven actually needs ## Changes ### Architecture Before: DataHavenServiceManager → ServiceManagerBase → ServiceManagerBaseStorage → OwnableUpgradeable After: DataHavenServiceManager → OwnableUpgradeable, IAVSRegistrar, IDataHavenServiceManager ### Removed (unused) - `IServiceManager` and `IServiceManagerUI` interfaces (old AVSDirectory model) - `ServiceManagerBase` and `ServiceManagerBaseStorage` middleware - `PermissionController` integration (5 proxy functions) - `createOperatorSets()` - only needed at initialization - `avs()` - never called ### Kept (with fixes) - `deregisterOperatorFromOperatorSets()` - added `onlyOwner` modifier (security fix) - `updateAVSMetadataURI()` - needed for EigenLayer registration ### Files Deleted - `src/interfaces/IServiceManager.sol` - `src/interfaces/IServiceManagerUI.sol` - `src/middleware/ServiceManagerBase.sol` - `src/middleware/ServiceManagerBaseStorage.sol` - `test/mocks/ServiceManagerMock.sol` - `test/ServiceManagerBase.t.sol` ## Test Plan - [x] `forge build` passes - [x] `forge test` - all 10 tests pass - [x] Contract bindings regenerated - [x] State diff regenerated
2026-01-13 14:03:10 +00:00
serviceManagerImplementation =
new DataHavenServiceManager(rewardsCoordinator, allocationManager);
serviceManager = DataHavenServiceManager(
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
address(
new TransparentUpgradeableProxy(
address(serviceManagerImplementation),
address(proxyAdmin),
abi.encodeWithSelector(
refactor(contracts): Harden DataHavenServiceManager with input validation and code cleanup (#395) ## Summary - Add zero address validation across all functions that accept address parameters to prevent misconfiguration - Fix race condition in `buildNewValidatorSetMessage()` that could cause reverts during validator deregistration - Refactor contract for improved readability and reduced code duplication - Update AVS metadata URL to point to the correct hosted JSON file ## Changes ### Security & Validation - Add `ZeroAddress` error and validate all address inputs in `initialize`, `setRewardsInitiator`, `setSnowbridgeGateway`, `addValidatorToAllowlist`, `registerOperator`, and `updateSolochainAddressForValidator` - Fix race condition: filter out zero solochain addresses in `buildNewValidatorSetMessage()` to prevent reverts when a validator is mid-deregistration ### Refactoring - Replace verbose `if/revert` patterns with `require` statements for consistency - Inline single-use internal functions (`_createDataHavenOperatorSets`, `_setRewardsInitiator`) - Consolidate duplicate error types into single `ZeroAddress` error - Rename `initialise` → `initialize` to maintain consistency with the transparent upgradability pattern - Optimize validator set message encoding by removing redundant wrapper function ### Observability - Add `SolochainAddressUpdated` event for tracking validator address changes ### Cleanup - Remove unused remappings from `foundry.toml` - Fix typo in metadata description --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2026-01-20 10:32:32 +00:00
DataHavenServiceManager.initialize.selector,
avsOwner,
rewardsInitiator,
feat: implement weighted top-32 validator selection (#443) ## Overview Implements deterministic weighted-stake-based validator selection in `DataHavenServiceManager`, building on the era-targeting submitter model from PR #433. Previously, `buildNewValidatorSetMessage()` forwarded all registered operators in arbitrary membership order with no stake-based ranking, meaning high-stake operators could be displaced by lower-stake ones when downstream caps applied. This PR fixes that by computing a weighted stake score per operator and selecting the top-32 candidates before bridging the set to DataHaven. Spec: `specs/validator-set-selection/validator-set-selection.md` ## Contract Changes (`DataHavenServiceManager.sol`) **New state:** - `MAX_ACTIVE_VALIDATORS = 32` — cap on the outbound validator set - `mapping(IStrategy => uint96) public strategiesAndMultipliers` — per-strategy weight used in the selection formula **Updated `buildNewValidatorSetMessage()`:** 1. Fetches allocated stake for all operators × strategies from `AllocationManager` 2. Computes `weightedStake(op) = Σ(allocatedStake[op][j] × multiplier[j])` across all strategies 3. Filters operators with no solochain address mapping or zero weighted stake 4. Runs a partial selection sort to pick the top `min(candidateCount, 32)` by descending weighted stake; ties broken by lower operator address (deterministic) 5. Reverts with `EmptyValidatorSet()` if no eligible candidates remain **Admin API changes:** - `addStrategiesToValidatorsSupportedStrategies()` signature changed from `IStrategy[]` to `IRewardsCoordinatorTypes.StrategyAndMultiplier[]` — strategy and multiplier are stored atomically in one call, eliminating the risk of a strategy being registered without a multiplier - New `setStrategiesAndMultipliers(StrategyAndMultiplier[])` — updates multiplier weights for existing strategies without touching the EigenLayer strategy set - New `getStrategiesAndMultipliers()` — returns all strategies with their current multipliers - `removeStrategiesFromValidatorsSupportedStrategies()` now cleans up multiplier entries on removal **New error / event:** - `EmptyValidatorSet()` — reverts when no eligible candidates exist - `StrategiesAndMultipliersSet(StrategyAndMultiplier[])` — emitted on add or update of multipliers ## Tests (`ValidatorSetSelection.t.sol`) New 552-line Foundry test suite covering all cases from the spec: | Case | |------| | `addStrategies` stores multiplier atomically | | `removeStrategies` deletes multiplier | | `setStrategiesAndMultipliers` updates without touching the strategy set | | `getStrategiesAndMultipliers` returns correct pairs | | Weighted stake computed correctly across multiple strategies | | Operators with zero weighted stake are excluded | | Unset multiplier treated as 0 | | Top-32 selection when candidate count > 32 | | All candidates included when count < 32 | | Tie-breaking by lower operator address | | `EmptyValidatorSet` revert when no eligible operators | ## Deploy Scripts - **`DeployBase.s.sol`**: Sets a default multiplier of `1` for all configured validator strategies after AVS registration via `setStrategiesAndMultipliers` - **New `AllocateOperatorStake.s.sol`**: Forge script that allocates full magnitude (`1e18`) to the validator operator set for a given operator. Must be run at least one block after `SignUpValidator` to respect EigenLayer's allocation configuration delay. ## E2E Framework - **`validators.ts` — `registerOperator()`**: Extended to deposit tokens into each deployed strategy and allocate full magnitude to the DataHaven operator set after registration. Previously operators registered without staking, producing zero weighted stake and getting filtered out by the new selection logic. - **`setup-validators.ts`**: Added a stake allocation pass after the registration loop, invoking `AllocateOperatorStake.s.sol` per validator. - **`validator-set-update.test.ts`**: Added debug logging for transaction receipts and the `OutboundMessageAccepted` / `ExternalValidatorsSet` events. - **`generated.ts`**: Regenerated contract bindings to include new functions, events, and the `EmptyValidatorSet` error. ## ⚠️ Breaking Changes ⚠️ - `addStrategiesToValidatorsSupportedStrategies(IStrategy[])` → `addStrategiesToValidatorsSupportedStrategies(StrategyAndMultiplier[])`: callers must supply multipliers alongside strategies. - Operators with zero weighted stake are no longer included in the bridged validator set. ## Rollout Notes 1. PR #433 (era-targeting + submitter role) must be deployed first 2. Deploy this `ServiceManager` upgrade 3. Confirm `strategiesAndMultipliers` is set for all active strategies (default multiplier `1` applied automatically by `DeployBase`) 4. Deploy the runtime cap-enforcement changes (spec section 10.2) 5. Submitter daemon requires no changes — continues submitting `targetEra = ActiveEra + 1`
2026-02-24 08:23:57 +00:00
defaultStrategyAndMultipliers,
feat: automated validator set submission with era targeting (#433) ## Era-targeted validator set submission with dedicated submitter role > **Note:** This PR includes a detailed specification at [`specs/validator-set-submission/validator-set-submission.md`](https://github.com/datahaven-xyz/datahaven/blob/feat/validator-set-submitter/specs/validator-set-submission/validator-set-submission.md) that covers the design rationale, submission lifecycle, era-targeting rules, and failure modes. Reading the spec first will make the contract, pallet, and daemon changes easier to follow. ### Summary - Introduce a dedicated `validatorSetSubmitter` role on `DataHavenServiceManager`, separating validator set submission authority from the contract owner - Replace the unscoped `sendNewValidatorSet` with `sendNewValidatorSetForEra`, which encodes a `targetEra` into the Snowbridge message payload - Add server-side era validation in the `external-validators` pallet to reject stale, duplicate, or out-of-range submissions - Add a long-running TypeScript daemon that watches session changes and automatically submits each era's validator set at the right time ### Contract changes (`contracts/`) - **New `validatorSetSubmitter` storage slot** — set during `initialize` and rotatable via `setValidatorSetSubmitter` (owner-only). The storage gap is decremented accordingly. - **`sendNewValidatorSet` → `sendNewValidatorSetForEra`** — accepts a `uint64 targetEra` parameter and is restricted to `onlyValidatorSetSubmitter` instead of `onlyOwner`. - **`buildNewValidatorSetMessageForEra`** — the `NewValidatorSetPayload.externalIndex` is now caller-supplied instead of hardcoded to `0`. - **New events** — `ValidatorSetSubmitterUpdated`, `ValidatorSetMessageSubmitted`. - **New error** — `OnlyValidatorSetSubmitter`. - **New test suite** — `ValidatorSetSubmitter.t.sol` covering submitter set/rotate, access control, era encoding, and legacy function removal. ### Pallet changes (`operator/`) - **`validate_target_era`** in `external-validators` — enforces `activeEra < targetEra <= activeEra + 1` and `targetEra > ExternalIndex` (dedup guard). - **New errors** — `TargetEraTooOld`, `TargetEraTooNew`, `DuplicateOrStaleTargetEra`. - **Tests** — five new test cases for era boundary conditions (next-era acceptance, old-era rejection, too-new rejection, duplicate rejection, genesis behavior). Existing `era_hooks_with_external_index` test updated to use valid target eras. - **Runtime test fixes** — `external_index: 0` → `1` in mainnet/stagenet/testnet EigenLayer message processor tests to satisfy the new validation. ### Validator set submitter daemon (`test/tools/validator-set-submitter/`) - Event-driven service that subscribes to finalized `Session.CurrentIndex` via Polkadot-API `watchValue`. - Submits once per era during the last session, targeting `ActiveEra + 1`. - Tracks submitted eras to avoid duplicates; skips if `ExternalIndex` already covers the target. - Startup self-checks: Ethereum connectivity, DataHaven connectivity, on-chain submitter authorization. - Supports `--dry-run` mode and YAML configuration. - Graceful shutdown on `SIGINT`/`SIGTERM`. ### Test & tooling updates - **E2E test** (`validator-set-update.test.ts`) — calls `sendNewValidatorSetForEra` with a computed `targetEra` and filters the substrate event by `external_index`. - **`update-validator-set.ts` script** — accepts `--target-era` flag; defaults to era 1 for fresh networks. - **CLI launch** — wires validator set update as an interactive step after relayer launch. - **`package.json`** — new `submitter` and `submitter:dry-run` scripts. - Regenerated contract bindings, PAPI metadata, state-diff, and storage layout snapshots. ### Test plan - [x] `forge test` — passes, including new `ValidatorSetSubmitter.t.sol` - [x] `cargo test` — passes, including new era-validation tests in `external-validators` - [x] `bun test:e2e` — validator-set-update suite passes with era-targeted flow - [x] Manual: run submitter daemon against local network (`bun submitter`), verify it submits once per era at the correct session ## ⚠️ Breaking Changes ⚠️ - **`sendNewValidatorSet` removed** — replaced by `sendNewValidatorSetForEra(uint64 targetEra, ...)`. Callers must now supply a `targetEra` parameter. - **Access control changed** — validator set submission is now restricted to the `validatorSetSubmitter` role instead of the contract `owner`. The submitter address is set during `initialize` and rotatable via `setValidatorSetSubmitter` (owner-only). - **`external-validators` pallet now validates `targetEra`** — messages with a stale, duplicate, or out-of-range `external_index` are rejected on-chain. Existing integrations sending `external_index: 0` will fail validation. --------- Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-20 09:31:44 +00:00
address(snowbridgeGatewayMock),
avsOwner
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
)
)
)
);
cheats.stopPrank();
console.log("ServiceManager implementation deployed");
}
function _setUpDefaultStrategiesAndMultipliers() internal virtual {
// Deploy mock tokens to be used for strategies.
cheats.startPrank(strategyOwner);
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
IERC20 token1 =
new ERC20FixedSupply("dog wif hat", "MOCK1", mockTokenInitialSupply, address(this));
IERC20 token2 =
new ERC20FixedSupply("jeo boden", "MOCK2", mockTokenInitialSupply, address(this));
IERC20 token3 =
new ERC20FixedSupply("pepe wif avs", "MOCK3", mockTokenInitialSupply, address(this));
// Deploy mock strategies.
strategyImplementation =
new StrategyBase(IStrategyManager(address(strategyManager)), pauserRegistry, "v-mock");
deployedStrategies.push(
StrategyBase(
address(
new TransparentUpgradeableProxy(
address(strategyImplementation),
address(proxyAdmin),
abi.encodeWithSelector(
StrategyBase.initialize.selector, token1, pauserRegistry
)
)
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
)
)
);
deployedStrategies.push(
StrategyBase(
address(
new TransparentUpgradeableProxy(
address(strategyImplementation),
address(proxyAdmin),
abi.encodeWithSelector(
StrategyBase.initialize.selector, token2, pauserRegistry
)
)
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
)
)
);
deployedStrategies.push(
StrategyBase(
address(
new TransparentUpgradeableProxy(
address(strategyImplementation),
address(proxyAdmin),
abi.encodeWithSelector(
StrategyBase.initialize.selector, token3, pauserRegistry
)
)
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
)
)
);
cheats.stopPrank();
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
deployedStrategies = _sortArrayAsc(deployedStrategies);
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
cheats.startPrank(strategyOwner);
strategyManager.addStrategiesToDepositWhitelist(deployedStrategies);
cheats.stopPrank();
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
defaultStrategyAndMultipliers.push(
IRewardsCoordinatorTypes.StrategyAndMultiplier(
IStrategy(address(deployedStrategies[0])), 1e18
)
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
);
defaultStrategyAndMultipliers.push(
IRewardsCoordinatorTypes.StrategyAndMultiplier(
IStrategy(address(deployedStrategies[1])), 2e18
)
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
);
defaultStrategyAndMultipliers.push(
IRewardsCoordinatorTypes.StrategyAndMultiplier(
IStrategy(address(deployedStrategies[2])), 3e18
)
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
);
}
function _labelContracts() internal {
cheats.label(address(emptyContract), "EmptyContract");
cheats.label(address(proxyAdmin), "ProxyAdmin");
cheats.label(address(pauserRegistry), "PauserRegistry");
cheats.label(address(delegationManager), "DelegationManager");
cheats.label(address(eigenPodManagerMock), "EigenPodManagerMock");
cheats.label(address(strategyManager), "StrategyManager");
cheats.label(address(rewardsCoordinatorMock), "RewardsCoordinatorMock");
cheats.label(address(allocationManager), "AllocationManager");
cheats.label(address(allocationManagerImplementation), "AllocationManagerImplementation");
cheats.label(address(serviceManager), "ServiceManager");
cheats.label(address(serviceManagerImplementation), "ServiceManagerImplementation");
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
}
/// @dev Sort to ensure that the array is in ascending order for strategies
function _sortArrayAsc(
IStrategy[] memory arr
) internal pure returns (IStrategy[] memory) {
uint256 l = arr.length;
for (uint256 i = 0; i < l; i++) {
for (uint256 j = i + 1; j < l; j++) {
if (address(arr[i]) > address(arr[j])) {
IStrategy temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
return arr;
}
fix: Resolve Foundry build errors and apply code formatting (#241) ## Summary Fixes the CI build failure in the `task-ts-build` workflow caused by Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's context-specific import remappings. ## Problem The Snowbridge submodule uses context-specific remappings (prefixed with `:`) for its dependencies: - `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts - `lib/snowbridge/contracts/:prb/math/` → PRB Math library Foundry v1.4.2's Solar linter doesn't understand these context-specific remappings and fails with errors like: ``` error: file openzeppelin/utils/cryptography/MerkleProof.sol not found error: file prb/math/src/UD60x18.sol not found ``` ## Solution Added global remappings that the linter can understand: ```toml "openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/", "prb/math/=lib/snowbridge/contracts/lib/prb-math/", ``` ### Why This Works - The linter can now resolve `openzeppelin/` and `prb/math/` imports globally - These global remappings take **lower precedence** than context-specific ones during compilation - The compiler still uses the context-specific remappings (with `:`) when compiling Snowbridge contracts - The linter uses the global remappings when checking all files ## Changes ### Commit 1: Add global remappings - `contracts/foundry.toml`: Added 2 global remapping entries ### Commit 2: Apply forge fmt - Applied automatic formatting via `forge fmt` to ensure code style consistency - Multi-line formatting for long import statements and function signatures - No functional changes - purely formatting updates ## Testing ✅ Local build succeeds with `forge build` ✅ No Snowbridge import resolution errors ✅ `forge fmt --check` passes with no formatting issues ✅ Only linting notes/warnings remain (not errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
2025-10-20 08:20:59 +00:00
function _incrementAddress(
address start,
uint256 inc
) internal pure returns (address) {
return address((uint256(uint160(start)) + inc).toUint160());
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
}
fix: Resolve Foundry build errors and apply code formatting (#241) ## Summary Fixes the CI build failure in the `task-ts-build` workflow caused by Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's context-specific import remappings. ## Problem The Snowbridge submodule uses context-specific remappings (prefixed with `:`) for its dependencies: - `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts - `lib/snowbridge/contracts/:prb/math/` → PRB Math library Foundry v1.4.2's Solar linter doesn't understand these context-specific remappings and fails with errors like: ``` error: file openzeppelin/utils/cryptography/MerkleProof.sol not found error: file prb/math/src/UD60x18.sol not found ``` ## Solution Added global remappings that the linter can understand: ```toml "openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/", "prb/math/=lib/snowbridge/contracts/lib/prb-math/", ``` ### Why This Works - The linter can now resolve `openzeppelin/` and `prb/math/` imports globally - These global remappings take **lower precedence** than context-specific ones during compilation - The compiler still uses the context-specific remappings (with `:`) when compiling Snowbridge contracts - The linter uses the global remappings when checking all files ## Changes ### Commit 1: Add global remappings - `contracts/foundry.toml`: Added 2 global remapping entries ### Commit 2: Apply forge fmt - Applied automatic formatting via `forge fmt` to ensure code style consistency - Multi-line formatting for long import statements and function signatures - No functional changes - purely formatting updates ## Testing ✅ Local build succeeds with `forge build` ✅ No Snowbridge import resolution errors ✅ `forge fmt --check` passes with no formatting issues ✅ Only linting notes/warnings remain (not errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
2025-10-20 08:20:59 +00:00
function _incrementBytes32(
bytes32 start,
uint256 inc
) internal pure returns (bytes32) {
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
return bytes32(uint256(start) + inc);
}
fix: Resolve Foundry build errors and apply code formatting (#241) ## Summary Fixes the CI build failure in the `task-ts-build` workflow caused by Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's context-specific import remappings. ## Problem The Snowbridge submodule uses context-specific remappings (prefixed with `:`) for its dependencies: - `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts - `lib/snowbridge/contracts/:prb/math/` → PRB Math library Foundry v1.4.2's Solar linter doesn't understand these context-specific remappings and fails with errors like: ``` error: file openzeppelin/utils/cryptography/MerkleProof.sol not found error: file prb/math/src/UD60x18.sol not found ``` ## Solution Added global remappings that the linter can understand: ```toml "openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/", "prb/math/=lib/snowbridge/contracts/lib/prb-math/", ``` ### Why This Works - The linter can now resolve `openzeppelin/` and `prb/math/` imports globally - These global remappings take **lower precedence** than context-specific ones during compilation - The compiler still uses the context-specific remappings (with `:`) when compiling Snowbridge contracts - The linter uses the global remappings when checking all files ## Changes ### Commit 1: Add global remappings - `contracts/foundry.toml`: Added 2 global remapping entries ### Commit 2: Apply forge fmt - Applied automatic formatting via `forge fmt` to ensure code style consistency - Multi-line formatting for long import statements and function signatures - No functional changes - purely formatting updates ## Testing ✅ Local build succeeds with `forge build` ✅ No Snowbridge import resolution errors ✅ `forge fmt --check` passes with no formatting issues ✅ Only linting notes/warnings remain (not errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
2025-10-20 08:20:59 +00:00
function _setERC20Balance(
address token,
address user,
uint256 amount
) internal {
// Assumes balanceOf is in slot 0 (standard in OpenZeppelin ERC20)
bytes32 slot = keccak256(abi.encode(user, uint256(0)));
cheats.store(token, slot, bytes32(amount));
}
feat: 🏗️ Setup basic AVS contract (#4) * forge install: eigenlayer-contracts v1.1.1 * fix: :wastebasket: Cleanup dependencies from init * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * chore: :see_no_evil: Ignore IDE directories * chore: :building_construction: Modify config in `foundry.toml` based on EigenLayer's example * feat: :construction: Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware * feat: :construction: Naive implementation of missing functions replacing AVSDirectory for AllocationManager * docs: :memo: Add first draft of contracts diagram * refactor: :fire: Remove unnecessary functions and refactor most important ones to the top * docs: :memo: Update contracts diagram * docs: :memo: Update contracts diagram * feat: :sparkles: Implement basic mocked Service Manager * test: :construction: Cleanup and start testing setup for mock ServiceManagerBase * test: :clown_face: Add mocks to setup tests * test: :clown_face: Add deployment of RewardsCoordinator * test: :white_check_mark: Deploy EigenLayer mocked contracts in test * revert: :heavy_minus_sign: Remove proglematic submodules * revert: :heavy_minus_sign: Remove forge-std dependency * forge install: forge-std v1.9.6 * forge install: openzeppelin-contracts v5.2.0 * forge install: openzeppelin-contracts-upgradeable v5.2.0 * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove faulty dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: remove added dependency * forge install: eigenlayer-contracts v1.3.0 * revert: :heavy_minus_sign: Remove openzeppelin dependencies from root project * test: :construction: Make test run after dependency mayhem * test: :white_check_mark: Add passing createOperatorSets test with empty params * style: :art: Apply forge fmt
2025-03-11 20:16:16 +00:00
}