Skip to content

Can't compile a clarity snippet with multiple principals #274

Closed
@ameeratgithub

Description

While adding support for principals in property testing framework, I've found an issue in /src/vm/clarity_wasm.rs in Clarity VM. It panics with message

panicked at /home/user1/.cargo/git/checkouts/stacks-core-16deff9526aec9a7/fd73fd5/clarity/./src/vm/clarity_wasm.rs:1756:26:
index out of bounds: the len is 8 but the index is 40 

Steps To Reproduce

use clar2wasm::tools::evaluate;
evaluate("(default-to (tuple (baBoferTsDF 'S1G2081040G2081040G2081040G208105NK8PE5.proptest-principal) (jumFfDpQjCqqbZvd (list 'S1G2081040G2081040G2081040G208105NK8PE5.proptest-principal)) (muxnhYYQ -120162851495380370837027214342302802479) (qVETsQyzOAOR 'S1G2081040G2081040G2081040G208105NK8PE5.proptest-principal)) none)").unwrap();

Stack backtrace:

   0: rust_begin_unwind
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_bounds_check
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/panicking.rs:180:5
   3: clarity::vm::clarity_wasm::wasm_to_clarity_value
             at /home/user1/.cargo/git/checkouts/stacks-core-16deff9526aec9a7/fd73fd5/clarity/src/vm/clarity_wasm.rs:1756:26
   4: clarity::vm::clarity_wasm::wasm_to_clarity_value
             at /home/user1/.cargo/git/checkouts/stacks-core-16deff9526aec9a7/fd73fd5/clarity/src/vm/clarity_wasm.rs:1817:21
   5: clarity::vm::clarity_wasm::initialize_contract
             at /home/user1/.cargo/git/checkouts/stacks-core-16deff9526aec9a7/fd73fd5/clarity/src/vm/clarity_wasm.rs:459:9
   6: clar2wasm::tools::TestEnvironment::init_contract_with_snippet
             at ./src/tools.rs:116:26
   7: clar2wasm::tools::TestEnvironment::evaluate
             at ./src/tools.rs:145:9
   8: clar2wasm::tools::evaluate_at
             at ./src/tools.rs:172:5
   9: clar2wasm::tools::evaluate
             at ./src/tools.rs:179:5
  10: wasm_generation::default_to::testing_dummy
             at ./tests/wasm-generation/default_to.rs:25:5
  11: wasm_generation::default_to::testing_dummy::{{closure}}
             at ./tests/wasm-generation/default_to.rs:24:20
  12: core::ops::function::FnOnce::call_once
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/ops/function.rs:250:5
  13: core::ops::function::FnOnce::call_once
             at /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/ops/function.rs:250:5

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

  • Status

    Status: ✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions