Skip to content

Commit fd32f3c

Browse files
authored
Add compilation flags and check size in CI (#321)
* Comment * Revert build-bpf * Fix size
1 parent 765f192 commit fd32f3c

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ RUN ./pyth-client/scripts/patch-solana.sh
6666

6767
# Build and test the oracle program.
6868
RUN cd pyth-client && ./scripts/build-bpf.sh .
69+
RUN cd pyth-client && ./scripts/check-size.sh
6970
# Run aggregation logic tests
7071
RUN cd pyth-client && ./scripts/run-aggregation-tests.sh
7172
RUN /bin/bash -l -c "pytest-3 --pyargs pyth"

scripts/build-bpf.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ rm ./target/*-keypair.json
3434
#build Rust and link it with C
3535
cd "${PYTH_DIR}"
3636
cargo clean
37-
cargo test-bpf
37+
cargo-test-bpf
3838
cargo clean
39-
cargo build-bpf
39+
cargo-build-bpf -- -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
4040

4141
sha256sum ./target/**/*.so
4242

scripts/check-size.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
#
3+
# While Solana doesn't support resizing programs, the oracle binary needs to be smaller than 81760 bytes
4+
ORACLE_SIZE=$(wc -c ./target/deploy/pyth_oracle.so | awk '{print $1}')
5+
if [ $ORACLE_SIZE -lt 81760 ]
6+
then
7+
echo "Size of pyth_oracle.so is small enough to be deployed to mainnet."
8+
echo $ORACLE_SIZE
9+
else
10+
echo "Size of pyth_oracle.so is too big to be deployed to mainnet."
11+
echo $ORACLE_SIZE
12+
exit 1
13+
fi

0 commit comments

Comments
 (0)