Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alenmestrov committed Dec 20, 2024
1 parent fcd5b3a commit 14db1bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions contracts/icp/context-config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::{BTreeMap, BTreeSet};

use calimero_context_config::icp::repr::ICRepr;
use calimero_context_config::icp::types::{ICApplication, ICCapability, ICRequest, ICSigned};
Expand Down
14 changes: 10 additions & 4 deletions contracts/icp/context-config/src/mutate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ async fn add_context(
application: Guard::new(author_id.rt().expect("infallible conversion"), application),
members: Guard::new(
author_id.rt().expect("infallible conversion"),
[author_id.rt().expect("infallible conversion")].into_iter().collect(),
[author_id.rt().expect("infallible conversion")]
.into_iter()
.collect(),
),
proxy: Guard::new(
author_id.rt().expect("infallible conversion"),
Expand Down Expand Up @@ -364,12 +366,16 @@ fn check_and_increment_nonce(
signer_id: &SignerId,
) -> Result<(), String> {
let context_identity = signer_id.rt().expect("infallible conversion");
let current_nonce = context.member_nonces.get(&context_identity).copied().unwrap_or(0);

let current_nonce = context
.member_nonces
.get(&context_identity)
.copied()
.unwrap_or(0);

if current_nonce != nonce {
return Err("invalid nonce".into());
}

context.member_nonces.insert(context_identity, nonce + 1);
Ok(())
}

0 comments on commit 14db1bb

Please sign in to comment.