Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add rewards-v2 related functionality #221

Merged
merged 9 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ MIDDLEWARE_CONTRACTS_ARGS:=$(patsubst %, --select '^%$$', $(shell echo $(MIDDLEW


### Core bindings ###
CORE_CONTRACTS:="DelegationManager IRewardsCoordinator StrategyManager IEigenPod EigenPod IEigenPodManager EigenPodManager IStrategy AVSDirectory AllocationManager PermissionController"
CORE_CONTRACTS:="DelegationManager IRewardsCoordinator StrategyManager IEigenPod EigenPod IEigenPodManager EigenPodManager IStrategy AVSDirectory AllocationManager PermissionController ERC20 Slasher ISlasher"
CORE_CONTRACTS_LOCATION:=$(MIDDLEWARE_CONTRACTS_LOCATION)/lib/eigenlayer-contracts
CORE_BINDINGS_PATH:=crates/utils/src/core
# The echo is to remove quotes, and the patsubst to make the regex match the full text only
Expand Down
4 changes: 2 additions & 2 deletions crates/chainio/clients/avsregistry/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use eigen_types::operator::{
bitmap_to_quorum_ids, bitmap_to_quorum_ids_from_u192, OperatorPubKeys,
};
use eigen_utils::{
deploy::stakeregistry::StakeRegistry, middleware::blsapkregistry::BLSApkRegistry,
middleware::blsapkregistry::BLSApkRegistry,
middleware::operatorstateretriever::OperatorStateRetriever,
middleware::registrycoordinator::RegistryCoordinator,
middleware::registrycoordinator::RegistryCoordinator, middleware::stakeregistry::StakeRegistry,
};

use num_bigint::BigInt;
Expand Down
10 changes: 5 additions & 5 deletions crates/chainio/clients/elcontracts/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use alloy_primitives::{Address, FixedBytes, U256};
use eigen_common::get_provider;
use eigen_logging::logger::SharedLogger;
use eigen_types::operator::Operator;
use eigen_utils::middleware::{
use eigen_utils::core::islasher::ISlasher;
use eigen_utils::core::{
avsdirectory::AVSDirectory, delegationmanager::DelegationManager, erc20::ERC20,
islasher::ISlasher, istrategy::IStrategy,
istrategy::IStrategy,
};

#[derive(Debug, Clone)]
pub struct ELChainReader {
_logger: SharedLogger,
Expand Down Expand Up @@ -399,13 +399,13 @@ mod tests {
},
};
use eigen_utils::{
deploy::mockavsservicemanager::MockAvsServiceManager,
middleware::{
core::{
avsdirectory::AVSDirectory::{self, calculateOperatorAVSRegistrationDigestHashReturn},
delegationmanager::DelegationManager::{
self, calculateDelegationApprovalDigestHashReturn,
},
},
sdk::mockavsservicemanager::MockAvsServiceManager,
};
use std::str::FromStr;

Expand Down
12 changes: 7 additions & 5 deletions crates/chainio/clients/elcontracts/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::reader::ELChainReader;
use alloy_primitives::{Address, FixedBytes, TxHash, U256};
use eigen_common::get_signer;
pub use eigen_types::operator::Operator;
use eigen_utils::deploy::irewardscoordinator::IRewardsCoordinator::{self, RewardsMerkleClaim};
use eigen_utils::middleware::{
use eigen_utils::core::irewardscoordinator::IRewardsCoordinator::{self, RewardsMerkleClaim};
use eigen_utils::core::{
delegationmanager::{
DelegationManager::{self},
IDelegationManager::OperatorDetails,
Expand Down Expand Up @@ -273,12 +273,14 @@ mod tests {
};
use eigen_types::operator::Operator;
use eigen_utils::{
deploy::{
contractsregistry::ContractsRegistry::{self, get_test_valuesReturn},
core::{
delegationmanager::DelegationManager,
irewardscoordinator::IRewardsCoordinator::{EarnerTreeMerkleLeaf, RewardsMerkleClaim},
},
sdk::{
contractsregistry::ContractsRegistry::{self, get_test_valuesReturn},
mockavsservicemanager::MockAvsServiceManager,
},
middleware::delegationmanager::DelegationManager,
};
use serial_test::serial;
use std::str::FromStr;
Expand Down
2 changes: 1 addition & 1 deletion crates/contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ src = "src"
out = "out"
libs = ["lib"]
fs_permissions = [{ access = "read-write", path = "./" }]

via-ir = true
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
2 changes: 1 addition & 1 deletion crates/contracts/lib/eigenlayer-middleware
Submodule eigenlayer-middleware updated 64 files
+0 −3 .gitmodules
+ audits/M2 Mainnet - Dedaub - Feb 2024.pdf
+ audits/Rewards v2 - SigmaPrime - Dec 2024.pdf
+2 −2 docs/README.md
+1 −1 docs/ServiceManagerBase.md
+1 −1 docs/experimental/AVS-Guide.md
+1 −0 foundry.toml
+0 −1 lib/ds-test
+1 −1 lib/eigenlayer-contracts
+1 −1 lib/forge-std
+8 −4 src/BLSApkRegistry.sol
+116 −62 src/BLSSignatureChecker.sol
+184 −0 src/EjectionManager.sol
+5 −1 src/IndexRegistry.sol
+33 −0 src/OperatorStateRetriever.sol
+87 −39 src/RegistryCoordinator.sol
+12 −2 src/RegistryCoordinatorStorage.sol
+192 −36 src/ServiceManagerBase.sol
+53 −0 src/ServiceManagerBaseStorage.sol
+3 −3 src/ServiceManagerRouter.sol
+52 −0 src/SocketRegistry.sol
+22 −10 src/StakeRegistry.sol
+24 −3 src/interfaces/IECDSAStakeRegistryEventsAndErrors.sol
+55 −0 src/interfaces/IEjectionManager.sol
+8 −0 src/interfaces/IRegistryCoordinator.sol
+37 −34 src/interfaces/IServiceManager.sol
+61 −0 src/interfaces/IServiceManagerUI.sol
+10 −0 src/interfaces/ISocketRegistry.sol
+0 −20 src/interfaces/ISocketUpdater.sol
+353 −0 src/unaudited/ECDSAServiceManagerBase.sol
+204 −75 src/unaudited/ECDSAStakeRegistry.sol
+10 −3 src/unaudited/ECDSAStakeRegistryStorage.sol
+14 −10 src/unaudited/examples/ECDSAStakeRegistryPermissioned.sol
+128 −0 test/events/IServiceManagerBaseEvents.sol
+1 −1 test/ffi/BLSPubKeyCompendiumFFI.t.sol
+3 −2 test/harnesses/RegistryCoordinatorHarness.t.sol
+7 −1 test/integration/CoreRegistration.t.sol
+129 −65 test/integration/IntegrationDeployer.t.sol
+1 −1 test/integration/TimeMachine.t.sol
+13 −11 test/integration/User.t.sol
+0 −63 test/integration/mocks/BeaconChainOracleMock.t.sol
+16 −15 test/integration/utils/Sort.t.sol
+7 −29 test/mocks/AVSDirectoryMock.sol
+27 −37 test/mocks/DelegationMock.sol
+22 −0 test/mocks/ECDSAServiceManagerMock.sol
+14 −0 test/mocks/ECDSAStakeRegistryMock.sol
+2 −0 test/mocks/RegistryCoordinatorMock.sol
+138 −0 test/mocks/RewardsCoordinatorMock.sol
+9 −3 test/mocks/ServiceManagerMock.sol
+369 −147 test/unit/BLSApkRegistryUnit.t.sol
+2 −1 test/unit/BLSSignatureCheckerUnit.t.sol
+1 −1 test/unit/BitmapUtils.t.sol
+186 −0 test/unit/ECDSAServiceManager.t.sol
+60 −14 test/unit/ECDSAStakeRegistryEqualWeightUnit.t.sol
+48 −16 test/unit/ECDSAStakeRegistryPermissionedUnit.t.sol
+472 −105 test/unit/ECDSAStakeRegistryUnit.t.sol
+448 −0 test/unit/EjectionManagerUnit.t.sol
+266 −110 test/unit/OperatorStateRetrieverUnit.t.sol
+85 −29 test/unit/RegistryCoordinatorUnit.t.sol
+1,082 −0 test/unit/ServiceManagerBase.t.sol
+1 −0 test/unit/ServiceManagerRouter.t.sol
+49 −0 test/unit/SocketRegistryUnit.t.sol
+822 −412 test/unit/StakeRegistryUnit.t.sol
+137 −90 test/utils/MockAVSDeployer.sol
7 changes: 5 additions & 2 deletions crates/contracts/script/DeployMockAvsRegistries.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/
import {IStrategyManager, IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol";
import {ISlasher} from "eigenlayer-contracts/src/contracts/interfaces/ISlasher.sol";
import "eigenlayer-contracts/src/test/mocks/EmptyContract.sol";

import {SocketRegistry} from "eigenlayer-middleware/src/SocketRegistry.sol";
import "eigenlayer-middleware/src/RegistryCoordinator.sol" as blsregcoord;
// import {ISocketRegistry} from "eigenlayer-middleware/src/interfaces/ISocketRegistry.sol";
import {IServiceManager} from "eigenlayer-middleware/src/interfaces/IServiceManager.sol";
import {IBLSApkRegistry, IIndexRegistry, IStakeRegistry} from "eigenlayer-middleware/src/RegistryCoordinator.sol";
import {BLSApkRegistry} from "eigenlayer-middleware/src/BLSApkRegistry.sol";
Expand Down Expand Up @@ -153,12 +154,14 @@ contract DeployMockAvsRegistries is
address(stakeRegistryImplementation)
);
}
address socketRegistry = address(new SocketRegistry(registryCoordinator));

registryCoordinatorImplementation = new blsregcoord.RegistryCoordinator(
blsregcoord.IServiceManager(address(mockAvsServiceManager)),
blsregcoord.IStakeRegistry(address(stakeRegistry)),
blsregcoord.IBLSApkRegistry(address(blsApkRegistry)),
blsregcoord.IIndexRegistry(address(indexRegistry))
blsregcoord.IIndexRegistry(address(indexRegistry)),
blsregcoord.ISocketRegistry(socketRegistry)
);

{
Expand Down
5 changes: 3 additions & 2 deletions crates/contracts/src/MockAvsServiceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ contract MockAvsServiceManager is ServiceManagerBase, BLSSignatureChecker {
)
ServiceManagerBase(
_avsDirectory,
_rewardsCoordinator,
_registryCoordinator,
_registryCoordinator.stakeRegistry()
)
BLSSignatureChecker(_registryCoordinator)
{}

function initialize(address _initialOwner) external initializer {
function initialize(address _initialOwner,address _rewardsInitiator) external initializer {
// TODO: setting _rewardsInitializer to be _initialOwner for now.
__ServiceManagerBase_init(_initialOwner);
__ServiceManagerBase_init(_initialOwner,_rewardsInitiator);
}
}
2 changes: 1 addition & 1 deletion crates/eigen-cli/src/eigen_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloy::primitives::Address;
use alloy::providers::Provider;
use eigen_common::get_provider;
use eigen_utils::{
middleware::delegationmanager::DelegationManager,
core::delegationmanager::DelegationManager,
middleware::iblssignaturechecker::IBLSSignatureChecker,
middleware::registrycoordinator::RegistryCoordinator,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ license-file.workspace = true

[dependencies]
alloy.workspace = true
reqwest.workspace = true
reqwest.workspace = true

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ library BeaconChainProofs {
non_camel_case_types,
non_snake_case,
clippy::pub_underscore_fields,
clippy::style
clippy::style,
clippy::empty_structs_with_brackets
)]
pub mod BeaconChainProofs {
use super::*;
Expand Down Expand Up @@ -1752,7 +1753,8 @@ interface IEigenPod {
non_camel_case_types,
non_snake_case,
clippy::pub_underscore_fields,
clippy::style
clippy::style,
clippy::empty_structs_with_brackets
)]
pub mod IEigenPod {
use super::*;
Expand Down Expand Up @@ -6430,7 +6432,7 @@ pub mod IEigenPod {
Self::SELECTORS.binary_search(&selector).is_ok()
}
#[inline]
#[allow(unsafe_code, non_snake_case)]
#[allow(non_snake_case)]
fn abi_decode_raw(
selector: [u8; 4],
data: &[u8],
Expand Down Expand Up @@ -6719,7 +6721,7 @@ pub mod IEigenPod {
selector,
));
};
(unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate)
DECODE_SHIMS[idx](data, validate)
}
#[inline]
fn abi_encoded_size(&self) -> usize {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ interface IEigenPodManager {
non_camel_case_types,
non_snake_case,
clippy::pub_underscore_fields,
clippy::style
clippy::style,
clippy::empty_structs_with_brackets
)]
pub mod IEigenPodManager {
use super::*;
Expand Down Expand Up @@ -4331,7 +4332,7 @@ pub mod IEigenPodManager {
Self::SELECTORS.binary_search(&selector).is_ok()
}
#[inline]
#[allow(unsafe_code, non_snake_case)]
#[allow(non_snake_case)]
fn abi_decode_raw(
selector: [u8; 4],
data: &[u8],
Expand Down Expand Up @@ -4600,7 +4601,7 @@ pub mod IEigenPodManager {
selector,
));
};
(unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate)
DECODE_SHIMS[idx](data, validate)
}
#[inline]
fn abi_encoded_size(&self) -> usize {
Expand Down
Loading
Loading