[#240] Fix contract address backfill for pre-redeploy data#241
[#240] Fix contract address backfill for pre-redeploy data#241realproject7 merged 2 commits intomainfrom
Conversation
Re-tag all existing rows from the new contract address (0x6b8d...) back to the old contract (0x05c4...) where they were actually created. Migration 00009 incorrectly defaulted to the new address. Fixes #240 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The migration matches the issue write-up, but as written it is not environment-safe. It blindly rewrites every row tagged with the new contract address, so any environment that has already indexed legitimate new-contract data will have that data silently corrupted back to the old address.
Findings
- [high]
00012_fix_contract_address_backfill.sqlupdates all rows withcontract_address = 0x6b8d...across all six tables, with no predicate that distinguishes wrongly backfilled pre-redeploy rows from legitimate new-contract rows.- File:
supabase/migrations/00012_fix_contract_address_backfill.sql:5 - Suggestion: make the backfill targetable and provably safe, for example by constraining on a pre-redeploy cutoff (
indexed_at/block_timestamp) or on a known bounded data set, rather than rewriting every row with the new address. At minimum, the migration should fail closed unless the operator explicitly confirms the environment contains no real new-contract data.
- File:
Decision
Requesting changes because this migration can corrupt legitimate data in any environment where new-contract rows already exist, and the safety assumption is not encoded anywhere in the SQL.
Only re-tag rows created/indexed before 2026-03-17T09:00:00Z to avoid overwriting any legitimate new-contract data indexed after migration 00009 was deployed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
Re-review complete. The backfill is now scoped to a concrete pre-deploy cutoff (2026-03-17T09:00:00Z) using the relevant timestamp columns per table, which prevents the migration from blindly retagging legitimate new-contract rows created after that point.
Findings
- None. The migration now encodes the safety assumption that was previously only implicit.
Decision
Approving because the follow-up makes the contract-address backfill fail closed to pre-cutoff data instead of rewriting every 0x6b8d... row indiscriminately. CI was still pending at the time of review.
…addresses P5-8c: Update testnet constants after P5-8a/b deployments: - PLOT_TOKEN testnet: PL_TEST (0x6Ef4...13Fa) replaces WETH stand-in - ZAP_PLOTLINK testnet: 0x38b0...a0D7 - RESERVE_LABEL: testnet "PL_TEST", mainnet "PLOT" - Added UNISWAP_V4_POOL_MANAGER constant Fixes #241 (partial — P5-8 only) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Updated ZAP_PLOTLINK testnet to redeployed address (0xC7C47D8...) - Reverted RESERVE_LABEL mainnet value to "PL_TEST" (out-of-scope change) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
[#241] P5-8c: Update constants with PL_TEST, ZapPlotLink addresses
Summary
0x6b8d...)0x05c4...)Test plan
0x05c4...)Fixes #240
🤖 Generated with Claude Code