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: update_avs_metadata_uri in AVS registry #344

Merged
merged 7 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
67 changes: 53 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ Each version will have a separate `Breaking Changes` section as well. To describ
Those changes in added, changed or breaking changes, should include usage examples to add clarity to the sdk user.

## [Unreleased]

### Added

* Added `eigen_common` dependency to the `eigensdk` crate when "full" feature is enabled in [#249](https://github.com/Layr-Labs/eigensdk-rs/pull/249).
* Added bindings for `ECDSAStakeRegistry` and `ECDSAServiceManagerBase` in [#269](https://github.com/Layr-Labs/eigensdk-rs/pull/269).
* Added release-plz in ci in [#275](https://github.com/Layr-Labs/eigensdk-rs/pull/275).
* Added new method `set_slashable_stake_lookahead` in `avsregistry/writer` in [#278](https://github.com/Layr-Labs/eigensdk-rs/pull/278).

```rust
let quorum_number = 0_u8;
let lookahead = 10_u32;
Expand All @@ -25,6 +28,7 @@ Those changes in added, changed or breaking changes, should include usage exampl
.await
.unwrap();
```

* Added new method `set_rewards_initiator` in `avsregistry/writer` in [#273](https://github.com/Layr-Labs/eigensdk-rs/pull/273).

```rust
Expand Down Expand Up @@ -97,7 +101,17 @@ Those changes in added, changed or breaking changes, should include usage exampl
.unwrap();
```

* Added new method `update_avs_metadata_uri` in `avsregistry/writer` in [#344](https://github.com/Layr-Labs/eigensdk-rs/pull/344).

```rust
let tx_hash = avs_writer
.update_avs_metadata_uri(new_metadata)
.await
.unwrap();
```

### Changed

* Changes in the way bindings are generated in [#243](https://github.com/Layr-Labs/eigensdk-rs/pull/243).
* The `bindings` target now generates the bindings using Docker with Foundry v0.3.0.
* The previous `bindings` target was renamed to `bindings_host`, as it runs without Docker. However the `bindings_host` target is for CI use only. To generate the bindings, please use the `bindings` target.
Expand All @@ -106,9 +120,11 @@ Those changes in added, changed or breaking changes, should include usage exampl
* Fixed incorrect package name in Cargo.toml for examples in [#285](https://github.com/Layr-Labs/eigensdk-rs/pull/285).

### Breaking changes

* refactor: update interface on `bls aggregation` in [#254](https://github.com/Layr-Labs/eigensdk-rs/pull/254)
* Introduces a new struct `TaskMetadata` with a constructor `TaskMetadata::new` to initialize a new task and a method `with_window_duration` to set the window duration.
* Refactors `initialize_new_task` and `single_task_aggregator` to accept a `TaskMetadata` struct instead of multiple parameters.

```rust
// BEFORE
bls_agg_service
Expand All @@ -132,8 +148,9 @@ Those changes in added, changed or breaking changes, should include usage exampl
)
bls_agg_service.initialize_new_task(metadata).await.unwrap();
```

* Removes `initialize_new_task_with_window` since `window_duration` can now be set in `TaskMetadata`.

```rust
// BEFORE
bls_agg_service
Expand All @@ -157,9 +174,11 @@ Those changes in added, changed or breaking changes, should include usage exampl
time_to_expiry,
).with_window_duration(window_duration);
bls_agg_service.initialize_new_task(metadata).await.unwrap();
* refactor: encapsulate parameters into `TaskSignature` in [#260](https://github.com/Layr-Labs/eigensdk-rs/pull/260)
* refactor: encapsulate parameters into `TaskSignature` in [#260](https://github.com/Layr-Labs/eigensdk-rs/pull/260)

* Introduced `TaskSignature` struct to encapsulate parameters related to task signatures:
* Updated `process_new_signature` to accept a `TaskSignature` struct instead of multiple parameters.

```rust
// BEFORE
bls_agg_service.process_new_signature(task_index, task_response_digest, bls_signature, operator_id).await.unwrap();
Expand All @@ -173,19 +192,24 @@ Those changes in added, changed or breaking changes, should include usage exampl
);
bls_agg_service.process_new_signature(task_signature).await.unwrap();
```

* Slashing UAM changes in [#248](https://github.com/Layr-Labs/eigensdk-rs/pull/248).

### Removed

* Removed homepage from testing-utils crate in [#266](https://github.com/Layr-Labs/eigensdk-rs/pull/266).
* Removed changelog generation by release-plz in [#281](https://github.com/Layr-Labs/eigensdk-rs/pull/281).
* Removed examples packages from workspace.dependencies in Cargo.toml in [#287](https://github.com/Layr-Labs/eigensdk-rs/pull/287).
* Removed release-plz-pr workflow in release-plz in [#292](https://github.com/Layr-Labs/eigensdk-rs/pull/292).

## [0.1.3] - 2024-01-17

### Added 🎉
* feat: add rewards-v2 related functionality by @supernovahs in https://github.com/Layr-Labs/eigensdk-rs/pull/221

* feat: add rewards-v2 related functionality by @supernovahs in <https://github.com/Layr-Labs/eigensdk-rs/pull/221>
* New methods in `ELChainReader`:
* `get_operator_avs_split`

```rust
// Given a chain_reader, an operator_address and an avs_address:

Expand All @@ -194,8 +218,9 @@ Those changes in added, changed or breaking changes, should include usage exampl
.await
.unwrap();
```

* `get_operator_pi_split`

```rust
// Given a chain_reader and an operator_address:

Expand All @@ -208,6 +233,7 @@ Those changes in added, changed or breaking changes, should include usage exampl

* New methods in `ELChainWriter`:
* `set_operator_avs_split`

```rust
// Given a chain_writer, an operator_address, an avs_address and a split:

Expand All @@ -217,7 +243,9 @@ Those changes in added, changed or breaking changes, should include usage exampl
.unwrap();
let receipt = wait_transaction(&http_endpoint, tx_hash).await.unwrap();
```

* `set_operator_pi_split`

```rust
// Given a chain_writer, an operator_address and a split:

Expand All @@ -227,10 +255,12 @@ Those changes in added, changed or breaking changes, should include usage exampl
.unwrap();
let receipt = wait_transaction(&http_endpoint, tx_hash).await.unwrap();
```

* Bindings updated for rewards-v2 core contracts release

### Breaking Changes 🛠
* feat!: remove delegation manager from `ELChainWriter` by @supernovahs in https://github.com/Layr-Labs/eigensdk-rs/pull/214

* feat!: remove delegation manager from `ELChainWriter` by @supernovahs in <https://github.com/Layr-Labs/eigensdk-rs/pull/214>
* `ELChainWriter::new` no longer receives the delegation manager address as first parameter.
Before, a chainWriter was created this way:

Expand All @@ -256,43 +286,52 @@ Those changes in added, changed or breaking changes, should include usage exampl
"bead471191bea97fc3aeac36c9d74c895e8a6242602e144e43152f96219e96e8".to_string(),
);
```
* feat!: change way bindings are generated by @MegaRedHand in https://github.com/Layr-Labs/eigensdk-rs/pull/204

* feat!: change way bindings are generated by @MegaRedHand in <https://github.com/Layr-Labs/eigensdk-rs/pull/204>
* `eigen_utils::core` contains bindings related to core contracts
* `eigen_utils::middleware` contains bindings related to middleware contracts
* `eigen_utils::sdk` contains bindings related to the SDK (should only be used for testing)

Now, to update the bindings, run `make bindings`. This command will generate the bindings files in the folder: `crates/utils`.

### Documentation 📚
* docs: add CHANGELOG.md by @lferrigno in https://github.com/Layr-Labs/eigensdk-rs/pull/220

* docs: add CHANGELOG.md by @lferrigno in <https://github.com/Layr-Labs/eigensdk-rs/pull/220>

### Other Changes
* ci: change docker setup action for official one by @MegaRedHand in https://github.com/Layr-Labs/eigensdk-rs/pull/219
* docs: add error message for `cargo test` on darwin by @MegaRedHand in https://github.com/Layr-Labs/eigensdk-rs/pull/215
* test: fix `test_register_and_update_operator` by @ricomateo in https://github.com/Layr-Labs/eigensdk-rs/pull/223
* chore: update way anvil state dump is generated by @ricomateo in https://github.com/Layr-Labs/eigensdk-rs/pull/222
* fix: disable doctests on `eigen-utils` by @MegaRedHand in https://github.com/Layr-Labs/eigensdk-rs/pull/227
* chore: bump version by @MegaRedHand in https://github.com/Layr-Labs/eigensdk-rs/pull/228
* docs: add GitHub release changelog configuration by @MegaRedHand in https://github.com/Layr-Labs/eigensdk-rs/pull/229

* ci: change docker setup action for official one by @MegaRedHand in <https://github.com/Layr-Labs/eigensdk-rs/pull/219>
* docs: add error message for `cargo test` on darwin by @MegaRedHand in <https://github.com/Layr-Labs/eigensdk-rs/pull/215>
* test: fix `test_register_and_update_operator` by @ricomateo in <https://github.com/Layr-Labs/eigensdk-rs/pull/223>
* chore: update way anvil state dump is generated by @ricomateo in <https://github.com/Layr-Labs/eigensdk-rs/pull/222>
* fix: disable doctests on `eigen-utils` by @MegaRedHand in <https://github.com/Layr-Labs/eigensdk-rs/pull/227>
* chore: bump version by @MegaRedHand in <https://github.com/Layr-Labs/eigensdk-rs/pull/228>
* docs: add GitHub release changelog configuration by @MegaRedHand in <https://github.com/Layr-Labs/eigensdk-rs/pull/229>

## [0.1.2] - 2025-01-09

### Added

* Added retries with exponential backoff to send transactions in [#158](https://github.com/Layr-Labs/eigensdk-rs/pull/158)
* Added `query_registration_detail` method in [#162](https://github.com/Layr-Labs/eigensdk-rs/pull/162)
* Added clippy lints in `Cargo.toml` in [#159](https://github.com/Layr-Labs/eigensdk-rs/pull/159)
* Added BLS aggregation logger in [#154](https://github.com/Layr-Labs/eigensdk-rs/pull/154)
* Added `common` crate to `eigensdk` crate in [#213](https://github.com/Layr-Labs/eigensdk-rs/pull/213)

### Changed

* Updated `eigenlayer-middleware` to v0.4.3 (rewards release) in [#177](https://github.com/Layr-Labs/eigensdk-rs/pull/177)
* Fixed Holesky RPC provider URL in [#184](https://github.com/Layr-Labs/eigensdk-rs/pull/184)
* Fixed BLS signature logic in [#174](https://github.com/Layr-Labs/eigensdk-rs/pull/174)

### Removed

* Deleted `TxManager` in [#151](https://github.com/Layr-Labs/eigensdk-rs/pull/151)
* Removed `TxManager` crate import in [#211](https://github.com/Layr-Labs/eigensdk-rs/pull/211)
* Removed logs in `operatorsinfo` test in [#185](https://github.com/Layr-Labs/eigensdk-rs/pull/185)

### Documentation

* Added notes for running tests in [#194](https://github.com/Layr-Labs/eigensdk-rs/pull/194)
* Added "Contract Bindings" section to the README in [#178](https://github.com/Layr-Labs/eigensdk-rs/pull/178)
* Added "Branches" section to the README in [#200](https://github.com/Layr-Labs/eigensdk-rs/pull/200)
Expand Down
48 changes: 48 additions & 0 deletions crates/chainio/clients/avsregistry/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,32 @@ impl AvsRegistryChainWriter {
info!(tx_hash = ?tx, "successfully set operator set param with the AVS's registry coordinator");
Ok(*tx.tx_hash())
}

/// Update the AVS metadata URI.
/// This function is used to update the AVS metadata URI of the AVS's RegistryCoordinator.
///
/// # Arguments
///
/// * `avs_metadata_uri` - The new AVS metadata URI.
///
/// # Returns
///
/// * `TxHash` - hash of the sent transaction.
pub async fn update_avs_metadata_uri(
&self,
avs_metadata_uri: &str,
) -> Result<TxHash, AvsRegistryError> {
info!("updating the AVS metadata URI of the AVS's registry coordinator");
let provider = get_signer(&self.signer.clone(), &self.provider);

ServiceManagerBase::new(self.service_manager_addr, provider)
.updateAVSMetadataURI(avs_metadata_uri.to_string())
.send()
.await
.inspect(|tx| info!(tx_hash = ?tx, "successfully set a new address as the rewards initiator"))
.map_err(AvsRegistryError::AlloyContractError)
.map(|tx| *tx.tx_hash())
}
}

#[cfg(test)]
Expand Down Expand Up @@ -685,6 +711,28 @@ mod tests {
assert_eq!(stream_event.socket, new_socket_addr);
}

#[tokio::test]
async fn test_update_avs_metadata_uri() {
let (_container, http_endpoint, _ws_endpoint) = start_anvil_container().await;
let avs_writer =
build_avs_registry_chain_writer(http_endpoint.clone(), FIRST_PRIVATE_KEY.to_string())
.await;

let new_metadata = "https://avs-metadata-uri.com";

let tx_hash = avs_writer
.update_avs_metadata_uri(new_metadata)
.await
.unwrap();

let tx_status = wait_transaction(&http_endpoint, tx_hash)
.await
.unwrap()
.status();

assert!(tx_status);
}

#[tokio::test]
async fn test_set_account_identifier() {
let (_container, http_endpoint, _ws_endpoint) = start_anvil_container().await;
Expand Down