Skip to content

Commit e3c416d

Browse files
authored
fix: wait for validator to advance past deploy slot (#4)
1 parent ef867ff commit e3c416d

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

write-program-buffer/tests/integration/prepare-clamp.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ if [ -z "$PRE_LEN" ]; then
4040
exit 1
4141
fi
4242

43+
DEPLOY_SLOT=$(solana slot -u "$RPC_URL")
44+
for i in $(seq 1 30); do
45+
CURRENT_SLOT=$(solana slot -u "$RPC_URL")
46+
[ "$CURRENT_SLOT" -gt "$DEPLOY_SLOT" ] && break
47+
if [ "$i" -eq 30 ]; then
48+
echo "Validator did not advance past slot $DEPLOY_SLOT" >&2
49+
exit 1
50+
fi
51+
sleep 1
52+
done
53+
4354
cp "$FIXTURES_DIR/program-big.so" target/deploy/fixture-clamp.so
4455

4556
echo "Prepared clamp scenario: deployer=$DEPLOYER program-id=$PROGRAM_ID pre-len=$PRE_LEN"

write-program-buffer/tests/integration/prepare-delta.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ if [ -z "$PRE_LEN" ]; then
4141
exit 1
4242
fi
4343

44+
DEPLOY_SLOT=$(solana slot -u "$RPC_URL")
45+
for i in $(seq 1 30); do
46+
CURRENT_SLOT=$(solana slot -u "$RPC_URL")
47+
[ "$CURRENT_SLOT" -gt "$DEPLOY_SLOT" ] && break
48+
if [ "$i" -eq 30 ]; then
49+
echo "Validator did not advance past slot $DEPLOY_SLOT" >&2
50+
exit 1
51+
fi
52+
sleep 1
53+
done
54+
4455
cp "$FIXTURES_DIR/program-medium.so" target/deploy/fixture-delta.so
4556

4657
echo "Prepared delta scenario: deployer=$DEPLOYER program-id=$PROGRAM_ID pre-len=$PRE_LEN delta=$DELTA"

write-program-buffer/tests/integration/prepare-nearmax.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ if [ "$PRE_LEN" -ne "$TARGET_CURRENT" ]; then
7171
exit 1
7272
fi
7373

74+
EXTEND_SLOT=$(solana slot -u "$RPC_URL")
75+
for i in $(seq 1 30); do
76+
CURRENT_SLOT=$(solana slot -u "$RPC_URL")
77+
[ "$CURRENT_SLOT" -gt "$EXTEND_SLOT" ] && break
78+
if [ "$i" -eq 30 ]; then
79+
echo "Validator did not advance past slot $EXTEND_SLOT" >&2
80+
exit 1
81+
fi
82+
sleep 1
83+
done
84+
7485
echo "Prepared nearmax scenario: deployer=$DEPLOYER program-id=$PROGRAM_ID pre-len=$PRE_LEN headroom=$HEADROOM"
7586
{
7687
echo "keypair=$(cat "$SCENARIO_DIR/deployer.json")"

0 commit comments

Comments
 (0)