Skip to content

Commit 82661e3

Browse files
committed
refactor: remove network from store_id Key
1 parent c994b61 commit 82661e3

File tree

5 files changed

+5
-14
lines changed

5 files changed

+5
-14
lines changed

crates/icp-cli/src/commands/canister/create.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ pub(crate) async fn exec(ctx: &Context, args: &CreateArgs) -> Result<(), Command
176176
.filter_map(|(_, c)| {
177177
ctx.ids
178178
.lookup(&Key {
179-
network: env.network.name.to_owned(),
180179
environment: env.name.to_owned(),
181180
canister: c.name.to_owned(),
182181
})
@@ -239,9 +238,8 @@ pub(crate) async fn exec(ctx: &Context, args: &CreateArgs) -> Result<(), Command
239238
// Indicate to user that the canister is created
240239
pb.set_message("Creating...");
241240

242-
// Create canister-network association-key
241+
// Create canister-environment association-key
243242
let k = Key {
244-
network: env_ref.network.name.to_owned(),
245243
environment: env_ref.name.to_owned(),
246244
canister: name.to_string(),
247245
};

crates/icp-cli/src/commands/sync/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ pub(crate) async fn exec(ctx: &Context, args: &SyncArgs) -> Result<(), CommandEr
132132

133133
// Get canister principal ID
134134
let cid = ctx.ids.lookup(&Key {
135-
network: env.network.name.to_owned(),
136135
environment: env.name.to_owned(),
137136
canister: c.name.to_owned(),
138137
})?;

crates/icp/src/context/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ impl Context {
168168
let cid = self
169169
.ids
170170
.lookup(&Key {
171-
network: env.network.name.to_owned(),
172171
environment: env.name.to_owned(),
173172
canister: canister_name.to_owned(),
174173
})

crates/icp/src/context/tests.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ async fn test_get_canister_id_for_env_success() {
115115
ids_store
116116
.register(
117117
&Key {
118-
network: "local".to_string(),
119118
environment: "dev".to_string(),
120119
canister: "backend".to_string(),
121120
},
@@ -337,7 +336,6 @@ async fn test_get_canister_id() {
337336
ids_store
338337
.register(
339338
&Key {
340-
network: "local".to_string(),
341339
environment: "dev".to_string(),
342340
canister: "backend".to_string(),
343341
},

crates/icp/src/store_id.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ pub trait Access: Sync + Send {
2626
/// An association-key, used for associating an existing canister to an ID on a network
2727
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
2828
pub struct Key {
29-
/// Network name
30-
pub network: String,
31-
3229
/// Environment name
3330
pub environment: String,
3431

@@ -46,8 +43,8 @@ pub enum RegisterError {
4643
RegisterLoadStore { source: json::Error },
4744

4845
#[snafu(display(
49-
"canister '{}' in environment '{}', associated with network '{}' is already registered with id '{id}'",
50-
key.canister, key.environment, key.network,
46+
"canister '{}' in environment '{}' is already registered with id '{id}'",
47+
key.canister, key.environment,
5148
))]
5249
AlreadyRegistered { key: Key, id: Principal },
5350

@@ -61,8 +58,8 @@ pub enum LookupIdError {
6158
LookupLoadStore { source: json::Error },
6259

6360
#[snafu(display(
64-
"could not find ID for canister '{}' in environment '{}', associated with network '{}'",
65-
key.canister, key.environment, key.network
61+
"could not find ID for canister '{}' in environment '{}'",
62+
key.canister, key.environment
6663
))]
6764
IdNotFound { key: Key },
6865

0 commit comments

Comments
 (0)