-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check-size.sh: Revert extra arg; rearrange build-bpf.sh instead
- Loading branch information
1 parent
22ee470
commit e8dcaf3
Showing
2 changed files
with
9 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
#!/usr/bin/env bash | ||
# | ||
set -e | ||
|
||
max_size=$1 | ||
filename=${2:-./target/deploy/pyth_oracle.so} | ||
|
||
# While Solana doesn't support resizing programs, the oracle binary needs to be smaller than 81760 bytes | ||
# (The available space for the oracle program on pythnet is 88429 and mainnet is 81760) | ||
ORACLE_SIZE=$(wc -c $filename | awk '{print $1}') | ||
if [ $ORACLE_SIZE -lt ${max_size} ] | ||
ORACLE_SIZE=$(wc -c ./target/deploy/pyth_oracle.so | awk '{print $1}') | ||
if [ $ORACLE_SIZE -lt ${1} ] | ||
then | ||
echo "Size of ${filename} is small enough to be deployed, since ${ORACLE_SIZE} is less than ${max_size}" | ||
echo "Size of pyth_oracle.so is small enough to be deployed, since ${ORACLE_SIZE} is less than ${1}" | ||
else | ||
echo "Size of ${filename} is too big to be deployed, since ${ORACLE_SIZE} is greater than ${max_size}" | ||
echo "Size of pyth_oracle.so is too big to be deployed, since ${ORACLE_SIZE} is greater than ${1}" | ||
exit 1 | ||
fi | ||
fi |