Browse Source

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
Trent Nelson 2 years ago
parent
commit
7c545b0ae9

+ 3 - 3
accounts-db/src/accounts_db.rs

@@ -10146,15 +10146,15 @@ pub mod tests {
         let offset = 3;
         let offset = 3;
         let hash = Hash::new(&[2; 32]);
         let hash = Hash::new(&[2; 32]);
         let stored_meta = StoredMeta {
         let stored_meta = StoredMeta {
-            /// global write version
+            // global write version
             write_version_obsolete: 0,
             write_version_obsolete: 0,
-            /// key for the account
+            // key for the account
             pubkey,
             pubkey,
             data_len: 43,
             data_len: 43,
         };
         };
         let account = StoredAccountMeta::AppendVec(AppendVecStoredAccountMeta {
         let account = StoredAccountMeta::AppendVec(AppendVecStoredAccountMeta {
             meta: &stored_meta,
             meta: &stored_meta,
-            /// account data
+            // account data
             account_meta: &account_meta,
             account_meta: &account_meta,
             data: account.data(),
             data: account.data(),
             offset,
             offset,

+ 3 - 3
accounts-db/src/ancient_append_vecs.rs

@@ -1822,15 +1822,15 @@ pub mod tests {
         let offset = 3;
         let offset = 3;
         let hash = Hash::new(&[2; 32]);
         let hash = Hash::new(&[2; 32]);
         let stored_meta = StoredMeta {
         let stored_meta = StoredMeta {
-            /// global write version
+            // global write version
             write_version_obsolete: 0,
             write_version_obsolete: 0,
-            /// key for the account
+            // key for the account
             pubkey,
             pubkey,
             data_len: 43,
             data_len: 43,
         };
         };
         let account = StoredAccountMeta::AppendVec(AppendVecStoredAccountMeta {
         let account = StoredAccountMeta::AppendVec(AppendVecStoredAccountMeta {
             meta: &stored_meta,
             meta: &stored_meta,
-            /// account data
+            // account data
             account_meta: &account_meta,
             account_meta: &account_meta,
             data: account.data(),
             data: account.data(),
             offset,
             offset,

+ 6 - 6
accounts-db/src/partitioned_rewards.rs

@@ -27,13 +27,13 @@ pub struct PartitionedEpochRewardsConfig {
 impl Default for PartitionedEpochRewardsConfig {
 impl Default for PartitionedEpochRewardsConfig {
     fn default() -> Self {
     fn default() -> Self {
         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,
             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,
             stake_account_stores_per_block: 4096,
             test_enable_partitioned_rewards: false,
             test_enable_partitioned_rewards: false,
             test_compare_partitioned_epoch_rewards: false,
             test_compare_partitioned_epoch_rewards: false,

+ 1 - 1
ci/docker-rust-nightly/Dockerfile

@@ -1,4 +1,4 @@
-FROM solanalabs/rust:1.72.0
+FROM solanalabs/rust:1.72.1
 ARG date
 ARG date
 
 
 RUN set -x \
 RUN set -x \

+ 1 - 1
ci/docker-rust/Dockerfile

@@ -1,6 +1,6 @@
 # Note: when the rust version is changed also modify
 # Note: when the rust version is changed also modify
 # ci/rust-version.sh to pick up the new image tag
 # 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
 ARG NODE_MAJOR=18
 
 

+ 1 - 1
ci/rust-version.sh

@@ -29,7 +29,7 @@ fi
 if [[ -n $RUST_NIGHTLY_VERSION ]]; then
 if [[ -n $RUST_NIGHTLY_VERSION ]]; then
   nightly_version="$RUST_NIGHTLY_VERSION"
   nightly_version="$RUST_NIGHTLY_VERSION"
 else
 else
-  nightly_version=2023-08-25
+  nightly_version=2023-09-20
 fi
 fi
 
 
 
 

+ 3 - 3
ledger/src/blockstore.rs

@@ -7134,8 +7134,8 @@ pub mod tests {
 
 
         let expected_transactions: Vec<VersionedTransactionWithStatusMeta> = entries
         let expected_transactions: Vec<VersionedTransactionWithStatusMeta> = entries
             .iter()
             .iter()
-            .cloned()
             .filter(|entry| !entry.is_tick())
             .filter(|entry| !entry.is_tick())
+            .cloned()
             .flat_map(|entry| entry.transactions)
             .flat_map(|entry| entry.transactions)
             .map(|transaction| {
             .map(|transaction| {
                 let mut pre_balances: Vec<u64> = vec![];
                 let mut pre_balances: Vec<u64> = vec![];
@@ -8018,8 +8018,8 @@ pub mod tests {
 
 
         let expected_transactions: Vec<VersionedTransactionWithStatusMeta> = entries
         let expected_transactions: Vec<VersionedTransactionWithStatusMeta> = entries
             .iter()
             .iter()
-            .cloned()
             .filter(|entry| !entry.is_tick())
             .filter(|entry| !entry.is_tick())
+            .cloned()
             .flat_map(|entry| entry.transactions)
             .flat_map(|entry| entry.transactions)
             .map(|transaction| {
             .map(|transaction| {
                 let mut pre_balances: Vec<u64> = vec![];
                 let mut pre_balances: Vec<u64> = vec![];
@@ -8138,8 +8138,8 @@ pub mod tests {
 
 
         let expected_transactions: Vec<VersionedTransactionWithStatusMeta> = entries
         let expected_transactions: Vec<VersionedTransactionWithStatusMeta> = entries
             .iter()
             .iter()
-            .cloned()
             .filter(|entry| !entry.is_tick())
             .filter(|entry| !entry.is_tick())
+            .cloned()
             .flat_map(|entry| entry.transactions)
             .flat_map(|entry| entry.transactions)
             .map(|transaction| {
             .map(|transaction| {
                 let mut pre_balances: Vec<u64> = vec![];
                 let mut pre_balances: Vec<u64> = vec![];

+ 2 - 2
ledger/src/blockstore/blockstore_purge.rs

@@ -716,8 +716,8 @@ pub mod tests {
             blockstore.insert_shreds(shreds, None, false).unwrap();
             blockstore.insert_shreds(shreds, None, false).unwrap();
             let signature = entries
             let signature = entries
                 .iter()
                 .iter()
-                .cloned()
                 .filter(|entry| !entry.is_tick())
                 .filter(|entry| !entry.is_tick())
+                .cloned()
                 .flat_map(|entry| entry.transactions)
                 .flat_map(|entry| entry.transactions)
                 .map(|transaction| transaction.signatures[0])
                 .map(|transaction| transaction.signatures[0])
                 .collect::<Vec<Signature>>()[0];
                 .collect::<Vec<Signature>>()[0];
@@ -759,8 +759,8 @@ pub mod tests {
             blockstore.insert_shreds(shreds, None, false).unwrap();
             blockstore.insert_shreds(shreds, None, false).unwrap();
             let signature: Signature = entries
             let signature: Signature = entries
                 .iter()
                 .iter()
-                .cloned()
                 .filter(|entry| !entry.is_tick())
                 .filter(|entry| !entry.is_tick())
+                .cloned()
                 .flat_map(|entry| entry.transactions)
                 .flat_map(|entry| entry.transactions)
                 .map(|transaction| transaction.signatures[0])
                 .map(|transaction| transaction.signatures[0])
                 .collect::<Vec<Signature>>()[0];
                 .collect::<Vec<Signature>>()[0];

+ 18 - 25
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 })
             .filter_map(|(s, _)| if s > latest_slot { Some(s) } else { None })
             .collect();
             .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);
             info!("Checking latest_slot {}", latest_slot);
             // Wait for the slot to be fully received by the validator
             // Wait for the slot to be fully received by the validator
             loop {
             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
     // 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
     // fork validator to get another version of the slot. Also ensure all versions of
     // the block are playable
     // 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
     // 3) Force `duplicate_fork_validator1_pubkey` to see a duplicate proof
     info!("Waiting for duplicate proof for slot: {}", dup_slot);
     info!("Waiting for duplicate proof for slot: {}", dup_slot);

+ 1 - 1
rust-toolchain.toml

@@ -1,2 +1,2 @@
 [toolchain]
 [toolchain]
-channel = "1.72.0"
+channel = "1.72.1"

+ 0 - 10
sdk/program/src/vote/state/vote_state_versions.rs

@@ -21,30 +21,20 @@ impl VoteStateVersions {
                 VoteState {
                 VoteState {
                     node_pubkey: state.node_pubkey,
                     node_pubkey: state.node_pubkey,
 
 
-                    /// the signer for withdrawals
                     authorized_withdrawer: state.authorized_withdrawer,
                     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,
                     commission: state.commission,
 
 
                     votes: Self::landed_votes_from_lockouts(state.votes),
                     votes: Self::landed_votes_from_lockouts(state.votes),
 
 
                     root_slot: state.root_slot,
                     root_slot: state.root_slot,
 
 
-                    /// the signer for vote transactions
                     authorized_voters,
                     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(),
                     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(),
                     epoch_credits: state.epoch_credits.clone(),
 
 
-                    /// most recent timestamp submitted with a vote
                     last_timestamp: state.last_timestamp.clone(),
                     last_timestamp: state.last_timestamp.clone(),
                 }
                 }
             }
             }