Skip to content

Commit edc6cb4

Browse files
committed
ci: sync hardcoded Light CPI signer with anchor keys sync'd program ID (anchor lane)
1 parent e0197a9 commit edc6cb4

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/typescript-tests.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,18 @@ jobs:
5959

6060
- name: Build and sync program ID
6161
working-directory: ${{ matrix.example }}
62-
run: anchor build
62+
run: |
63+
# Anchor 1.0 verifies declare_id! matches the program keypair. Sync it,
64+
# then keep the hardcoded Light CPI signer (derived from the program ID
65+
# at compile time) in sync with the synced ID so the CPI signer check
66+
# in the light-system-program passes at runtime.
67+
anchor keys sync
68+
PROGRAM_ID=$(grep -A 10 '\[programs.localnet\]' Anchor.toml | grep '=' | head -1 | sed 's/.*"\(.*\)".*/\1/')
69+
echo "Synced program ID: $PROGRAM_ID"
70+
grep -rl 'derive_light_cpi_signer!' programs 2>/dev/null | while IFS= read -r f; do
71+
sed -i -E "s/derive_light_cpi_signer!\(\"[^\"]*\"\)/derive_light_cpi_signer!(\"$PROGRAM_ID\")/g" "$f"
72+
done
73+
anchor build
6374
6475
- name: Test sbf
6576
working-directory: ${{ matrix.example }}

0 commit comments

Comments
 (0)