Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-write-program-buffer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
integration:
name: ${{ matrix.scenario }} (solana ${{ matrix.solana-version }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 0 additions & 1 deletion start-test-validator/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ runs:
LEDGER_DIR="${RUNNER_TEMP:-/tmp}/test-ledger"
fi

rm -rf "$LEDGER_DIR"
solana-test-validator --reset --quiet --ledger "$LEDGER_DIR" > "${RUNNER_TEMP:-/tmp}/validator-stdout.log" 2>&1 &
echo "Validator started with PID $!"

Expand Down
8 changes: 7 additions & 1 deletion write-program-buffer/tests/integration/assert-authority.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ fail() {
[ -n "${BUFFER:-}" ] || fail "action did not output a buffer address"
[ -n "${BUFFER_AUTHORITY:-}" ] || fail "BUFFER_AUTHORITY env not set"
[ -n "${DEPLOYER:-}" ] || fail "DEPLOYER env not set"
[ -n "${PROGRAM_ID:-}" ] || fail "PROGRAM_ID env not set"
[ -n "${PRE_LEN:-}" ] || fail "PRE_LEN env not set"

BUFFER_INFO=$(solana program show "$BUFFER" -u "$RPC_URL")
echo "$BUFFER_INFO"
Expand All @@ -20,9 +22,13 @@ AUTHORITY=$(echo "$BUFFER_INFO" | grep "Authority:" | awk '{print $2}' || true)
[ "$AUTHORITY" = "$BUFFER_AUTHORITY" ] || fail "buffer authority is $AUTHORITY, expected $BUFFER_AUTHORITY"
[ "$AUTHORITY" != "$DEPLOYER" ] || fail "buffer authority still equals the deployer"

POST_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true)
[ -n "$POST_LEN" ] || fail "could not read data length of program $PROGRAM_ID"
[ "$POST_LEN" -eq "$PRE_LEN" ] || fail "program was resized from $PRE_LEN to $POST_LEN bytes, expected no resize"

DUMP="$(mktemp)"
solana program dump "$BUFFER" "$DUMP" -u "$RPC_URL" || fail "could not dump buffer $BUFFER"
cmp -s "$ARTIFACT" "$DUMP" || fail "buffer contents differ from artifact"
rm -f "$DUMP"

echo "Authority transfer assertions passed"
echo "Authority transfer assertions passed: program stayed at $PRE_LEN bytes"
9 changes: 8 additions & 1 deletion write-program-buffer/tests/integration/prepare-authority.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ solana program deploy "$FIXTURES_DIR/program-small.so" \
-u "$RPC_URL" -k "$SCENARIO_DIR/deployer.json" \
--commitment confirmed

PRE_LEN=$(solana program show "$PROGRAM_ID" -u "$RPC_URL" | grep "Data Length:" | sed -E 's/.*Data Length: ([0-9]+).*/\1/' | cut -d ' ' -f1 || true)
if [ -z "$PRE_LEN" ]; then
echo "Could not read deployed program size" >&2
exit 1
fi

cp "$FIXTURES_DIR/program-small.so" target/deploy/fixture-authority.so

echo "Prepared authority scenario: deployer=$DEPLOYER program-id=$PROGRAM_ID authority-target=$AUTHORITY_TARGET"
echo "Prepared authority scenario: deployer=$DEPLOYER program-id=$PROGRAM_ID authority-target=$AUTHORITY_TARGET pre-len=$PRE_LEN"
{
echo "keypair=$(cat "$SCENARIO_DIR/deployer.json")"
echo "deployer=$DEPLOYER"
echo "program-id=$PROGRAM_ID"
echo "buffer-authority=$AUTHORITY_TARGET"
echo "pre-len=$PRE_LEN"
} >> "$GITHUB_OUTPUT"
Loading