updating solana version
This commit is contained in:
parent
870656be65
commit
fb0f1bb453
File diff suppressed because it is too large
Load Diff
15
Cargo.toml
15
Cargo.toml
|
@ -6,6 +6,7 @@ members = [
|
|||
"accounts_on_demand",
|
||||
"common",
|
||||
"token_account_storage",
|
||||
"simulate_from_snapshot"
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
|
@ -17,11 +18,15 @@ repository = "https://github.com/blockworks-foundation/solana-lite-account-manag
|
|||
license = "AGPL"
|
||||
|
||||
[workspace.dependencies]
|
||||
solana-sdk = "~1.18.15"
|
||||
solana-rpc-client = "~1.18.15"
|
||||
solana-account-decoder = "~1.18.15"
|
||||
solana-client = "~1.18.15"
|
||||
solana-program = "~1.18.15"
|
||||
solana-sdk = "~1.18.23"
|
||||
solana-rpc-client = "~1.18.23"
|
||||
solana-account-decoder = "~1.18.23"
|
||||
solana-client = "~1.18.23"
|
||||
solana-program = "~1.18.23"
|
||||
solana-accounts-db = "~1.18.23"
|
||||
solana-frozen-abi-macro = "~1.18.23"
|
||||
solana-runtime = "1.18.23"
|
||||
solana-rpc-client-api = "~1.18.23"
|
||||
|
||||
dashmap = "5.4.0"
|
||||
serde = { version = "1.0.160", features = ["derive"] }
|
||||
|
|
|
@ -5,7 +5,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
solana-sdk = {workspace = true}
|
||||
solana-rpc-client-api = "~1.18.15"
|
||||
solana-rpc-client-api = {workspace = true}
|
||||
itertools = {workspace = true}
|
||||
lz4 = {workspace = true}
|
||||
zstd = {workspace = true}
|
||||
|
|
|
@ -24,6 +24,27 @@ pub enum Data {
|
|||
}
|
||||
|
||||
impl Data {
|
||||
pub fn new(data:&[u8], compression_method: CompressionMethod) -> Self {
|
||||
match compression_method {
|
||||
CompressionMethod::None => Data::Uncompressed(data.to_vec()),
|
||||
CompressionMethod::Lz4(level) => {
|
||||
let len = data.len();
|
||||
let binary = lz4::block::compress(
|
||||
&data,
|
||||
Some(lz4::block::CompressionMode::FAST(level)),
|
||||
true,
|
||||
)
|
||||
.unwrap();
|
||||
Data::Lz4 { binary, len }
|
||||
}
|
||||
CompressionMethod::Zstd(level) => {
|
||||
let len = data.len();
|
||||
let binary = zstd::bulk::compress(&data, level).unwrap();
|
||||
Data::Zstd { binary, len }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
match self {
|
||||
Data::Uncompressed(d) => d.len(),
|
||||
|
@ -78,27 +99,9 @@ impl Account {
|
|||
account: SolanaAccount,
|
||||
compression_method: CompressionMethod,
|
||||
) -> Self {
|
||||
let data = match compression_method {
|
||||
CompressionMethod::None => Data::Uncompressed(account.data),
|
||||
CompressionMethod::Lz4(level) => {
|
||||
let len = account.data.len();
|
||||
let binary = lz4::block::compress(
|
||||
&account.data,
|
||||
Some(lz4::block::CompressionMode::FAST(level)),
|
||||
true,
|
||||
)
|
||||
.unwrap();
|
||||
Data::Lz4 { binary, len }
|
||||
}
|
||||
CompressionMethod::Zstd(level) => {
|
||||
let len = account.data.len();
|
||||
let binary = zstd::bulk::compress(&account.data, level).unwrap();
|
||||
Data::Zstd { binary, len }
|
||||
}
|
||||
};
|
||||
Self {
|
||||
lamports: account.lamports,
|
||||
data,
|
||||
data: Data::new(&account.data, compression_method),
|
||||
owner: account.owner,
|
||||
executable: account.executable,
|
||||
rent_epoch: account.rent_epoch,
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[toolchain]
|
||||
channel = "1.75.0"
|
||||
channel = "1.76.0"
|
||||
|
|
|
@ -24,7 +24,7 @@ lazy_static::lazy_static! {
|
|||
register_int_gauge!(opts!("lite_account_token_accounts_deleted_in_memory", "Account InMemory")).unwrap();
|
||||
}
|
||||
|
||||
const PARTIAL_PUBKEY_SIZE: usize = 8;
|
||||
const PARTIAL_PUBKEY_SIZE: usize = 4;
|
||||
type InmemoryPubkey = PartialPubkey<PARTIAL_PUBKEY_SIZE>;
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -39,7 +39,7 @@ lazy_static::lazy_static! {
|
|||
register_int_gauge!(opts!("lite_accounts_token_mints_in_memory", "Slot of latest account update")).unwrap();
|
||||
}
|
||||
|
||||
const PARTIAL_PUBKEY_SIZE: usize = 6;
|
||||
const PARTIAL_PUBKEY_SIZE: usize = 4;
|
||||
type InmemoryPubkey = PartialPubkey<PARTIAL_PUBKEY_SIZE>;
|
||||
#[derive(Clone)]
|
||||
struct ProcessedAccount {
|
||||
|
@ -602,7 +602,7 @@ impl AccountStorageInterface for TokenProgramAccountsStorage {
|
|||
) {
|
||||
Ok(res) => res,
|
||||
Err(e) => {
|
||||
log::error!("Token account was not able to identified {}", e);
|
||||
log::error!("Token program account {} was not able to identified {}", account_data.pubkey.to_string(), e);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ pub fn get_token_program_account_type(
|
|||
match type_account {
|
||||
0 => {
|
||||
//mint
|
||||
let mint = spl_token_2022::state::Mint::unpack(&account_data.account.data.data())?;
|
||||
let mint = spl_token_2022::state::Mint::unpack_unchecked(&account_data.account.data.data())?;
|
||||
Ok(TokenProgramAccountType::Mint(MintAccount {
|
||||
program: crate::account_types::Program::Token2022Program,
|
||||
pubkey: account_data.pubkey,
|
||||
|
@ -109,7 +109,7 @@ pub fn get_token_program_account_type(
|
|||
}
|
||||
1 => {
|
||||
let token_account =
|
||||
spl_token_2022::state::Account::unpack(&account_data.account.data.data())?;
|
||||
spl_token_2022::state::Account::unpack_unchecked(&account_data.account.data.data())?;
|
||||
let mint_index = get_or_create_mint_index(
|
||||
token_account.mint,
|
||||
mint_index_by_pubkey,
|
||||
|
@ -144,7 +144,7 @@ pub fn get_token_program_account_type(
|
|||
}
|
||||
2 => {
|
||||
let multi_sig =
|
||||
spl_token_2022::state::Multisig::unpack(&account_data.account.data.data())?;
|
||||
spl_token_2022::state::Multisig::unpack_unchecked(&account_data.account.data.data())?;
|
||||
Ok(TokenProgramAccountType::MultiSig(
|
||||
MultiSig {
|
||||
program: crate::account_types::Program::Token2022Program,
|
||||
|
@ -168,7 +168,7 @@ pub fn get_token_program_account_type(
|
|||
} else if account_data.account.owner == spl_token::ID {
|
||||
if account_data.account.data.len() == 82 {
|
||||
// mint
|
||||
let mint = spl_token::state::Mint::unpack(&account_data.account.data.data())?;
|
||||
let mint = spl_token::state::Mint::unpack_unchecked(&account_data.account.data.data())?;
|
||||
Ok(TokenProgramAccountType::Mint(MintAccount {
|
||||
program: crate::account_types::Program::TokenProgram,
|
||||
pubkey: account_data.pubkey,
|
||||
|
@ -183,7 +183,7 @@ pub fn get_token_program_account_type(
|
|||
} else if account_data.account.data.len() == 165 {
|
||||
//token account
|
||||
let token_account =
|
||||
spl_token::state::Account::unpack(&account_data.account.data.data())?;
|
||||
spl_token::state::Account::unpack_unchecked(&account_data.account.data.data())?;
|
||||
let mint_index = get_or_create_mint_index(
|
||||
token_account.mint,
|
||||
mint_index_by_pubkey,
|
||||
|
@ -215,8 +215,7 @@ pub fn get_token_program_account_type(
|
|||
}))
|
||||
} else {
|
||||
// multisig
|
||||
assert_eq!(account_data.account.data.len(), 355);
|
||||
let multi_sig = spl_token::state::Multisig::unpack(&account_data.account.data.data())?;
|
||||
let multi_sig = spl_token::state::Multisig::unpack_unchecked(&account_data.account.data.data())?;
|
||||
Ok(TokenProgramAccountType::MultiSig(
|
||||
MultiSig {
|
||||
program: crate::account_types::Program::TokenProgram,
|
||||
|
|
Loading…
Reference in New Issue