Skip to content

Commit

Permalink
conflicting cli opts
Browse files Browse the repository at this point in the history
  • Loading branch information
sesi200 committed Dec 22, 2023
1 parent 7cc27c9 commit 975aa28
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
19 changes: 14 additions & 5 deletions e2e/tests-dfx/cycles-ledger.bash
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ current_time_nanoseconds() {

assert_command dfx deploy

assert_command dfx canister call cycles-depositor deposit "(record {to = record{owner = principal \"$ALICE\";};cycles = 3_400_000_000_000;})" --identity cycle-giver
assert_command dfx canister call cycles-depositor deposit "(record {to = record{owner = principal \"$ALICE\";};cycles = 13_400_000_000_000;})" --identity cycle-giver
assert_command dfx canister call cycles-depositor deposit "(record {to = record{owner = principal \"$ALICE\"; subaccount = opt blob \"$ALICE_SUBACCT1_CANDID\"};cycles = 2_600_000_000_000;})" --identity cycle-giver

cd ..
Expand All @@ -450,14 +450,14 @@ current_time_nanoseconds() {
assert_command dfx canister id e2e_project_backend
E2E_PROJECT_BACKEND_CANISTER_ID=$(dfx canister id e2e_project_backend)
assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise
assert_eq "2399900000000 cycles."
assert_eq "12399900000000 cycles."
# forget about canister. If --created-at-time is a valid idempotency key we should end up with the same canister id
rm .dfx/local/canister_ids.json
assert_command dfx canister create e2e_project_backend --with-cycles 1T --created-at-time "$t" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID"
assert_command dfx canister id e2e_project_backend
assert_contains "$E2E_PROJECT_BACKEND_CANISTER_ID"
assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise
assert_eq "2399900000000 cycles."
assert_eq "12399900000000 cycles."
dfx canister stop e2e_project_backend
dfx canister delete e2e_project_backend

Expand All @@ -475,20 +475,29 @@ current_time_nanoseconds() {
assert_command dfx canister id e2e_project_backend
E2E_PROJECT_BACKEND_CANISTER_ID=$(dfx canister id e2e_project_backend)
assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise
assert_eq "1399800000000 cycles."
assert_eq "11399800000000 cycles."
# reset and forget about canister. If --created-at-time is a valid idempotency key we should end up with the same canister id
dfx canister uninstall-code e2e_project_backend
rm .dfx/local/canister_ids.json
assert_command dfx deploy e2e_project_backend --with-cycles 1T --created-at-time "$t" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" -vv
assert_command dfx canister id e2e_project_backend
assert_contains "$E2E_PROJECT_BACKEND_CANISTER_ID"
assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise
assert_eq "1399800000000 cycles."
assert_eq "11399800000000 cycles."
dfx canister stop e2e_project_backend
dfx canister delete e2e_project_backend

assert_command dfx deploy e2e_project_backend --with-cycles 0.5T --from-subaccount "$ALICE_SUBACCT1" --cycles-ledger-canister-id "$CYCLES_LEDGER_ID"
assert_command dfx canister id e2e_project_backend
assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --subaccount "$ALICE_SUBACCT1" --precise
assert_eq "1599800000000 cycles."
dfx canister stop e2e_project_backend
dfx canister delete e2e_project_backend

assert_command dfx deploy --with-cycles 1T --cycles-ledger-canister-id "$CYCLES_LEDGER_ID"
assert_command dfx canister id e2e_project_backend
assert_command dfx canister id e2e_project_frontend
assert_not_contains "$(dfx canister id e2e_project_backend)"
assert_command dfx cycles balance --cycles-ledger-canister-id "$CYCLES_LEDGER_ID" --precise
assert_eq "999600000000 cycles."
}
2 changes: 1 addition & 1 deletion src/dfx/src/commands/canister/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub struct CanisterCreateOpts {
/// Transaction timestamp, in nanoseconds, for use in controlling transaction deduplication, default is system time.
/// https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication-
//TODO(SDK-1331): unhide
#[arg(long, hide = true)]
#[arg(long, hide = true, conflicts_with = "all")]
created_at_time: Option<u64>,

/// Subaccount of the selected identity to spend cycles from.
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/src/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub struct DeployOpts {
/// Transaction timestamp, in nanoseconds, for use in controlling transaction deduplication, default is system time.
/// https://internetcomputer.org/docs/current/developer-docs/integrations/icrc-1/#transaction-deduplication-
//TODO(SDK-1331): unhide
#[arg(long, hide = true)]
#[arg(long, hide = true, requires = "canister_name")]
created_at_time: Option<u64>,

/// Subaccount of the selected identity to spend cycles from.
Expand Down

0 comments on commit 975aa28

Please sign in to comment.