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>
This commit is contained in:
Steve Degosserie 2025-10-20 10:20:59 +02:00 committed by GitHub
parent cffdad2358
commit 387c056912
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 402 additions and 256 deletions

View file

@ -26,6 +26,8 @@
"lib/eigenlayer-contracts/:@openzeppelin-upgrades/=lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/",
"lib/snowbridge/contracts/:openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/",
"lib/snowbridge/contracts/:prb/math/=lib/snowbridge/contracts/lib/prb-math/",
"openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/",
"prb/math/=lib/snowbridge/contracts/lib/prb-math/",
]
# Specifies the exact version of Solidity to use, overriding auto-detection.
solc_version = '0.8.28'

View file

@ -21,8 +21,9 @@ import {BeefyClient} from "snowbridge/src/BeefyClient.sol";
// OpenZeppelin imports
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import {TransparentUpgradeableProxy} from
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {
TransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
// EigenLayer imports
import {AllocationManager} from "eigenlayer-contracts/src/contracts/core/AllocationManager.sol";
@ -30,8 +31,9 @@ import {AVSDirectory} from "eigenlayer-contracts/src/contracts/core/AVSDirectory
import {DelegationManager} from "eigenlayer-contracts/src/contracts/core/DelegationManager.sol";
import {RewardsCoordinator} from "eigenlayer-contracts/src/contracts/core/RewardsCoordinator.sol";
import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol";
import {PermissionController} from
"eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {
PermissionController
} from "eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {EigenPodManager} from "eigenlayer-contracts/src/contracts/pods/EigenPodManager.sol";
import {IETHPOSDeposit} from "eigenlayer-contracts/src/contracts/interfaces/IETHPOSDeposit.sol";
@ -256,8 +258,9 @@ abstract contract DeployBase is Script, DeployParams, Accounts {
// Deploy the Service Manager
vm.broadcast(_deployerPrivateKey);
DataHavenServiceManager serviceManagerImplementation =
new DataHavenServiceManager(rewardsCoordinator, permissionController, allocationManager);
DataHavenServiceManager serviceManagerImplementation = new DataHavenServiceManager(
rewardsCoordinator, permissionController, allocationManager
);
Logging.logContractDeployed(
"ServiceManager Implementation", address(serviceManagerImplementation)
);

View file

@ -29,14 +29,17 @@ import {VetoableSlasher} from "../../src/middleware/VetoableSlasher.sol";
import {RewardsRegistry} from "../../src/middleware/RewardsRegistry.sol";
// Additional imports specific to local deployment
import {ERC20PresetFixedSupply} from
"@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
import {
ERC20PresetFixedSupply
} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import {ITransparentUpgradeableProxy} from
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {TransparentUpgradeableProxy} from
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {
ITransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {
TransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
// EigenLayer core contract imports for implementation declarations
@ -45,11 +48,13 @@ import {AVSDirectory} from "eigenlayer-contracts/src/contracts/core/AVSDirectory
import {DelegationManager} from "eigenlayer-contracts/src/contracts/core/DelegationManager.sol";
import {RewardsCoordinator} from "eigenlayer-contracts/src/contracts/core/RewardsCoordinator.sol";
import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol";
import {PermissionController} from
"eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {
PermissionController
} from "eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {IAllocationManagerTypes} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IETHPOSDeposit} from "eigenlayer-contracts/src/contracts/interfaces/IETHPOSDeposit.sol";
import {
IRewardsCoordinator,
@ -59,8 +64,9 @@ import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy
import {PauserRegistry} from "eigenlayer-contracts/src/contracts/permissions/PauserRegistry.sol";
import {EigenPod} from "eigenlayer-contracts/src/contracts/pods/EigenPod.sol";
import {EigenPodManager} from "eigenlayer-contracts/src/contracts/pods/EigenPodManager.sol";
import {StrategyBaseTVLLimits} from
"eigenlayer-contracts/src/contracts/strategies/StrategyBaseTVLLimits.sol";
import {
StrategyBaseTVLLimits
} from "eigenlayer-contracts/src/contracts/strategies/StrategyBaseTVLLimits.sol";
import {EmptyContract} from "eigenlayer-contracts/src/test/mocks/EmptyContract.sol";
import {DataHavenServiceManager} from "../../src/DataHavenServiceManager.sol";
@ -264,19 +270,23 @@ contract DeployLocal is DeployBase {
vm.toString(address(serviceManagerImplementation)),
'",'
);
json =
string.concat(json, '"VetoableSlasher": "', vm.toString(address(vetoableSlasher)), '",');
json =
string.concat(json, '"RewardsRegistry": "', vm.toString(address(rewardsRegistry)), '",');
json = string.concat(
json, '"VetoableSlasher": "', vm.toString(address(vetoableSlasher)), '",'
);
json = string.concat(
json, '"RewardsRegistry": "', vm.toString(address(rewardsRegistry)), '",'
);
json = string.concat(json, '"RewardsAgent": "', vm.toString(rewardsAgent), '",');
// EigenLayer contracts
json = string.concat(json, '"DelegationManager": "', vm.toString(address(delegation)), '",');
json =
string.concat(json, '"StrategyManager": "', vm.toString(address(strategyManager)), '",');
json = string.concat(
json, '"StrategyManager": "', vm.toString(address(strategyManager)), '",'
);
json = string.concat(json, '"AVSDirectory": "', vm.toString(address(avsDirectory)), '",');
json =
string.concat(json, '"EigenPodManager": "', vm.toString(address(eigenPodManager)), '",');
json = string.concat(
json, '"EigenPodManager": "', vm.toString(address(eigenPodManager)), '",'
);
json =
string.concat(json, '"EigenPodBeacon": "', vm.toString(address(eigenPodBeacon)), '",');
json = string.concat(
@ -448,18 +458,18 @@ contract DeployLocal is DeployBase {
vm.broadcast(_deployerPrivateKey);
rewardsCoordinatorImplementation = new RewardsCoordinator(
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
delegation,
strategyManager,
allocationManager,
pauserRegistry,
permissionController,
config.calculationIntervalSeconds,
config.maxRewardsDuration,
config.maxRetroactiveLength,
config.maxFutureLength,
config.genesisRewardsTimestamp,
SEMVER
)
delegation,
strategyManager,
allocationManager,
pauserRegistry,
permissionController,
config.calculationIntervalSeconds,
config.maxRewardsDuration,
config.maxRetroactiveLength,
config.maxFutureLength,
config.genesisRewardsTimestamp,
SEMVER
)
);
Logging.logContractDeployed(
"RewardsCoordinator Implementation", address(rewardsCoordinatorImplementation)
@ -588,7 +598,10 @@ contract DeployLocal is DeployBase {
Logging.logStep("PermissionController upgraded");
}
function _deployStrategies(PauserRegistry pauserRegistry, ProxyAdmin proxyAdmin) internal {
function _deployStrategies(
PauserRegistry pauserRegistry,
ProxyAdmin proxyAdmin
) internal {
// Deploy base strategy implementation
vm.broadcast(_deployerPrivateKey);
baseStrategyImplementation =
@ -624,9 +637,7 @@ contract DeployLocal is DeployBase {
// Store the strategy with its token information
deployedStrategies.push(
StrategyInfo({
address_: address(strategy),
underlyingToken: testToken,
tokenCreator: _operator
address_: address(strategy), underlyingToken: testToken, tokenCreator: _operator
})
);
Logging.logContractDeployed("Test Strategy", address(strategy));

View file

@ -167,8 +167,9 @@ contract DeployParams is Script, Config {
}
// Load EigenLayer-specific contract addresses (if they exist in config)
try vm.parseJsonAddress(configJson, ".eigenLayer.delegationManager") returns (address addr)
{
try vm.parseJsonAddress(configJson, ".eigenLayer.delegationManager") returns (
address addr
) {
config.delegationManager = addr;
} catch {
config.delegationManager = address(0);
@ -186,15 +187,17 @@ contract DeployParams is Script, Config {
config.avsDirectory = address(0);
}
try vm.parseJsonAddress(configJson, ".eigenLayer.rewardsCoordinator") returns (address addr)
{
try vm.parseJsonAddress(configJson, ".eigenLayer.rewardsCoordinator") returns (
address addr
) {
config.rewardsCoordinator = addr;
} catch {
config.rewardsCoordinator = address(0);
}
try vm.parseJsonAddress(configJson, ".eigenLayer.allocationManager") returns (address addr)
{
try vm.parseJsonAddress(configJson, ".eigenLayer.allocationManager") returns (
address addr
) {
config.allocationManager = addr;
} catch {
config.allocationManager = address(0);

View file

@ -23,13 +23,15 @@ import {DelegationManager} from "eigenlayer-contracts/src/contracts/core/Delegat
import {RewardsCoordinator} from "eigenlayer-contracts/src/contracts/core/RewardsCoordinator.sol";
import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {PermissionController} from
"eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {
PermissionController
} from "eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
// OpenZeppelin imports for proxy creation
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import {TransparentUpgradeableProxy} from
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {
TransparentUpgradeableProxy
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
/**
* @title DeployTestnet
@ -200,16 +202,19 @@ contract DeployTestnet is DeployBase {
vm.toString(address(serviceManagerImplementation)),
'",'
);
json =
string.concat(json, '"VetoableSlasher": "', vm.toString(address(vetoableSlasher)), '",');
json =
string.concat(json, '"RewardsRegistry": "', vm.toString(address(rewardsRegistry)), '",');
json = string.concat(
json, '"VetoableSlasher": "', vm.toString(address(vetoableSlasher)), '",'
);
json = string.concat(
json, '"RewardsRegistry": "', vm.toString(address(rewardsRegistry)), '",'
);
json = string.concat(json, '"RewardsAgent": "', vm.toString(rewardsAgent), '",');
// EigenLayer contracts (existing on testnet)
json = string.concat(json, '"DelegationManager": "', vm.toString(address(delegation)), '",');
json =
string.concat(json, '"StrategyManager": "', vm.toString(address(strategyManager)), '",');
json = string.concat(
json, '"StrategyManager": "', vm.toString(address(strategyManager)), '",'
);
json = string.concat(json, '"AVSDirectory": "', vm.toString(address(avsDirectory)), '",');
json = string.concat(
json, '"RewardsCoordinator": "', vm.toString(address(rewardsCoordinator)), '",'

View file

@ -2,8 +2,9 @@
pragma solidity ^0.8.27;
// EigenLayer imports
import {IAllocationManagerTypes} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {StrategyBase} from "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol";
// OpenZeppelin imports
@ -148,12 +149,12 @@ abstract contract SignUpOperatorBase is Script, ELScriptStorage, DHScriptStorage
// Register the operator as operator for the DataHaven service.
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = _getOperatorSetId();
IAllocationManagerTypes.RegisterParams memory registerParams = IAllocationManagerTypes
.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(_operatorSolochainAddress)
});
IAllocationManagerTypes.RegisterParams memory registerParams =
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(_operatorSolochainAddress)
});
vm.broadcast(_operatorPrivateKey);
allocationManager.registerForOperatorSets(_operator, registerParams);

View file

@ -6,8 +6,9 @@ import {Script} from "forge-std/Script.sol";
// EigenLayer imports
import {RewardsCoordinator} from "eigenlayer-contracts/src/contracts/core/RewardsCoordinator.sol";
import {PermissionController} from
"eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {
PermissionController
} from "eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {AllocationManager} from "eigenlayer-contracts/src/contracts/core/AllocationManager.sol";
import {DelegationManager} from "eigenlayer-contracts/src/contracts/core/DelegationManager.sol";
import {StrategyManager} from "eigenlayer-contracts/src/contracts/core/StrategyManager.sol";
@ -15,8 +16,9 @@ import {AVSDirectory} from "eigenlayer-contracts/src/contracts/core/AVSDirectory
import {EigenPodManager} from "eigenlayer-contracts/src/contracts/pods/EigenPodManager.sol";
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import {EigenPod} from "eigenlayer-contracts/src/contracts/pods/EigenPod.sol";
import {StrategyBaseTVLLimits} from
"eigenlayer-contracts/src/contracts/strategies/StrategyBaseTVLLimits.sol";
import {
StrategyBaseTVLLimits
} from "eigenlayer-contracts/src/contracts/strategies/StrategyBaseTVLLimits.sol";
import {IETHPOSDeposit} from "eigenlayer-contracts/src/contracts/interfaces/IETHPOSDeposit.sol";
// Struct used in the deployment JSON file to store detailed strategy information

View file

@ -5,8 +5,10 @@ import {console} from "forge-std/console.sol";
library Logging {
// Logging helper constants
string private constant HEADER1 = "============================================================";
string private constant HEADER2 = " ";
string private constant HEADER1 =
"============================================================";
string private constant HEADER2 =
" ";
string private constant FOOTER = "============================================================";
string private constant SEPARATOR =
"------------------------------------------------------------";
@ -28,15 +30,24 @@ library Logging {
console.log(SEPARATOR);
}
function logContractDeployed(string memory name, address contractAddress) internal pure {
function logContractDeployed(
string memory name,
address contractAddress
) internal pure {
console.log("| [+] %s: %s", name, contractAddress);
}
function logAgentOrigin(string memory name, string memory agentOrigin) internal pure {
function logAgentOrigin(
string memory name,
string memory agentOrigin
) internal pure {
console.log("| [+] %s: %s", name, agentOrigin);
}
function logFunctionSelector(string memory name, string memory selector) internal pure {
function logFunctionSelector(
string memory name,
string memory selector
) internal pure {
console.log("| [+] %s: %s", name, selector);
}
@ -57,7 +68,10 @@ library Logging {
console.log("");
}
function logProgress(uint16 step, uint16 totalSteps) internal pure {
function logProgress(
uint16 step,
uint16 totalSteps
) internal pure {
console.log("");
console.log(
"Progress: Step %d/%d completed (%d%%)", step, totalSteps, (step * 100) / totalSteps

View file

@ -7,10 +7,12 @@ import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IPermissionController
} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
@ -97,7 +99,9 @@ contract DataHavenServiceManager is ServiceManagerBase, IDataHavenServiceManager
) external payable onlyOwner {
// Send the new validator set message to the Snowbridge Gateway
bytes memory message = buildNewValidatorSetMessage();
_snowbridgeGateway.v2_sendMessage{value: msg.value}(
_snowbridgeGateway.v2_sendMessage{
value: msg.value
}(
message,
new bytes[](0), // No assets to send
bytes(""), // No claimer
@ -344,16 +348,13 @@ contract DataHavenServiceManager is ServiceManagerBase, IDataHavenServiceManager
IAllocationManagerTypes.CreateSetParams[] memory operatorSets =
new IAllocationManagerTypes.CreateSetParams[](3);
operatorSets[0] = IAllocationManagerTypes.CreateSetParams({
operatorSetId: VALIDATORS_SET_ID,
strategies: validatorsStrategies
operatorSetId: VALIDATORS_SET_ID, strategies: validatorsStrategies
});
operatorSets[1] = IAllocationManagerTypes.CreateSetParams({
operatorSetId: BSPS_SET_ID,
strategies: bspsStrategies
operatorSetId: BSPS_SET_ID, strategies: bspsStrategies
});
operatorSets[2] = IAllocationManagerTypes.CreateSetParams({
operatorSetId: MSPS_SET_ID,
strategies: mspsStrategies
operatorSetId: MSPS_SET_ID, strategies: mspsStrategies
});
_allocationManager.createOperatorSets(address(this), operatorSets);
}

View file

@ -137,7 +137,10 @@ interface IDataHavenServiceManager is
* @param executionFee The execution fee for the Snowbridge message
* @param relayerFee The relayer fee for the Snowbridge message
*/
function sendNewValidatorSet(uint128 executionFee, uint128 relayerFee) external payable;
function sendNewValidatorSet(
uint128 executionFee,
uint128 relayerFee
) external payable;
/**
* @notice Builds a new validator set message to be sent to the Snowbridge Gateway

View file

@ -1,13 +1,16 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IServiceManagerUI} from "./IServiceManagerUI.sol";
import {IAllocationManagerTypes} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol";
import {IRewardsRegistry} from "./IRewardsRegistry.sol";
@ -97,7 +100,11 @@ interface IServiceManager is IServiceManagerUI, IServiceManagerErrors, IServiceM
* @param target The address of the target to set the appointee for.
* @param selector The function selector to set the appointee for.
*/
function setAppointee(address appointee, address target, bytes4 selector) external;
function setAppointee(
address appointee,
address target,
bytes4 selector
) external;
/**
* @notice Calls `removeAppointee` on the `PermissionController` contract.
@ -106,7 +113,11 @@ interface IServiceManager is IServiceManagerUI, IServiceManagerErrors, IServiceM
* @param target The address of the target to remove the appointee for.
* @param selector The function selector to remove the appointee for.
*/
function removeAppointee(address appointee, address target, bytes4 selector) external;
function removeAppointee(
address appointee,
address target,
bytes4 selector
) external;
/**
* @notice Deregisters an operator from specified operator sets
@ -131,7 +142,10 @@ interface IServiceManager is IServiceManagerUI, IServiceManagerErrors, IServiceM
* @param rewardsRegistry The address of the rewards registry
* @dev Only callable by the owner
*/
function setRewardsRegistry(uint32 operatorSetId, IRewardsRegistry rewardsRegistry) external;
function setRewardsRegistry(
uint32 operatorSetId,
IRewardsRegistry rewardsRegistry
) external;
/**
* @notice Claim rewards for an operator from a specific merkle root index using Substrate/Snowbridge positional Merkle proofs
@ -190,5 +204,8 @@ interface IServiceManager is IServiceManagerUI, IServiceManagerErrors, IServiceM
* @param rewardsAgent New rewards agent address
* @dev Only callable by the owner
*/
function setRewardsAgent(uint32 operatorSetId, address rewardsAgent) external;
function setRewardsAgent(
uint32 operatorSetId,
address rewardsAgent
) external;
}

View file

@ -1,8 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;
import {ISignatureUtilsMixinTypes} from
"eigenlayer-contracts/src/contracts/interfaces/ISignatureUtilsMixin.sol";
import {
ISignatureUtilsMixinTypes
} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtilsMixin.sol";
/**
* @title Minimal interface for a ServiceManager-type contract that AVS ServiceManager contracts must implement

View file

@ -1,8 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
interface ISlasherErrors {
/// @notice Thrown when a caller without slasher privileges attempts a restricted operation

View file

@ -1,8 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {ISlasher} from "./ISlasher.sol";
interface IVetoableSlasherErrors {

View file

@ -174,7 +174,10 @@ library MerkleUtils {
* @param b Second hash
* @return The hash of the pair
*/
function hashPair(bytes32 a, bytes32 b) internal pure returns (bytes32) {
function hashPair(
bytes32 a,
bytes32 b
) internal pure returns (bytes32) {
return a < b ? efficientHash(a, b) : efficientHash(b, a);
}
@ -184,7 +187,10 @@ library MerkleUtils {
* @param b Second value
* @return value The keccak256 hash
*/
function efficientHash(bytes32 a, bytes32 b) internal pure returns (bytes32 value) {
function efficientHash(
bytes32 a,
bytes32 b
) internal pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)

View file

@ -16,7 +16,10 @@ contract RewardsRegistry is RewardsRegistryStorage {
* @param _avs Address of the AVS (Service Manager)
* @param _rewardsAgent Address of the rewards agent contract
*/
constructor(address _avs, address _rewardsAgent) RewardsRegistryStorage(_avs, _rewardsAgent) {}
constructor(
address _avs,
address _rewardsAgent
) RewardsRegistryStorage(_avs, _rewardsAgent) {}
/**
* @notice Modifier to restrict function access to the rewards agent only
@ -221,7 +224,10 @@ contract RewardsRegistry is RewardsRegistryStorage {
* @param operatorAddress Address of the operator to receive rewards
* @param rewardsAmount Amount of rewards to transfer
*/
function _transferRewards(address operatorAddress, uint256 rewardsAmount) internal {
function _transferRewards(
address operatorAddress,
uint256 rewardsAmount
) internal {
// Transfer rewards to the operator
(bool success,) = operatorAddress.call{value: rewardsAmount}("");
if (!success) {

View file

@ -13,7 +13,6 @@ abstract contract RewardsRegistryStorage is IRewardsRegistry {
* IMMUTABLES
*
*/
/// @notice Address of the AVS (Service Manager)
address public immutable avs;
@ -37,7 +36,10 @@ abstract contract RewardsRegistryStorage is IRewardsRegistry {
* @param _avs Address of the AVS (Service Manager)
* @param _rewardsAgent Address of the rewards agent contract
*/
constructor(address _avs, address _rewardsAgent) {
constructor(
address _avs,
address _rewardsAgent
) {
avs = _avs;
rewardsAgent = _rewardsAgent;
}

View file

@ -4,21 +4,25 @@ pragma solidity ^0.8.27;
import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ISignatureUtilsMixinTypes} from
"eigenlayer-contracts/src/contracts/interfaces/ISignatureUtilsMixin.sol";
import {
ISignatureUtilsMixinTypes
} from "eigenlayer-contracts/src/contracts/interfaces/ISignatureUtilsMixin.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
import {
IAllocationManager,
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {
IPermissionController
} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {
IPermissionController
} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {IServiceManager, IServiceManagerUI} from "../interfaces/IServiceManager.sol";
import {IRewardsRegistry} from "../interfaces/IRewardsRegistry.sol";
@ -43,9 +47,7 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage, IAVSRegistrar
IRewardsCoordinator __rewardsCoordinator,
IPermissionController __permissionController,
IAllocationManager __allocationManager
)
ServiceManagerBaseStorage(__rewardsCoordinator, __permissionController, __allocationManager)
{
) ServiceManagerBaseStorage(__rewardsCoordinator, __permissionController, __allocationManager) {
_disableInitializers();
}
@ -152,26 +154,26 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage, IAVSRegistrar
*/
function createOperatorDirectedOperatorSetRewardsSubmission(
OperatorSet calldata operatorSet,
IRewardsCoordinator.OperatorDirectedRewardsSubmission[] calldata
operatorDirectedRewardsSubmissions
IRewardsCoordinator
.OperatorDirectedRewardsSubmission[] calldata operatorDirectedRewardsSubmissions
) public virtual onlyRewardsInitiator {
for (uint256 i = 0; i < operatorDirectedRewardsSubmissions.length; ++i) {
// Calculate total amount of tokens to transfer
uint256 totalAmount = 0;
for (
uint256 j = 0; j < operatorDirectedRewardsSubmissions[i].operatorRewards.length; ++j
uint256 j = 0;
j < operatorDirectedRewardsSubmissions[i].operatorRewards.length;
++j
) {
totalAmount += operatorDirectedRewardsSubmissions[i].operatorRewards[j].amount;
}
// Transfer token to ServiceManager and approve RewardsCoordinator to transfer again
// in createOperatorDirectedOperatorSetRewardsSubmission() call
IERC20(operatorDirectedRewardsSubmissions[i].token).safeTransferFrom(
msg.sender, address(this), totalAmount
);
operatorDirectedRewardsSubmissions[i].token.safeIncreaseAllowance(
address(_rewardsCoordinator), totalAmount
);
IERC20(operatorDirectedRewardsSubmissions[i].token)
.safeTransferFrom(msg.sender, address(this), totalAmount);
operatorDirectedRewardsSubmissions[i].token
.safeIncreaseAllowance(address(_rewardsCoordinator), totalAmount);
}
_rewardsCoordinator.createOperatorDirectedOperatorSetRewardsSubmission(
@ -189,8 +191,10 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage, IAVSRegistrar
address operator,
uint32[] memory operatorSetIds
) external virtual override {
IAllocationManagerTypes.DeregisterParams memory params = IAllocationManagerTypes
.DeregisterParams({operator: operator, avs: address(this), operatorSetIds: operatorSetIds});
IAllocationManagerTypes.DeregisterParams memory params =
IAllocationManagerTypes.DeregisterParams({
operator: operator, avs: address(this), operatorSetIds: operatorSetIds
});
_allocationManager.deregisterFromOperatorSets(params);
}
@ -244,12 +248,13 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage, IAVSRegistrar
}
/// @inheritdoc IServiceManager
function setAppointee(address appointee, address target, bytes4 selector) external onlyOwner {
function setAppointee(
address appointee,
address target,
bytes4 selector
) external onlyOwner {
_permissionController.setAppointee({
account: address(this),
appointee: appointee,
target: target,
selector: selector
account: address(this), appointee: appointee, target: target, selector: selector
});
}
@ -260,10 +265,7 @@ abstract contract ServiceManagerBase is ServiceManagerBaseStorage, IAVSRegistrar
bytes4 selector
) external onlyOwner {
_permissionController.removeAppointee({
account: address(this),
appointee: appointee,
target: target,
selector: selector
account: address(this), appointee: appointee, target: target, selector: selector
});
}

View file

@ -3,14 +3,18 @@ pragma solidity ^0.8.27;
import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IPermissionController
} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {IVetoableSlasher} from "../interfaces/IVetoableSlasher.sol";
import {IServiceManager} from "../interfaces/IServiceManager.sol";

View file

@ -1,8 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {ISlasher} from "../interfaces/ISlasher.sol";
import {IServiceManager} from "../interfaces/IServiceManager.sol";
/// @title SlasherStorage
@ -15,7 +16,6 @@ abstract contract SlasherStorage is ISlasher {
* CONSTANTS AND IMMUTABLES
*
*/
/// @notice the AllocationManager that tracks OperatorSets and Slashing in EigenLayer
IAllocationManager public immutable allocationManager;
/// @notice the ServiceManager of the AVS
@ -23,7 +23,10 @@ abstract contract SlasherStorage is ISlasher {
uint256 public nextRequestId;
constructor(IAllocationManager _allocationManager, IServiceManager _serviceManager) {
constructor(
IAllocationManager _allocationManager,
IServiceManager _serviceManager
) {
allocationManager = _allocationManager;
serviceManager = _serviceManager;
}

View file

@ -3,8 +3,9 @@ pragma solidity ^0.8.27;
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IServiceManager} from "../interfaces/IServiceManager.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {SlasherBase} from "./SlasherBase.sol";
import {IVetoableSlasher, IVetoableSlasherTypes} from "../interfaces/IVetoableSlasher.sol";
@ -65,9 +66,7 @@ contract VetoableSlasher is IVetoableSlasher, SlasherBase {
) internal virtual {
uint256 requestId = nextRequestId++;
slashingRequests[requestId] = IVetoableSlasherTypes.VetoableSlashingRequest({
params: params,
requestBlock: block.number,
isPending: true
params: params, requestBlock: block.number, isPending: true
});
emit SlashingRequested(

View file

@ -6,8 +6,9 @@ pragma solidity ^0.8.13;
import {Test, console} from "forge-std/Test.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {StrategyBase} from "eigenlayer-contracts/src/contracts/strategies/StrategyBase.sol";
import {
IAllocationManagerErrors,

View file

@ -4,8 +4,9 @@ pragma solidity ^0.8.13;
/* solhint-disable func-name-mixedcase */
import {Test, console, stdError} from "forge-std/Test.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {AVSDeployer} from "./utils/AVSDeployer.sol";
import {RewardsRegistry} from "../src/middleware/RewardsRegistry.sol";

View file

@ -6,8 +6,9 @@ pragma solidity ^0.8.27;
import {Test, console} from "forge-std/Test.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IAllocationManagerErrors,
IAllocationManager,
@ -74,8 +75,7 @@ contract SlasherBaseTest is AVSDeployer {
wadsToSlash[0] = 1e16;
string memory description = "Test slashing by non-ServiceManager";
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes
.SlashingParams({
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes.SlashingParams({
operator: operator,
operatorSetId: operatorSetId,
strategies: strategies,
@ -127,8 +127,7 @@ contract SlasherBaseTest is AVSDeployer {
wadsToSlash[1] = 2e16; // 2% of the operator's stake
string memory description = "Multiple strategy slashing";
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes
.SlashingParams({
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes.SlashingParams({
operator: operator,
operatorSetId: operatorSetId,
strategies: strategies,
@ -167,8 +166,7 @@ contract SlasherBaseTest is AVSDeployer {
wadsToSlash[0] = 0; // Zero tokens
string memory description = "Zero wad slashing";
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes
.SlashingParams({
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes.SlashingParams({
operator: operator,
operatorSetId: operatorSetId,
strategies: strategies,
@ -207,8 +205,7 @@ contract SlasherBaseTest is AVSDeployer {
wadsToSlash[0] = 1e16; // 1% of the operator's stake
string memory description = "Revert test";
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes
.SlashingParams({
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes.SlashingParams({
operator: operator,
operatorSetId: operatorSetId,
strategies: strategies,

View file

@ -15,13 +15,15 @@ import {
} from "snowbridge/src/v2/Types.sol";
import {BeefyVerification} from "snowbridge/src/BeefyVerification.sol";
import {BeefyClient} from "snowbridge/src/BeefyClient.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
import {MerkleUtils} from "../src/libraries/MerkleUtils.sol";
import {
IRewardsRegistryEvents, IRewardsRegistryErrors
IRewardsRegistryEvents,
IRewardsRegistryErrors
} from "../src/interfaces/IRewardsRegistry.sol";
import {SnowbridgeAndAVSDeployer} from "./utils/SnowbridgeAndAVSDeployer.sol";
import {ScaleCodec} from "snowbridge/src/utils/ScaleCodec.sol";
@ -253,10 +255,7 @@ contract SnowbridgeIntegrationTest is SnowbridgeAndAVSDeployer {
commands[0] = updateRewardsCommand;
return InboundMessageV2({
origin: REWARDS_MESSAGE_ORIGIN,
nonce: 0,
topic: bytes32(0),
commands: commands
origin: REWARDS_MESSAGE_ORIGIN, nonce: 0, topic: bytes32(0), commands: commands
});
}
@ -269,10 +268,7 @@ contract SnowbridgeIntegrationTest is SnowbridgeAndAVSDeployer {
// The second message is a dummy message with a different origin.
messages[1] = InboundMessageV2({
origin: WRONG_MESSAGE_ORIGIN,
nonce: 1,
topic: bytes32(0),
commands: new CommandV2[](0)
origin: WRONG_MESSAGE_ORIGIN, nonce: 1, topic: bytes32(0), commands: new CommandV2[](0)
});
// The third message is an attempt at setting the new rewards root, but with a wrong origin
@ -296,10 +292,7 @@ contract SnowbridgeIntegrationTest is SnowbridgeAndAVSDeployer {
// The second message is a dummy message with a different origin.
messages[1] = InboundMessageV2({
origin: WRONG_MESSAGE_ORIGIN,
nonce: 1,
topic: bytes32(0),
commands: new CommandV2[](0)
origin: WRONG_MESSAGE_ORIGIN, nonce: 1, topic: bytes32(0), commands: new CommandV2[](0)
});
// The third message is an attempt at setting the new rewards root, but with a wrong origin

View file

@ -6,8 +6,9 @@ pragma solidity ^0.8.27;
import {Test, console} from "forge-std/Test.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IAllocationManagerErrors,
IAllocationManager,
@ -96,8 +97,7 @@ contract VetoableSlasherTest is AVSDeployer {
wadsToSlash[0] = 1e16; // 1% of the operator's stake
string memory description = "Test slashing";
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes
.SlashingParams({
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes.SlashingParams({
operator: operator,
operatorSetId: operatorSetId,
strategies: strategies,
@ -305,14 +305,14 @@ contract VetoableSlasherTest is AVSDeployer {
wadsToSlash2[0] = 2e16; // 2% of the operator's stake
string memory description2 = "Second slashing";
IAllocationManagerTypes.SlashingParams memory params2 = IAllocationManagerTypes
.SlashingParams({
operator: operator2,
operatorSetId: operatorSetId2,
strategies: strategies2,
wadsToSlash: wadsToSlash2,
description: description2
});
IAllocationManagerTypes.SlashingParams memory params2 =
IAllocationManagerTypes.SlashingParams({
operator: operator2,
operatorSetId: operatorSetId2,
strategies: strategies2,
wadsToSlash: wadsToSlash2,
description: description2
});
uint256 requestId2 = 1; // Second request
@ -364,8 +364,7 @@ contract VetoableSlasherTest is AVSDeployer {
wadsToSlash[0] = 1e16; // 1% of the operator's stake
string memory description = "Test slashing";
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes
.SlashingParams({
IAllocationManagerTypes.SlashingParams memory params = IAllocationManagerTypes.SlashingParams({
operator: operator,
operatorSetId: operatorSetId,
strategies: strategies,

View file

@ -10,9 +10,15 @@ import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy
import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol";
contract AllocationManagerIntermediate is IAllocationManager {
function initialize(address initialOwner, uint256 initialPausedStatus) external virtual {}
function initialize(
address initialOwner,
uint256 initialPausedStatus
) external virtual {}
function slashOperator(address avs, SlashingParams calldata params) external virtual {}
function slashOperator(
address avs,
SlashingParams calldata params
) external virtual {}
function modifyAllocations(
address operator,
@ -34,13 +40,25 @@ contract AllocationManagerIntermediate is IAllocationManager {
DeregisterParams calldata params
) external virtual {}
function setAllocationDelay(address operator, uint32 delay) external virtual {}
function setAllocationDelay(
address operator,
uint32 delay
) external virtual {}
function setAVSRegistrar(address avs, IAVSRegistrar registrar) external virtual {}
function setAVSRegistrar(
address avs,
IAVSRegistrar registrar
) external virtual {}
function updateAVSMetadataURI(address avs, string calldata metadataURI) external virtual {}
function updateAVSMetadataURI(
address avs,
string calldata metadataURI
) external virtual {}
function createOperatorSets(address avs, CreateSetParams[] calldata params) external virtual {}
function createOperatorSets(
address avs,
CreateSetParams[] calldata params
) external virtual {}
function addStrategiesToOperatorSet(
address avs,

View file

@ -1,19 +1,29 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {
IPermissionController
} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
contract PermissionControllerIntermediate is IPermissionController {
function addPendingAdmin(address account, address admin) external virtual {}
function addPendingAdmin(
address account,
address admin
) external virtual {}
function removePendingAdmin(address account, address admin) external virtual {}
function removePendingAdmin(
address account,
address admin
) external virtual {}
function acceptAdmin(
address account
) external virtual {}
function removeAdmin(address account, address admin) external virtual {}
function removeAdmin(
address account,
address admin
) external virtual {}
function setAppointee(
address account,
@ -29,7 +39,10 @@ contract PermissionControllerIntermediate is IPermissionController {
bytes4 selector
) external virtual {}
function isAdmin(address account, address caller) external view virtual returns (bool) {}
function isAdmin(
address account,
address caller
) external view virtual returns (bool) {}
function isPendingAdmin(
address account,

View file

@ -4,8 +4,9 @@ pragma solidity ^0.8.27;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol";
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
contract RewardsCoordinatorMock is IRewardsCoordinator {
@ -50,14 +51,20 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
OperatorDirectedRewardsSubmission[] calldata operatorDirectedRewardsSubmissions
) external override {}
function processClaim(RewardsMerkleClaim calldata claim, address recipient) external override {}
function processClaim(
RewardsMerkleClaim calldata claim,
address recipient
) external override {}
function processClaims(
RewardsMerkleClaim[] calldata claims,
address recipient
) external override {}
function submitRoot(bytes32 root, uint32 rewardsCalculationEndTimestamp) external override {}
function submitRoot(
bytes32 root,
uint32 rewardsCalculationEndTimestamp
) external override {}
function disableRoot(
uint32 rootIndex
@ -67,7 +74,10 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
address claimer
) external override {}
function setClaimerFor(address earner, address claimer) external override {}
function setClaimerFor(
address earner,
address claimer
) external override {}
function setActivationDelay(
uint32 _activationDelay
@ -77,15 +87,25 @@ contract RewardsCoordinatorMock is IRewardsCoordinator {
uint16 split
) external override {}
function setOperatorAVSSplit(address operator, address avs, uint16 split) external override {}
function setOperatorAVSSplit(
address operator,
address avs,
uint16 split
) external override {}
function setOperatorPISplit(address operator, uint16 split) external override {}
function setOperatorPISplit(
address operator,
uint16 split
) external override {}
function setRewardsUpdater(
address _rewardsUpdater
) external override {}
function setRewardsForAllSubmitter(address _submitter, bool _newValue) external override {}
function setRewardsForAllSubmitter(
address _submitter,
bool _newValue
) external override {}
function activationDelay() external view override returns (uint32) {}

View file

@ -1,12 +1,15 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {IRewardsCoordinator} from
"eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {IPermissionController} from
"eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {IAllocationManager} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IRewardsCoordinator
} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {
IPermissionController
} from "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol";
import {
IAllocationManager
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IRewardsRegistry} from "../../src/interfaces/IRewardsRegistry.sol";
import {ServiceManagerBase} from "../../src/middleware/ServiceManagerBase.sol";

View file

@ -6,15 +6,17 @@ import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.so
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {PauserRegistry} from "eigenlayer-contracts/src/contracts/permissions/PauserRegistry.sol";
import {IAllocationManagerTypes} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {AVSDirectory} from "eigenlayer-contracts/src/contracts/core/AVSDirectory.sol";
import {IAVSDirectory} from "eigenlayer-contracts/src/contracts/interfaces/IAVSDirectory.sol";
import {RewardsCoordinator} from "eigenlayer-contracts/src/contracts/core/RewardsCoordinator.sol";
import {PermissionController} from
"eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {
PermissionController
} from "eigenlayer-contracts/src/contracts/permissions/PermissionController.sol";
import {AllocationManager} from "eigenlayer-contracts/src/contracts/core/AllocationManager.sol";
import {
IRewardsCoordinator,
@ -54,7 +56,8 @@ contract AVSDeployer is Test {
RewardsRegistry public rewardsRegistry;
// VetoableSlasher roles and parameters
address public vetoCommitteeMember = address(uint160(uint256(keccak256("vetoCommitteeMember"))));
address public vetoCommitteeMember =
address(uint160(uint256(keccak256("vetoCommitteeMember"))));
uint32 public vetoWindowBlocks = 100; // 100 blocks veto window for tests
// RewardsRegistry roles and parameters
@ -197,19 +200,19 @@ contract AVSDeployer is Test {
// When the proxy is deployed, the `initialize` function is called.
cheats.startPrank(regularDeployer);
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams memory params =
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"
});
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"
});
rewardsCoordinatorImplementation = new RewardsCoordinator(params);
rewardsCoordinator = RewardsCoordinator(
address(
@ -405,15 +408,25 @@ contract AVSDeployer is Test {
return arr;
}
function _incrementAddress(address start, uint256 inc) internal pure returns (address) {
function _incrementAddress(
address start,
uint256 inc
) internal pure returns (address) {
return address(uint160(uint256(uint160(start) + inc)));
}
function _incrementBytes32(bytes32 start, uint256 inc) internal pure returns (bytes32) {
function _incrementBytes32(
bytes32 start,
uint256 inc
) internal pure returns (bytes32) {
return bytes32(uint256(start) + inc);
}
function _setERC20Balance(address token, address user, uint256 amount) internal {
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));

View file

@ -13,8 +13,9 @@ import {ud60x18} from "snowbridge/lib/prb-math/src/UD60x18.sol";
import {BeefyClient} from "snowbridge/src/BeefyClient.sol";
import {AVSDeployer} from "./AVSDeployer.sol";
import {TestUtils} from "./TestUtils.sol";
import {IAllocationManagerTypes} from
"eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {
IAllocationManagerTypes
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {ValidatorsUtils} from "../../script/utils/ValidatorsUtils.sol";
@ -210,12 +211,12 @@ contract SnowbridgeAndAVSDeployer is AVSDeployer {
// Register the validator as an operator for the DataHaven service.
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = serviceManager.VALIDATORS_SET_ID();
IAllocationManagerTypes.RegisterParams memory registerParams = IAllocationManagerTypes
.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(address(uint160(uint256(initialValidatorHashes[i]))))
});
IAllocationManagerTypes.RegisterParams memory registerParams =
IAllocationManagerTypes.RegisterParams({
avs: address(serviceManager),
operatorSetIds: operatorSetIds,
data: abi.encodePacked(address(uint160(uint256(initialValidatorHashes[i]))))
});
allocationManager.registerForOperatorSets(validatorsAllowlist[i], registerParams);
cheats.stopPrank();