From 7c545b0ae96be5a3ed2619fd04cf4f74e5447b77 Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Wed, 20 Sep 2023 23:53:36 -0600 Subject: [PATCH] bump rust stable to 1.72.1 (#33333) * bump rust stable to 1.72.1 * bump rust nightly to 2023-09-20 * fix nightly lint -- unused doc comment -- rustdoc does not generate documentation for expression fields * fix nightly lint -- unnecessarily eager cloning of iterator items * fix nightly lint -- loop never actually loops --- accounts-db/src/accounts_db.rs | 6 +-- accounts-db/src/ancient_append_vecs.rs | 6 +-- accounts-db/src/partitioned_rewards.rs | 12 +++--- ci/docker-rust-nightly/Dockerfile | 2 +- ci/docker-rust/Dockerfile | 2 +- ci/rust-version.sh | 2 +- ledger/src/blockstore.rs | 6 +-- ledger/src/blockstore/blockstore_purge.rs | 4 +- local-cluster/tests/local_cluster.rs | 43 ++++++++----------- rust-toolchain.toml | 2 +- .../src/vote/state/vote_state_versions.rs | 10 ----- 11 files changed, 39 insertions(+), 56 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index d2800b2ef..be5509678 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -10146,15 +10146,15 @@ pub mod tests { let offset = 3; let hash = Hash::new(&[2; 32]); let stored_meta = StoredMeta { - /// global write version + // global write version write_version_obsolete: 0, - /// key for the account + // key for the account pubkey, data_len: 43, }; let account = StoredAccountMeta::AppendVec(AppendVecStoredAccountMeta { meta: &stored_meta, - /// account data + // account data account_meta: &account_meta, data: account.data(), offset, diff --git a/accounts-db/src/ancient_append_vecs.rs b/accounts-db/src/ancient_append_vecs.rs index 3f4b7bb71..2bfe2a094 100644 --- a/accounts-db/src/ancient_append_vecs.rs +++ b/accounts-db/src/ancient_append_vecs.rs @@ -1822,15 +1822,15 @@ pub mod tests { let offset = 3; let hash = Hash::new(&[2; 32]); let stored_meta = StoredMeta { - /// global write version + // global write version write_version_obsolete: 0, - /// key for the account + // key for the account pubkey, data_len: 43, }; let account = StoredAccountMeta::AppendVec(AppendVecStoredAccountMeta { meta: &stored_meta, - /// account data + // account data account_meta: &account_meta, data: account.data(), offset, diff --git a/accounts-db/src/partitioned_rewards.rs b/accounts-db/src/partitioned_rewards.rs index c638b047c..9d012a71a 100644 --- a/accounts-db/src/partitioned_rewards.rs +++ b/accounts-db/src/partitioned_rewards.rs @@ -27,13 +27,13 @@ pub struct PartitionedEpochRewardsConfig { impl Default for PartitionedEpochRewardsConfig { fn default() -> Self { Self { - /// reward calculation happens synchronously during the first block of the epoch boundary. - /// So, # blocks for reward calculation is 1. + // reward calculation happens synchronously during the first block of the epoch boundary. + // So, # blocks for reward calculation is 1. reward_calculation_num_blocks: 1, - /// # stake accounts to store in one block during partitioned reward interval - /// Target to store 64 rewards per entry/tick in a block. A block has a minimum of 64 - /// entries/tick. This gives 4096 total rewards to store in one block. - /// This constant affects consensus. + // # stake accounts to store in one block during partitioned reward interval + // Target to store 64 rewards per entry/tick in a block. A block has a minimum of 64 + // entries/tick. This gives 4096 total rewards to store in one block. + // This constant affects consensus. stake_account_stores_per_block: 4096, test_enable_partitioned_rewards: false, test_compare_partitioned_epoch_rewards: false, diff --git a/ci/docker-rust-nightly/Dockerfile b/ci/docker-rust-nightly/Dockerfile index 6a0b5523f..23262061e 100644 --- a/ci/docker-rust-nightly/Dockerfile +++ b/ci/docker-rust-nightly/Dockerfile @@ -1,4 +1,4 @@ -FROM solanalabs/rust:1.72.0 +FROM solanalabs/rust:1.72.1 ARG date RUN set -x \ diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile index f6d1c5906..e5d80f9e0 100644 --- a/ci/docker-rust/Dockerfile +++ b/ci/docker-rust/Dockerfile @@ -1,6 +1,6 @@ # Note: when the rust version is changed also modify # ci/rust-version.sh to pick up the new image tag -FROM rust:1.72.0 +FROM rust:1.72.1 ARG NODE_MAJOR=18 diff --git a/ci/rust-version.sh b/ci/rust-version.sh index 1baaf19fc..76f929277 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -29,7 +29,7 @@ fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else - nightly_version=2023-08-25 + nightly_version=2023-09-20 fi diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 6660252e4..d11e03e6f 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -7134,8 +7134,8 @@ pub mod tests { let expected_transactions: Vec = entries .iter() - .cloned() .filter(|entry| !entry.is_tick()) + .cloned() .flat_map(|entry| entry.transactions) .map(|transaction| { let mut pre_balances: Vec = vec![]; @@ -8018,8 +8018,8 @@ pub mod tests { let expected_transactions: Vec = entries .iter() - .cloned() .filter(|entry| !entry.is_tick()) + .cloned() .flat_map(|entry| entry.transactions) .map(|transaction| { let mut pre_balances: Vec = vec![]; @@ -8138,8 +8138,8 @@ pub mod tests { let expected_transactions: Vec = entries .iter() - .cloned() .filter(|entry| !entry.is_tick()) + .cloned() .flat_map(|entry| entry.transactions) .map(|transaction| { let mut pre_balances: Vec = vec![]; diff --git a/ledger/src/blockstore/blockstore_purge.rs b/ledger/src/blockstore/blockstore_purge.rs index 2bd6bfca2..7a58d7875 100644 --- a/ledger/src/blockstore/blockstore_purge.rs +++ b/ledger/src/blockstore/blockstore_purge.rs @@ -716,8 +716,8 @@ pub mod tests { blockstore.insert_shreds(shreds, None, false).unwrap(); let signature = entries .iter() - .cloned() .filter(|entry| !entry.is_tick()) + .cloned() .flat_map(|entry| entry.transactions) .map(|transaction| transaction.signatures[0]) .collect::>()[0]; @@ -759,8 +759,8 @@ pub mod tests { blockstore.insert_shreds(shreds, None, false).unwrap(); let signature: Signature = entries .iter() - .cloned() .filter(|entry| !entry.is_tick()) + .cloned() .flat_map(|entry| entry.transactions) .map(|transaction| transaction.signatures[0]) .collect::>()[0]; diff --git a/local-cluster/tests/local_cluster.rs b/local-cluster/tests/local_cluster.rs index 137477be1..658fdf0de 100644 --- a/local-cluster/tests/local_cluster.rs +++ b/local-cluster/tests/local_cluster.rs @@ -4169,8 +4169,8 @@ fn find_latest_replayed_slot_from_ledger( .filter_map(|(s, _)| if s > latest_slot { Some(s) } else { None }) .collect(); - for new_latest_slot in new_latest_slots { - latest_slot = new_latest_slot; + if let Some(new_latest_slot) = new_latest_slots.first() { + latest_slot = *new_latest_slot; info!("Checking latest_slot {}", latest_slot); // Wait for the slot to be fully received by the validator loop { @@ -5293,30 +5293,23 @@ fn test_duplicate_shreds_switch_failure() { // 2) Wait for a duplicate slot to land on both validators and for the target switch // fork validator to get another version of the slot. Also ensure all versions of // the block are playable - let dup_slot; - loop { - dup_slot = duplicate_slot_receiver - .recv_timeout(Duration::from_millis(30_000)) - .expect("Duplicate leader failed to make a duplicate slot in allotted time"); + let dup_slot = duplicate_slot_receiver + .recv_timeout(Duration::from_millis(30_000)) + .expect("Duplicate leader failed to make a duplicate slot in allotted time"); - // Make sure both validators received and replay the complete blocks - let dup_frozen_hash = wait_for_duplicate_fork_frozen( - &cluster.ledger_path(&duplicate_fork_validator1_pubkey), - dup_slot, - ); - let original_frozen_hash = wait_for_duplicate_fork_frozen( - &cluster.ledger_path(&duplicate_leader_validator_pubkey), - dup_slot, - ); - if original_frozen_hash != dup_frozen_hash { - break; - } else { - panic!( - "Duplicate leader and partition target got same hash: {}", - original_frozen_hash - ); - } - } + // Make sure both validators received and replay the complete blocks + let dup_frozen_hash = wait_for_duplicate_fork_frozen( + &cluster.ledger_path(&duplicate_fork_validator1_pubkey), + dup_slot, + ); + let original_frozen_hash = wait_for_duplicate_fork_frozen( + &cluster.ledger_path(&duplicate_leader_validator_pubkey), + dup_slot, + ); + assert_ne!( + original_frozen_hash, dup_frozen_hash, + "Duplicate leader and partition target got same hash: {original_frozen_hash}", + ); // 3) Force `duplicate_fork_validator1_pubkey` to see a duplicate proof info!("Waiting for duplicate proof for slot: {}", dup_slot); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 743f7cd99..7eb23c42c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.72.0" +channel = "1.72.1" diff --git a/sdk/program/src/vote/state/vote_state_versions.rs b/sdk/program/src/vote/state/vote_state_versions.rs index dc7c0e9e6..7c4939d36 100644 --- a/sdk/program/src/vote/state/vote_state_versions.rs +++ b/sdk/program/src/vote/state/vote_state_versions.rs @@ -21,30 +21,20 @@ impl VoteStateVersions { VoteState { node_pubkey: state.node_pubkey, - /// the signer for withdrawals authorized_withdrawer: state.authorized_withdrawer, - /// percentage (0-100) that represents what part of a rewards - /// payout should be given to this VoteAccount commission: state.commission, votes: Self::landed_votes_from_lockouts(state.votes), root_slot: state.root_slot, - /// the signer for vote transactions authorized_voters, - /// history of prior authorized voters and the epochs for which - /// they were set, the bottom end of the range is inclusive, - /// the top of the range is exclusive prior_voters: CircBuf::default(), - /// history of how many credits earned by the end of each epoch - /// each tuple is (Epoch, credits, prev_credits) epoch_credits: state.epoch_credits.clone(), - /// most recent timestamp submitted with a vote last_timestamp: state.last_timestamp.clone(), } }