Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,191 changes: 1,368 additions & 823 deletions Cargo.lock

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,45 +61,45 @@ version = "0.1.0"
edition = "2021"

[workspace.dependencies]
solana-banks-client = { version = "2.2" }
solana-banks-interface = { version = "2.2" }
solana-program = "2.2"
solana-pubkey = "2.2"
solana-sdk = "2.2"
solana-banks-client = { version = "2.3" }
solana-banks-interface = { version = "2.3" }
solana-program = "2.3"
solana-pubkey = "2.3"
solana-sdk = "2.3"
solana-cpi = "2.2"
solana-client = "2.2"
solana-cli-output = "2.2"
solana-transaction-status = "2.2"
solana-account-decoder = "2.2"
solana-account-decoder-client-types = "2.2"
solana-transaction-status-client-types = "2.2"
solana-rpc = "2.2"
solana-rpc-client-api = "2.2"
solana-transaction-context = "2.2"
solana-frozen-abi = "2.2"
solana-frozen-abi-macro = "2.2"
solana-client = "2.3"
solana-cli-output = "2.3"
solana-transaction-status = "2.3"
solana-account-decoder = "2.3"
solana-account-decoder-client-types = "2.3"
solana-transaction-status-client-types = "2.3"
solana-rpc = "2.3"
solana-rpc-client-api = "2.3"
solana-transaction-context = "2.3"
solana-frozen-abi = "2.3"
solana-frozen-abi-macro = "2.3"
solana-msg = { version = "2.2" }
solana-zk-token-sdk = "2.2"
solana-logger = "2.2"
solana-bpf-loader-program = "2.2"
solana-zk-token-sdk = "2.3"
solana-logger = "2.3"
solana-bpf-loader-program = "2.3"
solana-bn254 = "2.2"
solana-sysvar = { version = "2.1.1" }
solana-program-error = { version = "2.1.1" }
solana-account-info = { version = "2.1.1" }
solana-sysvar = { version = "2.2" }
solana-program-error = { version = "2.2" }
solana-account-info = { version = "2.2" }
solana-transaction = { version = "2.2" }
solana-transaction-error = { version = "2.2" }
solana-hash = { version = "2.2" }
solana-hash = { version = "2.3" }
solana-clock = { version = "2.2" }
solana-signature = { version = "2.2" }
solana-signature = { version = "2.3" }
solana-commitment-config = { version = "2.2" }
solana-account = { version = "2.2" }
solana-epoch-info = { version = "2.2" }
solana-keypair = { version = "2.2" }
solana-compute-budget-interface = { version = "2.2" }
solana-signer = { version = "2.2" }
solana-instruction = "2.2"
solana-rpc-client = "2.2"
solana-compute-budget = { version = "2.2" }
solana-instruction = "2.3"
solana-rpc-client = "2.3"
solana-compute-budget = { version = "2.3" }

solana-system-interface = { version = "1" }
solana-security-txt = "1.1.1"
Expand All @@ -109,7 +109,7 @@ spl-pod = "0.5.1"
pinocchio = { version = "0.8.4" }
pinocchio-pubkey = { version = "0.3.0" }
bs58 = "^0.5.1"
litesvm = "0.6.1"
litesvm = "0.7"
# Anchor
anchor-lang = { version = "=0.31.1", features = ["idl-build"] }
anchor-spl = "=0.31.1"
Expand Down Expand Up @@ -225,8 +225,8 @@ rand = "0.8.5"

[patch.crates-io]
# Profiling logs and state is handled here
solana-program-runtime = { git = "https://github.com/Lightprotocol/agave", rev = "580e29f03e4176a4a5525abc188a948c6595c47f" }
solana-program-runtime = { git = "https://github.com/Lightprotocol/agave", rev = "35e7c295981a195e61b4f4039a5a6ef707d2210d" }
# Profiling syscalls are defined here
solana-bpf-loader-program = { git = "https://github.com/Lightprotocol/agave", rev = "580e29f03e4176a4a5525abc188a948c6595c47f" }
solana-bpf-loader-program = { git = "https://github.com/Lightprotocol/agave", rev = "35e7c295981a195e61b4f4039a5a6ef707d2210d" }
# Patch solana-program-memory to use older version where is_nonoverlapping is public
solana-program-memory = { git = "https://github.com/anza-xyz/solana-sdk", rev = "1c1d667f161666f12f5a43ebef8eda9470a8c6ee" }
4 changes: 4 additions & 0 deletions forester-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#![allow(clippy::result_large_err)]
#![allow(clippy::large_enum_variant)]
#![allow(deprecated)]

