Skip to content

Commit a43a6a0

Browse files
committed
try fix
1 parent 78078c2 commit a43a6a0

File tree

3 files changed

+3
-21
lines changed

3 files changed

+3
-21
lines changed

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

program/rust/Cargo.toml

-8
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,7 @@ pythnet-sdk = { git = "https://github.com/pyth-network/pyth-crosschain", rev="60
3333
serde_json = "1.0"
3434
test-generator = "0.3.1"
3535
csv = "1.1"
36-
lazy_static = "1.4.0"
3736

38-
# IMPORTANT: Features which affect oracle business logic must be added
39-
# to the `lazy_static` macro call in `pyth_simulator.rs`.
40-
#
41-
# Context: We perform a cargo-build-bpf call as part of running tests
42-
# to obtain a BPF binary for testing. Desired features are not known
43-
# to cargo-build-bpf at that point - we manually capture them at
44-
# compile-time and pass on to the child process.
4537
[features]
4638
check = [] # Skips make build in build.rs, use with cargo-clippy and cargo-check
4739
debug = []

program/rust/src/tests/pyth_simulator.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ use {
7070
},
7171
};
7272

73-
lazy_static::lazy_static! {
74-
// Build the oracle binary and make it available to the
75-
// simulator. lazy_static makes this happen only once per test
76-
// run.
77-
static ref ORACLE_PROGRAM_BINARY_PATH: PathBuf = {
78-
let target_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/../../target");
79-
80-
PathBuf::from(target_dir).join("deploy/pyth_oracle.so")
81-
};
82-
}
83-
8473
/// Simulator for the state of the pyth program on Solana. You can run solana transactions against
8574
/// this struct to test how pyth instructions execute in the Solana runtime.
8675
pub struct PythSimulator {
@@ -113,7 +102,9 @@ struct ProductMetadata {
113102
impl PythSimulator {
114103
/// Deploys the oracle program as upgradable
115104
pub async fn new() -> PythSimulator {
116-
let mut bpf_data = read_file(&*ORACLE_PROGRAM_BINARY_PATH);
105+
let target_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/../../target");
106+
let oracle_program_binary_path = PathBuf::from(target_dir).join("deploy/pyth_oracle.so");
107+
let mut bpf_data = read_file(&oracle_program_binary_path);
117108

118109
let mut program_test = ProgramTest::default();
119110
let program_key = Pubkey::new_unique();

0 commit comments

Comments
 (0)