Skip to content

Commit

Permalink
📌 Fixed deps for Anchor 0.29.0 and 0.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikrk authored and lukacan committed May 19, 2024
1 parent 9c9a966 commit a429055
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resolver = "1"
trident-test = { path = "./crates/test", version = "0.3.1" }
trident-client = { path = "./crates/client", version = "0.5.0" }
trident-explorer = { path = "./crates/explorer", version = "0.3.1" }
anchor-client = { version="0.29.0", features = ["async"]}
anchor-client = { version=">=0.29.0", features = ["async"]}
solana-sdk = "1.16"
solana-cli-output = "1.16"
solana-transaction-status = "1.16"
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,19 @@ For more detailed information, visit our [documentation](http://127.0.0.1:8000/t

- We support `Anchor` and `Solana` versions specified in the table below.

| Trident CLI | Anchor | Solana | Rust |
|--------------|:---------:|----------:|:-----------------------|
| `v0.6.0` | `^0.29` | `^1.17` | `nightly` |
| `v0.5.0` | `~0.28.*` | `=1.16.6` | |
| `v0.4.0` | `~0.27.*` | `>=1.15` | |
| `v0.3.0` | `~0.25.*` | `>=1.10` | |
| `v0.2.0` | `~0.24.*` | `>=1.9` | |
| Trident CLI | Anchor | Solana | Rust |
|--------------|:-----------------------:|----------:|:-----------------------|
| `v0.6.0` | `>=0.29` <sup>1</sup> | `^1.17` | `nightly` |
| `v0.5.0` | `~0.28.*` | `=1.16.6` | |
| `v0.4.0` | `~0.27.*` | `>=1.15` | |
| `v0.3.0` | `~0.25.*` | `>=1.10` | |
| `v0.2.0` | `~0.24.*` | `>=1.9` | |

1. To use Trident with Anchor 0.29.0, run the following commands from your project's root directory after Trident initialization:
```bash
cargo update [email protected] --precise 0.29.0
cargo update [email protected] --precise 0.29.0
```



Expand Down
5 changes: 3 additions & 2 deletions crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ trident-derive-fuzz-test-executor = { path = "./derive/fuzz_test_executor" }
trident-test = { workspace = true }
# INFO: Anchor-spl is here as dependency only to activate the idl-build feature, so that
# users do not have to do it manually in their program's Cargo.toml
anchor-spl = { version = "0.29.0", features = ["idl-build"] }
anchor-lang = { version = "0.29.0", features = ["idl-build", "init-if-needed"] }
anchor-spl = { version = ">=0.29.0", features = ["idl-build"] }
anchor-lang = { version = ">=0.29.0", features = ["idl-build", "init-if-needed"] }
anchor-syn = { version = ">=0.29.0" }
solana-sdk = { workspace = true }
solana-cli-output = { workspace = true }
solana-transaction-status = { workspace = true }
Expand Down
30 changes: 15 additions & 15 deletions crates/client/src/fuzzer/snapshot_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
use std::collections::HashMap;
use std::{error::Error, fs::File, io::Read};

use anchor_lang::anchor_syn::{AccountField, Ty};
use anchor_syn::{AccountField, Ty};
use heck::ToUpperCamelCase;
use proc_macro2::{Ident, Span, TokenStream};
use quote::{format_ident, quote, ToTokens};
use syn::parse::{Error as ParseError, Result as ParseResult};
use syn::spanned::Spanned;
use syn::{parse_quote, Attribute, Fields, GenericArgument, Item, ItemStruct, PathArguments, Type};

use anchor_lang::anchor_syn::parser::accounts::parse_account_field;
use anchor_syn::parser::accounts::parse_account_field;

use regex::Regex;

Expand Down Expand Up @@ -211,7 +211,7 @@ fn find_ctx_struct<'a>(items: &'a Vec<syn::Item>, name: &'a syn::Ident) -> Optio
None
}

fn is_boxed(ty: &anchor_lang::anchor_syn::Ty) -> bool {
fn is_boxed(ty: &anchor_syn::Ty) -> bool {
match ty {
Ty::Account(acc) => acc.boxed,
Ty::InterfaceAccount(acc) => acc.boxed,
Expand Down Expand Up @@ -402,26 +402,26 @@ fn deserialize_ctx_struct_anchor(
}

/// Get the identifier (name) of the passed sysvar type.
fn sysvar_to_ident(sysvar: &anchor_lang::anchor_syn::SysvarTy) -> String {
fn sysvar_to_ident(sysvar: &anchor_syn::SysvarTy) -> String {
let str = match sysvar {
anchor_lang::anchor_syn::SysvarTy::Clock => "Clock",
anchor_lang::anchor_syn::SysvarTy::Rent => "Rent",
anchor_lang::anchor_syn::SysvarTy::EpochSchedule => "EpochSchedule",
anchor_lang::anchor_syn::SysvarTy::Fees => "Fees",
anchor_lang::anchor_syn::SysvarTy::RecentBlockhashes => "RecentBlockhashes",
anchor_lang::anchor_syn::SysvarTy::SlotHashes => "SlotHashes",
anchor_lang::anchor_syn::SysvarTy::SlotHistory => "SlotHistory",
anchor_lang::anchor_syn::SysvarTy::StakeHistory => "StakeHistory",
anchor_lang::anchor_syn::SysvarTy::Instructions => "Instructions",
anchor_lang::anchor_syn::SysvarTy::Rewards => "Rewards",
anchor_syn::SysvarTy::Clock => "Clock",
anchor_syn::SysvarTy::Rent => "Rent",
anchor_syn::SysvarTy::EpochSchedule => "EpochSchedule",
anchor_syn::SysvarTy::Fees => "Fees",
anchor_syn::SysvarTy::RecentBlockhashes => "RecentBlockhashes",
anchor_syn::SysvarTy::SlotHashes => "SlotHashes",
anchor_syn::SysvarTy::SlotHistory => "SlotHistory",
anchor_syn::SysvarTy::StakeHistory => "StakeHistory",
anchor_syn::SysvarTy::Instructions => "Instructions",
anchor_syn::SysvarTy::Rewards => "Rewards",
};
str.into()
}

/// Converts passed account type to token streams. The function returns a pair of streams where the first
/// variable in the pair is the type itself and the second is a fully qualified function to deserialize
/// the given type.
pub fn ty_to_tokens(ty: &anchor_lang::anchor_syn::Ty) -> Option<(TokenStream, TokenStream)> {
pub fn ty_to_tokens(ty: &anchor_syn::Ty) -> Option<(TokenStream, TokenStream)> {
let (return_type, deser_method) = match ty {
Ty::AccountInfo | Ty::UncheckedAccount => return None,
Ty::SystemAccount => (
Expand Down

0 comments on commit a429055

Please sign in to comment.