Skip to content

test case: canister sandbox panic #3105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nix/drun.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pkgs:
# installed. You will normally not be bothered to perform
# the command therein manually.

cargoSha256 = "sha256-VmZIo60PAPgHrs95B1dqzTylTa1+yu+LvuyELFcejqI=";
cargoSha256 = "sha256-15xc6dSuXT9pINny5BP2J+JPOmhTdi+h2r5JAWXG1sE=";

nativeBuildInputs = with pkgs; [
pkg-config
Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"homepage": "",
"owner": "dfinity",
"repo": "ic",
"rev": "b1fa6ab6775411c2733f044c0f67d89aae78a9b0",
"sha256": "0459x15g1sfi2b6kyas8h0wgmvy866ii6i4q0hgnc2gcbpj55j86",
"rev": "0d859159546592ff775f618c864060552e1980ca",
"sha256": "14748ssplgbj9zm92yrm471y8j3c775d0qijsj50s0n8r51bv7ma",
"type": "tarball",
"url": "https://github.com/dfinity/ic/archive/b1fa6ab6775411c2733f044c0f67d89aae78a9b0.tar.gz",
"url": "https://github.com/dfinity/ic/archive/0d859159546592ff775f618c864060552e1980ca.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"ic-hs": {
Expand Down
7 changes: 4 additions & 3 deletions test/run-drun/basic-cycles.mo
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ actor a {
0x0,
0xFFFFFFFF,
0xFFFFFFFF_FFFFFFFF,
0x1_00000000_00000000,
0xFFFFFFFF_FFFFFFFF_FFFFFFFF,
0xFFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF,
// disabled as long as they crash the replica, see https://forum.dfinity.org/t/10729
// 0x1_00000000_00000000,
// 0xFFFFFFFF_FFFFFFFF_FFFFFFFF,
// 0xFFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF,
];

public func iter() : async () {
Expand Down
28 changes: 28 additions & 0 deletions test/run-drun/canster-sandbox-panic.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// test cycle overflow detection and larger cycle transfers

import Prim "mo:⛔";

actor a {

public func go() : async (){
// works for 0x1_0000000_000000;
// works for 0xF000000_000000;
let amount = 0xFFFFFFFF_00000000;

Prim.debugPrint("topping up");
let ic00 = actor "aaaaa-aa" : actor {
provisional_top_up_canister :
{ canister_id: Principal; amount : Nat } -> async ();
};
await ic00.provisional_top_up_canister({
canister_id = Prim.principalOfActor(a);
amount = amount});
Prim.debugPrint("done");
};
};

a.go(); //OR-CALL ingress go "DIDL\x00\x00"
//SKIP run
//SKIP run-ir
//SKIP run-low

7 changes: 0 additions & 7 deletions test/run-drun/ok/basic-cycles.drun-run.ok
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,4 @@ debug.print: {balance = 100_000_000_000_000}
debug.print: {topped_up_balance = 18_446_744_073_709_551_615}
debug.print: {added = 18_446_744_073_709_551_615}
debug.print: {amount = 18_446_744_073_709_551_615; available = 18_446_744_073_709_551_615}
debug.print: {balance = 18_446_744_073_709_551_615}
debug.print: {topped_up_balance = 18_446_744_073_709_551_616}
debug.print: {added = 18_446_744_073_709_551_616}
debug.print: {amount = 18_446_744_073_709_551_616; available = 18_446_744_073_709_551_616}
debug.print: {balance = 18_446_744_073_709_551_616}
debug.print: {topped_up_balance = 18_446_844_073_709_551_616}
debug.print: can't top up more
ingress Completed: Reply: 0x4449444c0000
11 changes: 0 additions & 11 deletions test/run-drun/ok/basic-cycles.ic-ref-run.ok
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,4 @@ debug.print: {balance = 4_294_967_295}
debug.print: {topped_up_balance = 18_446_744_073_709_551_615}
debug.print: {added = 18_446_744_073_709_551_615}
debug.print: {amount = 18_446_744_073_709_551_615; available = 18_446_744_073_709_551_615}
debug.print: {balance = 18_446_744_073_709_551_615}
debug.print: {topped_up_balance = 18_446_744_073_709_551_616}
debug.print: {added = 18_446_744_073_709_551_616}
debug.print: {amount = 18_446_744_073_709_551_616; available = 18_446_744_073_709_551_616}
debug.print: {balance = 18_446_744_073_709_551_616}
debug.print: {topped_up_balance = 79_228_162_514_264_337_593_543_950_335}
debug.print: {added = 79_228_162_514_264_337_593_543_950_335}
debug.print: {amount = 79_228_162_514_264_337_593_543_950_335; available = 79_228_162_514_264_337_593_543_950_335}
debug.print: {balance = 79_228_162_514_264_337_593_543_950_335}
debug.print: {topped_up_balance = 1_329_227_995_784_915_872_903_807_060_280_344_576}
debug.print: can't top up more
← replied: ()
7 changes: 7 additions & 0 deletions test/run-drun/ok/canster-sandbox-panic.drun-run.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
debug.print: topping up
thread '<unnamed>' panicked at 'Failed to serialize message: ErrorImpl { code: Message("The number can't be stored in CBOR"), offset: 0 }', /build/rs/canister_sandbox/common/src/transport.rs:285:55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'MR Batch Processor' panicked at 'Thread pool worker panicked', /build/drun-vendor.tar.gz/scoped_threadpool/src/lib.rs:236:13
thread 'main' panicked at 'failed to send batch XX: background worker is dead', messaging/src/message_routing.rs:949:51
1 change: 1 addition & 0 deletions test/run-drun/ok/canster-sandbox-panic.drun-run.ret.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return code 101
8 changes: 8 additions & 0 deletions test/run-drun/ok/canster-sandbox-panic.ic-ref-run.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
→ update create_canister(record {settings = null})
← replied: (record {hymijyo = principal "cvccv-qqaaq-aaaaa-aaaaa-c"})
→ update install_code(record {arg = blob ""; kca_xin = blob "\00asm\01\00\00\00\0…
← replied: ()
→ update go()
debug.print: topping up
debug.print: done
← replied: ()
1 change: 1 addition & 0 deletions test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function normalize () {
sed 's/trap at 0x[a-f0-9]*/trap at 0x___:/g' |
sed 's/^\( [0-9]\+:\).*!/\1 /g' | # wasmtime backtrace locations
sed 's/Ignore Diff:.*/Ignore Diff: (ignored)/ig' |
sed 's/Failed to send batch [0-9]*/failed to send batch XX/ig' |
sed 's/compiler (source .*)/compiler (source XXX)/ig' |
# Normalize canister id prefixes in debug prints
sed 's/\[Canister [0-9a-z\-]*\]/debug.print:/g' |
Expand Down