fix: persist cross-chain airdrop dedup state across restarts#2119
Merged
Scottcjn merged 1 commit intoScottcjn:mainfrom Apr 6, 2026
Merged
Conversation
Contributor
Author
|
For bounty payout, please use RTC wallet: RTC1d48d848a5aa5ecf2c5f01aa5fb64837daaf2f35. |
Owner
|
Merged. Payment: 40 RTC. Addresses #2118. Persists airdrop deduplication state to SQLite via rusqlite so restart no longer loses the in-memory set. Prevents double-claiming across node restarts. |
Owner
|
@createkr — Heads up: Nodes 1 and 2 are updated with all your security fixes (46 PRs merged since last deploy). Node 4 (your HK CognetCloud) is still running old code. When you get a chance, pull latest from main and restart. The P2P secret fix (#2047) requires a real |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: persist airdrop dedup state so duplicate claims survive restart
Problem
Duplicate-claim prevention in
cross-chain-airdropwas purely in-memory (HashSetinsideVerificationPipeline). After any process restart — including every CLI invocation — all dedup state was lost, allowing the same GitHub account or wallet to claim again.Solution
Introduced a
ClaimStoretrait with two implementations:InMemoryClaimStoreSqliteClaimStoreThe pipeline is now generic over
S: ClaimStore.VerificationPipeline::new()still defaults toInMemoryClaimStore(no breaking change). A newwith_store()constructor accepts any implementation.The CLI uses
SqliteClaimStoreby default when built with--features sqlite-store, writing toairdrop_claims.sqlitein the working directory.Key changes
src/claim_store.rs(new) —ClaimStoretrait,InMemoryClaimStore,SqliteClaimStore(feature-gated)src/pipeline.rs— generic overS: ClaimStore;new()delegates towith_store(..., InMemoryClaimStore::new())src/bin/airdrop_cli.rs— conditional compilation:SqliteClaimStorewhen feature enabled,InMemoryClaimStoreotherwiseCargo.toml— optionalrusqlitedep +sqlite-storefeatureTests
InMemoryClaimStoretestsSqliteClaimStoretests (includingtest_sqlite_survives_reopenwhich proves state persists across DB close/reopen)--features sqlite-storeCompatibility
VerificationPipeline::new()signature unchangedsqlite-storefeature is opt-in; zero new dependencies for existing users