forked from metaplex-foundation/mpl-token-metadata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
160 additions
and
48 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
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ test-ledger | |
dist | ||
.amman | ||
.crates | ||
.bin |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
OUTPUT="./programs/.bin" | ||
# saves external programs binaries to the output directory | ||
source ${SCRIPT_DIR}/dump.sh ${OUTPUT} | ||
# go to parent folder | ||
cd $(dirname $(dirname ${SCRIPT_DIR})) | ||
|
||
if [ -z ${PROGRAMS+x} ]; then | ||
PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" | ||
fi | ||
|
||
# default to input from the command-line | ||
ARGS=$* | ||
|
||
# command-line arguments override env variable | ||
if [ ! -z "$ARGS" ]; then | ||
PROGRAMS="[\"${1}\"]" | ||
shift | ||
ARGS=$* | ||
fi | ||
|
||
PROGRAMS=$(echo ${PROGRAMS} | jq -c '.[]' | sed 's/"//g') | ||
|
||
# creates the output directory if it doesn't exist | ||
if [ ! -d ${OUTPUT} ]; then | ||
mkdir ${OUTPUT} | ||
fi | ||
|
||
WORKING_DIR=$(pwd) | ||
export BPF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" | ||
|
||
for p in ${PROGRAMS[@]}; do | ||
cd ${WORKING_DIR}/programs/${p} | ||
cargo build-bpf --bpf-out-dir ${WORKING_DIR}/${OUTPUT} $ARGS | ||
done |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
# output colours | ||
RED() { echo $'\e[1;31m'$1$'\e[0m'; } | ||
GRN() { echo $'\e[1;32m'$1$'\e[0m'; } | ||
|
||
CURRENT_DIR=$(pwd) | ||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
# go to parent folder | ||
cd $(dirname $(dirname $SCRIPT_DIR)) | ||
|
||
OUTPUT=$1 | ||
EXTERNAL_ID=("auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg" "SysExL2WDyJi9aRZrXorrjHJut3JwHQ7R9bTyctbNNG" "TokExjvjJmhKaRBShsBAsbSvEWMA1AgUNK7ps4SAc2p") | ||
EXTERNAL_SO=("mpl_token_auth_rules.so" "mpl_system_extras.so" "mpl_token_extras.so") | ||
|
||
if [ -z ${RPC+x} ]; then | ||
RPC="https://api.mainnet-beta.solana.com" | ||
fi | ||
|
||
if [ -z "$OUTPUT" ]; then | ||
echo "missing output directory" | ||
exit 1 | ||
fi | ||
|
||
# creates the output directory if it doesn't exist | ||
if [ ! -d ${OUTPUT} ]; then | ||
mkdir ${OUTPUT} | ||
fi | ||
|
||
# only prints this if we have external programs | ||
if [ ${#EXTERNAL_ID[@]} -gt 0 ]; then | ||
echo "Dumping external programs to: '${OUTPUT}'" | ||
fi | ||
|
||
# dump external programs binaries if needed | ||
for i in ${!EXTERNAL_ID[@]}; do | ||
if [ ! -f "${OUTPUT}/${EXTERNAL_SO[$i]}" ]; then | ||
solana program dump -u $RPC ${EXTERNAL_ID[$i]} ${OUTPUT}/${EXTERNAL_SO[$i]} | ||
else | ||
solana program dump -u $RPC ${EXTERNAL_ID[$i]} ${OUTPUT}/onchain-${EXTERNAL_SO[$i]} > /dev/null | ||
ON_CHAIN=`sha256sum -b ${OUTPUT}/onchain-${EXTERNAL_SO[$i]} | cut -d ' ' -f 1` | ||
LOCAL=`sha256sum -b ${OUTPUT}/${EXTERNAL_SO[$i]} | cut -d ' ' -f 1` | ||
|
||
if [ "$ON_CHAIN" != "$LOCAL" ]; then | ||
echo $(RED "[ WARNING ] on-chain and local binaries are different for '${EXTERNAL_SO[$i]}'") | ||
else | ||
echo "$(GRN "[ SKIPPED ]") on-chain and local binaries are the same for '${EXTERNAL_SO[$i]}'" | ||
fi | ||
|
||
rm ${OUTPUT}/onchain-${EXTERNAL_SO[$i]} | ||
fi | ||
done | ||
|
||
# only prints this if we have external programs | ||
if [ ${#EXTERNAL_ID[@]} -gt 0 ]; then | ||
echo "" | ||
fi | ||
|
||
cd ${CURRENT_DIR} |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
OUTPUT="./programs/.bin" | ||
# saves external programs binaries to the output directory | ||
source ${SCRIPT_DIR}/dump.sh ${OUTPUT} | ||
# go to parent folder | ||
cd $(dirname $(dirname $SCRIPT_DIR)) | ||
|
||
if [ ! -z "$PROGRAM" ]; then | ||
PROGRAMS='["'${PROGRAM}'"]' | ||
fi | ||
|
||
if [ -z "$PROGRAMS" ]; then | ||
PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" | ||
fi | ||
|
||
# default to input from the command-line | ||
ARGS=$* | ||
|
||
# command-line arguments override env variable | ||
if [ ! -z "$ARGS" ]; then | ||
PROGRAMS="[\"${1}\"]" | ||
shift | ||
ARGS=$* | ||
fi | ||
|
||
PROGRAMS=$(echo $PROGRAMS | jq -c '.[]' | sed 's/"//g') | ||
|
||
WORKING_DIR=$(pwd) | ||
SOLFMT="solfmt" | ||
export BPF_OUT_DIR="${WORKING_DIR}/${OUTPUT}" | ||
|
||
for p in ${PROGRAMS[@]}; do | ||
cd ${WORKING_DIR}/programs/${p} | ||
|
||
if [ ! "$(command -v $SOLFMT)" = "" ]; then | ||
CARGO_TERM_COLOR=always cargo test-bpf --bpf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} 2>&1 | ${SOLFMT} | ||
else | ||
cargo test-bpf --bpf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} | ||
fi | ||
done |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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