Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 759fe14

Browse files
committed
Switch to solana_sdk Pack and COption
1 parent 15aa027 commit 759fe14

File tree

7 files changed

+72
-61
lines changed

7 files changed

+72
-61
lines changed

Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

token-swap/program/src/processor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ use solana_sdk::{
1919
info,
2020
program_error::PrintProgramError,
2121
program_error::ProgramError,
22+
program_option::COption,
23+
program_pack::Pack,
2224
pubkey::Pubkey,
2325
};
24-
use spl_token::{option::COption, pack::Pack};
2526

2627
// Test program id for the swap program.
2728
#[cfg(not(target_arch = "bpf"))]
@@ -584,7 +585,6 @@ mod tests {
584585
use spl_token::{
585586
error::TokenError,
586587
instruction::{approve, initialize_account, initialize_mint, mint_to, revoke},
587-
pack::Pack,
588588
processor::Processor as SplProcessor,
589589
state::{Account as SplAccount, Mint as SplMint},
590590
};

token/cli/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ version = "2.0.1"
1111
[dependencies]
1212
clap = "2.33.3"
1313
serde_json = "1.0.57"
14-
solana-account-decoder = { version = "1.3.11" }
15-
solana-clap-utils = { version = "1.3.11"}
16-
solana-cli-config = { version = "1.3.11" }
14+
solana-account-decoder = { version = "1.3.12" }
15+
solana-clap-utils = { version = "1.3.12"}
16+
solana-cli-config = { version = "1.3.12" }
1717
solana-client = { version = "1.3.11" }
1818
solana-logger = { version = "1.3.12" }
19-
solana-sdk = { version = "1.3.11" }
19+
solana-sdk = { version = "1.3.12" }
2020
spl-token = { version = "2.0", path="../program" }
2121

2222
[[bin]]

token/cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use solana_client::{rpc_client::RpcClient, rpc_request::TokenAccountsFilter};
1212
use solana_sdk::{
1313
commitment_config::CommitmentConfig,
1414
native_token::*,
15+
program_pack::Pack,
1516
pubkey::Pubkey,
1617
signature::{Keypair, Signer},
1718
system_instruction,
@@ -21,7 +22,6 @@ use spl_token::{
2122
self,
2223
instruction::*,
2324
native_mint,
24-
pack::Pack,
2525
state::{Account, Mint},
2626
};
2727
use std::process::exit;

token/perf-monitor/Cargo.lock

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

token/perf-monitor/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ edition = "2018"
1010
[dev-dependencies]
1111
rand = { version = "0.7.0"}
1212
spl-token = { path = "../program" }
13-
solana-sdk = { version = "1.3.9" }
14-
solana-bpf-loader-program = { version = "1.3.9" }
15-
solana_rbpf = "=0.1.30"
13+
solana-sdk = { version = "1.3.12" }
14+
solana-bpf-loader-program = { version = "1.3.12" }
15+
solana_rbpf = "=0.1.31"

token/perf-monitor/tests/assert_instruction_count.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@ use solana_bpf_loader_program::{
22
create_vm,
33
serialization::{deserialize_parameters, serialize_parameters},
44
};
5-
use solana_rbpf::InstructionMeter;
5+
use solana_rbpf::vm::{EbpfVm, InstructionMeter};
66
use solana_sdk::{
77
account::{Account as SolanaAccount, KeyedAccount},
88
bpf_loader,
99
entrypoint::SUCCESS,
10-
entrypoint_native::{ComputeBudget, ComputeMeter, InvokeContext, Logger, ProcessInstruction},
10+
entrypoint_native::{
11+
ComputeBudget, ComputeMeter, Executor, InvokeContext, Logger, ProcessInstruction,
12+
},
1113
instruction::{CompiledInstruction, InstructionError},
1214
message::Message,
15+
program_option::COption,
16+
program_pack::Pack,
1317
pubkey::Pubkey,
1418
sysvar::rent::{self, Rent},
1519
};
1620
use spl_token::{
1721
instruction::TokenInstruction,
18-
option::COption,
19-
pack::Pack,
2022
state::{Account, Mint},
2123
};
22-
use std::{cell::RefCell, fs::File, io::Read, path::PathBuf, rc::Rc};
24+
use std::{cell::RefCell, fs::File, io::Read, path::PathBuf, rc::Rc, sync::Arc};
2325

2426
fn load_program(name: &str) -> Vec<u8> {
2527
let mut path = PathBuf::new();
@@ -42,9 +44,14 @@ fn run_program(
4244
program_account.data = load_program("spl_token");
4345
let loader_id = bpf_loader::id();
4446
let mut invoke_context = MockInvokeContext::default();
47+
let executable = EbpfVm::<solana_bpf_loader_program::BPFError>::create_executable_from_elf(
48+
&&program_account.data,
49+
None,
50+
)
51+
.unwrap();
4552
let (mut vm, heap_region) = create_vm(
4653
&loader_id,
47-
&program_account.data,
54+
executable.as_ref(),
4855
parameter_accounts,
4956
&mut invoke_context,
5057
)
@@ -203,6 +210,10 @@ impl InvokeContext for MockInvokeContext {
203210
fn get_compute_meter(&self) -> Rc<RefCell<dyn ComputeMeter>> {
204211
Rc::new(RefCell::new(self.compute_meter.clone()))
205212
}
213+
fn add_executor(&mut self, _pubkey: &Pubkey, _executor: Arc<dyn Executor>) {}
214+
fn get_executor(&mut self, _pubkey: &Pubkey) -> Option<Arc<dyn Executor>> {
215+
None
216+
}
206217
}
207218

208219
#[derive(Debug, Default, Clone)]

0 commit comments

Comments
 (0)