Skip to content

Commit

Permalink
prevent spurious proxy deployment for existing context
Browse files Browse the repository at this point in the history
  • Loading branch information
miraclx committed Dec 20, 2024
1 parent 244aab0 commit 0182e26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/icp/context-config/src/mutate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ async fn add_context(
return Err("context addition must be signed by the context itself".into());
}

if with_state(|configs| configs.contexts.contains_key(&context_id)) {
return Err("context already exists".to_owned());
}

let proxy_canister_id = deploy_proxy_contract(context_id)
.await
.unwrap_or_else(|e| panic!("Failed to deploy proxy contract: {}", e));
Expand Down

0 comments on commit 0182e26

Please sign in to comment.