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

remove duplicate delegation manager in ELWriter #214

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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 .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

test:
name: Run Tests
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
HOLESKY_WS_URL: ${{ secrets.HOLESKY_WS_URL }}
HOLESKY_HTTP_URL: ${{ secrets.HOLESKY_HTTP_URL }}
Expand Down
2 changes: 1 addition & 1 deletion crates/chainio/clients/elcontracts/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use eigen_utils::middleware::{
pub struct ELChainReader {
_logger: SharedLogger,
slasher: Address,
delegation_manager: Address,
pub delegation_manager: Address,
avs_directory: Address,
pub provider: String,
}
Expand Down
11 changes: 4 additions & 7 deletions crates/chainio/clients/elcontracts/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub const GAS_LIMIT_REGISTER_AS_OPERATOR_DELEGATION_MANAGER: u128 = 300000;
/// Chain Writer to interact with EigenLayer contracts onchain
#[derive(Debug, Clone)]
pub struct ELChainWriter {
delegation_manager: Address,
strategy_manager: Address,
rewards_coordinator: Address,
el_chain_reader: ELChainReader,
Expand All @@ -31,15 +30,13 @@ pub struct ELChainWriter {

impl ELChainWriter {
pub fn new(
delegation_manager: Address,
strategy_manager: Address,
rewards_coordinator: Address,
el_chain_reader: ELChainReader,
provider: String,
signer: String,
) -> Self {
Self {
delegation_manager,
strategy_manager,
rewards_coordinator,
el_chain_reader,
Expand Down Expand Up @@ -73,7 +70,8 @@ impl ELChainWriter {
};
let provider = get_signer(&self.signer.clone(), &self.provider);

let contract_delegation_manager = DelegationManager::new(self.delegation_manager, provider);
let contract_delegation_manager =
DelegationManager::new(self.el_chain_reader.delegation_manager, provider);

let binding = {
let contract_call = contract_delegation_manager
Expand Down Expand Up @@ -129,7 +127,8 @@ impl ELChainWriter {
};
let provider = get_signer(&self.signer.clone(), &self.provider);

let contract_delegation_manager = DelegationManager::new(self.delegation_manager, provider);
let contract_delegation_manager =
DelegationManager::new(self.el_chain_reader.delegation_manager, provider);

let contract_call_modify_operator_details =
contract_delegation_manager.modifyOperatorDetails(operator_details);
Expand Down Expand Up @@ -330,14 +329,12 @@ mod tests {

async fn new_test_writer(http_endpoint: String) -> ELChainWriter {
let (el_chain_reader, _) = setup_el_chain_reader(http_endpoint.clone()).await;
let operator_addr = Address::from_str("90F79bf6EB2c4f870365E785982E1f101E93b906").unwrap();
let operator_private_key =
"7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6".to_string();
let strategy_manager = get_strategy_manager_address(http_endpoint.clone()).await;
let rewards_coordinator = get_rewards_coordinator_address(http_endpoint.clone()).await;

ELChainWriter::new(
operator_addr,
strategy_manager,
rewards_coordinator,
el_chain_reader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ mod tests {
let signer = PrivateKeySigner::from_str(pvt_key).unwrap();

let el_chain_writer = ELChainWriter::new(
delegation_manager_address,
strategy_manager_address,
rewards_coordinator_address,
el_chain_reader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ async fn main() -> Result<()> {
);
// A new ElChainWriter instance
let el_writer = ELChainWriter::new(
DELEGATION_MANAGER_ADDRESS,
STRATEGY_MANAGER_ADDRESS,
REWARDS_COORDINATOR,
el_chain_reader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ pub async fn register_operator(pvt_key: &str, bls_key: &str, http_endpoint: &str
);

let el_chain_writer = ELChainWriter::new(
delegation_manager_address,
strategy_manager_address,
rewards_coordinator_address,
el_chain_reader,
Expand Down
Loading