Skip to content

anchor-lang => 0.31 #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 12, 2025
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,994 changes: 2,219 additions & 775 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rpc_tests = []
[dependencies]
abi_stable = { version = "0.11", default-features = false }
ahash = "0.8.11"
anchor-lang = { version = "0.30", features = ["derive"] }
anchor-lang = { version = "0.31", features = ["derive"] }
base64 = "0.22"
bytemuck = "1.17"
dashmap = "6"
Expand All @@ -36,22 +36,23 @@ rayon = { version = "1.9.0", optional = true }
regex = "1.10"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
solana-account-decoder = "2"
solana-rpc-client = "2"
solana-rpc-client-api = "2"
solana-sdk = "2"
solana-transaction-status = "2"
solana-account-decoder-client-types = "2.1"
solana-rpc-client = "2.1"
solana-rpc-client-api = "2.1"
solana-sdk = "2.1"
solana-transaction-status = "2.1"
thiserror = "1"
tokio = { version = "1.42", features = ["full"] }
tokio-stream = "0.1.17"
tokio-tungstenite = { version = "0.20", features = ["native-tls"] }
tokio-tungstenite = { version = "0.26", features = ["native-tls"] }

drift-pubsub-client = { version = "0.1.0", path = "crates/pubsub-client" }

[dev-dependencies]
bytes = "1"
hex-literal = "0.4"
toml = "0.5"
solana-account-decoder = "2.1"
toml = "0.8"