pub mod account_zero_copy;
pub mod address_merkle_tree_config;
pub mod error;
Expand Down
4 changes: 2 additions & 2 deletions forester/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ impl ForesterConfig {
}
None => return Err(ConfigError::MissingField { field: "payer" })?,
};
let payer =
Keypair::from_bytes(&payer).map_err(|e| ConfigError::InvalidKeypair(e.to_string()))?;
let payer = Keypair::try_from(payer.as_slice())
.map_err(|e| ConfigError::InvalidKeypair(e.to_string()))?;

let derivation: Vec<u8> = match &args.derivation {
Some(derivation_str) => {
Expand Down
2 changes: 1 addition & 1 deletion forester/src/health_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async fn check_wallet_balance<R: Rpc>(
}
};

let keypair = match Keypair::from_bytes(&payer_bytes) {
let keypair = match Keypair::try_from(payer_bytes.as_slice()) {
Ok(kp) => kp,
Err(e) => {
return HealthCheckResult::new(
Expand Down
1 change: 1 addition & 0 deletions forester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use tokio::{
use tracing::debug;

#[tokio::main]
#[allow(clippy::result_large_err)]
async fn main() -> Result<(), ForesterError> {
setup_telemetry();

Expand Down
1 change: 1 addition & 0 deletions forester/src/processor/v1/send_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct PreparedBatchData {
timeout_deadline: Instant,
}

#[allow(clippy::large_enum_variant)]
enum TransactionSendResult {
Success(Signature),
Failure(ForesterError, Option<Signature>),
Expand Down
4 changes: 2 additions & 2 deletions forester/tests/e2e_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn get_forester_keypair() -> Keypair {
match bytes {
Ok(byte_vec) => {
if byte_vec.len() == 64 {
return Keypair::from_bytes(&byte_vec)
return Keypair::try_from(byte_vec.as_slice())
.expect("Failed to create keypair from byte array");
} else {
panic!(
Expand All @@ -159,7 +159,7 @@ fn get_forester_keypair() -> Keypair {

match bs58::decode(&keypair_string).into_vec() {
Ok(bytes) => {
Keypair::from_bytes(&bytes).expect("Failed to create keypair from base58 bytes")
Keypair::try_from(bytes.as_slice()).expect("Failed to create keypair from base58 bytes")
}
Err(_) => panic!(
"FORESTER_KEYPAIR must be either base58 encoded or byte array format [1,2,3,...]"
Expand Down
3 changes: 3 additions & 0 deletions program-libs/batched-merkle-tree/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ mod tests {

let mut value = [0u8; 32];
value[24..].copy_from_slice(&i.to_be_bytes());
#[allow(clippy::manual_is_multiple_of)]
let ref_hash_chain = if i % batch.zkp_batch_size == 0 {
value
} else {
Expand Down Expand Up @@ -863,6 +864,7 @@ mod tests {
)
.unwrap();
}
#[allow(clippy::manual_is_multiple_of)]
if (i + 1) % batch.zkp_batch_size == 0 && i != 0 {
assert_eq!(
batch.get_first_ready_zkp_batch().unwrap(),
Expand Down Expand Up @@ -954,6 +956,7 @@ mod tests {
let mut batch = get_test_batch();
assert_eq!(batch.get_num_elements_inserted_into_tree(), 0);
for i in 0..batch.get_num_zkp_batches() {
#[allow(clippy::manual_is_multiple_of)]
if i % batch.zkp_batch_size == 0 {
batch.num_full_zkp_batches += 1;
batch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl QueueBatches {
batch_size: u64,
zkp_batch_size: u64,
) -> Result<(), BatchedMerkleTreeError> {
#[allow(clippy::manual_is_multiple_of)]
if batch_size % zkp_batch_size != 0 {
return Err(BatchedMerkleTreeError::BatchSizeNotDivisibleByZkpBatchSize);
}
Expand Down
2 changes: 2 additions & 0 deletions program-libs/concurrent-merkle-tree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ where
while node_index > 1 {
// `node_index - 2` maps to the canopy index.
let canopy_index = node_index - 2;
#[allow(clippy::manual_is_multiple_of)]
let canopy_index = if canopy_index % 2 == 0 {
canopy_index + 1
} else {
Expand Down Expand Up @@ -562,6 +563,7 @@ where
self.changelog[changelog_index].path[0] = Some(**leaf);

for i in 0..self.height {
#[allow(clippy::manual_is_multiple_of)]
let is_left = current_index % 2 == 0;

if is_left {
Expand Down
2 changes: 1 addition & 1 deletion program-libs/hash-set/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl HashSet {
}

/// Returns an iterator over elements.
pub fn iter(&self) -> HashSetIterator {
pub fn iter(&self) -> HashSetIterator<'_> {
HashSetIterator {
hash_set: self,
current: 0,
Expand Down
2 changes: 1 addition & 1 deletion program-libs/indexed-array/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ where
self.current_node_index == I::zero()
}

pub fn iter(&self) -> IndexingArrayIter<H, I> {
pub fn iter(&self) -> IndexingArrayIter<'_, H, I> {
IndexingArrayIter {
indexing_array: self,
front: 0,
Expand Down
2 changes: 1 addition & 1 deletion program-libs/indexed-merkle-tree/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ where
self.current_node_index == I::zero()
}

pub fn iter(&self) -> IndexingArrayIter<H, I> {
pub fn iter(&self) -> IndexingArrayIter<'_, H, I> {
IndexingArrayIter {
indexing_array: self,
front: 0,
Expand Down
2 changes: 1 addition & 1 deletion program-libs/zero-copy-derive/src/shared/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn process_input_generic(
) -> syn::Result<(
&Ident, // Original name
proc_macro2::Ident, // Z-name
InputType, // Input type (struct or enum)
InputType<'_>, // Input type (struct or enum)
)> {
let name = &input.ident;
let z_name = format_ident!("Z{}", name);
Expand Down
1 change: 1 addition & 0 deletions program-libs/zero-copy-derive/tests/instruction_data.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(feature = "mut")]
#![allow(dead_code)]
use std::vec::Vec;

use borsh::{BorshDeserialize, BorshSerialize};
Expand Down
1 change: 1 addition & 0 deletions program-libs/zero-copy-derive/tests/random.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(feature = "mut")]
#![allow(dead_code)]
use std::assert_eq;

use borsh::BorshDeserialize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use light_test_utils::{
use light_verifier::VerifierError;
use num_bigint::ToBigUint;
use serial_test::serial;
#[allow(deprecated)]
use solana_sdk::{
account::WritableAccount,
instruction::Instruction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async fn test_create_and_update_group() {
.await
.unwrap();
let system_program_id_keypair =
Keypair::from_bytes(&OLD_SYSTEM_PROGRAM_ID_TEST_KEYPAIR).unwrap();
Keypair::try_from(OLD_SYSTEM_PROGRAM_ID_TEST_KEYPAIR.as_slice()).unwrap();
// add new program to group
let registered_program_pda = Pubkey::find_program_address(
&[system_program_id_keypair.pubkey().to_bytes().as_slice()],
Expand Down Expand Up @@ -324,7 +324,7 @@ async fn test_create_and_update_group() {
.unwrap();
let closed_registered_program_account =
context.get_account(registered_program_pda).await.unwrap();
assert_eq!(closed_registered_program_account.unwrap().data.len(), 0);
assert_eq!(closed_registered_program_account, None);
let recipient_balance = context.get_balance(&close_recipient).await.unwrap();
let rent_exemption = context
.get_minimum_balance_for_rent_exemption(RegisteredProgram::LEN)
Expand Down Expand Up @@ -374,7 +374,7 @@ async fn test_resize_registered_program_pda() {
let account_data = RegisteredProgramV1::deserialize(&mut &pre_account.data[8..]).unwrap();
println!("account_data: {:?}", account_data);
let mut transaction =
Transaction::new_with_payer(&[instruction.clone()], Some(&payer.pubkey()));
Transaction::new_with_payer(std::slice::from_ref(&instruction), Some(&payer.pubkey()));
let recent_blockhash = context.get_latest_blockhash().await.unwrap().0;
transaction.sign(&[&payer], recent_blockhash);
context.process_transaction(transaction).await.unwrap();
Expand All @@ -400,7 +400,7 @@ async fn test_resize_registered_program_pda() {
// Resize again should fail.
{
let mut transaction =
Transaction::new_with_payer(&[instruction.clone()], Some(&payer.pubkey()));
Transaction::new_with_payer(std::slice::from_ref(&instruction), Some(&payer.pubkey()));
let recent_blockhash = context.get_latest_blockhash().await.unwrap().0;
transaction.sign(&[&payer], recent_blockhash);
let result = context.process_transaction(transaction).await;
Expand Down Expand Up @@ -443,7 +443,7 @@ async fn test_resize_registered_program_pda() {
data: instruction_data.data(),
};
let mut transaction =
Transaction::new_with_payer(&[instruction.clone()], Some(&payer.pubkey()));
Transaction::new_with_payer(std::slice::from_ref(&instruction), Some(&payer.pubkey()));
let recent_blockhash = context.get_latest_blockhash().await.unwrap().0;
transaction.sign(&[&payer], recent_blockhash);
let result = context.process_transaction(transaction).await;
Expand Down
9 changes: 5 additions & 4 deletions program-tests/compressed-token-test/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ use light_test_utils::{
};
use rand::{seq::SliceRandom, thread_rng, Rng};
use serial_test::serial;
#[allow(deprecated)]
use solana_sdk::{
instruction::Instruction,
pubkey::Pubkey,
Expand Down Expand Up @@ -5616,7 +5617,7 @@ async fn batch_compress_with_batched_tree() {
airdrop_lamports(&mut rpc, &delegate.pubkey(), 1_000_000_000)
.await
.unwrap();
let mint_keypair = Keypair::from_bytes(
let mint_keypair = Keypair::try_from(
[
92, 10, 186, 75, 244, 33, 212, 169, 74, 97, 12, 151, 170, 73, 196, 211, 144, 174, 135,
134, 226, 202, 73, 127, 196, 58, 242, 47, 55, 228, 95, 41, 228, 15, 181, 122, 74, 247,
Expand All @@ -5629,7 +5630,7 @@ async fn batch_compress_with_batched_tree() {
println!("mint keypair {:?}", mint_keypair);
let mint = create_mint_helper_with_keypair(&mut rpc, &payer, &mint_keypair).await;
let amount = 10000u64;
let token_account_keypair = Keypair::from_bytes(
let token_account_keypair = Keypair::try_from(
[
146, 220, 11, 246, 163, 31, 179, 147, 57, 222, 86, 224, 126, 147, 227, 175, 189, 209,
175, 207, 241, 129, 182, 169, 150, 198, 133, 163, 136, 196, 191, 224, 178, 83, 220, 36,
Expand Down Expand Up @@ -5847,7 +5848,7 @@ async fn batch_compress_with_batched_tree() {
.await;
assert_rpc_error(result, 0, TokenError::InsufficientFunds as u32).unwrap();
}
let invalid_token_account_invalid_mint = Keypair::from_bytes(
let invalid_token_account_invalid_mint = Keypair::try_from(
[
115, 180, 27, 68, 167, 116, 94, 248, 224, 127, 195, 122, 31, 54, 174, 159, 116, 186,
54, 185, 64, 123, 9, 97, 189, 205, 251, 92, 210, 158, 114, 25, 86, 155, 159, 222, 91,
Expand All @@ -5857,7 +5858,7 @@ async fn batch_compress_with_batched_tree() {
.as_slice(),
)
.unwrap();
let invalid_mint_keypair = Keypair::from_bytes(
let invalid_mint_keypair = Keypair::try_from(
[
151, 111, 81, 148, 81, 197, 92, 46, 198, 61, 138, 73, 152, 16, 184, 8, 5, 228, 52, 166,
242, 220, 42, 75, 228, 34, 239, 85, 97, 190, 70, 104, 171, 19, 46, 51, 208, 201, 112,
Expand Down
3 changes: 3 additions & 0 deletions program-tests/merkle-tree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ where
};

for level in 0..limit {
#[allow(clippy::manual_is_multiple_of)]
let is_left = index % 2 == 0;

let sibling_index = if is_left { index + 1 } else { index - 1 };
Expand All @@ -252,6 +253,7 @@ where
let mut proof = Vec::with_capacity(self.height);

for level in 0..self.height {
#[allow(clippy::manual_is_multiple_of)]
let is_left = index % 2 == 0;
let sibling_index = if is_left { index + 1 } else { index - 1 };
let node = self.layers[level]
Expand Down Expand Up @@ -323,6 +325,7 @@ where
let mut current_index = leaf_index;

for sibling_hash in proof.iter() {
#[allow(clippy::manual_is_multiple_of)]
let is_left = current_index % 2 == 0;
let hashes = if is_left {
[&computed_hash[..], &sibling_hash[..]]
Expand Down
5 changes: 3 additions & 2 deletions program-tests/registry-test/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ async fn test_initialize_protocol_config() {
};

let payer = rpc.get_payer().insecure_clone();
let program_account_keypair = Keypair::from_bytes(&OLD_REGISTRY_ID_TEST_KEYPAIR).unwrap();
let program_account_keypair =
Keypair::try_from(OLD_REGISTRY_ID_TEST_KEYPAIR.as_slice()).unwrap();
let protocol_config = ProtocolConfig::default();
let (protocol_config_pda, bump) = get_protocol_config_pda_address();
let ix_data = light_registry::instruction::InitializeProtocolConfig {
Expand Down Expand Up @@ -334,7 +335,7 @@ async fn test_initialize_protocol_config() {
}
let cpi_authority_pda = get_cpi_authority_pda();

let group_seed_keypair = Keypair::from_bytes(&GROUP_PDA_SEED_TEST_KEYPAIR).unwrap();
let group_seed_keypair = Keypair::try_from(GROUP_PDA_SEED_TEST_KEYPAIR.as_slice()).unwrap();
let group_pda =
initialize_new_group(&group_seed_keypair, &payer, &mut rpc, cpi_authority_pda.0)
.await
Expand Down
Loading
Loading