Phoenix price points are keyed on the wall clock, so a replay is stored twice
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- postgresql, typescript
- Ambito
- backend-api-design, data, databases
Direzione di ricerca
Leggi src/ingest/venues/phoenix.ts intorno alle righe 426–470, confronta il modello di identità in src/ingest/venues/soroswap.ts intorno alla riga 392 e controlla upsertPricePoints in src/db.ts. Aggiungi o aggiorna i test in src/__tests__/phoenixIngester.test.ts e src/__tests__/pricePointIdentity.test.ts per verificare che letture identiche di un pool producano ID stabili, che riserve modificate producano ID diversi e che ripetere l’elaborazione di un batch non aggiunga righe. Esegui i test Vitest pertinenti; il lavoro è completato quando passano tutti i casi indicati relativi all’identità e alla ripetizione, senza valori di orologio o casuali nell’ID.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background
Issue #237 set a rule for rows that have no trade id: the row's identity must
come from the state that was read, never from the clock. The Soroswap adapter
states it in a comment: "Must never be Date.now()/random." The Horizon AMM
keys its snapshot on (pool, last_modified_ledger).
derivePhoenixPricePoints in src/ingest/venues/phoenix.ts (line 467) breaks
the rule:
eventId: `phoenix-${raw.poolAddress}-${Date.now()}`,
Every call makes a new id. A retried batch, or a second instance reading the
same pool, inserts the same observation again. The function is also documented
as "Pure", and it is not.
What to build
- Derive the id from the pool state: the pool address and the two reserves,
as Soroswap does (soroswap-${pool}-${reserveA}-${reserveB}). - Make sure the id does not depend on which way round the pool stores the
pair. The function swapsaandbfor a reversed pool; build the id from
the raw reserves before the swap, or from a fixed order. - Check what this does to an unchanged pool: identical reserves now produce
the same id, so the second write is skipped as a duplicate. Say in the PR
whether that is the wanted behaviour and what it means for freshness.
Where to look
src/ingest/venues/phoenix.tslines 426–470src/ingest/venues/soroswap.tsline 392 for the patternsrc/db.tsupsertPricePointsfor howeventIdbecomes the row idsrc/__tests__/phoenixIngester.test.ts,src/__tests__/pricePointIdentity.test.ts
Done when
- Two calls with the same pool read return the same
eventId - Two calls with different reserves return different ids
- No
Date.now()or random value is used to build the id - A test proves a replayed batch does not create a second row
Drips Wave · Complexity: Easy · 100 points
Repo: Divinity-Labs/Lens. Install with npm ci, typecheck with
npx tsc --noEmit, test with npm test. Tests are vitest, not jest
(running jest reports zero tests and proves nothing).
You cannot reach the production deployment. Everything must be proven with
local tests and fixtures. Do not write a test that needs the live network.
No floating point in new price or amount maths. Prices are stored as
Decimal(36, 18) and amounts as Decimal(36, 7). Do sums in SQL numeric, in
bigint, or on decimal strings. If you must touch existing float code, do not
add more of it.
The price convention is fixed: a stored price means units of assetB per
one unit of assetA, in the order the pair is configured. Every adapter must
follow it.
Generated files are checked byte for byte by CI (the OpenAPI spec, the
README sections, the GraphQL schema file, the TypeScript client schema, and the
Prisma migration baseline). If you change a route, the GraphQL schema or
prisma/schema.prisma, regenerate the generated files and commit them. The
commands are in the scripts section of package.json (openapi:gen,
readme:gen, graphql:schema:gen, client:gen) and in CONTRIBUTING.md. A
schema change also needs a migration and a regenerated baseline: see
docs/database-migrations.md. The database is migrated with
prisma migrate deploy, never db push.
Never shorten or invent a contract id or issuer address. Copy it in full
from the repo. If a venue's id is not in the repo, read it from the venue's
official docs and cite the source in the PR.
No personal data and no secrets in code, fixtures, logs or the PR. A
fixture recorded from a public API must not contain an API key.
Do not weaken a test to make it pass. If an existing test encodes the bug
you are fixing, change the test and say so in the PR.
Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk
- Lingua principale
- TypeScript
- Stelle
- 4
- Fork
- 71
- Merge medio
- 2g 6h
- PR unite (30g)
- 24
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Divinity-Labs/Lens
-
area:database difficulty:easy help wanted points:100 Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Divinity-Labs/Lens#688 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
`/price/:assetA/:assetB/history` turns a bad `limit` into a 500 and an unknown pair into an empty 200Forse già presa @I-frenzy l’ha presa oggi. Apertaarea:api difficulty:easy help wanted points:100 Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
Divinity-Labs/Lens#664 ·
I maintainer di solito rispondono entro 3 giorni
-
area:reliability difficulty:easy help wanted points:100 Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Divinity-Labs/Lens#663 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
`/status?network=mainnet` is rate limited although `/status` is exemptForse già presa @Joyful12-tech l’ha presa 1 giorno fa. Apertaarea:reliability difficulty:easy help wanted points:100 Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Divinity-Labs/Lens#662 ·
I maintainer di solito rispondono entro 3 giorni
-
Webhook retries have no jitter, so failures synchroniseForse già presa @Richard-tobi l’ha presa 35 giorni fa. Apertaarea:reliability difficulty:easy help wanted points:100 Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
Divinity-Labs/Lens#341 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di Divinity-Labs/Lens
Issue simili
-
CLI OAuth login fails behind an authenticating proxy: GET /api/v1/user omits Proxy-AuthorizationAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
lightdash/lightdash#33086 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[功能请求] 设置选项语言调整Aperta功能请求
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
antithesishq/bombadil#473 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ardia-browser/ardia#3291 ·
I maintainer di solito rispondono entro 1 giorno
-
The structured output reference promises null results for refusals that carry validation detailsApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno