Merge rust-bitcoin/rust-bitcoin#7039: primitives: Fix daily Miri cron failures with measured test gating
What changed, and why it matters
This change only adds `#[cfg_attr(miri, ignore)]` annotations to a handful of slow unit tests so they are skipped when run under Miri, a Rust interpreter used for detecting undefined behavior. It does not change any production code, consensus logic, or public APIs. The purpose is to stop daily automated Miri CI jobs from timing out or being killed due to extremely long-running tests. There is no security impact on users of the library.
No security action required. Treat as a normal test/CI maintenance change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit gates six expensive unit tests in primitives/src/block.rs, primitives/src/transaction.rs, and primitives/src/witness.rs with #[cfg_attr(miri, ignore)]. These tests construct large witness/transaction data and run for minutes to hours under Miri, causing CI failures. The patch does not alter the test logic, feature gates, or any non-test code. It is a CI/test-harness optimization.
Changed components
primitives/src/block.rs (tests only)primitives/src/transaction.rs (tests only)primitives/src/witness.rs (tests only)Inspect captured patch +6 / −0
### primitives/src/block.rs
@@ -2213,6 +2213,7 @@ mod tests {
#[test]
#[cfg(feature = "alloc")]
+ #[cfg_attr(miri, ignore)]
fn block_rejects_oversized_trailing_coinbase_witness_item() {
let reserved = [11u8; 32];
let mut txin = crate::TxIn::EMPTY_COINBASE;
### primitives/src/transaction.rs
@@ -2365,6 +2365,7 @@ mod tests {
#[test]
#[cfg(feature = "alloc")]
+ #[cfg_attr(miri, ignore)]
fn reject_transaction_exceeding_maximum_block_weight() {
let script_len = 600_000usize;
let mut tx_bytes = Vec::new();
@@ -2424,6 +2425,7 @@ mod tests {
#[test]
#[cfg(feature = "alloc")]
+ #[cfg_attr(miri, ignore)]
fn accept_transaction_at_maximum_block_weight() {
// A base size of 1,000,000 bytes gives a weight of exactly MAX_BLOCK_WEIGHT, which the
// `weight > MAX_BLOCK_WEIGHT` boundary in `end` must accept rather than reject.
### primitives/src/witness.rs
@@ -1648,6 +1648,7 @@ mod tests {
}
#[test]
+ #[cfg_attr(miri, ignore)]
fn decode_max_serialized_size() {
let element_len = MAX_WITNESS_SIZE
- crate::compact_size_encode(1usize).as_slice().len()
@@ -2052,6 +2053,7 @@ mod tests {
}
#[test]
+ #[cfg_attr(miri, ignore)]
fn decode_rejects_witness_over_limit_due_to_aggregate_data() {
let element_len = MAX_WITNESS_ITEM_SIZE / 2 + 1;
@@ -2077,6 +2079,7 @@ mod tests {
}
#[test]
+ #[cfg_attr(miri, ignore)]
fn decode_rejects_witness_over_limit_due_to_prefix_overhead() {
let count = MAX_WITNESS_SIZE;
let mut encoded = Vec::new();Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.