Skip to content

Commit 5e5caf7

Browse files
committed
Merge branch 'feat/clarity-5' into fix/from-consensus-buff
2 parents 0bbd49a + 3d081c3 commit 5e5caf7

10 files changed

+44
-189
lines changed

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,25 @@ A test should be marked `#[ignore]` if:
386386
| `bitcoind` | tests requiring bitcoin daemon |
387387
| `flaky` | tests that exhibit flaky behavior |
388388

389+
- **Consensus tests use `insta` to record snapshots** and then compare results across runs to ensure that there are no accidental consensus changes.
390+
1. Install `insta`:
391+
392+
```bash
393+
cargo install cargo-insta
394+
```
395+
396+
2. Run snapshot tests with `insta`:
397+
398+
```bash
399+
cargo insta test -p stackslib --unreferenced=delete -- chainstate::tests --include-ignored
400+
```
401+
402+
3. Review/accept snapshot updates:
403+
404+
```bash
405+
cargo insta review
406+
```
407+
389408
## Formatting
390409

391410
PRs will be checked against `rustfmt` and will _fail_ if not properly formatted.

README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,6 @@ cargo nextest run
7979

8080
_On Windows, many tests will fail, mainly due to parallelism. To mitigate the issue you may need to run the tests individually._
8181

82-
**Install `insta` for snapshot tests:**
83-
84-
```bash
85-
cargo install cargo-insta
86-
```
87-
88-
**Run snapshot tests with `insta`:**
89-
90-
```bash
91-
cargo insta test
92-
```
93-
94-
**Review/accept snapshot updates:**
95-
96-
```bash
97-
cargo insta review
98-
```
99-
10082
## Run the testnet
10183

10284
You can observe the state machine in action locally by running:

clarity/src/vm/tests/proptest_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ use crate::vm::database::STXBalance;
4141
use crate::vm::errors::{ClarityEvalError, VmExecutionError};
4242
use crate::vm::{ClarityVersion, execute_with_parameters_and_call_in_global_context};
4343

44-
const DEFAULT_EPOCH: StacksEpochId = StacksEpochId::Epoch34;
45-
const DEFAULT_CLARITY_VERSION: ClarityVersion = ClarityVersion::Clarity5;
44+
const DEFAULT_EPOCH: StacksEpochId = StacksEpochId::latest();
45+
const DEFAULT_CLARITY_VERSION: ClarityVersion = ClarityVersion::latest();
4646
const INITIAL_BALANCE: u128 = 1_000_000_000;
4747
const UTF8_SNIPPET_MAX_SEGMENTS: usize = 16;
4848
const UTF8_SIMPLE_ESCAPES: [&str; 6] = ["\\\"", "\\\\", "\\n", "\\t", "\\r", "\\0"];

clarity/src/vm/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl fmt::Display for ClarityVersion {
3939
}
4040

4141
impl ClarityVersion {
42-
pub fn latest() -> ClarityVersion {
42+
pub const fn latest() -> ClarityVersion {
4343
ClarityVersion::Clarity4
4444
}
4545

stackslib/src/chainstate/nakamoto/coordinator/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,8 @@ fn block_info_tests(use_primary_testnet: bool) {
10731073
ClarityVersion::Clarity2 => panic!("Clarity2 not supported in this test"),
10741074
ClarityVersion::Clarity3 => &clar3_contract_id,
10751075
ClarityVersion::Clarity4 => &clar4_contract_id,
1076+
// Later versions of Clarity are just running the same code as Clarity4 for now
1077+
// so it's not necessary to test them all individually here.
10761078
ClarityVersion::Clarity5 => panic!("Clarity5 not supported in this test"),
10771079
};
10781080
peer.with_db_state(|sortdb, chainstate, _, _| {

stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_1_tuple_only_parsing_latest_limit.snap

Lines changed: 0 additions & 42 deletions
This file was deleted.

stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_2_list_only_parsing_latest_limit.snap

Lines changed: 0 additions & 42 deletions
This file was deleted.

stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_3_list_only_checker_latest_limit.snap

Lines changed: 0 additions & 42 deletions
This file was deleted.

stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__vary_stack_depth_too_deep_checker_latest_limit.snap

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)