Skip to content

Commit 4ce6b69

Browse files
CRC: remove extra unrelated tests, remove unrelated comments, improve comments
Signed-off-by: Jacinta Ferrant <jacinta@stackslabs.com>
1 parent a40389b commit 4ce6b69

File tree

3 files changed

+3
-205
lines changed

3 files changed

+3
-205
lines changed

clarity-types/src/types/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ impl QualifiedContractIdentifier {
196196
pub fn parse(literal: &str) -> Result<QualifiedContractIdentifier, VmExecutionError> {
197197
let split: Vec<_> = literal.splitn(2, '.').collect();
198198
if split.len() != 2 {
199-
// This `TypeParseFailure` is **unreachable** in standard Clarity VM execution.
200-
// - Any qualified contract identifier with a mismatching number of '.' separators
201-
// would have failed earlier during static checks at deployment or function call parsing.
202-
// Only malformed input fed directly to this internal method (e.g., in unit tests) can trigger this error.
203199
return Err(RuntimeError::TypeParseFailure(
204200
"Invalid principal literal: expected a `.` in a qualified contract name"
205201
.to_string(),
@@ -304,10 +300,6 @@ impl TraitIdentifier {
304300
) -> Result<(Option<StandardPrincipalData>, ContractName, ClarityName), VmExecutionError> {
305301
let split: Vec<_> = literal.splitn(3, '.').collect();
306302
if split.len() != 3 {
307-
// This `TypeParseFailure` is **unreachable** in standard Clarity VM execution.
308-
// - Any trait identifier with a mismatching number of '.' separators
309-
// would have failed earlier during static checks at deployment or function call parsing.
310-
// Only malformed input fed directly to this internal method (e.g., in unit tests) can trigger this error.
311303
return Err(RuntimeError::TypeParseFailure(
312304
"Invalid principal literal: expected a `.` in a qualified contract name"
313305
.to_string(),

stackslib/src/chainstate/tests/runtime_tests.rs

Lines changed: 3 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ fn arithmetic_pow_neg() {
403403
/// Error: [`RuntimeError::Arithmetic`]
404404
/// Caused by: calling nlogn with n = 0
405405
/// Outcome: block accepted.
406+
/// Note: Returns a [`clarity::vm::analysis::CheckErrorKind::CostComputationFailed`] which wrapps the underlying [`RuntimeError::Arithmetic`] error.
406407
#[test]
407408
fn arithmetic_zero_n_log_n() {
408409
contract_call_consensus_test!(
@@ -614,6 +615,7 @@ fn defunct_pox_contracts() {
614615
let mut blocks = vec![];
615616
// Attempt to mine each transaction in a diff block
616617
for tx in [
618+
// These pox lockups should fail
617619
make_pox_lockup(
618620
&sender_sk,
619621
nonce,
@@ -639,6 +641,7 @@ fn defunct_pox_contracts() {
639641
lock_period,
640642
height,
641643
),
644+
// This final lockup should succeed until we upgrade our pox contract
642645
make_pox_4_lockup(
643646
&sender_sk,
644647
nonce + 3,
@@ -664,90 +667,6 @@ fn defunct_pox_contracts() {
664667
insta::assert_ron_snapshot!(results);
665668
}
666669

667-
/// Error: ERR_STACKING_ALREADY_STACKED
668-
/// Caused by: calling `stack-stx` when the caller already has an active lock.
669-
/// Outcome: block accepted
670-
#[test]
671-
fn pox_already_locked() {
672-
assert_eq!(
673-
StacksEpochId::latest(),
674-
StacksEpochId::Epoch33,
675-
"Test may need to update its pox contract call"
676-
);
677-
let sender_sk = StacksPrivateKey::from_hex(SK_1).unwrap();
678-
let address = to_addr(&sender_sk);
679-
let principal: PrincipalData = address.clone().into();
680-
let hash_mode = AddressHashMode::SerializeP2PKH;
681-
let addr_bytes = address.bytes();
682-
let pox_address = PoxAddress::from_legacy(hash_mode, addr_bytes.clone());
683-
let signer_key = StacksPublicKey::from_private(&sender_sk);
684-
let mut nonce = 0;
685-
686-
let lock_amount = TestStacker::DEFAULT_STACKER_AMOUNT;
687-
let addr_bytes = address.bytes();
688-
let lock_period = 1;
689-
let auth_id = 1;
690-
691-
// Height can be bogus; this test is not testing validity of cycle alignment.
692-
let height = 0;
693-
694-
let initial_balances = vec![(principal.clone(), u64::try_from(lock_amount).unwrap() * 2)];
695-
696-
let signature = make_signer_key_signature(
697-
&pox_address,
698-
&sender_sk,
699-
6,
700-
&Pox4SignatureTopic::StackStx,
701-
1,
702-
u128::MAX,
703-
auth_id,
704-
);
705-
706-
// First transaction: succeeds → lock is created.
707-
let tx1 = make_pox_4_lockup(
708-
&sender_sk,
709-
nonce,
710-
lock_amount,
711-
&pox_address,
712-
1,
713-
&signer_key,
714-
48,
715-
Some(signature.clone()),
716-
u128::MAX,
717-
auth_id,
718-
);
719-
nonce += 1;
720-
721-
// Second transaction: *same address, overlapping period* → ERR_STACKING_ALREADY_STACKED.
722-
let tx2 = make_pox_4_lockup(
723-
&sender_sk,
724-
nonce,
725-
lock_amount,
726-
&pox_address,
727-
1,
728-
&signer_key,
729-
48,
730-
Some(signature),
731-
u128::MAX,
732-
auth_id,
733-
);
734-
735-
let blocks = vec![
736-
TestBlock {
737-
transactions: vec![tx1],
738-
},
739-
TestBlock {
740-
transactions: vec![tx2],
741-
},
742-
];
743-
744-
let epoch_blocks = HashMap::from([(StacksEpochId::latest(), blocks)]);
745-
746-
let results = ConsensusTest::new(function_name!(), initial_balances, epoch_blocks).run();
747-
748-
insta::assert_ron_snapshot!(results);
749-
}
750-
751670
/// Error: [`RuntimeError::BlockTimeNotAvailable`]
752671
/// Caused by: attempting to retrieve the stacks-block-time from a pre-3.3 height
753672
/// Outcome: block accepted

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

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

0 commit comments

Comments
 (0)