Skip to content

Commit

Permalink
Update anchor to v0.29.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgarfield committed Feb 7, 2024
1 parent f87f5f1 commit d6fbdc3
Show file tree
Hide file tree
Showing 23 changed files with 1,809 additions and 1,209 deletions.
2,872 changes: 1,734 additions & 1,138 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ members = [
"cron",
"plugin",
"programs/*",
"relayer",
# "relayer",
"sdk",
"utils"
]

[profile.release]
overflow-checks = true

[patch.crates-io]
anchor-lang = { git = "https://github.com/coral-xyz/anchor", rev = "fbd0688" }
anchor-spl = { git = "https://github.com/coral-xyz/anchor", rev = "fbd0688", features = ["mint", "token"] }
16 changes: 8 additions & 8 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ keywords = ["solana"]
build = "build.rs"

[dependencies]
anchor-lang = "0.27.0"
anchor-spl = { features = ["mint", "token"], version = "0.27.0" }
anchor-lang = "0.29.0"
anchor-spl = { features = ["mint", "token"], version = "0.29.0" }
anyhow = "1.0.61"
bincode = "1.3.3"
bzip2 = "0.4"
Expand All @@ -32,12 +32,12 @@ reqwest = "0.11.14"
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
serde_yaml = "0.9.4"
solana-account-decoder = "=1.14.16"
solana-client = "=1.14.16"
solana-clap-utils = "=1.14.16"
solana-cli-config = "=1.14.16"
solana-sdk = "=1.14.16"
spl-associated-token-account = "1.1.1"
solana-account-decoder = "^1.16"
solana-client = "^1.16"
solana-clap-utils = "^1.16"
solana-cli-config = "^1.16"
solana-sdk = "^1.16"
spl-associated-token-account = "^2.3"
spl-memo = "3.0.1"
spl-token = "~3.5.0"
tar = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion cli/src/processor/crontab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn get(client: &Client, schedule: String) -> Result<(), CliError> {
let schedule = Schedule::from_str(schedule.as_str()).unwrap();

let mut i = 0;
for t in schedule.after(&DateTime::<Utc>::from_utc(
for t in schedule.after(&DateTime::<Utc>::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(clock.unix_timestamp, 0).unwrap(),
Utc,
)) {
Expand Down
19 changes: 10 additions & 9 deletions plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ crate-type = ["cdylib", "rlib"]
name = "clockwork_plugin"

[dependencies]
anchor-lang = "0.27.0"
anchor-lang = "0.29.0"
async_once = "0.2.6"
async-trait = "0.1.64"
bincode = "1.3.3"
Expand All @@ -37,18 +37,19 @@ clockwork-utils = { path = "../utils", version = "=2.0.18" }
lazy_static = "1.4.0"
log = "0.4"
prost = "0.10.0"
pyth-sdk-solana = "0.7.1"
pyth-sdk-solana = "0.9"
reqwest = "0.11.11"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
simple-error = "0.2.3"
solana-account-decoder = "=1.14.16"
solana-client = "=1.14.16"
solana-geyser-plugin-interface = "=1.14.16"
solana-logger = "=1.14.16"
solana-program = "=1.14.16"
solana-sdk = "=1.14.16"
solana-transaction-status = "=1.14.16"
solana-account-decoder = "^1.16"
solana-client = "^1.16"
solana-quic-client = "^1.16"
solana-geyser-plugin-interface = "^1.16"
solana-logger = "^1.16"
solana-program = "^1.16"
solana-sdk = "^1.16"
solana-transaction-status = "^1.16"
thiserror = "1.0.30"
tokio = "1.18.4"
futures = "0.3.26"
Expand Down
14 changes: 6 additions & 8 deletions plugin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ fn main() {
let rustc_v = rustc_version::version()
.expect("Unable to get rustc version")
.to_string();
let expected_v = "1.60.0".to_string();
let expected_v = "1.73.0".to_string();

// Check for a minimum version
// if !rustc_v.ends_with("-nightly") {
if rustc_v != expected_v {
println!("cargo:warning=trying to compile with rustc {}, we should be using {}",
rustc_v,
expected_v,
println!(
"cargo:warning=trying to compile with rustc {}, we should be using {}",
rustc_v, "nightly",
);
std::process::exit(1);
}
println!(
"cargo:rustc-env=RUSTC_VERSION={:#?}",
rustc_v,
);
println!("cargo:rustc-env=RUSTC_VERSION={:#?}", rustc_v,);

let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
Expand Down
24 changes: 12 additions & 12 deletions plugin/src/executors/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use solana_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPluginError, Result as PluginResult,
};
use solana_program::pubkey::Pubkey;
use solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool};
use solana_sdk::{
commitment_config::CommitmentConfig,
signature::{Keypair, Signature},
Expand Down Expand Up @@ -497,10 +498,8 @@ impl TxExecutor {
}

async fn simulate_tx(self: Arc<Self>, tx: &Transaction) -> PluginResult<Transaction> {
RpcClient::new_with_commitment(
LOCAL_RPC_URL.into(),
CommitmentConfig::processed(),
).simulate_transaction_with_config(
RpcClient::new_with_commitment(LOCAL_RPC_URL.into(), CommitmentConfig::processed())
.simulate_transaction_with_config(
tx,
RpcSimulateTransactionConfig {
replace_recent_blockhash: false,
Expand Down Expand Up @@ -549,18 +548,19 @@ static LOCAL_WEBSOCKET_URL: &str = "ws://127.0.0.1:8900";

// Do not use a static ref here.
// -> The quic connections are dropped only when TpuClient is dropped
async fn get_tpu_client() -> TpuClient {
// async fn get_tpu_client() -> TpuClient<QuicPool, QuicConnectionManager, QuicConnectionConfig> {
async fn get_tpu_client() -> TpuClient<QuicPool, QuicConnectionManager, QuicConfig> {
let rpc_client = Arc::new(RpcClient::new_with_commitment(
LOCAL_RPC_URL.into(),
CommitmentConfig::processed(),
));
LOCAL_RPC_URL.into(),
CommitmentConfig::processed(),
));
let tpu_client = TpuClient::new(
"tpu_client",
rpc_client,
LOCAL_WEBSOCKET_URL.into(),
TpuClientConfig { fanout_slots: 24 },
)
.await
.unwrap();
)
.await
.unwrap();
tpu_client
}

6 changes: 3 additions & 3 deletions plugin/src/observers/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{

use chrono::{DateTime, NaiveDateTime, Utc};
use clockwork_cron::Schedule;
use clockwork_thread_program::state::{Trigger, TriggerContext, Equality, VersionedThread};
use clockwork_thread_program::state::{Equality, Trigger, TriggerContext, VersionedThread};
use log::info;
use pyth_sdk_solana::PriceFeed;
use solana_geyser_plugin_interface::geyser_plugin_interface::{
Expand Down Expand Up @@ -250,7 +250,7 @@ impl ThreadObserver {
drop(w_account_threads);

// Threads with account triggers might be immediately executable,
// Thus, we should attempt to execute these threads right away without for an account update.
// Thus, we should attempt to execute these threads right away without for an account update.
let mut w_now_threads = self.now_threads.write().await;
w_now_threads.insert(thread_pubkey);
drop(w_now_threads);
Expand Down Expand Up @@ -381,7 +381,7 @@ fn next_moment(after: i64, schedule: String) -> Option<i64> {
match Schedule::from_str(&schedule) {
Err(_) => None,
Ok(schedule) => schedule
.next_after(&DateTime::<Utc>::from_utc(
.next_after(&DateTime::<Utc>::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(after, 0).unwrap(),
Utc,
))
Expand Down
19 changes: 14 additions & 5 deletions plugin/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl GeyserPlugin for ClockworkPlugin {
fn on_unload(&mut self) {}

fn update_account(
&mut self,
&self,
account: ReplicaAccountInfoVersions,
slot: u64,
is_startup: bool,
Expand All @@ -77,6 +77,15 @@ impl GeyserPlugin for ClockworkPlugin {
data: account_info.data,
write_version: account_info.write_version,
},
ReplicaAccountInfoVersions::V0_0_3(account_info) => ReplicaAccountInfo {
pubkey: account_info.pubkey,
lamports: account_info.lamports,
owner: account_info.owner,
executable: account_info.executable,
rent_epoch: account_info.rent_epoch,
data: account_info.data,
write_version: account_info.write_version,
},
};
let account_pubkey = Pubkey::try_from(account_info.pubkey).unwrap();
let event = AccountUpdateEvent::try_from(account_info);
Expand Down Expand Up @@ -140,13 +149,13 @@ impl GeyserPlugin for ClockworkPlugin {
Ok(())
}

fn notify_end_of_startup(&mut self) -> PluginResult<()> {
fn notify_end_of_startup(&self) -> PluginResult<()> {
info!("Snapshot loaded");
Ok(())
}

fn update_slot_status(
&mut self,
&self,
slot: u64,
_parent: Option<u64>,
status: SlotStatus,
Expand All @@ -168,15 +177,15 @@ impl GeyserPlugin for ClockworkPlugin {
}

fn notify_transaction(
&mut self,
&self,
_transaction: solana_geyser_plugin_interface::geyser_plugin_interface::ReplicaTransactionInfoVersions,
_slot: u64,
) -> PluginResult<()> {
Ok(())
}

fn notify_block_metadata(
&mut self,
&self,
_blockinfo: solana_geyser_plugin_interface::geyser_plugin_interface::ReplicaBlockInfoVersions,
) -> PluginResult<()> {
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion plugin/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ name = "clockwork_plugin_utils"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
solana-geyser-plugin-interface = "=1.14.16"
solana-geyser-plugin-interface = "^1.16"
4 changes: 2 additions & 2 deletions programs/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
anchor-lang = "0.27.0"
anchor-spl = { features = ["mint", "token"], version = "0.27.0" }
anchor-lang = "0.29.0"
anchor-spl = { features = ["mint", "token"], version = "0.29.0" }
clockwork-utils = { path = "../../utils", version = "=2.0.18" }
winnow = "=0.4.1"
toml_datetime = "=0.6.1"
2 changes: 1 addition & 1 deletion programs/network/src/instructions/delegation_withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn handler(ctx: Context<DelegationWithdraw>, amount: u64) -> Result<()> {
let token_program = &ctx.accounts.token_program;

// Transfer tokens from authority tokens to delegation
let bump = *ctx.bumps.get("delegation").unwrap();
let bump = ctx.bumps.delegation;
transfer(
CpiContext::new_with_signer(
token_program.to_account_info(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn handler(ctx: Context<StakeDelegationsProcessDelegation>) -> Result<Thread

// Transfer tokens from delegation to worker account.
let amount = delegation_stake.amount;
let bump = *ctx.bumps.get("delegation").unwrap();
let bump = ctx.bumps.delegation;
transfer(
CpiContext::new_with_signer(
token_program.to_account_info(),
Expand Down
4 changes: 2 additions & 2 deletions programs/thread/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
anchor-lang = "0.27.0"
anchor-lang = "0.29.0"
chrono = { version = "0.4.19", default-features = false, features = ["alloc"] }
clockwork-cron = { path = "../../cron", version = "=2.0.18" }
clockwork-network-program = { path = "../network", features = ["cpi"], version = "=2.0.18" }
clockwork-thread-program-v1 = { path = "v1", version = "=1.4.4" }
clockwork-utils = { path = "../../utils", version = "=2.0.18" }
pyth-sdk-solana = "0.7.1"
pyth-sdk-solana = "0.9"
static-pubkey = "1.0.3"
version = "3.0.0"
3 changes: 1 addition & 2 deletions programs/thread/src/instructions/thread_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ pub fn handler(ctx: Context<ThreadCreate>, amount: u64, id: Vec<u8>, instruction
let thread = &mut ctx.accounts.thread;

// Initialize the thread
let bump = *ctx.bumps.get("thread").unwrap();
thread.authority = authority.key();
thread.bump = bump;
thread.bump = ctx.bumps.thread;
thread.created_at = Clock::get().unwrap().into();
thread.exec_context = None;
thread.fee = MINIMUM_FEE;
Expand Down
2 changes: 1 addition & 1 deletion programs/thread/src/instructions/thread_kickoff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub fn handler(ctx: Context<ThreadKickoff>) -> Result<()> {
fn next_timestamp(after: i64, schedule: String) -> Option<i64> {
Schedule::from_str(&schedule)
.unwrap()
.next_after(&DateTime::<Utc>::from_utc(
.next_after(&DateTime::<Utc>::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(after, 0).unwrap(),
Utc,
))
Expand Down
2 changes: 1 addition & 1 deletion programs/thread/v1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ no-log-ix-name = []
cpi = ["no-entrypoint"]

[dependencies]
anchor-lang = "0.27.0"
anchor-lang = "0.29.0"
clockwork-anchor-gen = { version = "0.3.2", features = ["compat-program-result"] }
2 changes: 1 addition & 1 deletion programs/webhook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
anchor-lang = { features = ["init-if-needed"], version = "0.27.0" }
anchor-lang = { features = ["init-if-needed"], version = "0.29.0" }
clockwork-network-program = { path = "../network", features = ["cpi"], version = "=2.0.18" }
clockwork-utils = { path = "../../utils", version = "=2.0.18" }
serde = "1.0.152"
8 changes: 4 additions & 4 deletions relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish = false
[dependencies]
actix-cors = "0.6.4"
actix-web = "4.3.1"
anchor-lang = "0.27.0"
anchor-lang = "0.29.0"
byte-unit = "4.0.18"
clockwork-webhook-program = { path = "../programs/webhook", version = "=2.0.18" }
clockwork-relayer-api = { path = "api", version = "=2.0.18" }
Expand All @@ -25,9 +25,9 @@ lazy_static = "1.4.0"
reqwest = "0.11.14"
serde = "1.0.152"
serde_json = "1.0.94"
solana-client = "=1.14.16"
solana-zk-token-sdk = "=1.14.16"
solana-sdk = "=1.14.16"
solana-client = "^1.16"
solana-zk-token-sdk = "^1.16"
solana-sdk = "^1.16"
tokio = "1.26.0"
bincode = "1.3.3"
rayon = "1.7.0"
Expand Down
2 changes: 1 addition & 1 deletion relayer/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ name = "clockwork_relayer_api"
serde = "1.0.152"
# shadow-drive-sdk = "0.6.1"
# solana-zk-token-sdk = "=1.14.16"
solana-sdk = "=1.14.16"
solana-sdk = "^1.16"
# tokio = "1.26.0"
bincode = "1.3.3"
3 changes: 2 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[toolchain]
channel = "1.60.0"
channel = "1.73.0"
# channel = "nightly"
components = [ "rustfmt", "rust-analyzer" ]
profile = "minimal"
targets = [ "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin"]
2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["solana"]
name = "clockwork_sdk"

[dependencies]
anchor-lang = "0.27.0"
anchor-lang = "0.29.0"
chrono = { version = "0.4.19", default-features = false, features = ["alloc"] }
clockwork-thread-program = { path = "../programs/thread", features = ["cpi"], version = "=2.0.18" }
nom = "~7"
Expand Down
2 changes: 1 addition & 1 deletion utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["solana"]
name = "clockwork_utils"

[dependencies]
anchor-lang = "0.27.0"
anchor-lang = "0.29.0"
base64 = "~0.13"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down

0 comments on commit d6fbdc3

Please sign in to comment.