Update to solana v1.4.4
This commit is contained in:
parent
379d9f4405
commit
9f4e6d8beb
|
@ -98,7 +98,7 @@ jobs:
|
|||
strategy:
|
||||
matrix: ${{fromJson(needs.list_bpf_programs.outputs.matrix)}}
|
||||
env:
|
||||
SOLANA_VERSION: v1.4.3
|
||||
SOLANA_VERSION: v1.4.4
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
|
|
|
@ -11,7 +11,7 @@ edition = "2018"
|
|||
exclude_entrypoint = []
|
||||
|
||||
[dependencies]
|
||||
solana-program = "1.4.3"
|
||||
solana-program = "1.4.4"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
|
|
@ -9,11 +9,11 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
arrayref = "0.3.6"
|
||||
solana-program = "1.4.3"
|
||||
solana-program = "1.4.4"
|
||||
|
||||
[dev-dependencies]
|
||||
solana-bpf-loader-program = "1.5.0"
|
||||
solana-sdk = "1.5.0"
|
||||
solana-bpf-loader-program = "1.4.4"
|
||||
solana-sdk = "1.4.4"
|
||||
solana_rbpf = "=0.1.32"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -11,12 +11,12 @@ version = "2.0.1"
|
|||
[dependencies]
|
||||
clap = "2.33.3"
|
||||
serde_json = "1.0.57"
|
||||
solana-account-decoder = "1.4.3"
|
||||
solana-clap-utils = "1.4.3"
|
||||
solana-cli-config = "1.4.3"
|
||||
solana-client = "1.4.3"
|
||||
solana-logger = "1.4.3"
|
||||
solana-sdk = "1.4.3"
|
||||
solana-account-decoder = "1.4.4"
|
||||
solana-clap-utils = "1.4.4"
|
||||
solana-cli-config = "1.4.4"
|
||||
solana-client = "1.4.4"
|
||||
solana-logger = "1.4.4"
|
||||
solana-sdk = "1.4.4"
|
||||
spl-stake-pool = { version = "0.1.0", path="../program", features = [ "exclude_entrypoint" ] }
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -17,9 +17,12 @@ num-traits = "0.2"
|
|||
num_enum = "0.5.1"
|
||||
serde = "1.0.117"
|
||||
serde_derive = "1.0.103"
|
||||
solana-program = "1.4.3"
|
||||
solana-program = "1.4.4"
|
||||
spl-token = { path = "../../token/program", features = [ "exclude_entrypoint" ] }
|
||||
thiserror = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
solana-sdk = "1.4.4"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
|
|
@ -563,9 +563,10 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::instruction::{deposit, initialize, Fee, InitArgs};
|
||||
use solana_program::{
|
||||
account::Account, account_info::create_is_signer_account_infos, instruction::Instruction,
|
||||
native_token::sol_to_lamports, program_pack::Pack, program_stubs, rent::Rent, sysvar::rent,
|
||||
instruction::Instruction, native_token::sol_to_lamports, program_pack::Pack, program_stubs,
|
||||
rent::Rent,
|
||||
};
|
||||
use solana_sdk::account::{create_account, create_is_signer_account_infos, Account};
|
||||
use spl_token::{
|
||||
instruction::{initialize_account, initialize_mint},
|
||||
processor::Processor as TokenProcessor,
|
||||
|
@ -723,7 +724,7 @@ mod tests {
|
|||
SplAccount::get_packed_len(),
|
||||
&program_id,
|
||||
);
|
||||
let mut rent_sysvar_account = rent::create_account(1, &Rent::free());
|
||||
let mut rent_sysvar_account = create_account(&Rent::free(), 1);
|
||||
let owner_key = Pubkey::new_unique();
|
||||
let mut owner_account = Account::default();
|
||||
|
||||
|
@ -781,7 +782,7 @@ mod tests {
|
|||
SplMint::get_packed_len(),
|
||||
&program_id,
|
||||
);
|
||||
let mut rent_sysvar_account = rent::create_account(1, &Rent::free());
|
||||
let mut rent_sysvar_account = create_account(&Rent::free(), 1);
|
||||
|
||||
// create token mint
|
||||
do_process_instruction(
|
||||
|
|
|
@ -15,21 +15,21 @@ borsh = "0.7.1"
|
|||
curve25519-dalek = {git = "https://github.com/garious/curve25519-dalek", rev = "60efef3553d6bf3d7f3b09b5f97acd54d72529ff", default-features = false, features = ["borsh"]}
|
||||
elgamal_ristretto = { git = "https://github.com/garious/elgamal", rev = "db1eef8e01b8a6e93d3bdc64ab2c1acb39cb64d6", default-features = false }
|
||||
futures = "0.3"
|
||||
solana-banks-client = "1.4.3"
|
||||
solana-cli-config = "1.4.3"
|
||||
solana-sdk = "1.4.3"
|
||||
solana-banks-client = "1.4.4"
|
||||
solana-cli-config = "1.4.4"
|
||||
solana-sdk = "1.4.4"
|
||||
spl-themis-ristretto = { version = "0.1.0", path = "../program_ristretto", features = ["exclude_entrypoint"] }
|
||||
tarpc = { version = "0.22.0", features = ["full"] }
|
||||
tokio = "0.2"
|
||||
tokio = "0.3"
|
||||
url = "2.1"
|
||||
|
||||
[dev-dependencies]
|
||||
separator = "0.4.1"
|
||||
solana-banks-server = "1.4.3"
|
||||
solana-bpf-loader-program = "1.4.3"
|
||||
solana-core = "1.4.3"
|
||||
solana-banks-server = "1.4.4"
|
||||
solana-bpf-loader-program = "1.4.4"
|
||||
solana-core = "1.4.4"
|
||||
solana_rbpf = "=0.1.32"
|
||||
solana-runtime = "1.4.3"
|
||||
solana-runtime = "1.4.4"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
|
|
@ -3,7 +3,11 @@ use std::process::Command;
|
|||
fn main() {
|
||||
println!("cargo:warning=(not a warning) Building BPF themis program");
|
||||
Command::new("cargo")
|
||||
.arg("build-bpf")
|
||||
.args(&[
|
||||
"build-bpf",
|
||||
"--manifest-path",
|
||||
"../program_ristretto/Cargo.toml",
|
||||
])
|
||||
.status()
|
||||
.expect("Failed to build BPF themis program")
|
||||
.success();
|
||||
|
|
|
@ -198,17 +198,20 @@ pub async fn test_e2e(
|
|||
println!("Seeding feepayer accounts...");
|
||||
let feepayers: Vec<_> = (0..num_users).map(|_| Keypair::new()).collect();
|
||||
let recent_blockhash = client.get_recent_blockhash().await.unwrap();
|
||||
let txs: Vec<_> = feepayers.chunks(20).map(|feepayers| {
|
||||
let payments: Vec<_> = feepayers
|
||||
.iter()
|
||||
.map(|keypair| (keypair.pubkey(), sol_to_lamports(0.0011)))
|
||||
.collect();
|
||||
let ixs = system_instruction::transfer_many(&sender_pubkey, &payments);
|
||||
let msg = Message::new(&ixs, Some(&sender_keypair.pubkey()));
|
||||
let tx = Transaction::new(&[&sender_keypair], msg, recent_blockhash);
|
||||
assert_transaction_size(&tx);
|
||||
tx
|
||||
}).collect();
|
||||
let txs: Vec<_> = feepayers
|
||||
.chunks(20)
|
||||
.map(|feepayers| {
|
||||
let payments: Vec<_> = feepayers
|
||||
.iter()
|
||||
.map(|keypair| (keypair.pubkey(), sol_to_lamports(0.0011)))
|
||||
.collect();
|
||||
let ixs = system_instruction::transfer_many(&sender_pubkey, &payments);
|
||||
let msg = Message::new(&ixs, Some(&sender_keypair.pubkey()));
|
||||
let tx = Transaction::new(&[&sender_keypair], msg, recent_blockhash);
|
||||
assert_transaction_size(&tx);
|
||||
tx
|
||||
})
|
||||
.collect();
|
||||
process_transactions_with_commitment(client, txs, CommitmentLevel::Recent)
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -260,11 +263,9 @@ mod tests {
|
|||
use solana_banks_server::banks_server::start_local_server;
|
||||
use solana_runtime::{bank::Bank, bank_forks::BankForks};
|
||||
use solana_sdk::{
|
||||
account::{Account, KeyedAccount},
|
||||
account_info::AccountInfo,
|
||||
genesis_config::create_genesis_config,
|
||||
instruction::InstructionError,
|
||||
program_error::ProgramError,
|
||||
account::Account, account_info::AccountInfo, genesis_config::create_genesis_config,
|
||||
instruction::InstructionError, keyed_account::KeyedAccount,
|
||||
process_instruction::InvokeContext, program_error::ProgramError,
|
||||
};
|
||||
use spl_themis_ristretto::processor::process_instruction;
|
||||
use std::{
|
||||
|
@ -298,6 +299,7 @@ mod tests {
|
|||
program_id: &Pubkey,
|
||||
keyed_accounts: &[KeyedAccount],
|
||||
input: &[u8],
|
||||
_invoke_context: &mut dyn InvokeContext,
|
||||
) -> Result<(), InstructionError> {
|
||||
// Copy all the accounts into a HashMap to ensure there are no duplicates
|
||||
let mut accounts: HashMap<Pubkey, Account> = keyed_accounts
|
||||
|
@ -359,7 +361,7 @@ mod tests {
|
|||
let (genesis_config, sender_keypair) = create_genesis_config(sol_to_lamports(9_000_000.0));
|
||||
let mut bank = Bank::new(&genesis_config);
|
||||
let program_id = Keypair::new().pubkey();
|
||||
bank.add_builtin_program("Themis", program_id, process_instruction_native);
|
||||
bank.add_builtin("Themis", program_id, process_instruction_native);
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
Runtime::new().unwrap().block_on(async {
|
||||
let transport = start_local_server(&bank_forks).await;
|
||||
|
|
|
@ -6,29 +6,24 @@ use solana_bpf_loader_program::{
|
|||
create_vm,
|
||||
serialization::{deserialize_parameters, serialize_parameters},
|
||||
};
|
||||
use solana_rbpf::vm::{EbpfVm, InstructionMeter};
|
||||
use solana_runtime::process_instruction::{
|
||||
ComputeBudget, ComputeMeter, Executor, InvokeContext, Logger, ProcessInstruction,
|
||||
};
|
||||
use solana_rbpf::vm::EbpfVm;
|
||||
use solana_sdk::{
|
||||
account::{Account as SolanaAccount, KeyedAccount},
|
||||
account::Account,
|
||||
bpf_loader,
|
||||
entrypoint::SUCCESS,
|
||||
instruction::{CompiledInstruction, InstructionError},
|
||||
message::Message,
|
||||
instruction::InstructionError,
|
||||
keyed_account::KeyedAccount,
|
||||
process_instruction::{BpfComputeBudget, MockInvokeContext},
|
||||
pubkey::Pubkey,
|
||||
};
|
||||
use spl_themis_ristretto::{
|
||||
instruction::ThemisInstruction,
|
||||
state::{generate_keys, /*recover_scalar,*/ Policies, User},
|
||||
};
|
||||
use std::{cell::RefCell, fs::File, io::Read, path::PathBuf, rc::Rc, sync::Arc};
|
||||
use std::{fs::File, io::Read, path::PathBuf};
|
||||
|
||||
fn load_program(name: &str) -> Vec<u8> {
|
||||
let mut path = PathBuf::new();
|
||||
path.push("../../target/bpfel-unknown-unknown/release");
|
||||
path.push(name);
|
||||
path.set_extension("so");
|
||||
let path = PathBuf::from(name).with_extension("so");
|
||||
let mut file = File::open(path).unwrap();
|
||||
|
||||
let mut program = Vec::new();
|
||||
|
@ -41,10 +36,15 @@ fn run_program(
|
|||
parameter_accounts: &[KeyedAccount],
|
||||
instruction_data: &[u8],
|
||||
) -> Result<u64, InstructionError> {
|
||||
let mut program_account = SolanaAccount::default();
|
||||
let mut program_account = Account::default();
|
||||
program_account.data = load_program("spl_themis_ristretto");
|
||||
let loader_id = bpf_loader::id();
|
||||
let mut invoke_context = MockInvokeContext::default();
|
||||
invoke_context.bpf_compute_budget = BpfComputeBudget {
|
||||
max_invoke_depth: 10,
|
||||
..BpfComputeBudget::default()
|
||||
};
|
||||
|
||||
let executable = EbpfVm::<solana_bpf_loader_program::BPFError>::create_executable_from_elf(
|
||||
&&program_account.data,
|
||||
None,
|
||||
|
@ -189,7 +189,7 @@ fn assert_instruction_count() {
|
|||
.map(|i| (i as u8, pk.encrypt(&RISTRETTO_BASEPOINT_POINT).points))
|
||||
.collect();
|
||||
|
||||
let policies_account = SolanaAccount::new_ref(
|
||||
let policies_account = Account::new_ref(
|
||||
0,
|
||||
Policies {
|
||||
is_initialized: true,
|
||||
|
@ -213,7 +213,7 @@ fn assert_instruction_count() {
|
|||
// Create user account
|
||||
let user_key = Pubkey::new_unique();
|
||||
let user_account =
|
||||
SolanaAccount::new_ref(0, User::default().try_to_vec().unwrap().len(), &program_id);
|
||||
Account::new_ref(0, User::default().try_to_vec().unwrap().len(), &program_id);
|
||||
let instruction_data = ThemisInstruction::InitializeUserAccount { public_key: pk }
|
||||
.serialize()
|
||||
.unwrap();
|
||||
|
@ -294,96 +294,3 @@ fn assert_instruction_count() {
|
|||
assert!(calculate_aggregate_count <= BASELINE_CALCULATE_AGGREGATE_COUNT);
|
||||
assert!(proof_decryption_count <= BASELINE_PROOF_DECRYPTION_COUNT);
|
||||
}
|
||||
|
||||
// Mock InvokeContext
|
||||
|
||||
#[derive(Debug)]
|
||||
struct MockInvokeContext {
|
||||
pub key: Pubkey,
|
||||
pub logger: MockLogger,
|
||||
pub compute_meter: MockComputeMeter,
|
||||
compute_budget: ComputeBudget,
|
||||
}
|
||||
|
||||
impl Default for MockInvokeContext {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
key: Pubkey::default(),
|
||||
logger: MockLogger::default(),
|
||||
compute_meter: MockComputeMeter::default(),
|
||||
compute_budget: ComputeBudget {
|
||||
max_invoke_depth: 10,
|
||||
..ComputeBudget::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl InvokeContext for MockInvokeContext {
|
||||
fn push(&mut self, _key: &Pubkey) -> Result<(), InstructionError> {
|
||||
Ok(())
|
||||
}
|
||||
fn pop(&mut self) {}
|
||||
fn verify_and_update(
|
||||
&mut self,
|
||||
_message: &Message,
|
||||
_instruction: &CompiledInstruction,
|
||||
_accounts: &[Rc<RefCell<SolanaAccount>>],
|
||||
) -> Result<(), InstructionError> {
|
||||
Ok(())
|
||||
}
|
||||
fn get_caller(&self) -> Result<&Pubkey, InstructionError> {
|
||||
Ok(&self.key)
|
||||
}
|
||||
fn get_programs(&self) -> &[(Pubkey, ProcessInstruction)] {
|
||||
&[]
|
||||
}
|
||||
fn get_logger(&self) -> Rc<RefCell<dyn Logger>> {
|
||||
Rc::new(RefCell::new(self.logger.clone()))
|
||||
}
|
||||
fn get_compute_budget(&self) -> &ComputeBudget {
|
||||
&self.compute_budget
|
||||
}
|
||||
fn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>> {
|
||||
Rc::new(RefCell::new(self.compute_meter.clone()))
|
||||
}
|
||||
fn add_executor(&mut self, _pubkey: &Pubkey, _executor: Arc<dyn Executor>) {}
|
||||
fn get_executor(&mut self, _pubkey: &Pubkey) -> Option<Arc<dyn Executor>> {
|
||||
None
|
||||
}
|
||||
fn record_instruction(&self, _: &solana_sdk::instruction::Instruction) {
|
||||
todo!()
|
||||
}
|
||||
fn is_feature_active(&self, _: &solana_sdk::pubkey::Pubkey) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
struct MockComputeMeter {}
|
||||
impl ComputeMeter for MockComputeMeter {
|
||||
fn consume(&mut self, _amount: u64) -> Result<(), InstructionError> {
|
||||
Ok(())
|
||||
}
|
||||
fn get_remaining(&self) -> u64 {
|
||||
u64::MAX
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Default, Clone)]
|
||||
struct MockLogger {}
|
||||
impl Logger for MockLogger {
|
||||
fn log_enabled(&self) -> bool {
|
||||
true
|
||||
}
|
||||
fn log(&mut self, message: &str) {
|
||||
println!("{}", message);
|
||||
}
|
||||
}
|
||||
|
||||
struct TestInstructionMeter {}
|
||||
impl InstructionMeter for TestInstructionMeter {
|
||||
fn consume(&mut self, _amount: u64) {}
|
||||
fn get_remaining(&self) -> u64 {
|
||||
u64::MAX
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use solana_sdk::{
|
|||
transaction::Transaction,
|
||||
transport,
|
||||
};
|
||||
use spl_themis_ristretto_client::{test_e2e, process_transactions_with_commitment};
|
||||
use spl_themis_ristretto_client::{process_transactions_with_commitment, test_e2e};
|
||||
use std::{
|
||||
fs::{remove_dir_all, File},
|
||||
io::Read,
|
||||
|
@ -23,10 +23,7 @@ use tokio::runtime::Runtime;
|
|||
const DATA_CHUNK_SIZE: usize = 229; // Keep program chunks under PACKET_DATA_SIZE
|
||||
|
||||
fn load_program(name: &str) -> Vec<u8> {
|
||||
let mut path = PathBuf::new();
|
||||
path.push("../../target/bpfel-unknown-unknown/release");
|
||||
path.push(name);
|
||||
path.set_extension("so");
|
||||
let path = PathBuf::from(name).with_extension("so");
|
||||
let mut file = File::open(path).unwrap();
|
||||
|
||||
let mut program = Vec::new();
|
||||
|
|
|
@ -20,7 +20,7 @@ getrandom = { version = "0.1.15", features = ["dummy"] }
|
|||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
rand = "0.7.0"
|
||||
solana-program = "1.4.3"
|
||||
solana-program = "1.4.4"
|
||||
thiserror = "1.0"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -15,7 +15,7 @@ arrayref = "0.3.6"
|
|||
num_enum = "0.5.1"
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
solana-program = "1.4.3"
|
||||
solana-program = "1.4.4"
|
||||
thiserror = "1.0"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -15,11 +15,12 @@ production = []
|
|||
arrayref = "0.3.6"
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
solana-program = "1.4.3"
|
||||
solana-program = "1.4.4"
|
||||
spl-token = { path = "../../token/program", features = [ "exclude_entrypoint" ] }
|
||||
thiserror = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
solana-sdk = "1.4.4"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
|
|
@ -736,10 +736,8 @@ mod tests {
|
|||
},
|
||||
instruction::{deposit, initialize, swap, withdraw},
|
||||
};
|
||||
use solana_program::{
|
||||
account::Account, account_info::create_is_signer_account_infos, instruction::Instruction,
|
||||
program_stubs, rent::Rent, sysvar::rent,
|
||||
};
|
||||
use solana_program::{instruction::Instruction, program_stubs, rent::Rent};
|
||||
use solana_sdk::account::{create_account, create_is_signer_account_infos, Account};
|
||||
use spl_token::{
|
||||
error::TokenError,
|
||||
instruction::{
|
||||
|
@ -1294,7 +1292,7 @@ mod tests {
|
|||
&program_id,
|
||||
);
|
||||
let mut mint_authority_account = Account::default();
|
||||
let mut rent_sysvar_account = rent::create_account(1, &Rent::free());
|
||||
let mut rent_sysvar_account = create_account(&Rent::free(), 1);
|
||||
|
||||
do_process_instruction(
|
||||
initialize_account(&program_id, &account_key, &mint_key, account_owner_key).unwrap(),
|
||||
|
@ -1341,7 +1339,7 @@ mod tests {
|
|||
spl_token::state::Mint::get_packed_len(),
|
||||
&program_id,
|
||||
);
|
||||
let mut rent_sysvar_account = rent::create_account(1, &Rent::free());
|
||||
let mut rent_sysvar_account = create_account(&Rent::free(), 1);
|
||||
|
||||
do_process_instruction(
|
||||
initialize_mint(&program_id, &mint_key, authority_key, freeze_authority, 2).unwrap(),
|
||||
|
@ -3369,7 +3367,10 @@ mod tests {
|
|||
);
|
||||
let fee_account =
|
||||
Processor::unpack_token_account(&accounts.pool_fee_account.data).unwrap();
|
||||
assert_eq!(fee_account.amount, withdraw_fee.try_into().unwrap());
|
||||
assert_eq!(
|
||||
fee_account.amount,
|
||||
TryInto::<u64>::try_into(withdraw_fee).unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
// correct withdrawal from fee account
|
||||
|
@ -3418,7 +3419,10 @@ mod tests {
|
|||
)
|
||||
.unwrap();
|
||||
let token_a = Processor::unpack_token_account(&token_a_account.data).unwrap();
|
||||
assert_eq!(token_a.amount, withdrawn_a.try_into().unwrap());
|
||||
assert_eq!(
|
||||
token_a.amount,
|
||||
TryInto::<u64>::try_into(withdrawn_a).unwrap()
|
||||
);
|
||||
let withdrawn_b = accounts
|
||||
.swap_curve
|
||||
.calculator
|
||||
|
@ -3429,7 +3433,10 @@ mod tests {
|
|||
)
|
||||
.unwrap();
|
||||
let token_b = Processor::unpack_token_account(&token_b_account.data).unwrap();
|
||||
assert_eq!(token_b.amount, withdrawn_b.try_into().unwrap());
|
||||
assert_eq!(
|
||||
token_b.amount,
|
||||
TryInto::<u64>::try_into(withdrawn_b).unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3497,7 +3504,7 @@ mod tests {
|
|||
let token_a_amount = swap_token_a.amount;
|
||||
assert_eq!(
|
||||
token_a_amount,
|
||||
results.new_source_amount.try_into().unwrap()
|
||||
TryInto::<u64>::try_into(results.new_source_amount).unwrap()
|
||||
);
|
||||
let token_a = Processor::unpack_token_account(&token_a_account.data).unwrap();
|
||||
assert_eq!(token_a.amount, initial_a - a_to_b_amount);
|
||||
|
@ -3506,7 +3513,7 @@ mod tests {
|
|||
let token_b_amount = swap_token_b.amount;
|
||||
assert_eq!(
|
||||
token_b_amount,
|
||||
results.new_destination_amount.try_into().unwrap()
|
||||
TryInto::<u64>::try_into(results.new_destination_amount).unwrap()
|
||||
);
|
||||
let token_b = Processor::unpack_token_account(&token_b_account.data).unwrap();
|
||||
assert_eq!(
|
||||
|
@ -3524,7 +3531,10 @@ mod tests {
|
|||
)
|
||||
.unwrap();
|
||||
let fee_account = Processor::unpack_token_account(&accounts.pool_fee_account.data).unwrap();
|
||||
assert_eq!(fee_account.amount, first_fee.try_into().unwrap());
|
||||
assert_eq!(
|
||||
fee_account.amount,
|
||||
TryInto::<u64>::try_into(first_fee).unwrap()
|
||||
);
|
||||
|
||||
let first_swap_amount = results.amount_swapped;
|
||||
|
||||
|
@ -3561,7 +3571,7 @@ mod tests {
|
|||
let token_a_amount = swap_token_a.amount;
|
||||
assert_eq!(
|
||||
token_a_amount,
|
||||
results.new_destination_amount.try_into().unwrap()
|
||||
TryInto::<u64>::try_into(results.new_destination_amount).unwrap()
|
||||
);
|
||||
let token_a = Processor::unpack_token_account(&token_a_account.data).unwrap();
|
||||
assert_eq!(
|
||||
|
@ -3573,7 +3583,7 @@ mod tests {
|
|||
let token_b_amount = swap_token_b.amount;
|
||||
assert_eq!(
|
||||
token_b_amount,
|
||||
results.new_source_amount.try_into().unwrap()
|
||||
TryInto::<u64>::try_into(results.new_source_amount).unwrap()
|
||||
);
|
||||
let token_b = Processor::unpack_token_account(&token_b_account.data).unwrap();
|
||||
assert_eq!(
|
||||
|
|
|
@ -12,14 +12,14 @@ version = "2.0.3"
|
|||
clap = "2.33.3"
|
||||
console = "0.13.0"
|
||||
serde_json = "1.0.59"
|
||||
solana-account-decoder = "1.4.3"
|
||||
solana-clap-utils = "1.4.3"
|
||||
solana-cli-config = "1.4.3"
|
||||
solana-cli-output = "1.4.3"
|
||||
solana-client = "1.4.3"
|
||||
solana-logger = "1.4.3"
|
||||
solana-remote-wallet = "1.4.3"
|
||||
solana-sdk = "1.4.3"
|
||||
solana-account-decoder = "1.4.4"
|
||||
solana-clap-utils = "1.4.4"
|
||||
solana-cli-config = "1.4.4"
|
||||
solana-cli-output = "1.4.4"
|
||||
solana-client = "1.4.4"
|
||||
solana-logger = "1.4.4"
|
||||
solana-remote-wallet = "1.4.4"
|
||||
solana-sdk = "1.4.4"
|
||||
spl-token = { version = "2.0", path="../program", features = [ "exclude_entrypoint" ] }
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -10,7 +10,7 @@ edition = "2018"
|
|||
[dev-dependencies]
|
||||
rand = { version = "0.7.0"}
|
||||
spl-token = { path = "../program", features = [ "exclude_entrypoint" ] }
|
||||
solana-runtime = "1.4.3"
|
||||
solana-sdk = "1.4.3"
|
||||
solana-bpf-loader-program = "1.4.3"
|
||||
solana-runtime = "1.4.4"
|
||||
solana-sdk = "1.4.4"
|
||||
solana-bpf-loader-program = "1.4.4"
|
||||
solana_rbpf = "=0.1.32"
|
||||
|
|
|
@ -19,13 +19,10 @@ use spl_token::{
|
|||
instruction::TokenInstruction,
|
||||
state::{Account, Mint},
|
||||
};
|
||||
use std::{cell::RefCell, fs::File, io::Read, path::PathBuf};
|
||||
use std::{cell::RefCell, fs::File, io::Read};
|
||||
|
||||
fn load_program(name: &str) -> Vec<u8> {
|
||||
let mut path = PathBuf::new();
|
||||
path.push(name);
|
||||
path.set_extension("so");
|
||||
let mut file = File::open(path).unwrap();
|
||||
let mut file = File::open(name).unwrap();
|
||||
|
||||
let mut program = Vec::new();
|
||||
file.read_to_end(&mut program).unwrap();
|
||||
|
@ -38,9 +35,10 @@ fn run_program(
|
|||
instruction_data: &[u8],
|
||||
) -> Result<u64, InstructionError> {
|
||||
let mut program_account = SolanaAccount::default();
|
||||
program_account.data = load_program("spl_token");
|
||||
program_account.data = load_program("spl_token.so");
|
||||
let loader_id = bpf_loader::id();
|
||||
let mut invoke_context = MockInvokeContext::default();
|
||||
|
||||
let executable = EbpfVm::<solana_bpf_loader_program::BPFError>::create_executable_from_elf(
|
||||
&&program_account.data,
|
||||
None,
|
||||
|
@ -61,9 +59,8 @@ fn run_program(
|
|||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
SUCCESS,
|
||||
Ok(SUCCESS),
|
||||
vm.execute_program(parameter_bytes.as_mut_slice(), &[], &[heap_region])
|
||||
.unwrap()
|
||||
);
|
||||
deserialize_parameters(&loader_id, parameter_accounts, ¶meter_bytes).unwrap();
|
||||
Ok(vm.get_total_instruction_count())
|
||||
|
|
|
@ -12,13 +12,15 @@ exclude = ["js/**"]
|
|||
exclude_entrypoint = []
|
||||
|
||||
[dependencies]
|
||||
arrayref = "0.3.6"
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
remove_dir_all = "=0.5.0"
|
||||
solana-program = "1.4.3"
|
||||
thiserror = "1.0"
|
||||
arrayref = "0.3.6"
|
||||
num_enum = "0.5.1"
|
||||
solana-program = "1.4.4"
|
||||
thiserror = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
solana-sdk = "1.4.4"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
|
|
@ -781,9 +781,9 @@ impl PrintProgramError for TokenError {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::instruction::*;
|
||||
use solana_program::{
|
||||
account::Account as SolanaAccount, account_info::create_is_signer_account_infos,
|
||||
clock::Epoch, instruction::Instruction, sysvar::rent,
|
||||
use solana_program::{clock::Epoch, instruction::Instruction, sysvar::rent};
|
||||
use solana_sdk::account::{
|
||||
create_account, create_is_signer_account_infos, Account as SolanaAccount,
|
||||
};
|
||||
|
||||
fn do_process_instruction(
|
||||
|
@ -813,7 +813,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn rent_sysvar() -> SolanaAccount {
|
||||
rent::create_account(42, &Rent::default())
|
||||
create_account(&Rent::default(), 42)
|
||||
}
|
||||
|
||||
fn mint_minimum_balance() -> u64 {
|
||||
|
|
|
@ -12,15 +12,15 @@ exclude = ["js/**"]
|
|||
exclude_entrypoint = []
|
||||
|
||||
[dependencies]
|
||||
arrayref = "0.3.6"
|
||||
num-derive = "0.3"
|
||||
num-traits = "0.2"
|
||||
remove_dir_all = "=0.5.0"
|
||||
solana-program = "1.4.3"
|
||||
thiserror = "1.0"
|
||||
arrayref = "0.3.6"
|
||||
num_enum = "0.5.1"
|
||||
solana-program = "1.4.4"
|
||||
thiserror = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
solana-sdk = "1.4.4"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//! Program state processor
|
||||
|
||||
//#![cfg(feature = "program")]
|
||||
|
||||
use crate::{
|
||||
error::TokenError,
|
||||
instruction::{is_valid_signer_index, AuthorityType, TokenInstruction, MAX_SIGNERS},
|
||||
|
@ -784,9 +782,9 @@ impl PrintProgramError for TokenError {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::instruction::*;
|
||||
use solana_program::{
|
||||
account::Account as SolanaAccount, account_info::create_is_signer_account_infos,
|
||||
clock::Epoch, instruction::Instruction, sysvar::rent,
|
||||
use solana_program::{clock::Epoch, instruction::Instruction, sysvar::rent};
|
||||
use solana_sdk::account::{
|
||||
create_account, create_is_signer_account_infos, Account as SolanaAccount,
|
||||
};
|
||||
|
||||
fn do_process_instruction(
|
||||
|
@ -816,7 +814,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn rent_sysvar() -> SolanaAccount {
|
||||
rent::create_account(42, &Rent::default())
|
||||
create_account(&Rent::default(), 42)
|
||||
}
|
||||
|
||||
fn mint_minimum_balance() -> u64 {
|
||||
|
|
|
@ -8,7 +8,7 @@ edition = "2018"
|
|||
# Used to ensure that SPL programs are buildable by external clients
|
||||
|
||||
[dependencies]
|
||||
solana-sdk = "1.4.3"
|
||||
solana-sdk = "1.4.4"
|
||||
spl-memo = { path = "../../memo/program", features = [ "exclude_entrypoint" ] }
|
||||
spl-token = { path = "../../token/program", features = [ "exclude_entrypoint" ] }
|
||||
spl-token-swap = { path = "../../token-swap/program", features = [ "exclude_entrypoint" ] }
|
||||
|
|
Loading…
Reference in New Issue