Skip to content

Commit 327b908

Browse files
authored
Merge branch 'feat/clarity-wasm-develop' into test/clarity-wasm-type-value-err
2 parents 23e0d69 + f2955a7 commit 327b908

File tree

6 files changed

+43
-1
lines changed

6 files changed

+43
-1
lines changed

clarity/src/vm/tests/contracts.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ fn test_fully_qualified_contract_call(
460460
}
461461
}
462462

463+
// Test not valid for clarity-wasm runtime
464+
// Contracts would error in the static analysis pass.
465+
#[cfg(not(feature = "clarity-wasm"))]
463466
#[apply(test_epochs)]
464467
fn test_simple_naming_system(epoch: StacksEpochId, mut env_factory: MemoryEnvironmentGenerator) {
465468
let mut owned_env = env_factory.get_env(epoch);
@@ -744,6 +747,9 @@ fn test_simple_contract_call(epoch: StacksEpochId, mut env_factory: MemoryEnviro
744747
}
745748
}
746749

750+
// Test not valid for clarity-wasm runtime
751+
// Contracts would error in the static analysis pass.
752+
#[cfg(not(feature = "clarity-wasm"))]
747753
#[apply(test_epochs)]
748754
fn test_aborts(epoch: StacksEpochId, mut env_factory: MemoryEnvironmentGenerator) {
749755
let mut owned_env = env_factory.get_env(epoch);

clarity/src/vm/tests/traits.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@ fn test_reentrant_dynamic_dispatch(
702702
}
703703
}
704704

705+
// Test not valid for clarity-wasm runtime
706+
// Contracts would error in the static analysis pass.
707+
#[cfg(not(feature = "clarity-wasm"))]
705708
#[apply(test_clarity_versions)]
706709
fn test_readwrite_dynamic_dispatch(
707710
version: ClarityVersion,
@@ -759,6 +762,9 @@ fn test_readwrite_dynamic_dispatch(
759762
}
760763
}
761764

765+
// Test not valid for clarity-wasm runtime
766+
// Contracts would error in the static analysis pass.
767+
#[cfg(not(feature = "clarity-wasm"))]
762768
#[apply(test_clarity_versions)]
763769
fn test_readwrite_violation_dynamic_dispatch(
764770
version: ClarityVersion,

stackslib/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ rlimit = "0.10.2"
9999
chrono = "0.4.19"
100100

101101
[features]
102-
default = []
102+
default = ["clarity-wasm"]
103103
profile-sqlite = []
104104
disable-costs = []
105105
developer-mode = ["clarity/developer-mode"]
106106
monitoring_prom = ["prometheus"]
107107
slog_json = ["stacks-common/slog_json", "clarity/slog_json", "pox-locking/slog_json"]
108108
testing = ["chrono"]
109+
clarity-wasm = []
109110

110111
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
111112
sha2 = { version = "0.10", features = ["asm"] }

stackslib/src/clarity_vm/tests/costs.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,12 +820,18 @@ fn epoch205_nfts(use_mainnet: bool) {
820820
);
821821
}
822822

823+
// Test not valid for clarity-wasm runtime
824+
// Contracts would error in the static analysis pass.
823825
#[test]
826+
#[cfg(not(feature = "clarity-wasm"))]
824827
fn epoch205_nfts_mainnet() {
825828
epoch205_nfts(true)
826829
}
827830

831+
// Test not valid for clarity-wasm runtime
832+
// Contracts would error in the static analysis pass.
828833
#[test]
834+
#[cfg(not(feature = "clarity-wasm"))]
829835
fn epoch205_nfts_testnet() {
830836
epoch205_nfts(false)
831837
}

stackslib/src/clarity_vm/tests/events.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ fn test_emit_stx_burn_nok() {
271271
assert!(events.is_empty());
272272
}
273273

274+
// Test not valid for clarity-wasm runtime
275+
// Contracts would error in the static analysis pass.
276+
#[cfg(not(feature = "clarity-wasm"))]
274277
#[test]
275278
fn test_emit_nested_print_nok() {
276279
let contract = "(define-public (emit-event-nok)
@@ -288,6 +291,23 @@ fn test_emit_nested_print_nok() {
288291
assert_eq!(events.len(), 1);
289292
}
290293

294+
#[test]
295+
fn test_emit_nested_print_nok_valid_contract() {
296+
let contract = "(define-public (emit-event-nok)
297+
(begin
298+
(print \"bar\")
299+
(err u1)))
300+
(define-public (emit-event-ok)
301+
(begin
302+
(unwrap-err! (emit-event-nok) (err u1))
303+
(print \"foo\")
304+
(ok u1)))";
305+
306+
let (value, events) = helper_execute(contract, "emit-event-ok");
307+
assert_eq!(value, Value::okay(Value::UInt(1)).unwrap());
308+
assert_eq!(events.len(), 1);
309+
}
310+
291311
#[test]
292312
fn test_emit_ft_transfer_ok() {
293313
let contract = "(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)

stackslib/src/clarity_vm/tests/forking.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ fn test_at_block_good(#[case] version: ClarityVersion, #[case] epoch: StacksEpoc
210210
);
211211
}
212212

213+
// Test not valid for clarity-wasm runtime
214+
// Contracts would error in the static analysis pass.
215+
#[cfg(not(feature = "clarity-wasm"))]
213216
#[apply(test_clarity_versions)]
214217
fn test_at_block_missing_defines(#[case] version: ClarityVersion, #[case] epoch: StacksEpochId) {
215218
fn initialize_1(owned_env: &mut OwnedEnvironment) {

0 commit comments

Comments
 (0)