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 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
26 changes: 21 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ Those changes in added, changed or breaking changes, should include usage exampl

### Added 🎉

* 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();
```

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

```rust
Expand Down Expand Up @@ -63,10 +72,13 @@ Those changes in added, changed or breaking changes, should include usage exampl
### Documentation 📚

### Other Changes

* fix: missing block while waiting for operator state history in [#290](https://github.com/Layr-Labs/eigensdk-rs/pull/290).

## [0.3.0] - 2025-02-11

### Added

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

```rust
Expand Down Expand Up @@ -99,6 +111,7 @@ Those changes in added, changed or breaking changes, should include usage exampl
.await
.unwrap();
```

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

```rust
Expand All @@ -122,7 +135,6 @@ Those changes in added, changed or breaking changes, should include usage exampl
.status();
// tx_status should be true
```
<<<<<<< HEAD

* Added `get_operator_restaked_strategies` in `avsregistry/reader` in [#348](https://github.com/Layr-Labs/eigensdk-rs/pull/348).

Expand All @@ -134,8 +146,6 @@ Those changes in added, changed or breaking changes, should include usage exampl
```

* Added custom configuration for release-plz in [#281](https://github.com/Layr-Labs/eigensdk-rs/pull/281).
=======
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!!

>>>>>>> dev
* Added Rewards2.1 support in [#323](https://github.com/Layr-Labs/eigensdk-rs/pull/323).

* Set an operator's split on an operator set.
Expand Down Expand Up @@ -183,6 +193,7 @@ Those changes in added, changed or breaking changes, should include usage exampl
```

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

```rust
let operator_set_params = OperatorSetParam {
maxOperatorCount: 10,
Expand Down Expand Up @@ -267,7 +278,8 @@ Those changes in added, changed or breaking changes, should include usage exampl
```rust
let operator_set_quourm = avs_reader.is_operator_set_quorum(0).await.unwrap();
```
* Added version explicitly in crates in [#322](https://github.com/Layr-Labs/eigensdk-rs/pull/322).

* Added version explicitly in crates in [#322](https://github.com/Layr-Labs/eigensdk-rs/pull/322).
* Added new method `set_account_identifier` in `avsregistry/writer` in [#329](https://github.com/Layr-Labs/eigensdk-rs/pull/329).

```rust
Expand All @@ -276,6 +288,7 @@ Those changes in added, changed or breaking changes, should include usage exampl
.await
.unwrap();
```

* Added missing StakeRegistry writer functions in [#343](https://github.com/Layr-Labs/eigensdk-rs/pull/343).

* `set_minimum_stake_for_quorum`
Expand Down Expand Up @@ -317,6 +330,7 @@ Those changes in added, changed or breaking changes, should include usage exampl
.await
.unwrap();
```

* Added missing stake registry view methods in `avsregistry/reader` in [#347](https://github.com/Layr-Labs/eigensdk-rs/pull/347).

* `weight_of_operator_for_quorum`
Expand Down Expand Up @@ -363,6 +377,7 @@ Those changes in added, changed or breaking changes, should include usage exampl
.await
.unwrap();
```

* `get_latest_stake_update`

```rust
Expand All @@ -371,6 +386,7 @@ Those changes in added, changed or breaking changes, should include usage exampl
.await
.unwrap();
```

* `get_stake_update_at_index`

```rust
Expand Down Expand Up @@ -781,4 +797,4 @@ Those changes in added, changed or breaking changes, should include usage exampl
## Previous versions

This changelog was introduced in-between v0.1.2 and v0.1.3.
For changes from previous releases, you can check on our GitHub repo's releases page: [github.com/Layr-Labs/eigensdk-rs/releases](https://github.com/Layr-Labs/eigensdk-rs/releases)
For changes from previous releases, you can check on our GitHub repo's releases page: [github.com/Layr-Labs/eigensdk-rs/releases](https://github.com/Layr-Labs/eigensdk-rs/releases)
49 changes: 49 additions & 0 deletions crates/chainio/clients/avsregistry/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,33 @@ impl AvsRegistryChainWriter {
Ok(*tx.tx_hash())
}

/// Update the AVS metadata URI.
///
/// This function updates 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 updated AVS metadata URI"))
.map_err(AvsRegistryError::AlloyContractError)
.map(|tx| *tx.tx_hash())
}

/// Sets the minimum stake for the quorum
///
/// Can only be called by the registry coordinator's owner.
Expand Down Expand Up @@ -1154,6 +1181,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_churn_approver() {
let (_container, http_endpoint, _ws_endpoint) = start_anvil_container().await;
Expand Down
Loading