Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

fix(sybil-resistance): remove nx option to ensure claim updates in KV#2984

Open
evshank wants to merge 1 commit into
base:masterfrom
evshank:evshank-patch-1
Open

fix(sybil-resistance): remove nx option to ensure claim updates in KV#2984
evshank wants to merge 1 commit into
base:masterfrom
evshank:evshank-patch-1

Conversation

@evshank

@evshank evshank commented Mar 14, 2026

Copy link
Copy Markdown

Problem

The kv.set() call uses { nx: true }, which prevents updating existing records. When a key already exists in KV but the current discountType is not in previousClaims, the data isn't saved - yet the API still returns a signedMessage as if the claim was successfully stored.

This creates inconsistency between KV state and API response, breaking the anti-sybil protection mechanism that prevents duplicate signature issuance.

Solution

Remove nx: true from kv.set() options to ensure the record is always updated.

Impact

  • Existing records properly update when a new discountType is added
  • Duplicate claims for the same discountType are still rejected (upstream logic unchanged)
  • TTL (expiry) functionality remains intact
Problem
The kv.set() call uses { nx: true }, which prevents updating existing records. When a key already exists in KV but the current discountType is not in previousClaims, the data isn't saved — yet the API still returns a signedMessage as if the claim was successfully stored.

This creates inconsistency between KV state and API response, breaking the anti-sybil protection mechanism that prevents duplicate signature issuance.

Solution
Remove nx: true from kv.set() options to ensure the record is always updated.

Impact
Existing records properly update when a new discountType is added

Duplicate claims for the same discountType are still rejected (upstream logic unchanged)

TTL (expiry) functionality remains intact
@vercel

vercel Bot commented Mar 14, 2026

Copy link
Copy Markdown

@evshank is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants