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
3,574 changes: 1,343 additions & 2,231 deletions Cargo.lock

Large diffs are not rendered by default.

43 changes: 39 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[workspace]
members = [
"avm",
Expand All @@ -13,11 +12,47 @@ members = [
]
exclude = ["tests/cfo/deps/openbook-dex", "tests/swap/deps/openbook-dex"]
resolver = "2"
[profile.release]
lto = true

[workspace.dependencies]
solana-signer = "2"
solana-account = "3.0.0"
solana-account-decoder = "3.0.0"
solana-account-info = "3.0.0"
solana-cli-config = "3.0.0"
solana-clock = "3.0.0"
solana-commitment-config = "3.0.0"
solana-compute-budget-interface = "3.0.0"
solana-cpi = "3.0.0"
solana-define-syscall = "3.0.0"
solana-faucet = "3.0.0"
solana-feature-gate-interface = "3.0.0"
solana-instruction = "3.0.0"
solana-instructions-sysvar = "3.0.0"
solana-invoke = "0.5.0"
solana-keypair = "3.0.0"
solana-loader-v3-interface = "6.0.0"
solana-msg = "3.0.0"
solana-program = "3.0.0"
solana-program-entrypoint = "3.0.0"
solana-program-error = "3.0.0"
solana-program-memory = "3.0.0"
solana-program-option = "3.0.0"
solana-program-pack = "3.0.0"
solana-pubkey = "4.0.0"
solana-pubsub-client = "3.0.0"
solana-rpc-client = "3.0.0"
solana-rpc-client-api = "3.0.0"
solana-sdk-ids = "3.0.0"
solana-signature = "3.0.0"
solana-signer = "3.0.0"
solana-stake-interface = "2.0.0"
solana-system-interface = "2.0.0"
# FIXME: solana-sysvar 3.1.x contains breaking changes to sysvar retrieval
solana-sysvar = "~3.0.0"
solana-sysvar-id = "3.0.0"
solana-transaction = "3.0.0"

[profile.release]
lto = true

[profile.release.package.anchor-cli]
codegen-units = 1
26 changes: 13 additions & 13 deletions bench/BINARY_SIZE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Solana version: 2.3.0

Solana version: 2.3.0

| Program | Binary Size | - |
| ------- | ----------- | ----------------------- |
| Program | Binary Size | - |
| ------- | ----------- | ------------------------ |
| bench | 1,126,840 | 🔴 **+181,272 (19.17%)** |

### Notable changes
Expand All @@ -42,8 +42,8 @@ Solana version: 2.3.0

Solana version: 2.1.0

| Program | Binary Size | - |
| ------- | ----------- | --------------------- |
| Program | Binary Size | - |
| ------- | ----------- | ---------------------- |
| bench | 945,568 | 🟢 **-96,360 (9.25%)** |

### Notable changes
Expand All @@ -66,8 +66,8 @@ Solana version: 2.1.0

Solana version: 2.1.0

| Program | Binary Size | - |
| ------- | ----------- | ----------------------- |
| Program | Binary Size | - |
| ------- | ----------- | ------------------------ |
| bench | 1,041,928 | 🔴 **+250,920 (31.72%)** |

### Notable changes
Expand All @@ -93,8 +93,8 @@ Solana version: 1.18.17

Solana version: 1.18.8

| Program | Binary Size | - |
| ------- | ----------- | --------------------- |
| Program | Binary Size | - |
| ------- | ----------- | ---------------------- |
| bench | 791,008 | 🔴 **+47,952 (6.45%)** |

### Notable changes
Expand All @@ -107,8 +107,8 @@ Solana version: 1.18.8

Solana version: 1.17.0

| Program | Binary Size | +/- |
| ------- | ----------- | ----------------------- |
| Program | Binary Size | +/- |
| ------- | ----------- | ------------------------ |
| bench | 743,056 | 🟢 **-417,904 (36.00%)** |

### Notable changes
Expand All @@ -123,8 +123,8 @@ Solana version: 1.17.0

Solana version: 1.16.0

| Program | Binary Size | +/- |
| ------- | ----------- | --------------------- |
| Program | Binary Size | +/- |
| ------- | ----------- | ---------------------- |
| bench | 1,160,960 | 🔴 **+23,272 (2.05%)** |

### Notable changes
Expand All @@ -141,4 +141,4 @@ Solana version: 1.14.16
| ------- | ----------- | --- |
| bench | 1,137,688 | N/A |

---
---
534 changes: 267 additions & 267 deletions bench/COMPUTE_UNITS.md

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ semver = "1.0.4"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0"
shellexpand = "2.1.0"
solana-cli-config = "2"
solana-faucet = "2"
solana-rpc-client = "2"
solana-sdk = "2"
solana-cli-config.workspace = true
solana-clock.workspace = true
solana-commitment-config.workspace = true
solana-compute-budget-interface.workspace = true
solana-faucet = { workspace = true, features = ["agave-unstable-api"] }
solana-instruction.workspace = true
solana-keypair.workspace = true
solana-pubkey.workspace = true
solana-signature.workspace = true
solana-signer.workspace = true
solana-system-interface.workspace = true
solana-transaction.workspace = true
solana-rpc-client.workspace = true
syn = { version = "1.0.60", features = ["full", "extra-traits"] }
tar = "0.4.35"
toml = "0.7.6"
Expand Down
6 changes: 3 additions & 3 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use serde::de::{self, MapAccess, Visitor};
use serde::ser::SerializeMap;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use solana_cli_config::{Config as SolanaConfig, CONFIG_FILE};
use solana_sdk::clock::Slot;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::Keypair;
use solana_clock::Slot;
use solana_keypair::Keypair;
use solana_pubkey::Pubkey;
use solana_signer::Signer;
use std::collections::{BTreeMap, HashMap};
use std::convert::TryFrom;
Expand Down
19 changes: 9 additions & 10 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ use regex::{Regex, RegexBuilder};
use rust_template::{ProgramTemplate, TestTemplate};
use semver::{Version, VersionReq};
use serde_json::{json, Map, Value as JsonValue};
use solana_commitment_config::CommitmentConfig;
use solana_keypair::Keypair;
use solana_pubkey::Pubkey;
use solana_rpc_client::rpc_client::RpcClient;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, Signer};
use solana_signer::EncodableKey;
use solana_signer::{EncodableKey, Signer};
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::collections::HashSet;
Expand All @@ -31,7 +31,6 @@ use std::fs::{self, File};
use std::io::prelude::*;
use std::path::{Path, PathBuf};
use std::process::{Child, Command as ProcessCommand, Stdio};
use std::str::FromStr;
use std::string::ToString;
use std::sync::LazyLock;

Expand Down Expand Up @@ -487,7 +486,7 @@ pub enum ClusterCommand {
}

fn get_keypair(path: &str) -> Result<Keypair> {
solana_sdk::signature::read_keypair_file(path)
solana_keypair::read_keypair_file(path)
.map_err(|_| anyhow!("Unable to read keypair file ({path})"))
}

Expand Down Expand Up @@ -2402,7 +2401,7 @@ fn idl_ts(idl: &Idl) -> Result<String> {
let name = cur.get(1).unwrap().as_str();

// Do not modify pubkeys
if Pubkey::from_str(name).is_ok() {
if Pubkey::try_from(name).is_ok() {
return acc;
}

Expand Down Expand Up @@ -3032,7 +3031,7 @@ fn validator_flags(
.iter()
.map(|entry| {
let address = entry["address"].as_str().unwrap();
Pubkey::from_str(address)
Pubkey::try_from(address)
.map_err(|_| anyhow!("Invalid pubkey {}", address))
})
.collect::<Result<HashSet<Pubkey>>>()?
Expand Down Expand Up @@ -3070,7 +3069,7 @@ fn validator_flags(
.iter()
.map(|entry| {
let feature_flag = entry.as_str().unwrap();
Pubkey::from_str(feature_flag).map_err(|_| {
Pubkey::try_from(feature_flag).map_err(|_| {
anyhow!("Invalid pubkey (feature flag) {}", feature_flag)
})
})
Expand Down Expand Up @@ -3808,7 +3807,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> Res
println!("Found incorrect program id declaration in Anchor.toml for the program `{name}`");

// Update the program id
deployment.address = Pubkey::from_str(&actual_program_id).unwrap();
deployment.address = Pubkey::try_from(actual_program_id.as_str()).unwrap();
fs::write(cfg.path(), cfg.to_string())?;

println!("Updated to {actual_program_id}\n");
Expand Down
8 changes: 3 additions & 5 deletions cli/src/rust_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ use crate::{
use anyhow::Result;
use clap::{Parser, ValueEnum};
use heck::{ToLowerCamelCase, ToPascalCase, ToSnakeCase};
use solana_sdk::{
pubkey::Pubkey,
signature::{read_keypair_file, write_keypair_file, Keypair},
};
use solana_keypair::{read_keypair_file, write_keypair_file, Keypair};
use solana_pubkey::Pubkey;
use solana_signer::Signer;
use std::{
fmt::Write as _,
Expand Down Expand Up @@ -792,7 +790,7 @@ fn test_initialize() {{
let payer = read_keypair_file(&anchor_wallet).unwrap();

let client = Client::new_with_options(Cluster::Localnet, &payer, CommitmentConfig::confirmed());
let program_id = Pubkey::from_str(program_id).unwrap();
let program_id = Pubkey::try_from(program_id).unwrap();
let program = client.program(program_id).unwrap();

let tx = program
Expand Down
16 changes: 10 additions & 6 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ anyhow = "1"
futures = "0.3"
regex = "1"
serde = { version = "1", features = ["derive"] }
solana-account = "2"
solana-account-decoder = "2"
solana-pubsub-client = "2"
solana-rpc-client = "2"
solana-rpc-client-api = "2"
solana-sdk = "2"
solana-account.workspace = true
solana-account-decoder.workspace = true
solana-commitment-config.workspace = true
solana-instruction.workspace = true
solana-program.workspace = true
solana-pubsub-client.workspace = true
solana-rpc-client.workspace = true
solana-rpc-client-api.workspace = true
solana-signature.workspace = true
solana-signer.workspace = true
solana-transaction.workspace = true
thiserror = "1"
tokio = { version = "1", features = ["rt", "sync"] }
url = "2"
6 changes: 4 additions & 2 deletions client/example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ events = { path = "../../tests/events/programs/events", features = ["no-entrypoi
anyhow = "1.0.32"
clap = { version = "4.2.4", features = ["derive"] }
shellexpand = "2.1.0"
solana-sdk = "2"
solana-commitment-config = "3.0.0"
solana-sdk = "3.0.0"
solana-signer = "3.0.0"
solana-system-interface = "2.0.0"
tokio = { version = "1", features = ["full"] }
solana-signer = "2"
11 changes: 5 additions & 6 deletions client/example/src/blocking.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use anchor_client::solana_sdk::pubkey::Pubkey;
use anchor_client::solana_sdk::signature::Keypair;
use anchor_client::solana_sdk::system_instruction;
use anchor_client::{Client, Cluster};
use anyhow::Result;
use clap::Parser;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::read_keypair_file;
use solana_sdk::system_program;
use solana_signer::Signer;
use solana_sdk::signature::{Keypair, Signer};
use solana_system_interface::instruction as system_instruction;
use solana_system_interface::program as system_program;
// The `accounts` and `instructions` modules are generated by the framework.
use basic_2::accounts as basic_2_accounts;
use basic_2::instruction as basic_2_instruction;
Expand Down
2 changes: 1 addition & 1 deletion client/example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anchor_client::solana_sdk::pubkey::Pubkey;
use anyhow::Result;
use clap::Parser;
use solana_sdk::pubkey::Pubkey;

#[cfg(not(feature = "async"))]
mod blocking;
Expand Down
11 changes: 5 additions & 6 deletions client/example/src/nonblocking.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use anchor_client::solana_sdk::pubkey::Pubkey;
use anchor_client::solana_sdk::signature::Keypair;
use anchor_client::solana_sdk::system_instruction;
use anchor_client::{Client, Cluster};
use anyhow::Result;
use clap::Parser;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::read_keypair_file;
use solana_sdk::system_program;
use solana_signer::Signer;
use solana_sdk::signature::{Keypair, Signer};
use solana_system_interface::instruction as system_instruction;
use solana_system_interface::program as system_program;
// The `accounts` and `instructions` modules are generated by the framework.
use basic_2::accounts as basic_2_accounts;
use basic_2::instruction as basic_2_instruction;
Expand Down
7 changes: 4 additions & 3 deletions client/src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ use crate::{
RequestBuilder,
};
use anchor_lang::{prelude::Pubkey, AccountDeserialize, Discriminator};
use solana_commitment_config::CommitmentConfig;
use solana_rpc_client::nonblocking::rpc_client::RpcClient as AsyncRpcClient;
#[cfg(not(feature = "mock"))]
use solana_rpc_client::rpc_client::RpcClient;
use solana_rpc_client_api::{config::RpcSendTransactionConfig, filter::RpcFilterType};
use solana_sdk::{
commitment_config::CommitmentConfig, signature::Signature, transaction::Transaction,
};
use solana_signature::Signature;
use solana_signer::Signer;
use solana_transaction::Transaction;

use std::{marker::PhantomData, ops::Deref, sync::Arc};
use tokio::{
runtime::{Builder, Handle},
Expand Down
Loading