Skip to content

Commit 0eee5b8

Browse files
chore: update rust to 1.86 (#1759)
* chore: update rust to 1.86 * chore: simplify get_output_account (#1760) --------- Co-authored-by: ananas-block <58553958+ananas-block@users.noreply.github.com>
1 parent 04298af commit 0eee5b8

File tree

37 files changed

+201
-199
lines changed

37 files changed

+201
-199
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
rustup target add x86_64-unknown-linux-gnu --toolchain nightly
3838
rustup component add --toolchain nightly rustfmt
3939
rustup component add --toolchain nightly clippy
40-
rustup component add --toolchain 1.83-x86_64-unknown-linux-gnu clippy
40+
rustup component add --toolchain 1.86-x86_64-unknown-linux-gnu clippy
4141
./scripts/lint.sh

examples/anchor/counter/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(unexpected_cfgs)]
2+
13
use anchor_lang::{prelude::*, AnchorDeserialize, Discriminator};
24
use light_sdk::{
35
account::LightAccount,

forester/src/epoch_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl<R: RpcConnection, I: Indexer + IndexerType<R> + 'static> EpochManager<R, I>
314314
"last_epoch: {:?}, current_epoch: {:?}, slot: {:?}",
315315
last_epoch, current_epoch, slot
316316
);
317-
if last_epoch.map_or(true, |last| current_epoch > last) {
317+
if last_epoch.is_none_or(|last| current_epoch > last) {
318318
debug!("New epoch detected: {}", current_epoch);
319319
let phases = get_epoch_phases(&self.protocol_config, current_epoch);
320320
if slot < phases.registration.end {

forester/src/smart_transaction.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ pub struct CreateSmartTransactionConfig {
3232
///
3333
/// # Returns
3434
/// The confirmed transaction signature or an error if the confirmation times out
35-
pub async fn poll_transaction_confirmation<'a, R: RpcConnection>(
36-
connection: &mut bb8::PooledConnection<'a, SolanaConnectionManager<R>>,
35+
pub async fn poll_transaction_confirmation<R: RpcConnection>(
36+
connection: &mut bb8::PooledConnection<'_, SolanaConnectionManager<R>>,
3737
txt_sig: Signature,
3838
abort_timeout: Duration,
3939
) -> Result<Signature, light_client::rpc::RpcError> {
@@ -80,8 +80,8 @@ pub async fn poll_transaction_confirmation<'a, R: RpcConnection>(
8080
}
8181

8282
// Sends a transaction and handles its confirmation. Retries until timeout or last_valid_block_height is reached.
83-
pub async fn send_and_confirm_transaction<'a, R: RpcConnection>(
84-
connection: &mut bb8::PooledConnection<'a, SolanaConnectionManager<R>>,
83+
pub async fn send_and_confirm_transaction<R: RpcConnection>(
84+
connection: &mut bb8::PooledConnection<'_, SolanaConnectionManager<R>>,
8585
transaction: &Transaction,
8686
send_transaction_config: RpcSendTransactionConfig,
8787
last_valid_block_height: u64,
@@ -118,7 +118,7 @@ pub async fn send_and_confirm_transaction<'a, R: RpcConnection>(
118118
///
119119
/// # Arguments
120120
/// * `config` - The configuration for the smart transaction, which includes the transaction's instructions, signers, and lookup tables, depending on
121-
/// whether it's a legacy or versioned smart transaction. The transaction's send configuration can also be changed, if provided
121+
/// whether it's a legacy or versioned smart transaction. The transaction's send configuration can also be changed, if provided
122122
///
123123
/// # Returns
124124
/// An optimized `Transaction` and the `last_valid_block_height`

program-libs/batched-merkle-tree/src/merkle_tree.rs

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -356,22 +356,22 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
356356
/// Update the tree from the output queue account.
357357
/// 1. Create public inputs hash.
358358
/// 2. Verify update proof and update tree account.
359-
/// 2.1. Verify proof.
360-
/// 2.2. Increment sequence number.
361-
/// 2.3. Increment next index.
362-
/// 2.4. Append new root to root history.
359+
/// 2.1. Verify proof.
360+
/// 2.2. Increment sequence number.
361+
/// 2.3. Increment next index.
362+
/// 2.4. Append new root to root history.
363363
/// 3. Mark zkp batch as inserted in the merkle tree.
364-
/// 3.1. Checks that the batch is ready.
365-
/// 3.2. Increment the number of inserted zkps.
366-
/// 3.3. If all zkps are inserted, set batch state to inserted.
364+
/// 3.1. Checks that the batch is ready.
365+
/// 3.2. Increment the number of inserted zkps.
366+
/// 3.3. If all zkps are inserted, set batch state to inserted.
367367
/// 4. Increment next full batch index if inserted.
368368
/// 5. Zero out previous batch bloom filter of input queue
369-
/// if current batch is 50% inserted.
369+
/// if current batch is 50% inserted.
370370
/// 6. Return the batch append event.
371371
///
372372
/// Note: when proving inclusion by index in
373-
/// value array we need to insert the value into a bloom_filter once it is
374-
/// inserted into the tree. Check this with get_num_inserted_zkps
373+
/// value array we need to insert the value into a bloom_filter once it is
374+
/// inserted into the tree. Check this with get_num_inserted_zkps
375375
pub fn update_tree_from_output_queue_account(
376376
&mut self,
377377
queue_account: &mut BatchedQueueAccount,
@@ -475,14 +475,14 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
475475
/// Update the tree from the input/address queue account.
476476
/// 1. Create public inputs hash.
477477
/// 2. Verify update proof and update tree account.
478-
/// 2.1. Verify proof.
479-
/// 2.2. Increment sequence number.
480-
/// 2.3. If address tree increment next index.
481-
/// 2.4. Append new root to root history.
478+
/// 2.1. Verify proof.
479+
/// 2.2. Increment sequence number.
480+
/// 2.3. If address tree increment next index.
481+
/// 2.4. Append new root to root history.
482482
/// 3. Mark batch as inserted in the merkle tree.
483-
/// 3.1. Checks that the batch is ready.
484-
/// 3.2. Increment the number of inserted zkps.
485-
/// 3.3. If all zkps are inserted, set the state to inserted.
483+
/// 3.1. Checks that the batch is ready.
484+
/// 3.2. Increment the number of inserted zkps.
485+
/// 3.3. If all zkps are inserted, set the state to inserted.
486486
/// 4. Zero out previous batch bloom filter if current batch is 50% inserted.
487487
/// 5. Increment next full batch index if inserted.
488488
/// 6. Return the batch nullify event.
@@ -618,13 +618,13 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
618618
/// 1. Check that the tree is a state tree.
619619
/// 2. Create nullifier Hash(value,leaf_index, tx_hash).
620620
/// 3. Insert nullifier into current batch.
621-
/// 3.1. Insert compressed_account_hash into bloom filter.
622-
/// (bloom filter enables non-inclusion proofs in later txs)
623-
/// 3.2. Add nullifier to leaves hash chain.
624-
/// (Nullification means, the compressed_account_hash in the tree,
625-
/// is overwritten with a nullifier hash)
626-
/// 3.3. Check that compressed_account_hash
627-
/// does not exist in any other bloom filter.
621+
/// 3.1. Insert compressed_account_hash into bloom filter.
622+
/// (bloom filter enables non-inclusion proofs in later txs)
623+
/// 3.2. Add nullifier to leaves hash chain.
624+
/// (Nullification means, the compressed_account_hash in the tree,
625+
/// is overwritten with a nullifier hash)
626+
/// 3.3. Check that compressed_account_hash
627+
/// does not exist in any other bloom filter.
628628
pub fn insert_nullifier_into_queue(
629629
&mut self,
630630
compressed_account_hash: &[u8; 32],
@@ -707,8 +707,8 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
707707
/// Steps:
708708
/// 1. Check whether overlapping roots exist.
709709
/// 2. If yes:
710-
/// 2.1. Get, first safe root index.
711-
/// 2.2. Zero out roots from the oldest root to first safe root.
710+
/// 2.1. Get, first safe root index.
711+
/// 2.2. Zero out roots from the oldest root to first safe root.
712712
///
713713
/// Note on security for root buffer:
714714
/// Account {
@@ -722,20 +722,20 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
722722
/// Timeslot 1:
723723
/// - insert into B1 until full
724724
/// - update tree with B0 in 4 partial updates, don't clear B0 yet
725-
/// -> R0 -> B0.1
726-
/// -> R1 -> B0.2
727-
/// -> R2 -> B0.3
728-
/// -> R3 -> B0.4 - final B0 root
729-
/// B0.sequence_number = 13 (3 + account.root.length)
730-
/// B0.root_index = 3
725+
/// -> R0 -> B0.1
726+
/// -> R1 -> B0.2
727+
/// -> R2 -> B0.3
728+
/// -> R3 -> B0.4 - final B0 root
729+
/// B0.sequence_number = 13 (3 + account.root.length)
730+
/// B0.root_index = 3
731731
/// - execute some B1 root updates
732-
/// -> R4 -> B1.1
733-
/// -> R5 -> B1.2
734-
/// -> R6 -> B1.3
735-
/// -> R7 -> B1.4 - final B1 (update batch 0) root
736-
/// B0.sequence_number = 17 (7 + account.root.length)
737-
/// B0.root_index = 7
738-
/// current_sequence_number = 8
732+
/// -> R4 -> B1.1
733+
/// -> R5 -> B1.2
734+
/// -> R6 -> B1.3
735+
/// -> R7 -> B1.4 - final B1 (update batch 0) root
736+
/// B0.sequence_number = 17 (7 + account.root.length)
737+
/// B0.root_index = 7
738+
/// current_sequence_number = 8
739739
///
740740
/// Timeslot 2:
741741
/// - clear B0
@@ -779,12 +779,12 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
779779
///
780780
/// Idea:
781781
/// 1. Zeroing out the bloom filter of the previous batch is expensive
782-
/// -> the forester should do it.
782+
/// -> the forester should do it.
783783
/// 2. We don't want to zero out the bloom filter when inserting
784-
/// the last zkp of a batch for this might result in failing user tx.
784+
/// the last zkp of a batch for this might result in failing user tx.
785785
/// 3. Wait until next batch is 50% full as grace period for clients
786-
/// to switch from proof by index to proof by zkp
787-
/// for values inserted in the previous batch.
786+
/// to switch from proof by index to proof by zkp
787+
/// for values inserted in the previous batch.
788788
///
789789
/// Steps:
790790
/// 1. Previous batch must be inserted and bloom filter must not be zeroed out.
@@ -794,9 +794,9 @@ impl<'a> BatchedMerkleTreeAccount<'a> {
794794
/// 3.2. zero out bloom filter
795795
/// 3.3. zero out roots if needed
796796
///
797-
/// Initial state: 0 pending -> 1 previous pending even though it was never used
798-
/// 0 inserted -> 1 pending 0 -> 1 pending 50% - zero out 0 -> 1 inserted
799-
/// 0 pending -> 1 inserted
797+
/// Initial state: 0 pending -> 1 previous pending even though it was never used
798+
/// 0 inserted -> 1 pending 0 -> 1 pending 50% - zero out 0 -> 1 inserted
799+
/// 0 pending -> 1 inserted
800800
fn zero_out_previous_batch_bloom_filter(&mut self) -> Result<(), BatchedMerkleTreeError> {
801801
let current_batch = self.queue_batches.pending_batch_index as usize;
802802
let batch_size = self.queue_batches.batch_size;
@@ -1101,15 +1101,15 @@ mod test {
11011101
/// 1. No batch is ready -> nothing should happen.
11021102
/// 2. Batch 0 is inserted but Batch 1 is empty -> nothing should happen.
11031103
/// 3. Batch 0 is inserted but Batch 1 is 25% full (not the required half)
1104-
/// -> nothing should happen.
1104+
/// -> nothing should happen.
11051105
/// 4. Batch 0 is inserted and Batch 1 is full
1106-
/// -> should zero out all existing roots except the last one.
1106+
/// -> should zero out all existing roots except the last one.
11071107
/// 5. Batch 1 is inserted and Batch 0 is empty
1108-
/// -> nothing should happen.
1108+
/// -> nothing should happen.
11091109
/// 6. Batch 1 is inserted and Batch 0 is 25% full (not the required half)
1110-
/// -> nothing should happen.
1110+
/// -> nothing should happen.
11111111
/// 7. Batch 1 is inserted and Batch 0 is half full and no overlapping roots exist
1112-
/// -> bloom filter is zeroed, roots are untouched.
1112+
/// -> bloom filter is zeroed, roots are untouched.
11131113
/// 8. Batch 1 is already zeroed -> nothing should happen
11141114
/// 9. Batch 1 is inserted and Batch 0 is full and overlapping roots exist
11151115
#[test]

program-libs/batched-merkle-tree/src/queue.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ impl BatchedQueueMetadata {
9696
/// An output queue is configured with:
9797
/// 1. 2 batches
9898
/// 2. 2 value vecs (one for each batch)
99-
/// value vec length = batch size
99+
/// value vec length = batch size
100100
/// 3. 2 hash chain vecs (one for each batch)
101-
/// hash chain store length = batch size /zkp batch size
101+
/// hash chain store length = batch size /zkp batch size
102102
///
103103
/// Default config:
104104
/// - 50,000 batch size
105105
/// - 500 zkp batch size
106106
///
107107
/// Initialization:
108108
/// - an output queue is initialized
109-
/// in combination with a state Merkle tree
109+
/// in combination with a state Merkle tree
110110
/// - `init_batched_state_merkle_tree_from_account_info`
111111
///
112112
/// For deserialization use:
@@ -121,7 +121,7 @@ impl BatchedQueueMetadata {
121121
///
122122
/// To spend, the account compression program uses:
123123
/// - check_leaf_index_could_exist_in_batches in combination with
124-
/// `prove_inclusion_by_index_and_zero_out_leaf`
124+
/// `prove_inclusion_by_index_and_zero_out_leaf`
125125
///
126126
/// To read, light the system program uses:
127127
/// - `prove_inclusion_by_index`
@@ -298,8 +298,8 @@ impl<'a> BatchedQueueAccount<'a> {
298298
/// Proves inclusion of leaf index if it exists in one of the batches.
299299
/// 1. Iterate over all batches
300300
/// 2. Check if leaf index could exist in the batch.
301-
/// 2.1 If yes, check whether value at index is equal to hash_chain_value.
302-
/// Throw error if not.
301+
/// 2.1 If yes, check whether value at index is equal to hash_chain_value.
302+
/// Throw error if not.
303303
/// 3. Return true if leaf index exists in one of the batches.
304304
///
305305
/// Note, this method does not fail but returns `false`
@@ -448,7 +448,7 @@ impl DerefMut for BatchedQueueAccount<'_> {
448448
///
449449
/// Steps:
450450
/// 1. Check if the current batch is ready.
451-
/// 1.1. If the current batch is inserted, clear the batch.
451+
/// 1.1. If the current batch is inserted, clear the batch.
452452
/// 2. Insert value into the current batch.
453453
/// 3. If batch is full, increment currently_processing_batch_index.
454454
#[allow(clippy::too_many_arguments)]

program-libs/batched-merkle-tree/src/rollover_address_tree.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ pub fn rollover_batched_address_tree_from_account_info(
4545
///
4646
/// Steps:
4747
/// 1. Check that Merkle tree is ready to be rolled over:
48-
/// 1.1. rollover threshold is configured
49-
/// 1.2. next index is greater than rollover threshold
50-
/// 1.3. the network fee is not set if the current fee is zero
48+
/// 1.1. rollover threshold is configured
49+
/// 1.2. next index is greater than rollover threshold
50+
/// 1.3. the network fee is not set if the current fee is zero
5151
/// 2. Rollover the old Merkle tree and check:
52-
/// 2.2. Rollover is configured.
53-
/// 2.3. Tree is not already rolled over.
54-
/// 2.4. Mark as rolled over in this slot.
52+
/// 2.2. Rollover is configured.
53+
/// 2.3. Tree is not already rolled over.
54+
/// 2.4. Mark as rolled over in this slot.
5555
/// 3. Initialize new batched address Merkle tree account
56-
/// with the same parameters as the old account.
56+
/// with the same parameters as the old account.
5757
pub fn rollover_batched_address_tree<'a>(
5858
old_merkle_tree: &mut BatchedMerkleTreeAccount<'a>,
5959
new_mt_data: &'a mut [u8],

program-libs/batched-merkle-tree/src/rollover_state_tree.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,21 @@ pub fn rollover_batched_state_tree_from_account_info(
123123
///
124124
/// Steps:
125125
/// 1. Check that Merkle tree is ready to be rolled over:
126-
/// 1.1. rollover threshold is configured
127-
/// 1.2. next index is greater than rollover threshold
128-
/// 1.3. the network fee is not set if the current fee is zero
126+
/// 1.1. rollover threshold is configured
127+
/// 1.2. next index is greater than rollover threshold
128+
/// 1.3. the network fee is not set if the current fee is zero
129129
/// 2. Rollover Merkle tree and check:
130-
/// 2.1. Merkle tree and queue are associated.
131-
/// 2.2. Rollover is configured.
132-
/// 2.3. Tree is not already rolled over.
133-
/// 2.4. Mark as rolled over in this slot.
130+
/// 2.1. Merkle tree and queue are associated.
131+
/// 2.2. Rollover is configured.
132+
/// 2.3. Tree is not already rolled over.
133+
/// 2.4. Mark as rolled over in this slot.
134134
/// 3. Rollover output queue and check:
135-
/// 3.1. Merkle tree and queue are associated.
136-
/// 3.2. Rollover is configured.
137-
/// 3.3. Tree is not already rolled over.
138-
/// 3.4. Mark as rolled over in this slot.
135+
/// 3.1. Merkle tree and queue are associated.
136+
/// 3.2. Rollover is configured.
137+
/// 3.3. Tree is not already rolled over.
138+
/// 3.4. Mark as rolled over in this slot.
139139
/// 4. Initialize new Merkle tree and output queue
140-
/// with the same parameters as old accounts.
140+
/// with the same parameters as old accounts.
141141
pub fn rollover_batched_state_tree(
142142
params: RolloverBatchStateTreeParams,
143143
) -> Result<(), BatchedMerkleTreeError> {

program-libs/compressed-account/src/indexer_event/parse.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ struct AssociatedInstructions<'a> {
6767
/// 1. light_system_program::{Invoke, InvokeCpi, InvokeCpiReadOnly} (one of the 3)
6868
/// 2. account_compression::InsertIntoQueues
6969
/// - We return new addresses in batched trees separately
70-
/// because from the PublicTransactionEvent there
71-
/// is no way to know which addresses are new and
72-
/// for batched address trees we need to index the queue of new addresses
73-
/// the tree&queue account only contains bloomfilters, roots and metadata.
70+
/// because from the PublicTransactionEvent there
71+
/// is no way to know which addresses are new and
72+
/// for batched address trees we need to index the queue of new addresses
73+
/// the tree&queue account only contains bloomfilters, roots and metadata.
7474
///
7575
/// Steps:
7676
/// 0. Wrap program ids of instructions to filter but not change the pattern

program-libs/hasher/src/to_byte_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ mod test {
395395
// Test with longer string that gets truncated
396396
let long_string =
397397
"this is a string that is longer than 32 bytes and will be fail".to_string();
398-
let byte_len = long_string.as_bytes().len();
398+
let byte_len = long_string.len();
399399
let result = long_string.to_byte_array();
400400
assert_eq!(result, Err(HasherError::InvalidInputLength(31, byte_len)));
401401
}

0 commit comments

Comments
 (0)