diff --git a/clarity/src/vm/ast/definition_sorter/mod.rs b/clarity/src/vm/ast/definition_sorter/mod.rs index 153914110f3..a684d68e9cd 100644 --- a/clarity/src/vm/ast/definition_sorter/mod.rs +++ b/clarity/src/vm/ast/definition_sorter/mod.rs @@ -90,7 +90,7 @@ impl DefinitionSorter { let sorted_indexes = walker.get_sorted_dependencies(&self.graph); if let Some(deps) = walker.get_cycling_dependencies(&self.graph, &sorted_indexes) { - let functions_names = deps + let mut function_names = deps .into_iter() .filter_map(|i| { let exp = &contract_ast.pre_expressions[i]; @@ -99,7 +99,10 @@ impl DefinitionSorter { .map(|i| i.0.to_string()) .collect::>(); - let error = ParseError::new(ParseErrorKind::CircularReference(functions_names)); + // Sorting function names to make the error contents deterministic + function_names.sort(); + + let error = ParseError::new(ParseErrorKind::CircularReference(function_names)); return Err(error); } diff --git a/clarity/src/vm/ast/mod.rs b/clarity/src/vm/ast/mod.rs index 1947a5c602d..b09de172e6d 100644 --- a/clarity/src/vm/ast/mod.rs +++ b/clarity/src/vm/ast/mod.rs @@ -238,6 +238,7 @@ pub fn build_ast( mod test { use std::collections::HashMap; + use clarity_types::types::MAX_VALUE_SIZE; use stacks_common::types::StacksEpochId; use crate::vm::ast::build_ast; @@ -447,4 +448,141 @@ mod test { } } } + + #[test] + fn test_build_ast_error_exceeding_cost_balance_due_to_ast_parse() { + let limit = ExecutionCost { + read_count: u64::MAX, + write_count: u64::MAX, + read_length: u64::MAX, + write_length: u64::MAX, + runtime: 1, + }; + let mut tracker = LimitedCostTracker::new_with_limit(StacksEpochId::Epoch33, limit); + + let err = build_ast( + &QualifiedContractIdentifier::transient(), + "(define-constant my-const u1)", + &mut tracker, + ClarityVersion::Clarity4, + StacksEpochId::Epoch33, + ) + .unwrap_err(); + + assert!( + matches!(*err.err, ParseErrorKind::CostBalanceExceeded(_, _)), + "Instead found: {err}" + ); + } + + #[test] + fn test_build_ast_error_exceeding_cost_balance_due_to_ast_cycle_detection_with_0_edges() { + let expected_ast_parse_cost = 1215; + let expected_cycle_det_cost = 72; + let expected_total = expected_ast_parse_cost + expected_cycle_det_cost; + + let limit = ExecutionCost { + read_count: u64::MAX, + write_count: u64::MAX, + read_length: u64::MAX, + write_length: u64::MAX, + runtime: expected_ast_parse_cost, + }; + let mut tracker = LimitedCostTracker::new_with_limit(StacksEpochId::Epoch33, limit); + + let err = build_ast( + &QualifiedContractIdentifier::transient(), + "(define-constant a 0)(define-constant b 1)", // no dependency = 0 graph edge + &mut tracker, + ClarityVersion::Clarity4, + StacksEpochId::Epoch33, + ) + .expect_err("Expected parse error, but found success!"); + + let total = match *err.err { + ParseErrorKind::CostBalanceExceeded(total, _) => total, + _ => panic!("Expected CostBalanceExceeded, but found: {err}"), + }; + + assert_eq!(expected_total, total.runtime); + } + + #[test] + fn test_build_ast_error_exceeding_cost_balance_due_to_ast_cycle_detection_with_1_edge() { + let expected_ast_parse_cost = 1215; + let expected_cycle_det_cost = 213; + let expected_total = expected_ast_parse_cost + expected_cycle_det_cost; + + let limit = ExecutionCost { + read_count: u64::MAX, + write_count: u64::MAX, + read_length: u64::MAX, + write_length: u64::MAX, + runtime: expected_ast_parse_cost, + }; + let mut tracker = LimitedCostTracker::new_with_limit(StacksEpochId::Epoch33, limit); + + let err = build_ast( + &QualifiedContractIdentifier::transient(), + "(define-constant a 0)(define-constant b a)", // 1 dependency = 1 graph edge + &mut tracker, + ClarityVersion::Clarity4, + StacksEpochId::Epoch33, + ) + .expect_err("Expected parse error, but found success!"); + + let total = match *err.err { + ParseErrorKind::CostBalanceExceeded(total, _) => total, + _ => panic!("Expected CostBalanceExceeded, but found: {err}"), + }; + + assert_eq!(expected_total, total.runtime); + } + + #[test] + fn test_build_ast_error_vary_stack_too_deep() { + // This contract pass the parse v2 MAX_NESTING_DEPTH but fails the [`VaryStackDepthChecker`] + let contract = { + let count = AST_CALL_STACK_DEPTH_BUFFER + (MAX_CALL_STACK_DEPTH as u64) - 1; + let body_start = "(list ".repeat(count as usize); + let body_end = ")".repeat(count as usize); + format!("{{ a: {body_start}u1 {body_end} }}") + }; + + let err = build_ast( + &QualifiedContractIdentifier::transient(), + &contract, + &mut (), + ClarityVersion::Clarity4, + StacksEpochId::Epoch33, + ) + .expect_err("Expected parse error, but found success!"); + + assert!( + matches!(*err.err, ParseErrorKind::VaryExpressionStackDepthTooDeep), + "Instead found: {err}" + ); + } + + #[test] + fn test_build_ast_error_illegal_ascii_string_due_to_size() { + let contract = { + let string = "a".repeat(MAX_VALUE_SIZE as usize + 1); + format!("(define-constant my-str \"{string}\")") + }; + + let err = build_ast( + &QualifiedContractIdentifier::transient(), + &contract, + &mut (), + ClarityVersion::Clarity4, + StacksEpochId::Epoch33, + ) + .expect_err("Expected parse error, but found success!"); + + assert!( + matches!(*err.err, ParseErrorKind::IllegalASCIIString(_)), + "Instead found: {err}" + ); + } } diff --git a/clarity/src/vm/ast/parser/v2/mod.rs b/clarity/src/vm/ast/parser/v2/mod.rs index 25522173471..6a3e12fbf60 100644 --- a/clarity/src/vm/ast/parser/v2/mod.rs +++ b/clarity/src/vm/ast/parser/v2/mod.rs @@ -896,6 +896,12 @@ impl<'a> Parser<'a> { match Value::string_ascii_from_bytes(val.clone().into_bytes()) { Ok(s) => PreSymbolicExpression::atom_value(s), Err(_) => { + // Protect against console flooding and process hanging while running tests, + // using a purely arbitrary max chars limit. + // NOTE: A better place for this would be the enum itself, but then we need to write a custom Debug implementation + #[cfg(any(test, feature = "testing"))] + let val = ellipse_string_for_test(val, 128); + self.add_diagnostic( ParseErrorKind::IllegalASCIIString(val.clone()), token.span.clone(), @@ -1131,6 +1137,25 @@ pub fn parse_collect_diagnostics( (stmts, diagnostics, parser.success) } +/// Test helper function to shorten big strings while running tests +/// +/// This prevents both: +/// - Console flooding with multi-megabyte output during test runs. +/// - Potential test process blocking or hanging due to stdout buffering limits. +/// +/// In case a the input `string` need to be shortned based on `max_chars`, +/// the resulting string will be ellipsed showing the original character count. +#[cfg(any(test, feature = "testing"))] +fn ellipse_string_for_test(string: &str, max_chars: usize) -> String { + let char_count = string.chars().count(); + if char_count <= max_chars { + string.into() + } else { + let shortened: String = string.chars().take(max_chars).collect(); + format!("{shortened}...[{char_count}]") + } +} + #[cfg(test)] #[cfg(feature = "developer-mode")] mod tests { diff --git a/clarity/src/vm/costs/mod.rs b/clarity/src/vm/costs/mod.rs index e19be42348f..451e8768314 100644 --- a/clarity/src/vm/costs/mod.rs +++ b/clarity/src/vm/costs/mod.rs @@ -854,6 +854,49 @@ impl LimitedCostTracker { }; Ok(result) } + + /// Create a [`LimitedCostTracker`] given an epoch id and an execution cost limit for testing purpose + /// + /// Autoconfigure itself loading all clarity const functions without the need of passing a clarity database + #[cfg(any(test, feature = "testing"))] + pub fn new_with_limit(epoch_id: StacksEpochId, limit: ExecutionCost) -> LimitedCostTracker { + use stacks_common::consts::CHAIN_ID_TESTNET; + + let contract_name = LimitedCostTracker::default_cost_contract_for_epoch(epoch_id) + .expect("Failed retrieving cost contract!"); + let boot_costs_id = boot_code_id(&contract_name, false); + + let version = DefaultVersion::try_from(false, &boot_costs_id) + .expect("Failed defining default version!"); + + let mut cost_functions = HashMap::new(); + for each in ClarityCostFunction::ALL { + let evaluator = ClarityCostFunctionEvaluator::Default( + ClarityCostFunctionReference { + contract_id: boot_costs_id.clone(), + function_name: each.get_name(), + }, + each.clone(), + version, + ); + cost_functions.insert(each, evaluator); + } + + let cost_tracker = TrackerData { + cost_function_references: cost_functions, + cost_contracts: HashMap::new(), + contract_call_circuits: HashMap::new(), + limit, + memory_limit: CLARITY_MEMORY_LIMIT, + total: ExecutionCost::ZERO, + memory: 0, + epoch: epoch_id, + mainnet: false, + chain_id: CHAIN_ID_TESTNET, + }; + + LimitedCostTracker::Limited(cost_tracker) + } } impl TrackerData { diff --git a/stackslib/src/chainstate/tests/consensus.rs b/stackslib/src/chainstate/tests/consensus.rs index 3463de7238d..c0ed5d346a2 100644 --- a/stackslib/src/chainstate/tests/consensus.rs +++ b/stackslib/src/chainstate/tests/consensus.rs @@ -24,10 +24,9 @@ use clarity::types::chainstate::{ use clarity::types::{EpochList, StacksEpoch, StacksEpochId}; use clarity::util::hash::{MerkleTree, Sha512Trunc256Sum}; use clarity::util::secp256k1::MessageSignature; -use clarity::vm::ast::stack_depth_checker::AST_CALL_STACK_DEPTH_BUFFER; use clarity::vm::costs::ExecutionCost; use clarity::vm::types::PrincipalData; -use clarity::vm::{ClarityVersion, Value as ClarityValue, MAX_CALL_STACK_DEPTH}; +use clarity::vm::{ClarityVersion, Value as ClarityValue}; use serde::{Deserialize, Serialize, Serializer}; use stacks_common::bitvec::BitVec; @@ -51,7 +50,7 @@ use crate::net::tests::NakamotoBootPlan; /// The epochs to test for consensus are the current and upcoming epochs. /// This constant must be changed when new epochs are introduced. /// Note that contract deploys MUST be done in each epoch >= 2.0. -const EPOCHS_TO_TEST: &[StacksEpochId] = &[StacksEpochId::Epoch33]; +pub const EPOCHS_TO_TEST: &[StacksEpochId] = &[StacksEpochId::Epoch33]; pub const SK_1: &str = "a1289f6438855da7decf9b61b852c882c398cff1446b2a0f823538aa2ebef92e01"; pub const SK_2: &str = "4ce9a8f7539ea93753a36405b16e8b57e15a552430410709c2b6d65dca5c02e201"; @@ -67,7 +66,7 @@ const FOO_CONTRACT: &str = "(define-public (foo) (ok 1)) (define-public (bar (x uint)) (ok x))"; /// Returns the list of Clarity versions that can be used to deploy contracts in the given epoch. -const fn clarity_versions_for_epoch(epoch: StacksEpochId) -> &'static [ClarityVersion] { +pub const fn clarity_versions_for_epoch(epoch: StacksEpochId) -> &'static [ClarityVersion] { match epoch { StacksEpochId::Epoch10 => &[], StacksEpochId::Epoch20 | StacksEpochId::Epoch2_05 => &[ClarityVersion::Clarity1], @@ -782,7 +781,7 @@ impl ConsensusTest<'_> { /// - Block counts per epoch are precomputed /// - Epoch order is finalized /// - Transaction sequencing is fully planned -struct ContractConsensusTest<'a> { +pub struct ContractConsensusTest<'a> { /// Factory for generating signed, nonce-managed transactions. tx_factory: TestTxFactory, /// Underlying chainstate used for block execution and consensus checks. @@ -1246,7 +1245,7 @@ impl TestTxFactory { } } -/// Generates a consensus test for executing a contract function across multiple Stacks epochs. +/// Generates a consensus test body for executing a contract function across multiple Stacks epochs. /// /// This macro automates both contract deployment and function invocation across different /// epochs and Clarity versions. @@ -1263,28 +1262,28 @@ impl TestTxFactory { /// /// # Arguments /// -/// * `$name` — Name of the generated test function. /// * `contract_name` — The name of the contract. /// * `contract_code` — The Clarity source code for the contract. /// * `function_name` — The public function to call. /// * `function_args` — Function arguments, provided as a slice of [`ClarityValue`]. -/// * `deploy_epochs` — *(optional)* Epochs in which to deploy the contract. Defaults to all epochs ≥ 2.0. +/// * `deploy_epochs` — *(optional)* Epochs in which to deploy the contract. Defaults to all epochs ≥ 3.0. /// * `call_epochs` — *(optional)* Epochs in which to call the function. Defaults to [`EPOCHS_TO_TEST`]. /// /// # Example /// /// ```rust,ignore -/// contract_call_consensus_test!( -/// my_test, -/// contract_name: "my-contract", -/// contract_code: "(define-public (get-message) (ok \"hello\"))", -/// function_name: "get-message", -/// function_args: &[], -/// ); +/// #[test] +/// fn test_my_contract_call_consensus() { +/// contract_call_consensus_test!( +/// contract_name: "my-contract", +/// contract_code: "(define-public (get-message) (ok \"hello\"))", +/// function_name: "get-message", +/// function_args: &[], +/// ); +/// } /// ``` macro_rules! contract_call_consensus_test { ( - $name:ident, contract_name: $contract_name:expr, contract_code: $contract_code:expr, function_name: $function_name:expr, @@ -1292,16 +1291,15 @@ macro_rules! contract_call_consensus_test { $(deploy_epochs: $deploy_epochs:expr,)? $(call_epochs: $call_epochs:expr,)? ) => { - #[test] - fn $name() { - // Handle deploy_epochs parameter (default to all epochs >= 2.0 if not provided) - let deploy_epochs = &StacksEpochId::ALL[1..]; + { + // Handle deploy_epochs parameter (default to all epochs >= 2.0 if not provided) + let deploy_epochs = &clarity::types::StacksEpochId::ALL[1..]; $(let deploy_epochs = $deploy_epochs;)? // Handle call_epochs parameter (default to EPOCHS_TO_TEST if not provided) - let call_epochs = EPOCHS_TO_TEST; + let call_epochs = $crate::chainstate::tests::consensus::EPOCHS_TO_TEST; $(let call_epochs = $call_epochs;)? - let contract_test = ContractConsensusTest::new( + let contract_test = $crate::chainstate::tests::consensus::ContractConsensusTest::new( function_name!(), vec![], deploy_epochs, @@ -1316,8 +1314,9 @@ macro_rules! contract_call_consensus_test { } }; } +pub(crate) use contract_call_consensus_test; -/// Generates a consensus test for contract deployment across multiple Stacks epochs. +/// Generates a consensus test body for contract deployment across multiple Stacks epochs. /// /// This macro automates deploying a contract across different Stacks epochs and /// Clarity versions. It is primarily used for consensus-critical testing of contract @@ -1332,7 +1331,6 @@ macro_rules! contract_call_consensus_test { /// /// # Arguments /// -/// * `$name` — Name of the generated test function. /// * `contract_name` — Name of the contract being tested. /// * `contract_code` — The Clarity source code of the contract. /// * `deploy_epochs` — *(optional)* Epochs in which to deploy the contract. Defaults to [`EPOCHS_TO_TEST`]. @@ -1340,34 +1338,33 @@ macro_rules! contract_call_consensus_test { /// # Example /// /// ```rust,ignore -/// contract_deploy_consensus_test!( -/// deploy_test, -/// contract_name: "my-contract", -/// contract_code: "(define-public (init) (ok true))", -/// ); +/// #[test] +/// fn test_my_contract_deploy_consensus() { +/// contract_deploy_consensus_test!( +/// deploy_test, +/// contract_name: "my-contract", +/// contract_code: "(define-public (init) (ok true))", +/// ); +/// } /// ``` macro_rules! contract_deploy_consensus_test { // Handle the case where deploy_epochs is not provided ( - $name:ident, contract_name: $contract_name:expr, contract_code: $contract_code:expr, ) => { contract_deploy_consensus_test!( - $name, contract_name: $contract_name, contract_code: $contract_code, - deploy_epochs: EPOCHS_TO_TEST, + deploy_epochs: $crate::chainstate::tests::consensus::EPOCHS_TO_TEST, ); }; ( - $name:ident, contract_name: $contract_name:expr, contract_code: $contract_code:expr, deploy_epochs: $deploy_epochs:expr, ) => { - contract_call_consensus_test!( - $name, + $crate::chainstate::tests::consensus::contract_call_consensus_test!( contract_name: $contract_name, contract_code: $contract_code, function_name: "", // No function calls, just deploys @@ -1377,6 +1374,44 @@ macro_rules! contract_deploy_consensus_test { ); }; } +pub(crate) use contract_deploy_consensus_test; + +// Just a namespace for utilities for writing consensus tests +pub struct ConsensusUtils; + +impl ConsensusUtils { + pub fn new_deploy_tx( + nonce: u64, + contract_name: &str, + contract_code: &str, + clarity_version: Option, + ) -> StacksTransaction { + let deploy_tx = make_contract_publish_versioned( + &FAUCET_PRIV_KEY, + nonce, + contract_code.len() as u64 * 100, + CHAIN_ID_TESTNET, + contract_name, + contract_code, + clarity_version, + ); + StacksTransaction::consensus_deserialize(&mut deploy_tx.as_slice()).unwrap() + } + + pub fn new_call_tx(nonce: u64, contract_name: &str, funct_name: &str) -> StacksTransaction { + let call_tx = make_contract_call( + &FAUCET_PRIV_KEY, + nonce, + 200, + CHAIN_ID_TESTNET, + &to_addr(&FAUCET_PRIV_KEY), + contract_name, + funct_name, + &[], + ); + StacksTransaction::consensus_deserialize(&mut call_tx.as_slice()).unwrap() + } +} #[test] fn test_append_empty_blocks() { @@ -1439,27 +1474,25 @@ fn test_append_stx_transfers_success() { insta::assert_ron_snapshot!(result); } -// Example of using the `contract_call_consensus_test!` macro -// Deploys a contract to each epoch, for each Clarity version, -// then calls a function in that contract and snapshots the results. -contract_call_consensus_test!( - successfully_deploy_and_call, - contract_name: "foo_contract", - contract_code: FOO_CONTRACT, - function_name: "bar", - function_args: &[ClarityValue::UInt(1)], -); - -// Example of using the `contract_deploy_consensus_test!` macro -// Deploys a contract that exceeds the maximum allowed stack depth -// and verifies that deployment fails with the expected error. -contract_deploy_consensus_test!( - chainstate_error_expression_stack_depth_too_deep, - contract_name: "test-exceeds", - contract_code: &{ - let exceeds_repeat_factor = AST_CALL_STACK_DEPTH_BUFFER + (MAX_CALL_STACK_DEPTH as u64); - let tx_exceeds_body_start = "{ a : ".repeat(exceeds_repeat_factor as usize); - let tx_exceeds_body_end = "} ".repeat(exceeds_repeat_factor as usize); - format!("{tx_exceeds_body_start}u1 {tx_exceeds_body_end}") - }, -); +/// Example of using the `contract_call_consensus_test!` macro +/// Deploys a contract to each epoch, for each Clarity version, +/// then calls a function in that contract and snapshots the results. +#[test] +fn test_successfully_deploy_and_call() { + contract_call_consensus_test!( + contract_name: "foo_contract", + contract_code: FOO_CONTRACT, + function_name: "bar", + function_args: &[ClarityValue::UInt(1)], + ); +} + +/// Example of using the `contract_deploy_consensus_test!` macro +/// Deploys a contract to all epoch, for each Clarity version +#[test] +fn test_successfully_deploy() { + contract_deploy_consensus_test!( + contract_name: "foo_contract", + contract_code: FOO_CONTRACT, + ); +} diff --git a/stackslib/src/chainstate/tests/mod.rs b/stackslib/src/chainstate/tests/mod.rs index 02df4fefc24..5cc9d90523a 100644 --- a/stackslib/src/chainstate/tests/mod.rs +++ b/stackslib/src/chainstate/tests/mod.rs @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . pub mod consensus; +mod parse_tests; use std::fs; diff --git a/stackslib/src/chainstate/tests/parse_tests.rs b/stackslib/src/chainstate/tests/parse_tests.rs new file mode 100644 index 00000000000..c5aae11701a --- /dev/null +++ b/stackslib/src/chainstate/tests/parse_tests.rs @@ -0,0 +1,547 @@ +// Copyright (C) 2025 Stacks Open Internet Foundation +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! This module contains consensus tests related to Clarity Parse errors. + +use std::collections::HashMap; + +use clarity::vm::ast::errors::ParseErrorKind; +use clarity::vm::ast::parser::v2::{MAX_CONTRACT_NAME_LEN, MAX_NESTING_DEPTH, MAX_STRING_LEN}; +use clarity::vm::ast::stack_depth_checker::AST_CALL_STACK_DEPTH_BUFFER; +use clarity::vm::types::MAX_VALUE_SIZE; +use clarity::vm::MAX_CALL_STACK_DEPTH; + +use crate::chainstate::tests::consensus::{ + clarity_versions_for_epoch, contract_deploy_consensus_test, ConsensusTest, ConsensusUtils, + TestBlock, EPOCHS_TO_TEST, +}; +use crate::core::BLOCK_LIMIT_MAINNET_21; + +/// Generates a coverage classification report for a specific [`ParseErrorKind`] variant. +/// +/// This method exists purely for **documentation and tracking purposes**. +/// It helps maintainers understand which error variants have been: +/// +/// - ✅ **Tested** — verified through consensus tests. +/// - ⚙️ **Ignored** — not tested on purpose. (e.g. parser v1 errors). +/// - 🚫 **Unreachable** — not testable from consensus test side for reasons. +#[allow(dead_code)] +fn variant_coverage_report(variant: ParseErrorKind) { + enum VariantCoverage { + // Cannot occur through valid execution. The string is to explain the reason. + Unreachable_Functionally(&'static str), + // Unexpected error, that should never happen + Unreachable_ExpectLike, + // Defined but never used + Unreachable_NotUsed, + // Not tested on purpose. The string is to explain the reason. + Ignored(&'static str), + // Covered by consensus tests. The func lists is for to link the variant with the related tests + Tested(Vec), + } + + use ParseErrorKind::*; + use VariantCoverage::*; + + _ = match variant { + // Costs + CostOverflow => Unreachable_ExpectLike, + CostBalanceExceeded(_, _) => Tested(vec![test_cost_balance_exceeded]), + MemoryBalanceExceeded(_, _) => Unreachable_NotUsed, + CostComputationFailed(_) => Unreachable_ExpectLike, + ExecutionTimeExpired => Unreachable_NotUsed, + + TooManyExpressions => Unreachable_ExpectLike, + ExpressionStackDepthTooDeep => Tested(vec![ + test_stack_depth_too_deep_case_2_list_only_parsing, + test_stack_depth_too_deep_case_2_list_only_parsing, + test_stack_depth_too_deep_case_3_list_only_checker, + ]), + VaryExpressionStackDepthTooDeep => Tested(vec![test_vary_stack_depth_too_deep_checker]), + FailedParsingIntValue(_) => Tested(vec![test_failed_parsing_int_value]), + CircularReference(_) => Tested(vec![test_circular_reference]), + NameAlreadyUsed(_) => Tested(vec![test_named_already_used]), + TraitReferenceNotAllowed => Tested(vec![test_trait_ref_not_allowed]), + ImportTraitBadSignature => Tested(vec![test_import_trait_bad_signature]), + DefineTraitBadSignature => Tested(vec![test_define_trait_bad_signature]), + ImplTraitBadSignature => Tested(vec![test_impl_trait_bad_signature]), + TraitReferenceUnknown(_) => Tested(vec![test_trait_reference_unknown]), + Lexer(LexerError) => Tested(vec![test_lexer_unknown_symbol]), + ContractNameTooLong(String) => Tested(vec![test_contract_name_too_long]), + ExpectedClosing(Token) => Tested(vec![test_expected_closing]), + ExpectedContractIdentifier => Tested(vec![test_expected_contract_identifier]), + ExpectedTraitIdentifier => Tested(vec![test_expected_trait_identifier]), + ExpectedWhitespace => Tested(vec![test_expected_white_space]), + FailedParsingUIntValue(_) => Tested(vec![test_failed_parsing_uint_value]), + IllegalTraitName(_) => Unreachable_Functionally("prevented by Lexer checks returning `Lexer` variant"), + InvalidPrincipalLiteral => Tested(vec![test_invalid_principal_literal]), + InvalidBuffer => Unreachable_Functionally("prevented by both Lexer checks, and StacksTransaction::consensus_serialize with MAX_TRANSACTION_LEN (panic)"), + NameTooLong(_) => Tested(vec![test_name_too_long]), + UnexpectedToken(_) => Tested(vec![test_unexpected_token]), + TupleColonExpectedv2 => Tested(vec![test_tuple_colon_expected_v2]), + TupleCommaExpectedv2 => Tested(vec![test_tuple_comma_expected_v2]), + TupleValueExpected => Tested(vec![test_tuple_value_expected]), + IllegalClarityName(_) => Unreachable_Functionally("prevented by Lexer checks returning `Lexer` variant"), + IllegalASCIIString(_) => Tested(vec![test_illegal_ascii_string]), + IllegalContractName(_) => Unreachable_Functionally("prevented by Lexer checks returning `Lexer` variant or Parser by MAX_CONTRACT_NAME_LEN returning `ContractNameTooLong` variant"), + NoteToMatchThis(_) => Unreachable_Functionally("It is reachable, but only visible in diagnostic mode as it comes as a later diagnostic error"), + UnexpectedParserFailure => Unreachable_ExpectLike, + InterpreterFailure => Unreachable_ExpectLike, // currently cause block rejection + + // V1 + FailedCapturingInput + | SeparatorExpected(_) + | SeparatorExpectedAfterColon(_) + | ProgramTooLarge + | IllegalVariableName(_) + | FailedParsingBuffer(_) + | FailedParsingHexValue(_, _) + | FailedParsingPrincipal(_) + | FailedParsingField(_) + | FailedParsingRemainder(_) + | ClosingParenthesisUnexpected + | ClosingParenthesisExpected + | ClosingTupleLiteralUnexpected + | ClosingTupleLiteralExpected + | TupleColonExpected(_) + | TupleCommaExpected(_) + | TupleItemExpected(_) + | CommaSeparatorUnexpected + | ColonSeparatorUnexpected + | InvalidCharactersDetected + | InvalidEscaping => Ignored("parser v1 is deprecated and maybe removed in the next future."), + } +} + +/// ParserError: [`ParseErrorKind::CostBalanceExceeded`] +/// Caused by: exceeding runtime cost limit [`BLOCK_LIMIT_MAINNET_21`] during contract deploy parsing +/// Outcome: block rejected +/// Note: This cost error is remapped as [`crate::chainstate::stacks::Error::CostOverflowError`] +#[test] +fn test_cost_balance_exceeded() { + const RUNTIME_LIMIT: u64 = BLOCK_LIMIT_MAINNET_21.runtime as u64; + // Arbitrary parameters determined through empirical testing + const CONTRACT_FUNC_INVOCATIONS: u64 = 29_022; + const CALL_RUNTIME_COST: u64 = 249_996_284; + const CALLS_NEEDED: u64 = RUNTIME_LIMIT / CALL_RUNTIME_COST - 1; + + let costly_contract_code = { + let mut code = String::from( + "(define-constant msg 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f)\n\ + (define-constant sig 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f40)\n\ + (define-constant key 0xfffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0df)\n\ + (define-read-only (costly-func)\n (begin\n", + ); + for _ in 0..CONTRACT_FUNC_INVOCATIONS { + code.push_str(" (secp256k1-verify msg sig key)\n"); + } + code.push_str(" true))"); + code + }; + + let large_contract_code = &{ + let mut code = String::new(); + for i in 0..50_000u64 { + code.push_str(&format!("(define-public (gen-fn-{i}) (ok {i}))\n", i = i)); + } + code + }; + + let mut result = vec![]; + for each_epoch in EPOCHS_TO_TEST { + for &each_clarity_ver in clarity_versions_for_epoch(*each_epoch) { + let mut nonce = 0; + let mut txs = vec![]; + + // Create a contract that will be costly to execute + txs.push(ConsensusUtils::new_deploy_tx( + nonce, + "costly-contract", + &costly_contract_code, + None, + )); + + // Create contract calls that push the runtime cost to a considerably high value + while nonce < CALLS_NEEDED { + nonce += 1; + txs.push(ConsensusUtils::new_call_tx( + nonce, + "costly-contract", + "costly-func", + )); + } + + // Create a large contract that push the runtime cost close to the limit + nonce += 1; + txs.push(ConsensusUtils::new_deploy_tx( + nonce, + "runtime-close", + large_contract_code, + None, + )); + + // Create a large contract that exceeds the runtime cost limit during parsing + // NOTE: This is the only transaction relevant for demonstrating the runtime cost exceeding the limit during parsing. + // Previous transactions are included only for test setup. Hence, clarity version is used here. + nonce += 1; + txs.push(ConsensusUtils::new_deploy_tx( + nonce, + "runtime-exceeded", + large_contract_code, + Some(each_clarity_ver), + )); + + let block = TestBlock { transactions: txs }; + + let epoch_blocks = HashMap::from([(*each_epoch, vec![block])]); + + let each_result = ConsensusTest::new(function_name!(), vec![], epoch_blocks).run(); + result.extend(each_result); + } + } + + insta::assert_ron_snapshot!(result); +} + +/// ParserError: [`ParseErrorKind::ExpressionStackDepthTooDeep`] +/// Caused by: nested contract body exceeding stack depth limit on parsing tuples +/// Outcome: block rejected +#[test] +fn test_stack_depth_too_deep_case_1_tuple_only_parsing() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: &{ + // In parse v2, open brace '{' have a stack count of 2. + let count = MAX_NESTING_DEPTH / 2 + 1; + let body_start = "{ a : ".repeat(count as usize); + let body_end = "} ".repeat(count as usize); + format!("{body_start}u1 {body_end}") + }, + ); +} + +/// ParserError: [`ParseErrorKind::ExpressionStackDepthTooDeep`] +/// Caused by: nested contract body exceeding stack depth limit on parsing lists +/// Outcome: block rejected +#[test] +fn test_stack_depth_too_deep_case_2_list_only_parsing() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: &{ + // In parse v2, open parenthesis '(' have a stack count of 1. + let count = MAX_NESTING_DEPTH; + let body_start = "(list ".repeat(count as usize); + let body_end = ")".repeat(count as usize); + format!("{body_start}u1 {body_end}") + }, + ); +} + +/// ParserError: [`ParseErrorKind::ExpressionStackDepthTooDeep`] +/// Caused by: nested contract body exceeding stack depth limit on checking lists ast +/// Outcome: block rejected +#[test] +fn test_stack_depth_too_deep_case_3_list_only_checker() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: &{ + // In parse v2, open parenthesis '(' have a stack count of 1. + let count = AST_CALL_STACK_DEPTH_BUFFER + MAX_CALL_STACK_DEPTH as u64; + let body_start = "(list ".repeat(count as usize); + let body_end = ")".repeat(count as usize); + format!("{body_start}u1 {body_end}") + }, + ); +} + +/// ParserError: [`ParseErrorKind::VaryExpressionStackDepthTooDeep`] +/// Caused by: nested contract body exceeding stack depth limit on checking vary list/tuple ast +/// Outcome: block rejected +#[test] +fn test_vary_stack_depth_too_deep_checker() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: &{ + let count = AST_CALL_STACK_DEPTH_BUFFER + (MAX_CALL_STACK_DEPTH as u64) - 1; + let body_start = "(list ".repeat(count as usize); + let body_end = ")".repeat(count as usize); + format!("{{ a: {body_start}u1 {body_end} }}") + }, + ); +} + +/// ParserError: [`ParseErrorKind::FailedParsingIntValue`] +/// Caused by: number bigger than i128 +/// Outcome: block accepted +#[test] +fn test_failed_parsing_int_value() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-data-var my-int int 340282366920938463463374607431768211455)", + ); +} + +/// ParserError [`ParseErrorKind::FailedParsingUIntValue`] +/// Caused by: number bigger than u128 +/// Outcome: block accepted +#[test] +fn test_failed_parsing_uint_value() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-data-var my-uint uint u999340282366920938463463374607431768211455)", + ); +} + +/// ParserError [`ParseErrorKind::CircularReference`] +/// Caused by: interdependent functions +/// Outcome: block accepted +#[test] +fn test_circular_reference() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: " + (define-constant my-a my-b) + (define-constant my-b my-a) + ", + ); +} + +/// ParserError [`ParseErrorKind::NameAlreadyUsed`] +/// Caused by: trait name conflicts only +/// Outcome: block accepted +#[test] +fn test_named_already_used() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: " + (define-trait trait-1 ( + (get-1 (uint) (response uint uint)))) + (define-trait trait-1 ( + (get-1 (int) (response uint uint)))) + ", + ); +} + +/// ParserError [`ParseErrorKind::TraitReferenceNotAllowed`] +/// Caused by: trait reference can not be stored +/// Outcome: block accepted +#[test] +fn test_trait_ref_not_allowed() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: " + (define-trait trait-1 ( + (get-1 (uint) (response uint uint)))) + (define-map kv-store { key: uint } { value: }) + ", + ); +} + +/// ParserError [`ParseErrorKind::ImportTraitBadSignature`] +/// Caused by: trait import with bad signature (missing trait name or identifier) +/// Outcome: block accepted +#[test] +fn test_import_trait_bad_signature() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(use-trait)", + ); +} + +/// ParserError [`ParseErrorKind::DefineTraitBadSignature`] +/// Caused by: trait define with bad signature (missing trait name or definition) +/// Outcome: block accepted +#[test] +fn test_define_trait_bad_signature() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-trait)", + ); +} + +/// ParserError [`ParseErrorKind::ImplTraitBadSignature`] +/// Caused by: trait implementation with bad signature (missing trait identifier) +/// Outcome: block accepted +#[test] +fn test_impl_trait_bad_signature() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(impl-trait)", + ); +} + +/// ParserError [`ParseErrorKind::TraitReferenceUnknown`] +/// Caused by: referencing an undeclared trait +/// Outcome: block accepted +#[test] +fn test_trait_reference_unknown() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(+ 1 )", + ); +} + +/// ParserError: [`ParseErrorKind::Lexer`] +/// Caused by: unknown symbol +/// Outcome: block accepted +#[test] +fn test_lexer_unknown_symbol() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-data-var my-uint uint _)", + ); +} + +/// ParserError: [`ParseErrorKind::ExpectedClosing`] +/// Caused by: missing closing parenthesis +/// Outcome: block accepted +#[test] +fn test_expected_closing() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(", + ); +} + +/// ParserError: [`ParseErrorKind::ExpectedWhitespace`] +/// Caused by: missing space before expression +/// Outcome: block accepted +#[test] +fn test_expected_white_space() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + //miss space between (get-one) and (ok u1) + contract_code: "(define-public (get-one)(ok u1))", + ); +} + +/// ParserError: [`ParseErrorKind::UnexpectedToken`] +/// Caused by: unexpected token in the expression (rightest paranthesis) +/// Outcome: block accepted +#[test] +fn test_unexpected_token() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-public (get-one) (ok u1)) )", + ); +} + +/// ParserError: [`ParseErrorKind::NameTooLong`] +/// Caused by: identifier longer than [`MAX_STRING_LEN`] +/// Outcome: block accepted +#[test] +fn test_name_too_long() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: &{ + let name = "n".repeat(MAX_STRING_LEN + 1); + format!("(define-public ({name}) (ok u1))") + }, + ); +} + +/// ParserError: [`ParseErrorKind::InvalidPrincipalLiteral`] +/// Caused by: valid principal chars but wrong format (due to the starting "AAA") +/// Outcome: block accepted +#[test] +fn test_invalid_principal_literal() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-constant my-principal 'AAAST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA)", + ); +} + +/// ParserError: [`ParseErrorKind::ExpectedContractIdentifier`] +/// Caused by: missing name in contract identifier (nothing after the dot '.') +/// Outcome: block accepted +#[test] +fn test_expected_contract_identifier() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-constant my-contract-id 'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.)", + ); +} + +/// ParserError: [`ParseErrorKind::ExpectedTraitIdentifier`] +/// Caused by: missing name in trait identifier (nothing after the dot '.') +/// Outcome: block accepted +#[test] +fn test_expected_trait_identifier() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "(define-constant my-trait-id 'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.contract.)", + ); +} + +/// ParserError: [`ParseErrorKind::TupleColonExpectedv2`] +/// Caused by: missing colon between field name and value in tuple definition +/// Outcome: block accepted +#[test] +fn test_tuple_colon_expected_v2() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "{ a 1 }", + ); +} + +/// ParserError: [`ParseErrorKind::TupleCommaExpectedv2`] +/// Caused by: missing comma between fields in tuple definition +/// Outcome: block accepted +#[test] +fn test_tuple_comma_expected_v2() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "{ a : 1 b : 2 }", + ); +} + +/// ParserError: [`ParseErrorKind::TupleValueExpected`] +/// Caused by: missing value for field in tuple definition +/// Outcome: block accepted +#[test] +fn test_tuple_value_expected() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: "{ a : ", + ); +} + +/// ParserError: [`ParseErrorKind::ContractNameTooLong`] +/// Caused by: contract name longer than [`MAX_CONTRACT_NAME_LEN`] +/// Outcome: block accepted +#[test] +fn test_contract_name_too_long() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: &{ + let name = "a".repeat(MAX_CONTRACT_NAME_LEN + 1); + format!("(define-constant my-contract-id 'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.{name})") + }, + ); +} + +/// ParserError: [`ParseErrorKind::IllegalASCIIString`] +/// Caused by: string longer than [`MAX_VALUE_SIZE`] +/// Outcome: block accepted +#[test] +fn test_illegal_ascii_string() { + contract_deploy_consensus_test!( + contract_name: "my-contract", + contract_code: &{ + let string = "a".repeat(MAX_VALUE_SIZE as usize + 1); + format!("(define-constant my-str \"{string}\")") + }, + ); +} diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__consensus__successfully_deploy.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__consensus__successfully_deploy.snap new file mode 100644 index 00000000000..919738dcedd --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__consensus__successfully_deploy.snap @@ -0,0 +1,118 @@ +--- +source: stackslib/src/chainstate/tests/consensus.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "db9cec6900e5d62e14daacb309835672bb2ae5d86f13b19dd854f3e8638f7e25", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: foo_contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "None [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: true, + data: Bool(true), + )), + cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "06c25dc479f0f6a90b6d3aac0df87a473b6ab4fe8cefa264e29da5807f5bae56", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: foo_contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "None [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: true, + data: Bool(true), + )), + cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "4d3f3e2b98842cfa9b5c9d20d9f03272f197a3b2aa01ad6a428d0127c52086b8", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: foo_contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "None [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: true, + data: Bool(true), + )), + cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "92bebb4e0dfa11a5d41ae2644a27cb3975ab64412b0704cec68b83c759cb6bf0", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: foo_contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "None [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: true, + data: Bool(true), + )), + cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 121, + write_count: 2, + read_length: 1, + read_count: 1, + runtime: 11968, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__circular_reference.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__circular_reference.snap new file mode 100644 index 00000000000..82020f333ee --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__circular_reference.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "7ab69ffa0c3c2f81ad5f6d3149256a02d6d03b28fba526e1581c398b5a043fbf", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(detected interdependent functions (my-a, my-b)) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "613a5e4b132cc1d2b410bc14574cff2fe28ca65483f1f22294edaa2346d54bfc", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(detected interdependent functions (my-a, my-b)) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "6ff87ceec96cd7f4c4bc7affcf5a9c703c41d64acfdbd5e2b74cbce98cf48755", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(detected interdependent functions (my-a, my-b)) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "ab5bee8bb7f686d1776327324d4b537fd0a83f82d56f13191e98aae24c28a575", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(detected interdependent functions (my-a, my-b)) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2838, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__contract_name_too_long.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__contract_name_too_long.snap new file mode 100644 index 00000000000..5052cce5e05 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__contract_name_too_long.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "402b2b9c4a70b32ee21a0bb1f52ada137eb6aa8514ec52ff14437d588476c0f9", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(contract name \'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\' is too long) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "da0287ecf63229a462b9ec5842baebb55dc063d738cea6ecded996c016b7a87c", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(contract name \'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\' is too long) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "3351070ce61051d7fb9171ab788118eef6346774197ef1bd92d5a9e464ad6464", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(contract name \'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\' is too long) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "4af30f20271d1de97420726838d55177a70a5aa133507e70868555dfe8481e88", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(contract name \'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\' is too long) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 3240, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__cost_balance_exceeded.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__cost_balance_exceeded.snap new file mode 100644 index 00000000000..2a6306f8ce3 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__cost_balance_exceeded.snap @@ -0,0 +1,10 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Failure("Invalid Stacks block 6da94a301c807241a1693938f5ba0fdca8ce8728870b94542a627edf3ae53de9: CostOverflowError(ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 4948255138 }, ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 5004355279 }, ExecutionCost { write_length: 15000000, write_count: 15000, read_length: 100000000, read_count: 15000, runtime: 5000000000 })"), + Failure("Invalid Stacks block eb87eaa8b1c7ada1bd79d9a1cef70e9a2d9ecad64ce496acb5563a53076c9f10: CostOverflowError(ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 4948255138 }, ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 5004355279 }, ExecutionCost { write_length: 15000000, write_count: 15000, read_length: 100000000, read_count: 15000, runtime: 5000000000 })"), + Failure("Invalid Stacks block f3f134a271cff7f040e979c42819732db63065bba5700b5e3289465befa67bc7: CostOverflowError(ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 4948255138 }, ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 5004355279 }, ExecutionCost { write_length: 15000000, write_count: 15000, read_length: 100000000, read_count: 15000, runtime: 5000000000 })"), + Failure("Invalid Stacks block a1ad938c6a3d38090388874f098773fe6e06e2c5021d3ee785369991af6f8c18: CostOverflowError(ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 4948255138 }, ExecutionCost { write_length: 3589069, write_count: 4, read_length: 19309683, read_count: 59, runtime: 5004355279 }, ExecutionCost { write_length: 15000000, write_count: 15000, read_length: 100000000, read_count: 15000, runtime: 5000000000 })"), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__define_trait_bad_signature.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__define_trait_bad_signature.snap new file mode 100644 index 00000000000..b95eb6ca8cf --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__define_trait_bad_signature.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "44ca4f1ccdb55e785b2b98355ff643afc29552d337a77d8aae7a8fbea92711b3", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some((define-trait ...) expects a trait name and a trait definition) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "e49e9e3db458445bdd122b785e15cf5b62cfed610a78cf0d3d376c47a1cb8d19", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some((define-trait ...) expects a trait name and a trait definition) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "44e4bfb517b36f5b81acfd527f703b0ac748aa655a2bee874011babfc07923a4", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some((define-trait ...) expects a trait name and a trait definition) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "bd67d0a7909f74e6309e3e76de58128ccda4a63808e5f345b7b95e3aaf2bef1f", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some((define-trait ...) expects a trait name and a trait definition) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 531, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_closing.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_closing.snap new file mode 100644 index 00000000000..cc9975602ea --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_closing.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "8200fef72d7ac74d94cf04d8380bc2712bea1accaa344bdebc2f13688aa229de", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(expected closing \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "d158d9ec50963ed16576f23cf4986332d865ad7a6bad92df1b30802cfbfacc0f", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(expected closing \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "71e83d9dc89c9d0ca1f37aed6f7e42150e94cf9bedbb874dbbbab0e808195170", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(expected closing \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "dc1f0901117fbf7630a22b4ebe1c7558938d65ed4f1e605121b7c2e955853cfc", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(expected closing \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 108, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_contract_identifier.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_contract_identifier.snap new file mode 100644 index 00000000000..f14fe7f737c --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_contract_identifier.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "521709c3b38bc77adadbb214fb8c51bae4e7be3a36ff74ebd6dab57195ed6742", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(expected contract identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "a4320c24fc22782770df9ac3b4246a59c38f0b5c94d8f383705ff16226496d81", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(expected contract identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "931f98cd7034f063113578e2c6566ec7b2a1c689c8f6c7b1884087afcb2fa050", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(expected contract identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "18cc7b32170ca3aec71613522da433ff6b3eff4ecde4ec863b667bf730300a01", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(expected contract identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_trait_identifier.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_trait_identifier.snap new file mode 100644 index 00000000000..d852866e077 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_trait_identifier.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "5846f21bff86ebad3b7e9d78cb3be7f9575ef65a556c9c741c793ed24d20a901", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(expected trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "a6b06d804cf3068001594627291950bf8bfe412161be0ab43145dbf206bc6566", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(expected trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "cc3ad65b3cdb9fff1b2c4102b7e1ef29c1470af18bd6e73c6985ebaf81b7b989", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(expected trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "acd3717f2ce3da36936700c4c706c77532a95831a4866725b1523abb3245e623", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(expected trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2295, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_white_space.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_white_space.snap new file mode 100644 index 00000000000..f92895ea8cb --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__expected_white_space.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "6fc50cfef3fc12b015d46fd7e8e08f2b5ec36418616ce137615896202a16472f", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "6677d9a6bb79a3f164ec823e57cc54aae6e36f8963b7061bdb02da11c845a5ea", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "91f7fd87440fa728d6358cbdadfe2f47c1ef8b0e807d1fe288bbca6fed2f1383", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "42cc705ab00645b41ab11df6f6f925a754153b3a64870d5c06e9037464f31e96", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(expected whitespace before expression) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__failed_parsing_int_value.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__failed_parsing_int_value.snap new file mode 100644 index 00000000000..2b5c8c170ae --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__failed_parsing_int_value.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "d051f199f13a82a2c762ffd40fbf88ef4db12ad5c32f2cd8e81da82567a4ee1f", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(Failed to parse int literal \'340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "0020a0109fc788d8c8ebb55b98c9dff4c708b2d5bb8f873ea4c6f99a6aa36bc5", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(Failed to parse int literal \'340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "a13e22acf1aa2c9d4fd2144c8bebdde42068155eb55b2881e60c7443e6871884", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(Failed to parse int literal \'340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "f8931afae481a2069b7583a9eb345f35016029d2ea93deebc96cb29095075de5", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(Failed to parse int literal \'340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1917, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__failed_parsing_uint_value.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__failed_parsing_uint_value.snap new file mode 100644 index 00000000000..5e364f9d5a0 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__failed_parsing_uint_value.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "885ef373bdf13ef6bc97b86a00a378342c3622a453e17aa71d57c6d874dd1b96", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(Failed to parse uint literal \'u999340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "a9aa1213dca0a0d08e84f816ab13f010ef31837b4d0438b32b1ae08047962684", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(Failed to parse uint literal \'u999340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "47681c2598980e51d5ec1279fd6e2214a248cc148026404530a5a83093f819a2", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(Failed to parse uint literal \'u999340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "c60680e6a32e9c5d32bece5e7d80d950e202634a37bcdd755ed6aa013a3c412e", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(Failed to parse uint literal \'u999340282366920938463463374607431768211455\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2079, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__illegal_ascii_string.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__illegal_ascii_string.snap new file mode 100644 index 00000000000..d5848c229b6 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__illegal_ascii_string.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "bce8902e2b520985bd53d0508010c9734be504c6ecc05de7d2c725a83508e06c", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(illegal ascii string \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[1048577]\") [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "f5bcb545d89f5251af901855a6e240415ff4f537a905231edc91a1840a2a17ca", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(illegal ascii string \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[1048577]\") [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "14b400e84355bd45ab5da07d82d1bede1c33857fe92e73ad88cd2b7bb0260b15", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(illegal ascii string \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[1048577]\") [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "68319316c5e389132bbef0ea236f247e7b15644cc0ca4abb89ea22675e8b771b", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(illegal ascii string \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...[1048577]\") [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 28312389, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__impl_trait_bad_signature.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__impl_trait_bad_signature.snap new file mode 100644 index 00000000000..1148d00caef --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__impl_trait_bad_signature.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "3ec1a588162ba6d1f5dff66293892c47e4fee8042ffa965d81620ce8e81dc43a", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some((impl-trait ...) expects a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "9a0a39fce5de531b7a1178dfde6bf9a63fe17749bbdccbaab0e053e55f6eba39", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some((impl-trait ...) expects a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "43d5cbc86fa6e027c17ed7b9ca3854886fa66205414fd2c83a3d3cac67e90eaa", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some((impl-trait ...) expects a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "09a14f566da262fd2227eb32746d1190427883b3c0662d8f2dc0ffd6f398d15a", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some((impl-trait ...) expects a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 477, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__import_trait_bad_signature.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__import_trait_bad_signature.snap new file mode 100644 index 00000000000..bb08fe517fe --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__import_trait_bad_signature.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "b74e2dcb2fd4c51c4fa1c554b14b1cb254608184e7fcf7ac2a2c20d7f26e78bb", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some((use-trait ...) expects a trait name and a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "29046a17e8b33683f0a56cdd01267c2dd7121765d05be401bd2a3b7334749718", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some((use-trait ...) expects a trait name and a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "2d86aaf4e9eb377c8c34321a4238c02907136af6ce1978686cdf99c36076b69b", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some((use-trait ...) expects a trait name and a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "f8930c5e8c33bf167a13e1a117888d9b43f2f409ce8f9ef35101ef99e3ef3cb6", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some((use-trait ...) expects a trait name and a trait identifier) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 450, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__invalid_principal_literal.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__invalid_principal_literal.snap new file mode 100644 index 00000000000..ebca236d272 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__invalid_principal_literal.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "521709c3b38bc77adadbb214fb8c51bae4e7be3a36ff74ebd6dab57195ed6742", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(invalid principal literal) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "2955944cf1ac20cd5635b968b28234d5d38d689762d32ccf29bc91cb49a54954", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(invalid principal literal) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "edf6f7133c73c1d7bd2b566b2acee77a4c68f340416199d0c5151abf93fbca44", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(invalid principal literal) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "3981564b3fa9a4403ff0f5b080e375e7ad26762899a655fa3c27c68807961fdb", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(invalid principal literal) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 2133, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__lexer_unknown_symbol.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__lexer_unknown_symbol.snap new file mode 100644 index 00000000000..810f940de72 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__lexer_unknown_symbol.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "6fc50cfef3fc12b015d46fd7e8e08f2b5ec36418616ce137615896202a16472f", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(unknown symbol, \'_\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "6f052948e5c836fbceebd13104c9ebb0693047d8cfa415fef84df3867bba8863", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(unknown symbol, \'_\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "065d3fe36a169077cb3a4b24839f01cbd73b150344e574418cb157795682d993", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(unknown symbol, \'_\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "7a87ac45f1a24f24d4b60ab4cefe8d52499754e65492e594cf9b741de6ec989f", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(unknown symbol, \'_\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 945, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__name_too_long.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__name_too_long.snap new file mode 100644 index 00000000000..6d448c5ccf0 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__name_too_long.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "3457624fc4dd8beb1c68b4b2a0932ec59f2fcbee2125fad97eda9697ac5dbd34", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(illegal name (too long), \'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "f4e641df46d610f8b686dd06aa2cace75c30643a0b628acf71baefb93e96fe58", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(illegal name (too long), \'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "9cd47227a7bcc100726fd6f2340272d6e970ed911fefa8389e3646938ae8336c", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(illegal name (too long), \'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "7592a3885e6a170c2d5fa4fce5b24bb7ebed85dd474a66c8f2942b7b98e02d8d", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(illegal name (too long), \'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4266, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__named_already_used.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__named_already_used.snap new file mode 100644 index 00000000000..27fecaa8cf8 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__named_already_used.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "863fbb2cac39c175b28b867dfb388f4fe0d6cf0a8585cc250e842b95eb901611", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(defining \'trait-1\' conflicts with previous value) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "71f06f0152b590dee043b03a389a79a41e2bd33829ef80fc865fc3ab28851adc", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(defining \'trait-1\' conflicts with previous value) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "49e8b9190a0bae9d95d1b480bf3821e10f2c80813fefd0c6e22b9db60f521088", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(defining \'trait-1\' conflicts with previous value) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "8bc2f3404b84d09537ee3bac4327859c16abd0b5ef2b245b97e7c5e91f6f1bcb", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(defining \'trait-1\' conflicts with previous value) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 5256, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__consensus__chainstate_error_expression_stack_depth_too_deep.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_1_tuple_only_parsing.snap similarity index 61% rename from stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__consensus__chainstate_error_expression_stack_depth_too_deep.snap rename to stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_1_tuple_only_parsing.snap index 285a27f06ea..4943fc35a49 100644 --- a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__consensus__chainstate_error_expression_stack_depth_too_deep.snap +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_1_tuple_only_parsing.snap @@ -1,10 +1,10 @@ --- -source: stackslib/src/chainstate/tests/consensus.rs +source: stackslib/src/chainstate/tests/parse_tests.rs expression: result --- [ - Failure("Invalid Stacks block ab4cca0f2bea4c37632906a6c63c393dec801b0744e606fc7e808b6a90f75688: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), - Failure("Invalid Stacks block fa80f79d7dba3ac2a4ec7416c918d38897777edc6ceeb534398643e91a4651c1: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), - Failure("Invalid Stacks block 659b87c8404845e53739138b8a764835c160141cc769748ea88dc11ecda2099e: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), - Failure("Invalid Stacks block de9748ca8c889ef4c6f5c4304fbf32612ced35030bafb47ad5fe110f4f12fcf3: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 26e08f5ea1da412dc3d61e9000a22875505b957c869ff9cfa424e8aeb3a42c58: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 5b0f18980a80d3125cf86b52e22f134cb62a952ff764142f01374a9fd7fae904: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 7c9be251e72db548c5e783be09cd2977d935538bb609bc3fc8c851f1d63976db: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 36b1f166745299eec7d133423c9e1324d6b9dba7845568e5461f1642878b6ebb: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), ] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_2_list_only_parsing.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_2_list_only_parsing.snap new file mode 100644 index 00000000000..e78ef1b75a5 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_2_list_only_parsing.snap @@ -0,0 +1,10 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Failure("Invalid Stacks block c16319651ae845216eb9d210c2ccb31b1c2395e03a778b78df40e9c717b235f9: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 01adb6707769dda2ece9d4598708aec77afe7a7c140d0778c07b34197940c855: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 3d8ef61dd08aa51d2b5ff5820635d4b65a201b480b0a583d4cee0cae6ac24c1d: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block e9ef2e4035476691b6fecbc8ad94a4022ddcba1f4d66e91c903d42c5355b401d: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_3_list_only_checker.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_3_list_only_checker.snap new file mode 100644 index 00000000000..535d252c325 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__stack_depth_too_deep_case_3_list_only_checker.snap @@ -0,0 +1,10 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Failure("Invalid Stacks block 7413f1cc34a57d4b05e1547231409382380ad87c38906521c7382a57b08dda8b: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 8aee6d0c3ecad52ae99e7b379154d3a63268a342710902f872d0436fa2a2a70d: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 6901c067a82bc6a6bb2c214e9eb88f4df9424cca96bfaa3b3fdb8624426b2b6e: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 3b47319fec3fb79d7ff4b2ea411df889f58229ad7e132612a1ec3fe65aea26c9: ClarityError(Parse(ParseError { err: ExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__trait_ref_not_allowed.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__trait_ref_not_allowed.snap new file mode 100644 index 00000000000..a4e662b3ad7 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__trait_ref_not_allowed.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "659859594d162e888aec6fc00c47c8f3809288e42aff1018d4b683065a7cf905", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(trait references can not be stored) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "4359f0afa86887bed70f37a74b08e8b3777a7e2aa5a0022dff5839ac4470992a", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(trait references can not be stored) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "fdf6c60d280ceba492ef5e93b33b717ef4f293197341675601dda5dcfaf5d421", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(trait references can not be stored) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "96d08bb6d8d61d6c651be7d0f9e741233458f7561c49a2a777a8dabf755de5ad", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(trait references can not be stored) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 4857, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__trait_reference_unknown.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__trait_reference_unknown.snap new file mode 100644 index 00000000000..1a25af8dfc6 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__trait_reference_unknown.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "959b74fa7723534df5d5822bfc6a4b65f94aecff60da6ee5fd2fe9e565266fd1", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(use of undeclared trait ) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "c75edea2214c3dddbaa2ac6b26c1ff681967bb056b6aa7c73fa0c7775bb6f6e5", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(use of undeclared trait ) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "d882a0b5242655de096c2ace57e93c0a3677a44d590d6d3b3137b535997ceed8", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(use of undeclared trait ) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "49c864041b41bdd3e292c97873f7c7b14979ef6760915ccf679e4d85ce073bd0", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(use of undeclared trait ) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 585, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_colon_expected_v2.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_colon_expected_v2.snap new file mode 100644 index 00000000000..661765614d9 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_colon_expected_v2.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "f240ac1a69d29c82bb9555f0f510f05db577239e2d6310c8a6ec0ceab5915756", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(expected \':\' after key in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "9af456f3414f99ef8f2f7119898b257219a8aa4ae5e81387ddd60e2a8199ac8f", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(expected \':\' after key in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "518d3ca8c727301b9307081d68f47cf871570b3c5f9daf1b2b192108b813d032", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(expected \':\' after key in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "a14a262dca5dd914edf24f7eabf61c8ef2595fd55140a0c908d6b3b5dd58be01", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(expected \':\' after key in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 270, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_comma_expected_v2.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_comma_expected_v2.snap new file mode 100644 index 00000000000..12397cd3a96 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_comma_expected_v2.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "959b74fa7723534df5d5822bfc6a4b65f94aecff60da6ee5fd2fe9e565266fd1", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(expected \',\' separating key-value pairs in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "91eacccda4485168feccbcc5db6385d7a4daddd4b40131b1c24c461b01da8f74", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(expected \',\' separating key-value pairs in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "8b2ca1cb7f15180d44973b5a5f538e795db40800edb79e0cb9e902e9ffadf9f1", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(expected \',\' separating key-value pairs in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "dd40dacd5815729588f58d79ff493cf87a9d8397b072deb5a36ae693ff563732", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(expected \',\' separating key-value pairs in tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 513, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_value_expected.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_value_expected.snap new file mode 100644 index 00000000000..975dcda47ff --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__tuple_value_expected.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "52f82ee453f2bea020f052f610ca7763364c714242e0a1c00b93d13d22500941", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(expected value expression for tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "991d055532bd0a381148c5f1e95bb8ed2e5010df2d9178736fc01c853eff51d1", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(expected value expression for tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "1fdce3bad2b2e2096002b08e2f61800438fba4aae7a172acb2671658e3fd43ab", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(expected value expression for tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "2d649f1b37a9e328344f80bc15a6897ebbde53bc554a55cbffd22439059a48d4", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(expected value expression for tuple) [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 243, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__unexpected_token.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__unexpected_token.snap new file mode 100644 index 00000000000..e5a7895d726 --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__unexpected_token.snap @@ -0,0 +1,126 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Success(ExpectedBlockOutput( + marf_hash: "0b7ad43ce5bf830f058036bb6086ca6f74a201d679705b56795f7eb69809f818", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))", + vm_error: "Some(unexpected \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "09b6651b6710476fc630f85f6558b49f8c713fa9a122bfebf0f3c0c77a574c4c", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))", + vm_error: "Some(unexpected \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "1277926bd2b5c822535c4f2c1b4c5f4be848eb29e9d2c305a462bab32a77a073", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))", + vm_error: "Some(unexpected \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + )), + Success(ExpectedBlockOutput( + marf_hash: "995a2718b26b303e57ba32c04f68a3528e08c1d2ce430ebdc6f0f78998c77395", + evaluated_epoch: Epoch33, + transactions: [ + ExpectedTransactionOutput( + tx: "SmartContract(name: my-contract-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))", + vm_error: "Some(unexpected \')\') [NON-CONSENSUS BREAKING]", + return_type: Response(ResponseData( + committed: false, + data: Optional(OptionalData( + data: None, + )), + )), + cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + ), + ], + total_block_cost: ExecutionCost( + write_length: 0, + write_count: 0, + read_length: 0, + read_count: 0, + runtime: 1026, + ), + )), +] diff --git a/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__vary_stack_depth_too_deep_checker.snap b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__vary_stack_depth_too_deep_checker.snap new file mode 100644 index 00000000000..ee152813bae --- /dev/null +++ b/stackslib/src/chainstate/tests/snapshots/blockstack_lib__chainstate__tests__parse_tests__vary_stack_depth_too_deep_checker.snap @@ -0,0 +1,10 @@ +--- +source: stackslib/src/chainstate/tests/parse_tests.rs +expression: result +--- +[ + Failure("Invalid Stacks block 7984229eead50d241a49f6f75674a7b1fbcac5d83b081f32060d6e0e0d911380: ClarityError(Parse(ParseError { err: VaryExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block 6b2739a0d386cc60d03b81f4c0e99f48e83d67e5750de488758913facda32842: ClarityError(Parse(ParseError { err: VaryExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block a8d52638fa2c7e6fdcfb80ebb77321f35235a78674e1280e06da9a5f644ae52b: ClarityError(Parse(ParseError { err: VaryExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), + Failure("Invalid Stacks block d24edff3b799448360febd21e38b4285616fec41cd20b213bcfc4f4fc8ae7311: ClarityError(Parse(ParseError { err: VaryExpressionStackDepthTooDeep, pre_expressions: None, diagnostic: Diagnostic { level: Error, message: \"AST has too deep of an expression nesting. The maximum stack depth is 64\", spans: [], suggestion: None } }))"), +]