From 14db1bb58d5758c0d8ebe1df7b4aafc147fc615a Mon Sep 17 00:00:00 2001 From: alenmestrov Date: Fri, 20 Dec 2024 18:09:28 +0100 Subject: [PATCH] fix: lint --- contracts/icp/context-config/src/lib.rs | 3 +-- contracts/icp/context-config/src/mutate.rs | 14 ++++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/contracts/icp/context-config/src/lib.rs b/contracts/icp/context-config/src/lib.rs index b278d9b48..40cb300c1 100644 --- a/contracts/icp/context-config/src/lib.rs +++ b/contracts/icp/context-config/src/lib.rs @@ -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}; diff --git a/contracts/icp/context-config/src/mutate.rs b/contracts/icp/context-config/src/mutate.rs index 321ac2878..88aba9622 100644 --- a/contracts/icp/context-config/src/mutate.rs +++ b/contracts/icp/context-config/src/mutate.rs @@ -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"), @@ -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(()) }