Skip to content

Commit

Permalink
Add the bpf program after the validator is up - doing this currently …
Browse files Browse the repository at this point in the history
…for every test, even though only one test needs them, i think this can be something we pass to the testcontainers library, but want to see how slow it is first
  • Loading branch information
ml-james committed Sep 17, 2024
1 parent a215800 commit 499d7e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ public abstract class IntegrationTestBase
{
SOLANA_VALIDATOR = new GenericContainer<>(new ImageFromDockerfile().withDockerfile(Path.of(MountableFile.forClasspathResource("Dockerfile").getFilesystemPath())))
.withCopyFileToContainer(MountableFile.forClasspathResource("solana-run.sh"), "/solana-run.sh")
.withCopyFileToContainer(MountableFile.forClasspathResource("lmax_multisig.so"), "/multisig/lmax_multisig.so")
.withCopyFileToContainer(MountableFile.forClasspathResource("lmax_multisig.so"), "/lmax_multisig.so")
.withCopyFileToContainer(MountableFile.forClasspathResource("upgrade_authority.json"), "/upgrade_authority.json")
.withCopyFileToContainer(MountableFile.forClasspathResource("bpf_program.json"), "/bpf_program.json")
.withExposedPorts(SOLANA_HTTP_PORT, SOLANA_WS_PORT)
.withEnv("SOLANA_RUN_SH_VALIDATOR_ARGS", "--bpf-program CxmAHzszTVSWmtBnCXda7eUTemd8DGyax88yYk54A2PT /multisig/lmax_multisig.so --ticks-per-slot=8")
.withEnv("SOLANA_RUN_SH_VALIDATOR_ARGS", "--ticks-per-slot=8")
.withNetwork(NETWORK);

SOLANA_VALIDATOR.start();
Expand Down
1 change: 1 addition & 0 deletions src/integration-test/resources/bpf_program.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[61,196,159,98,23,173,199,31,231,199,114,186,197,109,57,63,107,200,112,213,255,160,241,57,77,236,166,195,202,255,88,144,177,185,110,204,245,183,13,245,247,158,124,13,207,38,93,189,174,177,67,96,65,158,117,67,213,221,149,207,228,39,63,146]
32 changes: 24 additions & 8 deletions src/integration-test/resources/solana-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,36 @@ else
$SOLANA_RUN_SH_GENESIS_ARGS
fi

abort() {
set +e
kill "$validator"
wait "$validator"
}
trap abort INT TERM EXIT

args=(
--ledger "$ledgerDir"
--gossip-port 8001
--rpc-port 8899
)

# shellcheck disable=SC2086
solana-test-validator "${args[@]}" $SOLANA_RUN_SH_VALIDATOR_ARGS &
validator=$!

wait "$validator"

solana config set --url "http://localhost:8899"

set +e
while true; do

solana ping --count 1 > /dev/null 2>&1

if [ $? -eq 0 ]; then
echo "Solana RPC is responsive!"
break
else
echo "Waiting for Solana RPC to become responsive..."
fi
sleep 0.5
done
set -e

solana program deploy /lmax_multisig.so --program-id /bpf_program.json --upgrade-authority /upgrade_authority.json
#solana program show CxmAHzszTVSWmtBnCXda7eUTemd8DGyax88yYk54A2PT

wait "$validator"

1 change: 1 addition & 0 deletions src/integration-test/resources/upgrade_authority.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[202,101,0,209,102,238,230,73,253,213,87,196,29,150,233,22,76,33,202,41,139,151,4,110,169,33,68,147,253,94,157,215,0,179,40,133,43,36,208,40,29,110,65,126,205,211,111,151,29,241,182,112,20,241,41,84,12,181,176,237,207,139,117,228]

0 comments on commit 499d7e6

Please sign in to comment.