mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-23 17:28:23 +00:00
refactor: rename rewardsInitiator to snowbridgeInitiator (#476)
## Summary Renames the rewardsInitiator state variable, modifier, internal check function, setRewardsInitiator function, and RewardsInitiatorSet event in DataHavenServiceManager to their snowbridgeInitiator-prefixed equivalents, to better reflect the role of this address. ## Motivation The previous rewardsInitiator naming was misleading — the address filling this role is specifically the Snowbridge relayer/gateway. Renaming it end-to-end clarifies intent and aligns the codebase with the actual architecture. ## Changes * DataHavenServiceManager.sol: renamed state variable, modifier, internal check, setRewardsInitiator → -> setSnowbridgeInitiator, RewardsInitiatorSet -> SnowbridgeInitiatorSet * IDataHavenServiceManager.sol: updated event, function signature, and NatSpec * Deploy scripts & configs: updated field names across all environments (anvil, testnet, stagenet, mainnet)
This commit is contained in:
parent
e60363ecc3
commit
6d323385d8
27 changed files with 726 additions and 671 deletions
|
|
@ -26,7 +26,7 @@
|
|||
},
|
||||
"avs": {
|
||||
"avsOwner": "0x976EA74026E726554dB657fA54763abd0C3a0aa9",
|
||||
"rewardsInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
|
||||
"snowbridgeInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
|
||||
"validatorSetSubmitter": "0x976EA74026E726554dB657fA54763abd0C3a0aa9",
|
||||
"validatorsStrategies": []
|
||||
},
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
/// The address of the account that initiates the rewards calculation.
|
||||
/// This is for the EigenLayer rewards distribution way, using the RewardsCoordinator.
|
||||
/// But for now, we're not using it, and instead sending the rewards directly.
|
||||
"rewardsInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
|
||||
"snowbridgeInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955",
|
||||
/// The EigenLayer strategy addresses for the Validators to stake into.
|
||||
/// The beaconChainETHStrategy is a virtual address representing native beacon chain ETH.
|
||||
/// All networks:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
},
|
||||
"avs": {
|
||||
"avsOwner": "0x0000000000000000000000000000000000000000",
|
||||
"rewardsInitiator": "0x0000000000000000000000000000000000000000",
|
||||
"snowbridgeInitiator": "0x0000000000000000000000000000000000000000",
|
||||
"validatorsStrategies": [
|
||||
"0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0",
|
||||
"0x93c4b944D05dfe6df7645A86cd2206016c51564D",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
},
|
||||
"avs": {
|
||||
"avsOwner": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e",
|
||||
"rewardsInitiator": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e",
|
||||
"snowbridgeInitiator": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e",
|
||||
"validatorsStrategies": [
|
||||
"0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0",
|
||||
"0xf8a1a66130d614c7360e868576d5e59203475fe0",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
},
|
||||
"avs": {
|
||||
"avsOwner": "0x0000000000000000000000000000000000000000",
|
||||
"rewardsInitiator": "0x0000000000000000000000000000000000000000",
|
||||
"snowbridgeInitiator": "0x0000000000000000000000000000000000000000",
|
||||
"validatorsStrategies": [
|
||||
"0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0",
|
||||
"0xf8a1a66130d614c7360e868576d5e59203475fe0",
|
||||
|
|
|
|||
|
|
@ -1,27 +1 @@
|
|||
{
|
||||
"network": "anvil",
|
||||
"BeefyClient": "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf",
|
||||
"AgentExecutor": "0x0E801D84Fa97b50751Dbf25036d067dCf18858bF",
|
||||
"Gateway": "0x9d4454B023096f34B160D6B654540c56A1F81688",
|
||||
"ServiceManager": "0x809d550fca64d94Bd9F66E60752A544199cfAC3D",
|
||||
"ServiceManagerImplementation": "0x36C02dA8a0983159322a80FFE9F24b1acfF8B570",
|
||||
"ProxyAdmin": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
|
||||
"RewardsAgent": "0xac06641381166cf085281c45292147f833C622d7",
|
||||
"DelegationManager": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
|
||||
"StrategyManager": "0x9A676e781A523b5d0C0e43731313A708CB607508",
|
||||
"AVSDirectory": "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
|
||||
"EigenPodManager": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
|
||||
"EigenPodBeacon": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
|
||||
"RewardsCoordinator": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
|
||||
"AllocationManager": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
|
||||
"PermissionController": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
|
||||
"ETHPOSDeposit": "0xC7f2Cf4845C6db0e1a1e91ED41Bcd0FcC1b0E141",
|
||||
"BaseStrategyImplementation": "0xf5059a5D33d5853360D16C683c16e67980206f36",
|
||||
"DeployedStrategies": [
|
||||
{
|
||||
"address": "0x998abeb3E57409262aE5b751f60747921B33613E",
|
||||
"underlyingToken": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
|
||||
"tokenCreator": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||
}
|
||||
]
|
||||
}
|
||||
{"network": "anvil","BeefyClient": "0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf","AgentExecutor": "0x0E801D84Fa97b50751Dbf25036d067dCf18858bF","Gateway": "0x9d4454B023096f34B160D6B654540c56A1F81688","ServiceManager": "0x809d550fca64d94Bd9F66E60752A544199cfAC3D","ServiceManagerImplementation": "0x36C02dA8a0983159322a80FFE9F24b1acfF8B570","ProxyAdmin": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788","RewardsAgent": "0xac06641381166cf085281c45292147f833C622d7","DelegationManager": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82","StrategyManager": "0x9A676e781A523b5d0C0e43731313A708CB607508","AVSDirectory": "0x0B306BF915C4d645ff596e518fAf3F9669b97016","EigenPodManager": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1","EigenPodBeacon": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1","RewardsCoordinator": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE","AllocationManager": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed","PermissionController": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c","ETHPOSDeposit": "0xC7f2Cf4845C6db0e1a1e91ED41Bcd0FcC1b0E141","BaseStrategyImplementation": "0xf5059a5D33d5853360D16C683c16e67980206f36","DeployedStrategies": [{"address": "0x998abeb3E57409262aE5b751f60747921B33613E","underlyingToken": "0x95401dc811bb5740090279Ba06cfA8fcF6113778","tokenCreator": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"}]}
|
||||
|
|
@ -1 +1 @@
|
|||
d7d30510de741750e5b2069228eb2b037f20cc22
|
||||
630d9358671b9af84c8ff6b14c76dd908a130321
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -18,7 +18,7 @@ contract Config {
|
|||
// AVS parameters
|
||||
struct AVSConfig {
|
||||
address avsOwner;
|
||||
address rewardsInitiator;
|
||||
address snowbridgeInitiator;
|
||||
address[] validatorsStrategies;
|
||||
address validatorSetSubmitter;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import {ValidatorsUtils} from "../../script/utils/ValidatorsUtils.sol";
|
|||
// Shared structs
|
||||
struct ServiceManagerInitParams {
|
||||
address avsOwner;
|
||||
address rewardsInitiator;
|
||||
address snowbridgeInitiator;
|
||||
IRewardsCoordinatorTypes.StrategyAndMultiplier[] validatorsStrategiesAndMultipliers;
|
||||
address gateway;
|
||||
address validatorSetSubmitter;
|
||||
|
|
@ -271,7 +271,7 @@ abstract contract DeployBase is Script, DeployParams, Accounts {
|
|||
// Create service manager initialisation parameters struct
|
||||
ServiceManagerInitParams memory initParams = ServiceManagerInitParams({
|
||||
avsOwner: avsConfig.avsOwner,
|
||||
rewardsInitiator: agentAddress,
|
||||
snowbridgeInitiator: agentAddress,
|
||||
validatorsStrategiesAndMultipliers: strategiesAndMultipliers,
|
||||
gateway: address(gateway),
|
||||
validatorSetSubmitter: avsConfig.validatorSetSubmitter,
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ contract DeployLive is DeployBase {
|
|||
bytes memory initData = abi.encodeWithSelector(
|
||||
DataHavenServiceManager.initialize.selector,
|
||||
params.avsOwner,
|
||||
params.rewardsInitiator,
|
||||
params.snowbridgeInitiator,
|
||||
params.validatorsStrategiesAndMultipliers,
|
||||
params.gateway,
|
||||
params.validatorSetSubmitter,
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ contract DeployLocal is DeployBase {
|
|||
bytes memory initData = abi.encodeWithSelector(
|
||||
DataHavenServiceManager.initialize.selector,
|
||||
params.avsOwner,
|
||||
params.rewardsInitiator,
|
||||
params.snowbridgeInitiator,
|
||||
params.validatorsStrategiesAndMultipliers,
|
||||
params.gateway,
|
||||
params.validatorSetSubmitter,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ contract DeployParams is Script, Config {
|
|||
} else {
|
||||
config.avsOwner = vm.parseJsonAddress(configJson, ".avs.avsOwner");
|
||||
}
|
||||
config.rewardsInitiator = vm.parseJsonAddress(configJson, ".avs.rewardsInitiator");
|
||||
config.snowbridgeInitiator = vm.parseJsonAddress(configJson, ".avs.snowbridgeInitiator");
|
||||
config.validatorsStrategies =
|
||||
vm.parseJsonAddressArray(configJson, ".avs.validatorsStrategies");
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ contract DataHavenServiceManagerBadLayout is OwnableUpgradeable {
|
|||
uint256 public layoutBreaker;
|
||||
|
||||
// Original variables (shifted by one slot)
|
||||
address public rewardsInitiator;
|
||||
address public snowbridgeInitiator;
|
||||
mapping(address => bool) public validatorsAllowlist;
|
||||
IGatewayV2 private _snowbridgeGateway;
|
||||
mapping(address => address) public validatorEthAddressToSolochainAddress;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
// ============ State Variables ============
|
||||
|
||||
/// @notice The address authorized to initiate rewards submissions
|
||||
address public rewardsInitiator;
|
||||
address public snowbridgeInitiator;
|
||||
|
||||
/// @inheritdoc IDataHavenServiceManager
|
||||
mapping(address => bool) public validatorsAllowlist;
|
||||
|
|
@ -90,8 +90,8 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
// ============ Modifiers ============
|
||||
|
||||
/// @notice Restricts function to the rewards initiator
|
||||
modifier onlyRewardsInitiator() {
|
||||
_checkRewardsInitiator();
|
||||
modifier onlySnowbridgeInitiator() {
|
||||
_checkSnowbridgeInitiator();
|
||||
_;
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +129,8 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
require(msg.sender == proxyAdmin, NotProxyAdmin());
|
||||
}
|
||||
|
||||
function _checkRewardsInitiator() internal view {
|
||||
require(msg.sender == rewardsInitiator, OnlyRewardsInitiator());
|
||||
function _checkSnowbridgeInitiator() internal view {
|
||||
require(msg.sender == snowbridgeInitiator, OnlyRewardsInitiator());
|
||||
}
|
||||
|
||||
function _checkValidator() internal view {
|
||||
|
|
@ -166,21 +166,21 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
/// @inheritdoc IDataHavenServiceManager
|
||||
function initialize(
|
||||
address initialOwner,
|
||||
address _rewardsInitiator,
|
||||
address _snowbridgeInitiator,
|
||||
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory validatorsStrategiesAndMultipliers,
|
||||
address _snowbridgeGatewayAddress,
|
||||
address _validatorSetSubmitter,
|
||||
string memory initialVersion
|
||||
) public virtual initializer {
|
||||
require(initialOwner != address(0), ZeroAddress());
|
||||
require(_rewardsInitiator != address(0), ZeroAddress());
|
||||
require(_snowbridgeInitiator != address(0), ZeroAddress());
|
||||
require(_snowbridgeGatewayAddress != address(0), ZeroAddress());
|
||||
require(bytes(initialVersion).length > 0, EmptyVersion());
|
||||
|
||||
__Ownable_init();
|
||||
_transferOwnership(initialOwner);
|
||||
rewardsInitiator = _rewardsInitiator;
|
||||
emit RewardsInitiatorSet(address(0), _rewardsInitiator);
|
||||
snowbridgeInitiator = _snowbridgeInitiator;
|
||||
emit SnowbridgeInitiatorSet(address(0), _snowbridgeInitiator);
|
||||
|
||||
// Set version from parameter (allows flexibility per deployment environment)
|
||||
_version = initialVersion;
|
||||
|
|
@ -522,7 +522,7 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
/// @inheritdoc IDataHavenServiceManager
|
||||
function submitRewards(
|
||||
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission calldata submission
|
||||
) external override onlyRewardsInitiator {
|
||||
) external override onlySnowbridgeInitiator {
|
||||
IRewardsCoordinatorTypes.OperatorDirectedRewardsSubmission memory translatedSubmission =
|
||||
submission;
|
||||
|
||||
|
|
@ -567,13 +567,13 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
}
|
||||
|
||||
/// @inheritdoc IDataHavenServiceManager
|
||||
function setRewardsInitiator(
|
||||
address newRewardsInitiator
|
||||
function setSnowbridgeInitiator(
|
||||
address newSnowbridgeInitiator
|
||||
) external override onlyOwner {
|
||||
require(newRewardsInitiator != address(0), ZeroAddress());
|
||||
address oldInitiator = rewardsInitiator;
|
||||
rewardsInitiator = newRewardsInitiator;
|
||||
emit RewardsInitiatorSet(oldInitiator, newRewardsInitiator);
|
||||
require(newSnowbridgeInitiator != address(0), ZeroAddress());
|
||||
address oldInitiator = snowbridgeInitiator;
|
||||
snowbridgeInitiator = newSnowbridgeInitiator;
|
||||
emit SnowbridgeInitiatorSet(oldInitiator, newSnowbridgeInitiator);
|
||||
}
|
||||
|
||||
// ============ AVS Management Functions ============
|
||||
|
|
@ -605,7 +605,7 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
*/
|
||||
function slashValidatorsOperator(
|
||||
SlashingRequest[] calldata slashings
|
||||
) external onlyRewardsInitiator {
|
||||
) external onlySnowbridgeInitiator {
|
||||
for (uint256 i = 0; i < slashings.length; i++) {
|
||||
address ethOperator = validatorSolochainAddressToEthAddress[slashings[i].operator];
|
||||
if (ethOperator == address(0)) continue;
|
||||
|
|
|
|||
|
|
@ -91,10 +91,10 @@ interface IDataHavenServiceManagerEvents {
|
|||
/// @param operatorCount The number of operators that received rewards
|
||||
event RewardsSubmitted(uint256 totalAmount, uint256 operatorCount);
|
||||
|
||||
/// @notice Emitted when the rewards initiator address is updated
|
||||
/// @param oldInitiator The previous rewards initiator address
|
||||
/// @param newInitiator The new rewards initiator address
|
||||
event RewardsInitiatorSet(address indexed oldInitiator, address indexed newInitiator);
|
||||
/// @notice Emitted when the snowbridge initiator address is updated
|
||||
/// @param oldInitiator The previous snowbridge initiator address
|
||||
/// @param newInitiator The new snowbridge initiator address
|
||||
event SnowbridgeInitiatorSet(address indexed oldInitiator, address indexed newInitiator);
|
||||
|
||||
/// @notice Emitted when a validator updates their solochain address
|
||||
/// @param validator Address of the validator
|
||||
|
|
@ -189,7 +189,7 @@ interface IDataHavenServiceManager is
|
|||
/**
|
||||
* @notice Initializes the DataHaven Service Manager
|
||||
* @param initialOwner Address of the initial owner (AVS owner)
|
||||
* @param rewardsInitiator Address authorized to initiate rewards
|
||||
* @param snowbridgeInitiator Address authorized to initiate rewards
|
||||
* @param validatorsStrategiesAndMultipliers Array of strategy-multiplier pairs for the validators
|
||||
* operator set. Each multiplier must be non-zero.
|
||||
* @param _snowbridgeGatewayAddress Address of the Snowbridge Gateway
|
||||
|
|
@ -198,7 +198,7 @@ interface IDataHavenServiceManager is
|
|||
*/
|
||||
function initialize(
|
||||
address initialOwner,
|
||||
address rewardsInitiator,
|
||||
address snowbridgeInitiator,
|
||||
IRewardsCoordinatorTypes.StrategyAndMultiplier[] memory validatorsStrategiesAndMultipliers,
|
||||
address _snowbridgeGatewayAddress,
|
||||
address _validatorSetSubmitter,
|
||||
|
|
@ -343,11 +343,11 @@ interface IDataHavenServiceManager is
|
|||
) external;
|
||||
|
||||
/**
|
||||
* @notice Set the rewards initiator address authorized to submit rewards
|
||||
* @param initiator The address of the rewards initiator (Snowbridge Agent)
|
||||
* @notice Set the snowbridge initiator address authorized to submit rewards
|
||||
* @param initiator The address of the snowbridge initiator (Snowbridge Agent)
|
||||
* @dev Only callable by the owner
|
||||
*/
|
||||
function setRewardsInitiator(
|
||||
function setSnowbridgeInitiator(
|
||||
address initiator
|
||||
) external;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
{
|
||||
"astId": 23887,
|
||||
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
|
||||
"label": "rewardsInitiator",
|
||||
"label": "snowbridgeInitiator",
|
||||
"offset": 0,
|
||||
"slot": "101",
|
||||
"type": "t_address"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ contract OperatorAddressMappingsTest is AVSDeployer {
|
|||
// Configure the rewards initiator (not strictly needed for these tests,
|
||||
// but keeps setup consistent with other suites).
|
||||
vm.prank(avsOwner);
|
||||
serviceManager.setRewardsInitiator(snowbridgeAgent);
|
||||
serviceManager.setSnowbridgeInitiator(snowbridgeAgent);
|
||||
}
|
||||
|
||||
function _registerOperator(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ contract RewardsSubmitterTest is AVSDeployer {
|
|||
|
||||
// Configure the rewards initiator
|
||||
vm.prank(avsOwner);
|
||||
serviceManager.setRewardsInitiator(snowbridgeAgent);
|
||||
serviceManager.setSnowbridgeInitiator(snowbridgeAgent);
|
||||
|
||||
// Fund the service manager with reward tokens
|
||||
IERC20(address(rewardToken)).safeTransfer(address(serviceManager), 100000e18);
|
||||
|
|
@ -100,21 +100,21 @@ contract RewardsSubmitterTest is AVSDeployer {
|
|||
|
||||
// ============ Configuration Tests ============
|
||||
|
||||
function test_setRewardsInitiator() public {
|
||||
function test_setSnowbridgeInitiator() public {
|
||||
address newInitiator = address(0x123);
|
||||
|
||||
vm.prank(avsOwner);
|
||||
vm.expectEmit(true, true, false, false);
|
||||
emit IDataHavenServiceManagerEvents.RewardsInitiatorSet(snowbridgeAgent, newInitiator);
|
||||
serviceManager.setRewardsInitiator(newInitiator);
|
||||
emit IDataHavenServiceManagerEvents.SnowbridgeInitiatorSet(snowbridgeAgent, newInitiator);
|
||||
serviceManager.setSnowbridgeInitiator(newInitiator);
|
||||
|
||||
assertEq(serviceManager.rewardsInitiator(), newInitiator);
|
||||
assertEq(serviceManager.snowbridgeInitiator(), newInitiator);
|
||||
}
|
||||
|
||||
function test_setRewardsInitiator_revertsIfNotOwner() public {
|
||||
function test_setSnowbridgeInitiator_revertsIfNotOwner() public {
|
||||
vm.prank(operator1);
|
||||
vm.expectRevert(bytes("Ownable: caller is not the owner"));
|
||||
serviceManager.setRewardsInitiator(address(0x123));
|
||||
serviceManager.setSnowbridgeInitiator(address(0x123));
|
||||
}
|
||||
|
||||
// ============ Access Control Tests ============
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ contract SlashingTest is AVSDeployer {
|
|||
|
||||
// Configure the rewards initiator (because only the reward agent can submit slashing request)
|
||||
vm.prank(avsOwner);
|
||||
serviceManager.setRewardsInitiator(snowbridgeAgent);
|
||||
serviceManager.setSnowbridgeInitiator(snowbridgeAgent);
|
||||
|
||||
vm.prank(operator);
|
||||
delegationManager.registerAsOperator(address(0), 0, "");
|
||||
|
|
@ -93,7 +93,7 @@ contract SlashingTest is AVSDeployer {
|
|||
|
||||
// Configure the rewards initiator (because only the reward agent can submit slashing request)
|
||||
vm.prank(avsOwner);
|
||||
serviceManager.setRewardsInitiator(snowbridgeAgent);
|
||||
serviceManager.setSnowbridgeInitiator(snowbridgeAgent);
|
||||
|
||||
vm.prank(operator);
|
||||
delegationManager.registerAsOperator(address(0), 0, "");
|
||||
|
|
@ -147,7 +147,7 @@ contract SlashingTest is AVSDeployer {
|
|||
function test_fulfilSlashingRequest_skipsUnknownSolochainAddress() public {
|
||||
// Configure the rewards initiator (because only the reward agent can submit slashing request)
|
||||
vm.prank(avsOwner);
|
||||
serviceManager.setRewardsInitiator(snowbridgeAgent);
|
||||
serviceManager.setSnowbridgeInitiator(snowbridgeAgent);
|
||||
|
||||
address unknownSolochainOperator = address(0xDEAD);
|
||||
DataHavenServiceManager.SlashingRequest[] memory slashings =
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ contract ValidatorSetSubmitterTest is SnowbridgeAndAVSDeployer {
|
|||
abi.encodeWithSelector(
|
||||
DataHavenServiceManager.initialize.selector,
|
||||
avsOwner,
|
||||
rewardsInitiator,
|
||||
snowbridgeInitiator,
|
||||
emptyStrategies,
|
||||
address(snowbridgeGatewayMock),
|
||||
address(0),
|
||||
|
|
|
|||
|
|
@ -20,18 +20,18 @@ contract StorageLayoutTest is AVSDeployer {
|
|||
function test_upgradePreservesState() public {
|
||||
// 1. Populate state
|
||||
address testValidator = address(0x1234);
|
||||
address newRewardsInitiator = address(0x9999);
|
||||
address newSnowbridgeInitiator = address(0x9999);
|
||||
address testSubmitter = address(0x5678);
|
||||
|
||||
vm.startPrank(avsOwner);
|
||||
serviceManager.addValidatorToAllowlist(testValidator);
|
||||
serviceManager.setRewardsInitiator(newRewardsInitiator);
|
||||
serviceManager.setSnowbridgeInitiator(newSnowbridgeInitiator);
|
||||
serviceManager.setValidatorSetSubmitter(testSubmitter);
|
||||
vm.stopPrank();
|
||||
|
||||
// 2. Record state before upgrade
|
||||
bool allowlistBefore = serviceManager.validatorsAllowlist(testValidator);
|
||||
address rewardsInitiatorBefore = serviceManager.rewardsInitiator();
|
||||
address snowbridgeInitiatorBefore = serviceManager.snowbridgeInitiator();
|
||||
address ownerBefore = serviceManager.owner();
|
||||
address gatewayBefore = serviceManager.snowbridgeGateway();
|
||||
address submitterBefore = serviceManager.validatorSetSubmitter();
|
||||
|
|
@ -51,9 +51,9 @@ contract StorageLayoutTest is AVSDeployer {
|
|||
"validatorsAllowlist should be preserved"
|
||||
);
|
||||
assertEq(
|
||||
serviceManager.rewardsInitiator(),
|
||||
rewardsInitiatorBefore,
|
||||
"rewardsInitiator should be preserved"
|
||||
serviceManager.snowbridgeInitiator(),
|
||||
snowbridgeInitiatorBefore,
|
||||
"snowbridgeInitiator should be preserved"
|
||||
);
|
||||
assertEq(serviceManager.owner(), ownerBefore, "owner should be preserved");
|
||||
assertEq(
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ contract AVSDeployer is Test {
|
|||
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 snowbridgeInitiator =
|
||||
address(uint160(uint256(keccak256("snowbridgeInitiator"))));
|
||||
address public pauser = address(uint160(uint256(keccak256("pauser"))));
|
||||
address public unpauser = address(uint160(uint256(keccak256("unpauser"))));
|
||||
address public rewardsUpdater = address(uint160(uint256(keccak256("rewardsUpdater"))));
|
||||
|
|
@ -246,7 +247,7 @@ contract AVSDeployer is Test {
|
|||
abi.encodeWithSelector(
|
||||
DataHavenServiceManager.initialize.selector,
|
||||
avsOwner,
|
||||
rewardsInitiator,
|
||||
snowbridgeInitiator,
|
||||
defaultStrategyAndMultipliers,
|
||||
address(snowbridgeGatewayMock),
|
||||
avsOwner,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export const showDeploymentPlanAndStatus = async (chain: string, environment?: s
|
|||
"Block Explorer": deploymentParams.blockExplorer,
|
||||
"Genesis Time": new Date(deploymentParams.genesisTime * 1000).toISOString(),
|
||||
"AVS Owner": `${config.avs.avsOwner.slice(0, 10)}...${config.avs.avsOwner.slice(-8)}`,
|
||||
"Rewards Initiator": `${config.avs.rewardsInitiator.slice(0, 10)}...${config.avs.rewardsInitiator.slice(-8)}`
|
||||
"Rewards Initiator": `${config.avs.snowbridgeInitiator.slice(0, 10)}...${config.avs.snowbridgeInitiator.slice(-8)}`
|
||||
};
|
||||
|
||||
if (environment) {
|
||||
|
|
|
|||
|
|
@ -2149,7 +2149,11 @@ export const dataHavenServiceManagerAbi = [
|
|||
type: 'function',
|
||||
inputs: [
|
||||
{ name: 'initialOwner', internalType: 'address', type: 'address' },
|
||||
{ name: '_rewardsInitiator', internalType: 'address', type: 'address' },
|
||||
{
|
||||
name: '_snowbridgeInitiator',
|
||||
internalType: 'address',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'validatorsStrategiesAndMultipliers',
|
||||
internalType: 'struct IRewardsCoordinatorTypes.StrategyAndMultiplier[]',
|
||||
|
|
@ -2225,13 +2229,6 @@ export const dataHavenServiceManagerAbi = [
|
|||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [],
|
||||
name: 'rewardsInitiator',
|
||||
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
||||
stateMutability: 'view',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [
|
||||
|
|
@ -2243,15 +2240,6 @@ export const dataHavenServiceManagerAbi = [
|
|||
outputs: [],
|
||||
stateMutability: 'payable',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [
|
||||
{ name: 'newRewardsInitiator', internalType: 'address', type: 'address' },
|
||||
],
|
||||
name: 'setRewardsInitiator',
|
||||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [
|
||||
|
|
@ -2265,6 +2253,19 @@ export const dataHavenServiceManagerAbi = [
|
|||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [
|
||||
{
|
||||
name: 'newSnowbridgeInitiator',
|
||||
internalType: 'address',
|
||||
type: 'address',
|
||||
},
|
||||
],
|
||||
name: 'setSnowbridgeInitiator',
|
||||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [
|
||||
|
|
@ -2325,6 +2326,13 @@ export const dataHavenServiceManagerAbi = [
|
|||
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
||||
stateMutability: 'view',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [],
|
||||
name: 'snowbridgeInitiator',
|
||||
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
||||
stateMutability: 'view',
|
||||
},
|
||||
{
|
||||
type: 'function',
|
||||
inputs: [{ name: '', internalType: 'contract IStrategy', type: 'address' }],
|
||||
|
|
@ -2514,25 +2522,6 @@ export const dataHavenServiceManagerAbi = [
|
|||
],
|
||||
name: 'OwnershipTransferred',
|
||||
},
|
||||
{
|
||||
type: 'event',
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
name: 'oldInitiator',
|
||||
internalType: 'address',
|
||||
type: 'address',
|
||||
indexed: true,
|
||||
},
|
||||
{
|
||||
name: 'newInitiator',
|
||||
internalType: 'address',
|
||||
type: 'address',
|
||||
indexed: true,
|
||||
},
|
||||
],
|
||||
name: 'RewardsInitiatorSet',
|
||||
},
|
||||
{
|
||||
type: 'event',
|
||||
anonymous: false,
|
||||
|
|
@ -2566,6 +2555,25 @@ export const dataHavenServiceManagerAbi = [
|
|||
],
|
||||
name: 'SnowbridgeGatewaySet',
|
||||
},
|
||||
{
|
||||
type: 'event',
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
{
|
||||
name: 'oldInitiator',
|
||||
internalType: 'address',
|
||||
type: 'address',
|
||||
indexed: true,
|
||||
},
|
||||
{
|
||||
name: 'newInitiator',
|
||||
internalType: 'address',
|
||||
type: 'address',
|
||||
indexed: true,
|
||||
},
|
||||
],
|
||||
name: 'SnowbridgeInitiatorSet',
|
||||
},
|
||||
{
|
||||
type: 'event',
|
||||
anonymous: false,
|
||||
|
|
@ -11021,15 +11029,6 @@ export const readDataHavenServiceManagerOwner =
|
|||
functionName: 'owner',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link readContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"rewardsInitiator"`
|
||||
*/
|
||||
export const readDataHavenServiceManagerRewardsInitiator =
|
||||
/*#__PURE__*/ createReadContract({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
functionName: 'rewardsInitiator',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link readContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"snowbridgeGateway"`
|
||||
*/
|
||||
|
|
@ -11039,6 +11038,15 @@ export const readDataHavenServiceManagerSnowbridgeGateway =
|
|||
functionName: 'snowbridgeGateway',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link readContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"snowbridgeInitiator"`
|
||||
*/
|
||||
export const readDataHavenServiceManagerSnowbridgeInitiator =
|
||||
/*#__PURE__*/ createReadContract({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
functionName: 'snowbridgeInitiator',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link readContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"strategiesAndMultipliers"`
|
||||
*/
|
||||
|
|
@ -11199,15 +11207,6 @@ export const writeDataHavenServiceManagerSendNewValidatorSetForEra =
|
|||
functionName: 'sendNewValidatorSetForEra',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link writeContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setRewardsInitiator"`
|
||||
*/
|
||||
export const writeDataHavenServiceManagerSetRewardsInitiator =
|
||||
/*#__PURE__*/ createWriteContract({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
functionName: 'setRewardsInitiator',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link writeContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setSnowbridgeGateway"`
|
||||
*/
|
||||
|
|
@ -11217,6 +11216,15 @@ export const writeDataHavenServiceManagerSetSnowbridgeGateway =
|
|||
functionName: 'setSnowbridgeGateway',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link writeContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setSnowbridgeInitiator"`
|
||||
*/
|
||||
export const writeDataHavenServiceManagerSetSnowbridgeInitiator =
|
||||
/*#__PURE__*/ createWriteContract({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
functionName: 'setSnowbridgeInitiator',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link writeContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setStrategiesAndMultipliers"`
|
||||
*/
|
||||
|
|
@ -11385,15 +11393,6 @@ export const simulateDataHavenServiceManagerSendNewValidatorSetForEra =
|
|||
functionName: 'sendNewValidatorSetForEra',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link simulateContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setRewardsInitiator"`
|
||||
*/
|
||||
export const simulateDataHavenServiceManagerSetRewardsInitiator =
|
||||
/*#__PURE__*/ createSimulateContract({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
functionName: 'setRewardsInitiator',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link simulateContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setSnowbridgeGateway"`
|
||||
*/
|
||||
|
|
@ -11403,6 +11402,15 @@ export const simulateDataHavenServiceManagerSetSnowbridgeGateway =
|
|||
functionName: 'setSnowbridgeGateway',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link simulateContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setSnowbridgeInitiator"`
|
||||
*/
|
||||
export const simulateDataHavenServiceManagerSetSnowbridgeInitiator =
|
||||
/*#__PURE__*/ createSimulateContract({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
functionName: 'setSnowbridgeInitiator',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link simulateContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"setStrategiesAndMultipliers"`
|
||||
*/
|
||||
|
|
@ -11517,15 +11525,6 @@ export const watchDataHavenServiceManagerOwnershipTransferredEvent =
|
|||
eventName: 'OwnershipTransferred',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `eventName` set to `"RewardsInitiatorSet"`
|
||||
*/
|
||||
export const watchDataHavenServiceManagerRewardsInitiatorSetEvent =
|
||||
/*#__PURE__*/ createWatchContractEvent({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
eventName: 'RewardsInitiatorSet',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `eventName` set to `"RewardsSubmitted"`
|
||||
*/
|
||||
|
|
@ -11553,6 +11552,15 @@ export const watchDataHavenServiceManagerSnowbridgeGatewaySetEvent =
|
|||
eventName: 'SnowbridgeGatewaySet',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `eventName` set to `"SnowbridgeInitiatorSet"`
|
||||
*/
|
||||
export const watchDataHavenServiceManagerSnowbridgeInitiatorSetEvent =
|
||||
/*#__PURE__*/ createWatchContractEvent({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
eventName: 'SnowbridgeInitiatorSet',
|
||||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `eventName` set to `"SolochainAddressUpdated"`
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -123,16 +123,16 @@ describe("Rewards Message Flow", () => {
|
|||
expect(serviceManager.address).toBeDefined();
|
||||
expect(gateway.address).toBeDefined();
|
||||
|
||||
const rewardsInitiator = (await publicClient.readContract({
|
||||
const snowbridgeInitiator = (await publicClient.readContract({
|
||||
address: serviceManager.address,
|
||||
abi: serviceManager.abi,
|
||||
functionName: "rewardsInitiator",
|
||||
functionName: "snowbridgeInitiator",
|
||||
args: []
|
||||
})) as Address;
|
||||
|
||||
// ServiceManager must have a rewardsInitiator configured for EigenLayer rewards submission
|
||||
expect(rewardsInitiator).toBeDefined();
|
||||
logger.debug(`ServiceManager rewardsInitiator: ${rewardsInitiator}`);
|
||||
// ServiceManager must have a snowbridgeInitiator configured for EigenLayer rewards submission
|
||||
expect(snowbridgeInitiator).toBeDefined();
|
||||
logger.debug(`ServiceManager snowbridgeInitiator: ${snowbridgeInitiator}`);
|
||||
});
|
||||
|
||||
it("should wait for era end and emit RewardsMessageSent", async () => {
|
||||
|
|
|
|||
|
|
@ -91,16 +91,16 @@ describe("Should slash an operator", () => {
|
|||
expect(serviceManager.address).toBeDefined();
|
||||
expect(gateway.address).toBeDefined();
|
||||
|
||||
const rewardsInitiator = (await publicClient.readContract({
|
||||
const snowbridgeInitiator = (await publicClient.readContract({
|
||||
address: serviceManager.address,
|
||||
abi: serviceManager.abi,
|
||||
functionName: "rewardsInitiator",
|
||||
functionName: "snowbridgeInitiator",
|
||||
args: []
|
||||
})) as Address;
|
||||
|
||||
// ServiceManager must have a rewardsInitiator configured for EigenLayer rewards submission
|
||||
expect(rewardsInitiator).toBeDefined();
|
||||
logger.info(`ServiceManager rewardsInitiator: ${rewardsInitiator}`);
|
||||
// ServiceManager must have a snowbridgeInitiator configured for EigenLayer rewards submission
|
||||
expect(snowbridgeInitiator).toBeDefined();
|
||||
logger.info(`ServiceManager snowbridgeInitiator: ${snowbridgeInitiator}`);
|
||||
});
|
||||
|
||||
it("Activate slashing", async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue