fix(build): Fix new nightly clippy lints and cargo feature resolution (#6814)

* Implement minor and patch database format versions

* Log and update database format versions when opening database

* Refactor the current list of column families into a constant

* Open all available column families, including from future Zebra versions

* Refactor note commitment tree lookups to go through the height methods

* Make Sapling/Orchard note commitment tree lookup forwards compatible

* Ignore errors reading column family lists from disk

* Update format version comments and TODOs

* Correctly log newly created database formats

* Fix a new cargo lint about resolver versions

* cargo clippy --fix --all-features --all-targets

* cargo fmt --all

* Add missing tokio feature in the state, revealed by the new resolver

* Add missing dev dependencies in zebra-node-services

* Add a missing `tokio` feature from PR #6813

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
teor 2023-06-07 16:04:04 +10:00 committed by GitHub
parent 59086c7d00
commit f3e330995f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 76 additions and 74 deletions

View File

@ -14,6 +14,9 @@ members = [
"tower-fallback",
]
# Use the edition 2021 dependency resolver in the workspace, to match the crates
resolver = "2"
[profile.dev]
panic = "abort"

View File

@ -43,7 +43,7 @@ tempfile = "3.5.0"
thiserror = "1.0.40"
futures = "0.3.28"
tokio = { version = "1.28.2", features = ["fs", "net", "time", "tracing", "macros", "rt-multi-thread"] }
tokio = { version = "1.28.2", features = ["fs", "io-util", "net", "time", "tracing", "macros", "rt-multi-thread"] }
tokio-stream = { version = "0.1.14", features = ["sync", "time"] }
tokio-util = { version = "0.7.8", features = ["codec"] }
tower = { version = "0.4.13", features = ["retry", "discover", "load", "load-shed", "timeout", "util", "buffer"] }

View File

@ -112,7 +112,7 @@ proptest! {
// Check the state after the response
let error = shared_error_slot.try_get_error();
assert!(matches!(error, None));
assert!(error.is_none());
inbound_service.expect_no_requests().await?;

View File

@ -1176,7 +1176,7 @@ async fn add_initial_peers_is_rate_limited() {
// Check for panics or errors in the address book updater task.
let updater_result = address_book_updater_task_handle.now_or_never();
assert!(
matches!(updater_result, None)
updater_result.is_none()
|| matches!(updater_result, Some(Err(ref join_error)) if join_error.is_cancelled())
// The task method only returns one kind of error.
// We can't check for error equality due to type erasure,
@ -1643,8 +1643,7 @@ where
// Check for panics or errors in the crawler.
let crawl_result = crawl_task_handle.now_or_never();
assert!(
matches!(crawl_result, None)
|| matches!(crawl_result, Some(Err(ref e)) if e.is_cancelled()),
crawl_result.is_none() || matches!(crawl_result, Some(Err(ref e)) if e.is_cancelled()),
"unexpected error or panic in peer crawler task: {crawl_result:?}",
);
@ -1749,8 +1748,7 @@ where
// Check for panics or errors in the listener.
let listen_result = listen_task_handle.now_or_never();
assert!(
matches!(listen_result, None)
|| matches!(listen_result, Some(Err(ref e)) if e.is_cancelled()),
listen_result.is_none() || matches!(listen_result, Some(Err(ref e)) if e.is_cancelled()),
"unexpected error or panic in inbound peer listener task: {listen_result:?}",
);

View File

@ -306,7 +306,7 @@ where
.all(|harness| harness.remote_version() < minimum_version);
if all_peers_are_outdated {
prop_assert!(matches!(poll_result, None));
prop_assert!(poll_result.is_none());
} else {
prop_assert!(matches!(poll_result, Some(Ok(_))));
}

View File

@ -336,12 +336,10 @@ fn peer_set_route_inv_advertised_registry_order(advertised_first: bool) {
};
assert!(
matches!(
other_handle
.try_to_receive_outbound_client_request()
.request(),
None
),
other_handle
.try_to_receive_outbound_client_request()
.request()
.is_none(),
"request routed to non-advertised peer",
);
});
@ -430,12 +428,10 @@ fn peer_set_route_inv_missing_registry_order(missing_first: bool) {
};
assert!(
matches!(
missing_handle
.try_to_receive_outbound_client_request()
.request(),
None
),
missing_handle
.try_to_receive_outbound_client_request()
.request()
.is_none(),
"request routed to missing peer",
);
@ -529,12 +525,9 @@ fn peer_set_route_inv_all_missing_fail() {
let missing_handle = &mut handles[0];
assert!(
matches!(
missing_handle
missing_handle
.try_to_receive_outbound_client_request()
.request(),
None
),
.request().is_none(),
"request routed to missing peer",
);

View File

@ -37,3 +37,11 @@ jsonrpc-core = { version = "18.0.0", optional = true }
reqwest = { version = "0.11.18", optional = true }
serde = { version = "1.0.163", optional = true }
serde_json = { version = "1.0.95", optional = true }
[dev-dependencies]
color-eyre = "0.6.2"
jsonrpc-core = "18.0.0"
reqwest = "0.11.18"
serde = "1.0.163"
serde_json = "1.0.95"

View File

@ -76,7 +76,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -137,7 +137,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -197,7 +197,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -251,7 +251,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -307,7 +307,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -405,7 +405,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -461,7 +461,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -519,7 +519,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -552,7 +552,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
runtime.block_on(async move {
mempool.expect_no_requests().await?;
@ -631,7 +631,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
// check no requests were made during this test
runtime.block_on(async move {
@ -855,7 +855,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;
@ -955,7 +955,7 @@ proptest! {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
prop_assert!(matches!(rpc_tx_queue_task_result, None));
prop_assert!(rpc_tx_queue_task_result.is_none());
Ok::<_, TestCaseError>(())
})?;

View File

@ -52,7 +52,7 @@ async fn rpc_getinfo() {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
#[tokio::test(flavor = "multi_thread")]
@ -211,7 +211,7 @@ async fn rpc_getblock() {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
#[tokio::test(flavor = "multi_thread")]
@ -253,7 +253,7 @@ async fn rpc_getblock_parse_error() {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
#[tokio::test(flavor = "multi_thread")]
@ -307,7 +307,7 @@ async fn rpc_getblock_missing_error() {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
#[tokio::test(flavor = "multi_thread")]
@ -355,7 +355,7 @@ async fn rpc_getbestblockhash() {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
#[tokio::test(flavor = "multi_thread")]
@ -519,7 +519,7 @@ async fn rpc_getrawtransaction() {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
#[tokio::test(flavor = "multi_thread")]
@ -625,7 +625,7 @@ async fn rpc_getaddresstxids_invalid_arguments() {
// The queue task should continue without errors or panics
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
#[tokio::test(flavor = "multi_thread")]

View File

@ -78,10 +78,10 @@ fn rpc_server_spawn(parallel_cpu_threads: bool) {
// The server and queue tasks should continue without errors or panics
let rpc_server_task_result = rpc_server_task_handle.now_or_never();
assert!(matches!(rpc_server_task_result, None));
assert!(rpc_server_task_result.is_none());
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
});
info!("waiting for RPC server to shut down...");
@ -184,10 +184,10 @@ fn rpc_server_spawn_unallocated_port(parallel_cpu_threads: bool, do_shutdown: bo
} else {
// The server and queue tasks should continue without errors or panics
let rpc_server_task_result = rpc_server_task_handle.now_or_never();
assert!(matches!(rpc_server_task_result, None));
assert!(rpc_server_task_result.is_none());
let rpc_tx_queue_task_result = rpc_tx_queue_task_handle.now_or_never();
assert!(matches!(rpc_tx_queue_task_result, None));
assert!(rpc_tx_queue_task_result.is_none());
}
});

View File

@ -52,7 +52,7 @@ tempfile = "3.5.0"
thiserror = "1.0.40"
rayon = "1.7.0"
tokio = { version = "1.28.2", features = ["sync", "tracing"] }
tokio = { version = "1.28.2", features = ["rt-multi-thread", "sync", "tracing"] }
tower = { version = "0.4.13", features = ["buffer", "util"] }
tracing = "0.1.37"

View File

@ -117,13 +117,13 @@ async fn mempool_requests_for_transactions() {
let sync_gossip_result = sync_gossip_task_handle.now_or_never();
assert!(
matches!(sync_gossip_result, None),
sync_gossip_result.is_none(),
"unexpected error or panic in sync gossip task: {sync_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
}
@ -208,13 +208,13 @@ async fn mempool_push_transaction() -> Result<(), crate::BoxError> {
let sync_gossip_result = sync_gossip_task_handle.now_or_never();
assert!(
matches!(sync_gossip_result, None),
sync_gossip_result.is_none(),
"unexpected error or panic in sync gossip task: {sync_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
@ -313,13 +313,13 @@ async fn mempool_advertise_transaction_ids() -> Result<(), crate::BoxError> {
let sync_gossip_result = sync_gossip_task_handle.now_or_never();
assert!(
matches!(sync_gossip_result, None),
sync_gossip_result.is_none(),
"unexpected error or panic in sync gossip task: {sync_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
@ -629,13 +629,13 @@ async fn mempool_transaction_expiration() -> Result<(), crate::BoxError> {
let sync_gossip_result = sync_gossip_task_handle.now_or_never();
assert!(
matches!(sync_gossip_result, None),
sync_gossip_result.is_none(),
"unexpected error or panic in sync gossip task: {sync_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
@ -727,13 +727,13 @@ async fn inbound_block_height_lookahead_limit() -> Result<(), crate::BoxError> {
let sync_gossip_result = sync_gossip_task_handle.now_or_never();
assert!(
matches!(sync_gossip_result, None),
sync_gossip_result.is_none(),
"unexpected error or panic in sync gossip task: {sync_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);

View File

@ -108,13 +108,13 @@ async fn inbound_peers_empty_address_book() -> Result<(), crate::BoxError> {
let block_gossip_result = block_gossip_task_handle.now_or_never();
assert!(
matches!(block_gossip_result, None),
block_gossip_result.is_none(),
"unexpected error or panic in block gossip task: {block_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
@ -191,13 +191,13 @@ async fn inbound_block_empty_state_notfound() -> Result<(), crate::BoxError> {
let block_gossip_result = block_gossip_task_handle.now_or_never();
assert!(
matches!(block_gossip_result, None),
block_gossip_result.is_none(),
"unexpected error or panic in block gossip task: {block_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
@ -311,13 +311,13 @@ async fn inbound_tx_empty_state_notfound() -> Result<(), crate::BoxError> {
let block_gossip_result = block_gossip_task_handle.now_or_never();
assert!(
matches!(block_gossip_result, None),
block_gossip_result.is_none(),
"unexpected error or panic in block gossip task: {block_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
@ -461,13 +461,13 @@ async fn outbound_tx_unrelated_response_notfound() -> Result<(), crate::BoxError
let block_gossip_result = block_gossip_task_handle.now_or_never();
assert!(
matches!(block_gossip_result, None),
block_gossip_result.is_none(),
"unexpected error or panic in block gossip task: {block_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);
@ -574,13 +574,13 @@ async fn outbound_tx_partial_response_notfound() -> Result<(), crate::BoxError>
let block_gossip_result = block_gossip_task_handle.now_or_never();
assert!(
matches!(block_gossip_result, None),
block_gossip_result.is_none(),
"unexpected error or panic in block gossip task: {block_gossip_result:?}",
);
let tx_gossip_result = tx_gossip_task_handle.now_or_never();
assert!(
matches!(tx_gossip_result, None),
tx_gossip_result.is_none(),
"unexpected error or panic in transaction gossip task: {tx_gossip_result:?}",
);

View File

@ -255,7 +255,7 @@ async fn sync_blocks_ok() -> Result<(), crate::BoxError> {
let chain_sync_result = chain_sync_task_handle.now_or_never();
assert!(
matches!(chain_sync_result, None),
chain_sync_result.is_none(),
"unexpected error or panic in chain sync task: {chain_sync_result:?}",
);
@ -486,7 +486,7 @@ async fn sync_blocks_duplicate_hashes_ok() -> Result<(), crate::BoxError> {
let chain_sync_result = chain_sync_task_handle.now_or_never();
assert!(
matches!(chain_sync_result, None),
chain_sync_result.is_none(),
"unexpected error or panic in chain sync task: {chain_sync_result:?}",
);
@ -539,7 +539,7 @@ async fn sync_block_lookahead_drop() -> Result<(), crate::BoxError> {
let chain_sync_result = chain_sync_task_handle.now_or_never();
assert!(
matches!(chain_sync_result, None),
chain_sync_result.is_none(),
"unexpected error or panic in chain sync task: {chain_sync_result:?}",
);
@ -694,7 +694,7 @@ async fn sync_block_too_high_obtain_tips() -> Result<(), crate::BoxError> {
let chain_sync_result = chain_sync_task_handle.now_or_never();
assert!(
matches!(chain_sync_result, None),
chain_sync_result.is_none(),
"unexpected error or panic in chain sync task: {chain_sync_result:?}",
);
@ -915,7 +915,7 @@ async fn sync_block_too_high_extend_tips() -> Result<(), crate::BoxError> {
let chain_sync_result = chain_sync_task_handle.now_or_never();
assert!(
matches!(chain_sync_result, None),
chain_sync_result.is_none(),
"unexpected error or panic in chain sync task: {chain_sync_result:?}",
);