-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* splay tree * upgrade * test * check init arg during upgrade * fix * use vessel
- Loading branch information
1 parent
44cb004
commit 9f8330a
Showing
9 changed files
with
170 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,9 @@ yarn-debug.log* | |
yarn-error.log* | ||
|
||
.eslintcache | ||
.vessel | ||
|
||
# IDEs | ||
/.idea | ||
/.vscode | ||
/.history | ||
/.history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!ic-repl | ||
|
||
let id = call ic.provisional_create_canister_with_cycles(record { settings = null; amount = null }); | ||
let S = id.canister_id; | ||
|
||
let init = opt record { | ||
cycles_per_canister = 105_000_000_000 : nat; | ||
max_num_canisters = 2 : nat; | ||
TTL = 1 : nat; | ||
}; | ||
call ic.install_code( | ||
record { | ||
arg = encode (init); | ||
wasm_module = file "../../.dfx/local/canisters/backend/backend.wasm"; | ||
mode = variant { install }; | ||
canister_id = S; | ||
}, | ||
); | ||
let c1 = call S.getCanisterId(); | ||
c1; | ||
let c2 = call S.getCanisterId(); | ||
c2; | ||
|
||
call ic.install_code( | ||
record { | ||
arg = encode (init); | ||
wasm_module = file "../../.dfx/local/canisters/backend/backend.wasm"; | ||
mode = variant { upgrade }; | ||
canister_id = S; | ||
}, | ||
); | ||
let c3 = call S.getCanisterId(); | ||
c3; | ||
let c4 = call S.getCanisterId(); | ||
c4; | ||
assert c1.id != c2.id; | ||
assert c1.id == c3.id; | ||
assert c2.id == c4.id; | ||
|
||
// Okay to increase pool and TTL | ||
let init = opt record { | ||
cycles_per_canister = 105_000_000_000 : nat; | ||
max_num_canisters = 3 : nat; | ||
TTL = 3600_000_000_000 : nat; | ||
}; | ||
call ic.install_code( | ||
record { | ||
arg = encode (init); | ||
wasm_module = file "../../.dfx/local/canisters/backend/backend.wasm"; | ||
mode = variant { upgrade }; | ||
canister_id = S; | ||
}, | ||
); | ||
let c5 = call S.getCanisterId(); | ||
c5; | ||
assert c5.id != c1.id; | ||
assert c5.id != c2.id; | ||
fail call S.getCanisterId(); | ||
assert _ ~= "No available canister id"; | ||
|
||
// Cannot reduce pool | ||
let init = opt record { | ||
cycles_per_canister = 105_000_000_000 : nat; | ||
max_num_canisters = 1 : nat; | ||
TTL = 1 : nat; | ||
}; | ||
fail call ic.install_code( | ||
record { | ||
arg = encode (init); | ||
wasm_module = file "../../.dfx/local/canisters/backend/backend.wasm"; | ||
mode = variant { upgrade }; | ||
canister_id = S; | ||
}, | ||
); | ||
assert _ ~= "assertion failed"; | ||
// still old canister, new TTL does not apply | ||
fail call S.getCanisterId(); | ||
assert _ ~= "No available canister id"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let upstream = https://github.com/kritzcreek/vessel-package-set/releases/download/mo-0.6.4-20210624/package-set.dhall sha256:3f4cffd315d8ee5d2b4b5b00dc03b2e02732345b565340b7cb9cc0001444f525 | ||
let Package = | ||
{ name : Text, version : Text, repo : Text, dependencies : List Text } | ||
|
||
let | ||
-- This is where you can add your own packages to the package-set | ||
additions = | ||
[{ name = "base" | ||
, repo = "https://github.com/dfinity/motoko-base" | ||
, version = "dfx-0.7.0" | ||
, dependencies = [] : List Text | ||
}] : List Package | ||
|
||
let | ||
{- This is where you can override existing packages in the package-set | ||
For example, if you wanted to use version `v2.0.0` of the foo library: | ||
let overrides = [ | ||
{ name = "foo" | ||
, version = "v2.0.0" | ||
, repo = "https://github.com/bar/foo" | ||
, dependencies = [] : List Text | ||
} | ||
] | ||
-} | ||
overrides = | ||
[] : List Package | ||
|
||
in upstream # additions # overrides |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
dependencies = [ "base", "splay" ], | ||
compiler = None Text | ||
} |