mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-23 09:18:21 +00:00
rename rewardsInitiator to snowbridgeInitiator
This commit is contained in:
parent
d5390be43d
commit
142f85b56d
22 changed files with 51 additions and 51 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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -270,7 +270,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 RewardsInitiatorSet(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;
|
||||
|
||||
|
|
@ -571,8 +571,8 @@ contract DataHavenServiceManager is OwnableUpgradeable, IAVSRegistrar, IDataHave
|
|||
address newRewardsInitiator
|
||||
) external override onlyOwner {
|
||||
require(newRewardsInitiator != address(0), ZeroAddress());
|
||||
address oldInitiator = rewardsInitiator;
|
||||
rewardsInitiator = newRewardsInitiator;
|
||||
address oldInitiator = snowbridgeInitiator;
|
||||
snowbridgeInitiator = newRewardsInitiator;
|
||||
emit RewardsInitiatorSet(oldInitiator, newRewardsInitiator);
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
{
|
||||
"astId": 23887,
|
||||
"contract": "src/DataHavenServiceManager.sol:DataHavenServiceManager",
|
||||
"label": "rewardsInitiator",
|
||||
"label": "snowbridgeInitiator",
|
||||
"offset": 0,
|
||||
"slot": "101",
|
||||
"type": "t_address"
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ contract RewardsSubmitterTest is AVSDeployer {
|
|||
emit IDataHavenServiceManagerEvents.RewardsInitiatorSet(snowbridgeAgent, newInitiator);
|
||||
serviceManager.setRewardsInitiator(newInitiator);
|
||||
|
||||
assertEq(serviceManager.rewardsInitiator(), newInitiator);
|
||||
assertEq(serviceManager.snowbridgeInitiator(), newInitiator);
|
||||
}
|
||||
|
||||
function test_setRewardsInitiator_revertsIfNotOwner() public {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ contract ValidatorSetSubmitterTest is SnowbridgeAndAVSDeployer {
|
|||
abi.encodeWithSelector(
|
||||
DataHavenServiceManager.initialize.selector,
|
||||
avsOwner,
|
||||
rewardsInitiator,
|
||||
snowbridgeInitiator,
|
||||
emptyStrategies,
|
||||
address(snowbridgeGatewayMock),
|
||||
address(0),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ contract StorageLayoutTest is AVSDeployer {
|
|||
|
||||
// 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,7 @@ 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 +246,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,7 @@ 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[]',
|
||||
|
|
@ -2228,7 +2228,7 @@ export const dataHavenServiceManagerAbi = [
|
|||
{
|
||||
type: 'function',
|
||||
inputs: [],
|
||||
name: 'rewardsInitiator',
|
||||
name: 'snowbridgeInitiator',
|
||||
outputs: [{ name: '', internalType: 'address', type: 'address' }],
|
||||
stateMutability: 'view',
|
||||
},
|
||||
|
|
@ -11022,12 +11022,12 @@ export const readDataHavenServiceManagerOwner =
|
|||
})
|
||||
|
||||
/**
|
||||
* Wraps __{@link readContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"rewardsInitiator"`
|
||||
* Wraps __{@link readContract}__ with `abi` set to __{@link dataHavenServiceManagerAbi}__ and `functionName` set to `"snowbridgeInitiator"`
|
||||
*/
|
||||
export const readDataHavenServiceManagerRewardsInitiator =
|
||||
/*#__PURE__*/ createReadContract({
|
||||
abi: dataHavenServiceManagerAbi,
|
||||
functionName: 'rewardsInitiator',
|
||||
functionName: 'snowbridgeInitiator',
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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