diff --git a/zebra-chain/src/orchard/tests/vectors.rs b/zebra-chain/src/orchard/tests/vectors.rs index 8d0576ed9b7..6bb3b24c502 100644 --- a/zebra-chain/src/orchard/tests/vectors.rs +++ b/zebra-chain/src/orchard/tests/vectors.rs @@ -4,6 +4,6 @@ mod sinsemilla; mod tree; pub use group_hash::GROUP_HASHES; -pub use key_components::KEY_COMPONENTS; + pub use sinsemilla::SINSEMILLA; pub use tree::{COMMITMENTS, EMPTY_ROOTS, ROOTS}; diff --git a/zebra-consensus/src/block/check.rs b/zebra-consensus/src/block/check.rs index e9ba97636d4..e539743a3d8 100644 --- a/zebra-consensus/src/block/check.rs +++ b/zebra-consensus/src/block/check.rs @@ -33,7 +33,7 @@ pub fn coinbase_is_first(block: &Block) -> Result, // let first = block .transactions - .get(0) + .first() .ok_or(BlockError::NoTransactions)?; // > The first transaction in a block MUST be a coinbase transaction, // > and subsequent transactions MUST NOT be coinbase transactions. @@ -142,7 +142,7 @@ pub fn equihash_solution_is_valid(header: &Header) -> Result<(), equihash::Error /// [3.9]: https://zips.z.cash/protocol/protocol.pdf#subsidyconcepts pub fn subsidy_is_valid(block: &Block, network: Network) -> Result<(), BlockError> { let height = block.coinbase_height().ok_or(SubsidyError::NoCoinbase)?; - let coinbase = block.transactions.get(0).ok_or(SubsidyError::NoCoinbase)?; + let coinbase = block.transactions.first().ok_or(SubsidyError::NoCoinbase)?; // Validate funding streams let Some(halving_div) = subsidy::general::halving_divisor(height, network) else { @@ -211,7 +211,7 @@ pub fn miner_fees_are_valid( block_miner_fees: Amount, ) -> Result<(), BlockError> { let height = block.coinbase_height().ok_or(SubsidyError::NoCoinbase)?; - let coinbase = block.transactions.get(0).ok_or(SubsidyError::NoCoinbase)?; + let coinbase = block.transactions.first().ok_or(SubsidyError::NoCoinbase)?; let transparent_value_balance: Amount = subsidy::general::output_amounts(coinbase) .iter() diff --git a/zebra-consensus/src/block/tests.rs b/zebra-consensus/src/block/tests.rs index 13e8be79cf0..2eed87601d3 100644 --- a/zebra-consensus/src/block/tests.rs +++ b/zebra-consensus/src/block/tests.rs @@ -103,7 +103,7 @@ static INVALID_COINBASE_TRANSCRIPT: Lazy< assert_eq!(block3.transactions.len(), 1); // Extract the coinbase transaction from the block - let coinbase_transaction = block3.transactions.get(0).unwrap().clone(); + let coinbase_transaction = block3.transactions.first().unwrap().clone(); // Add another coinbase transaction to block block3.transactions.push(coinbase_transaction); @@ -373,7 +373,7 @@ fn coinbase_validation_failure() -> Result<(), Report> { block.transactions.push( block .transactions - .get(0) + .first() .expect("block has coinbase") .clone(), ); @@ -436,7 +436,7 @@ fn funding_stream_validation_failure() -> Result<(), Report> { // Build the new transaction with modified coinbase outputs let tx = block .transactions - .get(0) + .first() .map(|transaction| { let mut output = transaction.outputs()[0].clone(); output.value = Amount::try_from(i32::MAX).unwrap(); diff --git a/zebra-consensus/src/transaction/tests.rs b/zebra-consensus/src/transaction/tests.rs index 63d720c9d0b..9b0e6aaaee4 100644 --- a/zebra-consensus/src/transaction/tests.rs +++ b/zebra-consensus/src/transaction/tests.rs @@ -2791,7 +2791,7 @@ fn coinbase_outputs_are_decryptable_for_historical_blocks_for_network( .unwrap(); let coinbase_tx = block .transactions - .get(0) + .first() .expect("must have coinbase transaction"); // Check if the coinbase outputs are decryptable with an all-zero key. diff --git a/zebra-state/src/service/check.rs b/zebra-state/src/service/check.rs index bd8dd8b8648..c89f63956e0 100644 --- a/zebra-state/src/service/check.rs +++ b/zebra-state/src/service/check.rs @@ -72,7 +72,7 @@ where .collect(); let parent_block = relevant_chain - .get(0) + .first() .expect("state must contain parent block to do contextual validation"); let parent_block = parent_block.borrow(); let parent_height = parent_block diff --git a/zebra-state/src/service/finalized_state/disk_format.rs b/zebra-state/src/service/finalized_state/disk_format.rs index d780843d2b1..072841d6635 100644 --- a/zebra-state/src/service/finalized_state/disk_format.rs +++ b/zebra-state/src/service/finalized_state/disk_format.rs @@ -16,7 +16,7 @@ pub mod upgrade; #[cfg(test)] mod tests; -pub use block::{TransactionIndex, TransactionLocation, MAX_ON_DISK_HEIGHT}; +pub use block::{TransactionLocation, MAX_ON_DISK_HEIGHT}; pub use transparent::{OutputIndex, OutputLocation}; /// Helper type for writing types to disk as raw bytes. diff --git a/zebra-state/src/service/read.rs b/zebra-state/src/service/read.rs index cdee026d875..b8d0223923f 100644 --- a/zebra-state/src/service/read.rs +++ b/zebra-state/src/service/read.rs @@ -28,21 +28,21 @@ mod tests; pub use address::{ balance::transparent_balance, tx_id::transparent_tx_ids, - utxo::{address_utxos, AddressUtxos, ADDRESS_HEIGHTS_FULL_RANGE}, + utxo::{address_utxos, AddressUtxos}, }; pub use block::{ any_utxo, block, block_header, mined_transaction, transaction_hashes_for_block, unspent_utxo, - utxo, }; pub use find::{ - best_tip, block_locator, chain_contains_hash, depth, finalized_state_contains_block_hash, - find_chain_hashes, find_chain_headers, hash_by_height, height_by_hash, next_median_time_past, + best_tip, block_locator, depth, finalized_state_contains_block_hash, find_chain_hashes, + find_chain_headers, hash_by_height, height_by_hash, next_median_time_past, non_finalized_state_contains_block_hash, tip, tip_height, }; pub use tree::{orchard_subtrees, orchard_tree, sapling_subtrees, sapling_tree}; -#[cfg(feature = "getblocktemplate-rpcs")] -pub use difficulty::get_block_template_chain_info; +#[cfg(any(test, feature = "proptest-impl"))] +#[allow(unused_imports)] +pub use address::utxo::ADDRESS_HEIGHTS_FULL_RANGE; /// If a finalized state query is interrupted by a new finalized block, /// retry this many times. diff --git a/zebra-state/src/service/tests.rs b/zebra-state/src/service/tests.rs index b7e55b9a9d9..0321e1bb965 100644 --- a/zebra-state/src/service/tests.rs +++ b/zebra-state/src/service/tests.rs @@ -143,20 +143,20 @@ async fn test_populated_state_responds_correctly( transcript.push(( Request::FindBlockHashes { known_blocks: known_hashes.iter().rev().cloned().collect(), - stop: next_hashes.get(0).cloned(), + stop: next_hashes.first().cloned(), }, Ok(Response::BlockHashes( - next_hashes.get(0).iter().cloned().cloned().collect(), + next_hashes.first().iter().cloned().cloned().collect(), )), )); transcript.push(( Request::FindBlockHeaders { known_blocks: known_hashes.iter().rev().cloned().collect(), - stop: next_hashes.get(0).cloned(), + stop: next_hashes.first().cloned(), }, Ok(Response::BlockHeaders( - next_headers.get(0).iter().cloned().cloned().collect(), + next_headers.first().iter().cloned().cloned().collect(), )), ));