Skip to content

Commit 47115ab

Browse files
committed
remove PC_PYTHNET flag
1 parent d649901 commit 47115ab

File tree

5 files changed

+5
-38
lines changed

5 files changed

+5
-38
lines changed

program/c/makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ else
1111
include $(SOLANA)/sdk/sbf/c/sbf.mk
1212
endif
1313

14-
# Propagate the PC_PYTHNET feature by conditionally defining it in a
15-
# features.h header. The makefile included from Solana SDK does not
16-
# have an easy way to pass extra C flags which motivates this approach.
17-
ifdef PC_PYTHNET
18-
FEATURES_H_BODY:="\#pragma once\n\#define PC_PYTHNET 1"
19-
else
20-
FEATURES_H_BODY:="\#pragma once"
21-
endif
14+
FEATURES_H_BODY:="\#pragma once"
2215

2316

2417
.PHONY: features.h # Putting this in .PHONY makes sure the header is always regenerated

program/c/src/oracle/native/upd_aggregate.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ char heap_start[8192];
99
#include "../upd_aggregate.h"
1010
#include "../features.h"
1111

12-
#ifdef PC_PYTHNET
1312
extern bool c_upd_aggregate_pythnet( pc_price_t *ptr, uint64_t slot, int64_t timestamp ){
14-
#else
15-
extern bool c_upd_aggregate_solana( pc_price_t *ptr, uint64_t slot, int64_t timestamp ){
16-
#endif
1713
return upd_aggregate(ptr, slot, timestamp );
1814
}
1915

program/c/src/oracle/oracle.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@ extern "C" {
2727
#define PC_NUM_COMP_PYTHNET 128
2828

2929
// PC_NUM_COMP - number of price components in use
30-
#ifdef PC_PYTHNET
3130
// Not whole PC_NUM_COMP_PYTHNET because of stack issues appearing in upd_aggregate()
3231
#define PC_NUM_COMP 64
33-
#else
34-
#define PC_NUM_COMP PC_NUM_COMP_SOLANA
35-
#endif
32+
3633

3734
#define PC_PROD_ACC_SIZE 512
3835
#define PC_EXP_DECAY -9
@@ -209,7 +206,6 @@ typedef struct pc_price
209206
pc_price_comp_t comp_[PC_NUM_COMP];// component prices
210207
} pc_price_t;
211208

212-
#ifdef PC_PYTHNET
213209

214210
// Replace Solana component size's contribution with Pythnet's
215211
#define PC_EXPECTED_PRICE_T_SIZE_PYTHNET (3312 \
@@ -220,9 +216,6 @@ typedef struct pc_price
220216
static_assert( sizeof( pc_price_t ) == PC_EXPECTED_PRICE_T_SIZE_PYTHNET, "" );
221217
#undef PC_EXPECTED_PRICE_SIZE_PYTHNET
222218

223-
#else
224-
static_assert( sizeof( pc_price_t ) == 3312, "" );
225-
#endif
226219

227220
// This constant needs to be an upper bound of the price account size, it is used within pythd for ztsd.
228221
// It is set tighly to the current price account + 96 component prices + 48 bytes for cumulative sums

program/c/src/oracle/upd_aggregate.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
#include "upd_aggregate.h"
77
#include "features.h"
88

9-
// Dynamically deciding the name prevents linking the wrong C binary flavor
10-
#ifdef PC_PYTHNET
9+
1110
extern bool c_upd_aggregate_pythnet( pc_price_t *ptr, uint64_t slot, int64_t timestamp ){
12-
#else
13-
extern bool c_upd_aggregate_solana( pc_price_t *ptr, uint64_t slot, int64_t timestamp ){
14-
#endif
1511
return upd_aggregate(ptr, slot, timestamp );
1612
}
1713

program/rust/build.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@ fn main() {
2424
eprintln!("OUT_DIR is {}", out_dir);
2525
let out_dir = PathBuf::from(out_dir);
2626

27-
let mut make_extra_flags = vec![];
28-
let mut clang_extra_flags = vec![];
29-
30-
// Define PC_PYTHNET for the C binary build
31-
make_extra_flags.push("PC_PYTHNET=1");
32-
33-
// Define PC_PYTHNET for the bindings build
34-
clang_extra_flags.push("-DPC_PYTHNET=1");
35-
3627
let mut make_targets = vec![];
3728
if target_arch == "bpf" {
3829
make_targets.push("cpyth-bpf");
@@ -48,7 +39,7 @@ fn main() {
4839
if has_feat_check {
4940
eprintln!("WARNING: `check` feature active, make build is skipped");
5041
} else {
51-
do_make_build(make_extra_flags, make_targets, &out_dir);
42+
do_make_build(make_targets, &out_dir);
5243

5344
// Link against the right library for the architecture
5445
if target_arch == "bpf" {
@@ -71,7 +62,6 @@ fn main() {
7162
// Generate and write bindings
7263
let bindings = Builder::default()
7364
.clang_arg(format!("-I{:}", get_solana_inc_path().display()))
74-
.clang_args(clang_extra_flags)
7565
.header("./src/bindings.h")
7666
.rustfmt_bindings(true)
7767
.generate()
@@ -85,14 +75,13 @@ fn main() {
8575
println!("cargo:rerun-if-changed=../");
8676
}
8777

88-
fn do_make_build(extra_flags: Vec<&str>, targets: Vec<&str>, out_dir: &Path) {
78+
fn do_make_build(targets: Vec<&str>, out_dir: &Path) {
8979
// We must forward OUT_DIR as an env variable to the make script otherwise it will output
9080
// its artifacts to the wrong place.
9181
let make_output = std::process::Command::new("make")
9282
.env("VERBOSE", "1")
9383
.env("OUT_DIR", out_dir.display().to_string())
9484
.current_dir("../c")
95-
.args(extra_flags)
9685
.args(targets)
9786
.output()
9887
.expect("Failed to run make for C oracle program");

0 commit comments

Comments
 (0)