Solana: deposit_record ConstraintSeeds error on SOL deposit test #66

Closed
opened 2026-03-20 10:27:46 +00:00 by Brouie · 4 comments
Brouie commented 2026-03-20 10:27:46 +00:00 (Migrated from gitlab.com)

Branch: feat/solana-integration\nCommit: 7e7249a\nTests: 32/33 pass on clean validator, 1 fails\n\nError:\n\nAnchorError caused by account: deposit_record. Error Code: ConstraintSeeds. Error Number: 2006.\nError Message: A seeds constraint was violated.\n\n\nThe deposit_record PDA seed derivation doesn't match between the program and the test. Occurs during the SOL deposit test.\n\nEnvironment: New QA server (qadev-ubuntu-16gb-sin-1), Solana CLI 3.1.11, Anchor 1.0.0-rc.4

**Branch:** feat/solana-integration\n**Commit:** 7e7249a\n**Tests:** 32/33 pass on clean validator, 1 fails\n\n**Error:**\n```\nAnchorError caused by account: deposit_record. Error Code: ConstraintSeeds. Error Number: 2006.\nError Message: A seeds constraint was violated.\n```\n\nThe deposit_record PDA seed derivation doesn't match between the program and the test. Occurs during the SOL deposit test.\n\n**Environment:** New QA server (qadev-ubuntu-16gb-sin-1), Solana CLI 3.1.11, Anchor 1.0.0-rc.4
Brouie commented 2026-03-23 01:20:15 +00:00 (Migrated from gitlab.com)

mentioned in issue #61

mentioned in issue #61
PlasticDigits commented 2026-03-23 03:42:34 +00:00 (Migrated from gitlab.com)

mentioned in commit a10a01d912

mentioned in commit a10a01d91212820ebfe0765f8a73153d5485e081
PlasticDigits commented 2026-03-23 03:42:45 +00:00 (Migrated from gitlab.com)

Fix pushed in commit a10a01d on feat/solana-integration.

Root cause: The deposit tests hardcoded PDA nonce values (1, 2, 3) assuming bridge.deposit_nonce == 0. On a validator that retains ledger state between runs (e.g. run-test-validator.sh without --reset), the on-chain deposit_nonce is already > 0, so the test-derived PDA doesn't match the program-derived PDA → ConstraintSeeds error 2006.

Fix: Added getNextDepositNonce() helper that reads deposit_nonce from the bridge account at runtime. All 7 deposit PDA derivations in deposit_withdraw.test.ts now use this instead of hardcoded values. The deposit tests are fully idempotent regardless of starting validator state.

@Brouie — could you re-run the test suite on the QA server and confirm 33/33 pass? A --reset on the validator first would also verify it works from clean state.

Fix pushed in commit a10a01d on `feat/solana-integration`. **Root cause:** The deposit tests hardcoded PDA nonce values (`1`, `2`, `3`) assuming `bridge.deposit_nonce == 0`. On a validator that retains ledger state between runs (e.g. `run-test-validator.sh` without `--reset`), the on-chain `deposit_nonce` is already > 0, so the test-derived PDA doesn't match the program-derived PDA → `ConstraintSeeds` error 2006. **Fix:** Added `getNextDepositNonce()` helper that reads `deposit_nonce` from the bridge account at runtime. All 7 deposit PDA derivations in `deposit_withdraw.test.ts` now use this instead of hardcoded values. The deposit tests are fully idempotent regardless of starting validator state. @Brouie — could you re-run the test suite on the QA server and confirm 33/33 pass? A `--reset` on the validator first would also verify it works from clean state.
Brouie commented 2026-03-23 03:59:15 +00:00 (Migrated from gitlab.com)

Verified fix (a10a01d). 34/34 tests pass on clean validator. Second run shows expected stale-state failures (PDAs already exist). Dynamic nonce lookup works correctly.

Verified fix (a10a01d). 34/34 tests pass on clean validator. Second run shows expected stale-state failures (PDAs already exist). Dynamic nonce lookup works correctly.
Brouie (Migrated from gitlab.com) closed this issue 2026-03-23 03:59:16 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-bridge-monorepo#66
No description provided.