[build-dependencies]
drift-idl-gen = { version = "0.1.3", path = "crates/drift-idl-gen" }
2 changes: 1 addition & 1 deletion crates/drift-ffi-sys
Submodule drift-ffi-sys updated 2 files
+6 −6 Cargo.lock
+2 −2 Cargo.toml
2 changes: 1 addition & 1 deletion crates/drift-idl-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "drift-idl-gen"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/drift-labs/drift-rs"
Expand Down
10 changes: 5 additions & 5 deletions crates/drift-idl-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,13 @@ fn generate_idl_types(idl: &Idl) -> String {
}
#[automatically_derived]
impl anchor_lang::Discriminator for #struct_name {
const DISCRIMINATOR: [u8; 8] = #discriminator;
const DISCRIMINATOR: &[u8] = &#discriminator;
}
#zc_tokens
#[automatically_derived]
impl anchor_lang::AccountSerialize for #struct_name {
fn try_serialize<W: std::io::Write>(&self, writer: &mut W) -> anchor_lang::Result<()> {
if writer.write_all(&Self::DISCRIMINATOR).is_err() {
if writer.write_all(Self::DISCRIMINATOR).is_err() {
return Err(anchor_lang::error::ErrorCode::AccountDidNotSerialize.into());
}

Expand Down Expand Up @@ -399,7 +399,7 @@ fn generate_idl_types(idl: &Idl) -> String {
}
#[automatically_derived]
impl anchor_lang::Discriminator for #struct_name {
const DISCRIMINATOR: [u8; 8] = #discriminator;
const DISCRIMINATOR: &[u8] = &#discriminator;
}
#[automatically_derived]
impl anchor_lang::InstructionData for #struct_name {}
Expand Down Expand Up @@ -439,7 +439,7 @@ fn generate_idl_types(idl: &Idl) -> String {
}
#[automatically_derived]
impl anchor_lang::Discriminator for #struct_name {
const DISCRIMINATOR: [u8; 8] = #discriminator;
const DISCRIMINATOR: &[u8] = &#discriminator;
}
#[automatically_derived]
unsafe impl anchor_lang::__private::bytemuck::Pod for #struct_name {}
Expand All @@ -462,7 +462,7 @@ fn generate_idl_types(idl: &Idl) -> String {
#[automatically_derived]
impl anchor_lang::AccountSerialize for #struct_name {
fn try_serialize<W: std::io::Write>(&self, writer: &mut W) -> anchor_lang::Result<()> {
if writer.write_all(&Self::DISCRIMINATOR).is_err() {
if writer.write_all(Self::DISCRIMINATOR).is_err() {
return Err(anchor_lang::error::ErrorCode::AccountDidNotSerialize.into());
}

Expand Down
9 changes: 4 additions & 5 deletions crates/pubsub-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ gjson = "0.8.1"
log = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["raw_value"] }
solana-account-decoder = "2"
solana-sdk = "2"
solana-rpc-client-api = "2"
solana-account-decoder-client-types = "2.1"
solana-sdk = "2.1"
solana-rpc-client-api = "2.1"
thiserror = "1"
tokio = { version = "1.42", features = ["full"] }
tokio-stream = "0.1"
# bump after solana-sdk crate updates to 2.1.x
tokio-tungstenite = { version = "0.20.1", features = ["native-tls"] }
tokio-tungstenite = { version = "0.26.0", features = ["native-tls"] }
url = "2.5"
18 changes: 9 additions & 9 deletions crates/pubsub-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use futures_util::{
use log::*;
use serde::de::DeserializeOwned;
use serde_json::{json, Value};
use solana_account_decoder::UiAccount;
use solana_account_decoder_client_types::UiAccount;
use solana_rpc_client_api::{
config::{
RpcAccountInfoConfig, RpcBlockSubscribeConfig, RpcBlockSubscribeFilter,
Expand Down Expand Up @@ -489,14 +489,14 @@ impl PubsubClient {
if let Some(response_sender) = inflight_requests.remove(&id) {
match err {
Some(reason) => {
let _ = response_sender.send(Err(PubsubClientError::RequestFailed { reason, message: text.clone()}));
let _ = response_sender.send(Err(PubsubClientError::RequestFailed { reason, message: text.to_string()}));
},
None => {
let json_result = gjson::get(text, "result");
let json_result_value = if json_result.exists() {
Ok(serde_json::from_str::<Value>(json_result.json()).unwrap())
} else {
Err(PubsubClientError::RequestFailed { reason: "missing `result` field".into(), message: text.clone() })
Err(PubsubClientError::RequestFailed { reason: "missing `result` field".into(), message: text.to_string() })
};

if let Err(err) = response_sender.send(json_result_value) {
Expand All @@ -510,13 +510,13 @@ impl PubsubClient {
} else if let Some((operation, payload, response_sender)) = inflight_subscribes.remove(&id) {
match err {
Some(reason) => {
let _ = response_sender.send(Err(PubsubClientError::SubscribeFailed { reason, message: text.clone()}));
let _ = response_sender.send(Err(PubsubClientError::SubscribeFailed { reason, message: text.to_string()}));
},
None => {
// Subscribe Id
let sid = gjson::get(text, "result");
if !sid.exists() {
return Err(PubsubClientError::SubscribeFailed { reason: "invalid `result` field".into(), message: text.clone() });
return Err(PubsubClientError::SubscribeFailed { reason: "invalid `result` field".into(), message: text.to_string() });
}
let sid = sid.u64();

Expand Down Expand Up @@ -579,8 +579,8 @@ impl PubsubClient {
request_id += 1;
let method = format!("{operation}Subscribe");
let text = json!({"jsonrpc":"2.0","id":request_id,"method":method,"params":params}).to_string();
if let Err(err) = ws.send(Message::Text(text.clone())).await {
log::warn!(target: "ws", "sending subscribe failed: {text}, {err:?}");
if let Err(ref err) = ws.send(Message::Text(text.clone().into())).await {
log::warn!(target: "ws", "sending subscribe failed, {text}, {err:?}");
break 'manager;
}
inflight_subscribes.insert(request_id, (operation, text, response_sender));
Expand All @@ -593,7 +593,7 @@ impl PubsubClient {
request_id += 1;
let method = format!("{operation}Unsubscribe");
let text = json!({"jsonrpc":"2.0","id":request_id,"method":method,"params":[sid]}).to_string();
if let Err(err) = ws.send(Message::Text(text.clone())).await {
if let Err(err) = ws.send(Message::Text(text.clone().into())).await {
log::warn!(target: "ws", "sending unsubscribe failed: {text}, {err:?}");
}
inflight_unsubscribes.insert(request_id, response_sender);
Expand All @@ -604,7 +604,7 @@ impl PubsubClient {
let (method, params, response_sender) = request.expect("request channel");
request_id += 1;
let text = json!({"jsonrpc":"2.0","id":request_id,"method":method,"params":params}).to_string();
if let Err(err) = ws.send(Message::Text(text)).await {
if let Err(err) = ws.send(Message::Text(text.into())).await {
log::warn!(target: "ws", "sending request failed. {err:?}");
}
inflight_requests.insert(request_id, response_sender);
Expand Down
2 changes: 1 addition & 1 deletion crates/src/auction_subscriber.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Mutex;

use solana_account_decoder::UiAccountEncoding;
use solana_account_decoder_client_types::UiAccountEncoding;
use solana_sdk::commitment_config::CommitmentConfig;

use crate::{
Expand Down
Loading