Skip to content

Commit a2e6577

Browse files
authored
program/rust: Remove resize logic, forbid v1 prices on pythnet (#379)
* program/rust: Remove resize logic, forbid v1 prices on pythnet * program/rust/Cargo.toml: Clarify comment on oracle features * pyth_simulator.rs: remove price_v2_resize feature detection * scripts/build-bpf.sh: Don't use individual tests for pythnet tests * program/rust: Consolidate PriceAccount(V2) into a single type * program/rust: price.rs, upd_price.rs: Update comments * program/rust tests: mod declaration feature gates instead of #![] * program/rust test_add_publisher.rs: Remove trivial variable
1 parent fca9f4a commit a2e6577

16 files changed

+307
-583
lines changed

program/rust/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ test-generator = "0.3.1"
3535
csv = "1.1"
3636
lazy_static = "1.4.0"
3737

38-
# IMPORTANT: Features in this crate must be added to the `lazy_static` macro call in `pyth_simulator.rs`.
38+
# IMPORTANT: Features which affect oracle business logic must be added
39+
# to the `lazy_static` macro call in `pyth_simulator.rs`.
3940
#
4041
# Context: We perform a cargo-build-bpf call as part of running tests
4142
# to obtain a BPF binary for testing. Desired features are not known
@@ -44,8 +45,7 @@ lazy_static = "1.4.0"
4445
[features]
4546
debug = []
4647
library = []
47-
pythnet = []
48-
price_v2_resize = []
48+
pythnet = [] # logic-affecting features start with this one
4949

5050
[lib]
5151
crate-type = ["cdylib", "lib"]

program/rust/src/accounts.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ mod product;
4343
// Some types only exist during use as a library.
4444
#[cfg(feature = "strum")]
4545
pub use price::MessageType;
46+
#[cfg(feature = "pythnet")]
47+
pub use price::PriceCumulative;
4648
#[cfg(test)]
4749
pub use product::{
4850
account_has_key_values,
@@ -53,9 +55,7 @@ pub use {
5355
permission::PermissionAccount,
5456
price::{
5557
PriceAccount,
56-
PriceAccountV2,
5758
PriceComponent,
58-
PriceCumulative,
5959
PriceEma,
6060
PriceInfo,
6161
PythOracleSerialize,
@@ -71,6 +71,7 @@ pub use {
7171
/// There is a single permissions account under `PERMISSIONS_SEED` that stores which keys
7272
/// are authorized to perform certain adminsitrative actions.
7373
pub const PERMISSIONS_SEED: &str = "permissions";
74+
7475
#[cfg(feature = "pythnet")]
7576
/// The update price instruction can optionally invoke another program via CPI. The
7677
/// CPI will be signed with the PDA `[UPD_PRICE_WRITE_SEED, invoked_program_public_key]`

0 commit comments

Comments
 (0)