Skip to content

Commit

Permalink
chore: update to agent-rs 0.28 (#3378)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspofford-dfinity authored Sep 21, 2023
1 parent a742cba commit b76a5e6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 24 deletions.
40 changes: 29 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ license = "Apache-2.0"

[workspace.dependencies]
candid = "0.9.0"
ic-agent = "0.27.0"
ic-agent = "0.28.0"
ic-asset = { path = "src/canisters/frontend/ic-asset" }
ic-cdk = "0.10.0"
ic-identity-hsm = "0.27.0"
ic-utils = "0.27.0"
ic-identity-hsm = "0.28.0"
ic-utils = "0.28.0"

aes-gcm = "0.9.4"
anyhow = "1.0.56"
Expand Down Expand Up @@ -69,19 +69,19 @@ url = "2.1.0"
walkdir = "2.3.2"

[patch.crates-io.ic-agent]
version = "0.27.0"
version = "0.28.0"
git = "https://github.com/dfinity/agent-rs.git"
rev = "eaba57b6cda43abc04581d61d19c1f2809cc6b90"
rev = "9c4db330d96938d95eda69bbf5878db91aae0aa1"

[patch.crates-io.ic-identity-hsm]
version = "0.27.0"
version = "0.28.0"
git = "https://github.com/dfinity/agent-rs.git"
rev = "eaba57b6cda43abc04581d61d19c1f2809cc6b90"
rev = "9c4db330d96938d95eda69bbf5878db91aae0aa1"

[patch.crates-io.ic-utils]
version = "0.27.0"
version = "0.28.0"
git = "https://github.com/dfinity/agent-rs.git"
rev = "eaba57b6cda43abc04581d61d19c1f2809cc6b90"
rev = "9c4db330d96938d95eda69bbf5878db91aae0aa1"

[profile.release]
panic = 'abort'
Expand Down
16 changes: 15 additions & 1 deletion src/dfx-core/src/identity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ use crate::identity::identity_file_locations::IdentityFileLocations;
use crate::json::{load_json_file, save_json_file};
use candid::Principal;
use ic_agent::agent::EnvelopeContent;
use ic_agent::identity::{AnonymousIdentity, BasicIdentity, Secp256k1Identity};
use ic_agent::identity::{
AnonymousIdentity, BasicIdentity, Delegation, Secp256k1Identity, SignedDelegation,
};
use ic_agent::Signature;
use ic_identity_hsm::HardwareIdentity;
pub use identity_manager::{
Expand Down Expand Up @@ -253,9 +255,21 @@ impl ic_agent::Identity for Identity {
self.inner.public_key()
}

fn delegation_chain(&self) -> Vec<SignedDelegation> {
self.inner.delegation_chain()
}

fn sign(&self, content: &EnvelopeContent) -> Result<Signature, String> {
self.inner.sign(content)
}

fn sign_arbitrary(&self, content: &[u8]) -> Result<Signature, String> {
self.inner.sign_arbitrary(content)
}

fn sign_delegation(&self, content: &Delegation) -> Result<Signature, String> {
self.inner.sign_delegation(content)
}
}

impl AsRef<Identity> for Identity {
Expand Down
6 changes: 3 additions & 3 deletions src/dfx/src/commands/canister/request_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use backoff::backoff::Backoff;
use backoff::ExponentialBackoff;
use candid::Principal;
use clap::Parser;
use ic_agent::agent::{Replied, RequestStatusResponse};
use ic_agent::agent::RequestStatusResponse;
use ic_agent::{AgentError, RequestId};
use std::str::FromStr;

Expand Down Expand Up @@ -49,15 +49,15 @@ pub async fn exec(env: &dyn Environment, opts: RequestStatusOpts) -> DfxResult {
.or_else(|_| canister_id_store.get(callee_canister))?;

let mut retry_policy = ExponentialBackoff::default();
let Replied::CallReplied(blob) = async {
let blob = async {
let mut request_accepted = false;
loop {
match agent
.request_status_raw(&request_id, canister_id)
.await
.context("Failed to fetch request status.")?
{
RequestStatusResponse::Replied { reply } => return Ok(reply),
RequestStatusResponse::Replied(reply) => return Ok(reply.arg),
RequestStatusResponse::Rejected(response) => {
return Err(DfxError::new(AgentError::ReplicaError(response)))
}
Expand Down

0 comments on commit b76a5e6

Please sign in to comment.