Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions clarity/src/vm/ast/parser/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,16 @@ fn handle_expression(
}
}

// TODO: #4587 create default for `SymbolicExpression`, then check if mutation tests are caught for these cases:
// ParseResult::from(vec![Default::default()])
// ParseResult::from(vec![])
// ParseResult::new()
// ParseResult::from_iter([vec![Default::default()]])
// ParseResult::new(vec![Default::default()])
// ParseResult::new(vec![])
// ParseResult::from_iter([vec![]])
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn parse_lexed(input: Vec<(LexItem, u32, u32)>) -> ParseResult<Vec<PreSymbolicExpression>> {
let mut parse_stack = Vec::new();

Expand Down
20 changes: 20 additions & 0 deletions clarity/src/vm/ast/parser/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@ impl<'a> Parser<'a> {
///
/// Returns Some(node) if the open node is finished and should be popped from the stack.
/// Returns None if the open node is not finished and should remain on the parser stack.
// TODO: #4587 create default for `SymbolicExpression`, then check if mutation tests are caught for these cases:
// ParseResult::from_iter([Some(Default::default())])
// ParseResult::new(None)
// ParseResult::from_iter([None])
// ParseResult::new(Some(Default::default()))
// ParseResult::from(None)
// ParseResult::from(Some(Default::default()))
// ParseResult::new()
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn handle_open_node(
&mut self,
open_node: &mut ParserStackElement,
Expand Down Expand Up @@ -275,6 +285,16 @@ impl<'a> Parser<'a> {
}
}

// TODO: #4587 create default for `SymbolicExpression`, then check if mutation tests are caught for these cases:
// ParseResult::from_iter([Some(Default::default())])
// ParseResult::new(None)
// ParseResult::from_iter([None])
// ParseResult::new(Some(Default::default()))
// ParseResult::from(None)
// ParseResult::from(Some(Default::default()))
// ParseResult::new()
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn handle_open_tuple(
&mut self,
open_tuple: &mut OpenTuple,
Expand Down
10 changes: 10 additions & 0 deletions clarity/src/vm/ast/sugar_expander/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ impl SugarExpander {
Ok(())
}

// TODO: #4587 create default for `SymbolicExpression`, then check if mutation tests are caught for these cases:
// ParseResult::from(vec![Default::default()])
// ParseResult::from(vec![])
// ParseResult::new()
// ParseResult::from_iter([vec![Default::default()]])
// ParseResult::new(vec![Default::default()])
// ParseResult::new(vec![])
// ParseResult::from_iter([vec![]])
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn transform(
&self,
pre_exprs_iter: PreExpressionsDrain,
Expand Down
8 changes: 6 additions & 2 deletions clarity/src/vm/costs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,8 @@ impl TrackerData {
/// `apply_updates` - tells this function to look for any changes in the cost voting contract
/// which would need to be applied. if `false`, just load the last computed cost state in this
/// fork.
/// TODO: #4587 add test for Err cases
/// Or keep the skip and remove the comment
// TODO: #4587 add test for Err cases
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn load_costs(&mut self, clarity_db: &mut ClarityDatabase, apply_updates: bool) -> Result<()> {
clarity_db.begin();
Expand Down Expand Up @@ -958,6 +958,10 @@ fn parse_cost(
}
}

// TODO: #4587 create default for `ExecutionCost`, then check if mutation tests are caught for these case:
// Ok(Default::default())
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn compute_cost(
cost_tracker: &mut TrackerData,
cost_function_reference: ClarityCostFunctionReference,
Expand Down
12 changes: 6 additions & 6 deletions clarity/src/vm/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1529,9 +1529,9 @@ impl TupleData {
self.data_map.is_empty()
}

///TODO: #4587 create default for TupleData, then check if the mutation tests are caught for the case:
/// Ok((Default::default()))
/// Or keep the skip and remove the comment
// TODO: #4587 create default for TupleData, then check if the mutation tests are caught for the case:
// Ok((Default::default()))
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn from_data(data: Vec<(ClarityName, Value)>) -> Result<TupleData> {
let mut type_map = BTreeMap::new();
Expand All @@ -1549,9 +1549,9 @@ impl TupleData {
Self::new(TupleTypeSignature::try_from(type_map)?, data_map)
}

///TODO: #4587 create default for TupleData, then check if the mutation tests are caught for the case:
/// Ok((Default::default()))
/// Or keep the skip and remove the comment
// TODO: #4587 create default for TupleData, then check if the mutation tests are caught for the case:
// Ok((Default::default()))
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn from_data_typed(
epoch: &StacksEpochId,
Expand Down
1 change: 1 addition & 0 deletions libsigner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stackslib = { path = "../stackslib"}
thiserror = "1.0"
tiny_http = "0.12"
wsts = { workspace = true }
mutants = "0.0.3"

[dev-dependencies]
rand_core = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions libsigner/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ fn ack_dispatcher(request: HttpRequest) {
}

/// Process a stackerdb event from the node
// TODO: #4587 create default for `SignerEvent` and `EventError`, then check if mutation tests are caught for these case:
// Ok(Default::default())
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn process_stackerdb_event(
local_addr: Option<SocketAddr>,
mut request: HttpRequest,
Expand Down
1 change: 1 addition & 0 deletions pox-locking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ path = "src/lib.rs"
clarity = { package = "clarity", path = "../clarity" }
stacks_common = { package = "stacks-common", path = "../stacks-common" }
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
mutants = "0.0.3"

[features]
slog_json = ["stacks_common/slog_json", "clarity/slog_json"]
3 changes: 3 additions & 0 deletions pox-locking/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ fn create_event_info_aggregation_code(function_name: &str) -> String {
}

/// Craft the code snippet to generate the method-specific `data` payload
// TODO: #4587 add tests for `String::new()` and `"xyzzy".into()` returning case.
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn create_event_info_data_code(
function_name: &str,
args: &[Value],
Expand Down
1 change: 1 addition & 0 deletions stackslib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ libstackerdb = { path = "../libstackerdb" }
siphasher = "0.3.7"
wsts = { workspace = true }
hashbrown = { workspace = true }
mutants = "0.0.3"

[target.'cfg(not(any(target_os = "macos",target_os="windows", target_arch = "arm" )))'.dependencies]
tikv-jemallocator = {workspace = true}
Expand Down
3 changes: 3 additions & 0 deletions stackslib/src/burnchains/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,9 @@ impl<'a> BurnchainDBTransaction<'a> {

/// You'd only do this in network emergencies, where node operators are expected to declare an
/// anchor block missing (or present). Ideally there'd be a smart contract somewhere for this.
// TODO: #4587 add tests for `Ok(())` returning case
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn set_override_affirmation_map(
&self,
reward_cycle: u64,
Expand Down
3 changes: 3 additions & 0 deletions stackslib/src/burnchains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ impl PoxConstants {
) // total liquid supply is 40000000000000000 µSTX
}

// TODO: #4587 create default for PoxConstants, then check if the mutation tests are caught:
// Default::default()
#[cfg_attr(test, mutants::skip)]
pub fn regtest_default() -> PoxConstants {
PoxConstants::new(
5,
Expand Down
7 changes: 7 additions & 0 deletions stackslib/src/chainstate/burn/db/sortdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ impl FromRow<LeaderBlockCommitOp> for LeaderBlockCommitOp {
}

impl FromRow<StackStxOp> for StackStxOp {
// TODO: #4587 create default for `StackStxOp`, then check if mutation tests are caught for these case:
// Ok(Default::default())
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn from_row<'a>(row: &'a Row) -> Result<StackStxOp, db_error> {
let txid = Txid::from_column(row, "txid")?;
let vtxindex: u32 = row.get_unwrap("vtxindex");
Expand Down Expand Up @@ -4811,6 +4815,9 @@ impl SortitionDB {

/// Are microblocks disabled by Epoch 2.5 at the height specified
/// in `at_burn_height`?
// TODO: #4587 add test for the `None` case returning Ok(false)
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn are_microblocks_disabled(conn: &DBConn, at_burn_height: u64) -> Result<bool, db_error> {
match Self::get_stacks_epoch_by_epoch_id(conn, &StacksEpochId::Epoch25)? {
Some(epoch_25) => Ok(at_burn_height >= epoch_25.start_height),
Expand Down
11 changes: 11 additions & 0 deletions stackslib/src/chainstate/burn/operations/stack_stx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ impl StackStxOp {
}
}

// TODO: #4587 create default for `ParsedData`, then check if mutation tests are caught for these case:
// Some(Default::default())
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
fn parse_data(data: &Vec<u8>) -> Option<ParsedData> {
/*
Wire format:
Expand Down Expand Up @@ -273,6 +277,10 @@ impl StackStxOp {

/// parse a StackStxOp
/// `pox_sunset_ht` is the height at which PoX *disables*
// TODO: #4587 create default for `StackStxOp` and `op_error`, then check if mutation tests are caught for these case:
// Ok(Default::default())
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn parse_from_tx(
block_height: u64,
block_hash: &BurnchainHeaderHash,
Expand Down Expand Up @@ -395,6 +403,9 @@ impl StacksMessageCodec for StackStxOp {
}

impl StackStxOp {
// TODO: #4587 add tests for `Ok(())` returning case.
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn check(&self) -> Result<(), op_error> {
if self.stacked_ustx == 0 {
warn!("Invalid StackStxOp, must have positive ustx");
Expand Down
3 changes: 3 additions & 0 deletions stackslib/src/chainstate/coordinator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2412,6 +2412,9 @@ impl<
/// this happens, *and* if re-processing the new affirmed history is *blocked on* the
/// unavailability of a PoX anchor block that *must now* exist, then return the hash of this
/// anchor block.
// TODO: #4587,create default for BlockHeaderHash, then check if mutation tests are caught for these cases:
// Ok(Some(Default::default))
#[cfg_attr(test, mutants::skip)]
pub fn handle_new_epoch2_burnchain_block(
&mut self,
already_processed_burn_blocks: &mut HashSet<BurnchainHeaderHash>,
Expand Down
15 changes: 15 additions & 0 deletions stackslib/src/chainstate/stacks/boot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ impl StacksChainState {
/// Currently, this just means applying any auto-unlocks to Stackers who qualified.
///
/// This should only be called for PoX v2 cycles.
// TODO: #4587 create default for StacksTransactionEvent , then check if mutation tests are caught for these cases:
// Ok(vec![Default::default()])
#[cfg_attr(test, mutants::skip)]
pub fn handle_pox_cycle_start_pox_2(
clarity: &mut ClarityTransactionConnection,
cycle_number: u64,
Expand All @@ -439,6 +442,9 @@ impl StacksChainState {
/// Currently, this just means applying any auto-unlocks to Stackers who qualified.
///
/// This should only be called for PoX v3 cycles.
// TODO: #4587 create default for StacksTransactionEvent , then check if mutation tests are caught for these cases:
// Ok(vec![Default::default()])
#[cfg_attr(test, mutants::skip)]
pub fn handle_pox_cycle_start_pox_3(
clarity: &mut ClarityTransactionConnection,
cycle_number: u64,
Expand All @@ -451,6 +457,9 @@ impl StacksChainState {
/// Currently, this just means applying any auto-unlocks to Stackers who qualified.
///
/// This should only be called for PoX v4 cycles.
// TODO: #4587 create default for StacksTransactionEvent , then check if mutation tests are caught for these cases:
// Ok(vec![Default::default()])
#[cfg_attr(test, mutants::skip)]
pub fn handle_pox_cycle_start_pox_4(
_clarity: &mut ClarityTransactionConnection,
_cycle_number: u64,
Expand All @@ -463,6 +472,9 @@ impl StacksChainState {
/// Do all the necessary Clarity operations at the start of a PoX reward cycle.
/// Currently, this just means applying any auto-unlocks to Stackers who qualified.
///
// TODO: #4587 create default for StacksTransactionEvent , then check if mutation tests are caught for these cases:
// Ok(vec![Default::default()])
#[cfg_attr(test, mutants::skip)]
fn handle_pox_cycle_missed_unlocks(
clarity: &mut ClarityTransactionConnection,
cycle_number: u64,
Expand Down Expand Up @@ -757,6 +769,9 @@ impl StacksChainState {
/// are repeated floor(stacked_amt / threshold) times.
/// If an address appears in `addresses` multiple times, then the address's associated amounts
/// are summed.
// TODO: #4587 create default for RewardSet , then check if mutation tests are caught for these cases:
// Default::default()
#[cfg_attr(test, mutants::skip)]
pub fn make_reward_set(
threshold: u128,
mut addresses: Vec<RawRewardSetEntry>,
Expand Down
16 changes: 16 additions & 0 deletions stackslib/src/chainstate/stacks/db/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4134,6 +4134,10 @@ impl StacksChainState {

/// Process any Stacking-related bitcoin operations
/// that haven't been processed in this Stacks fork yet.
// TODO: #4587 create default for `StacksTransactionReceipt`, then check if mutation tests are caught for these case:
// vec![Default::default()]
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn process_stacking_ops(
clarity_tx: &mut ClarityTx,
operations: Vec<StackStxOp>,
Expand Down Expand Up @@ -4237,6 +4241,11 @@ impl StacksChainState {
all_receipts
}

// TODO: #4587 add test for `Ok(vec![])` returning case.
// TODO: #4587 create default for `Value`, then check if mutation tests are caught for these case:
// Ok(vec![Default::default()])
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn collect_pox_4_stacking_args(op: &StackStxOp) -> Result<Vec<Value>, String> {
let signer_key = match op.signer_key {
Some(signer_key) => match Value::buff_from(signer_key.as_bytes().to_vec()) {
Expand Down Expand Up @@ -6026,6 +6035,13 @@ impl StacksChainState {
/// Return a poison microblock transaction payload if the microblock stream contains a
/// deliberate miner fork (this is NOT consensus-critical information, but is instead meant for
/// consumption by future miners).
// TODO: #4587 add default for `StacksEpochReceipt` and `TransactionPayload`, then check if mutation tests are caught for these cases:
// Ok((None, Some(Default::default())))
// Ok((Some(Default::default()), None))
// Ok((Some(Default::default()), Some(Default::default())))
// This is caught: Ok(None, None)
// Or keep the skip and remove the comment
#[cfg_attr(test, mutants::skip)]
pub fn process_next_staging_block<'a, T: BlockEventDispatcher>(
&mut self,
burnchain_dbconn: &DBConn,
Expand Down
Loading