Ogmios: represent 64-bit amounts as bigint with lossless JSON to avoid precision loss
Maintainer thường phản hồi trong vòng 1 ngày
@emmanuel-musau đang làm issue này rồi.
Từ ngày 28/9/2026.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
Hướng nghiên cứu
Bắt đầu trong packages/evolution/src/sdk/provider/internal/Ogmios.ts, tập trung vào các kiểu amount bị ảnh hưởng và toOgmiosUTxOs, sau đó kiểm tra HttpUtils.postJson để xem việc tuần tự hóa request và response. Truy vết đường đi additionalUtxo từ KupmiosEffects.ts và KoiosEffect.ts. Hoàn tất khi trường hợp hồi quy bảo toàn 2^64-1 và 2^53+1 dưới dạng các số JSON chính xác, không có dấu ngoặc kép, và việc phân tích amount đầu vào không bị mất dữ liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The Ogmios provider converts 64-bit Cardano amounts (lovelace and native-token quantities) with Number(...), but a JS number is exact only to 2^53-1. Cardano amounts are uint64, so any value above 2^53 is silently corrupted. Every other provider uses BigInt(...), and the SDK models Coin as Schema.BigInt up to 2^64-1, so this is an inconsistent defect. The corrupted values are sent to Ogmios as the additionalUtxo set during transaction evaluation, producing wrong ex-units/fees and on-chain rejection for transactions involving high-supply tokens. Fail closed: no fund loss, the tx is just rejected.
Affected
packages/evolution/src/sdk/provider/internal/Ogmios.ts: OgmiosAssets type (L128), Value type (L130-132), toOgmiosUTxOs Number(quantity) (L189) and Number(lovelace) (L216), inbound LovelaceAsset schema (L24-26), Delegation rewards/deposit (L118-119)
reached via: KupmiosEffects.ts:380 and KoiosEffect.ts:325 (additionalUtxo for evaluateTransaction)
transport: HttpUtils.postJson (bodyJson -> JSON.stringify on send; response.json -> JSON.parse on receive)
contrast (correct): Koios.ts:292/298, Maestro.ts toBigInt, Blockfrost.ts
Fix
Represent Ogmios amounts as bigint end to end (OgmiosAssets -> Record<string, Record<string, bigint>>, Value.ada.lovelace -> bigint, drop Number(...) in toOgmiosUTxOs).
Important: Ogmios encodes amounts as UNQUOTED JSON numbers (per the Ogmios v6 API, e.g. { "ada": { "lovelace": 1234 } }), so:
- on send, a bigint cannot go through JSON.stringify; emit it as a bare JSON numeric literal via a lossless serializer (json-bigint style or a replacer that splices the integer), not as a quoted string (Ogmios will reject a string).
- on receive, response.json uses standard JSON.parse which truncates above 2^53 before the schema, so any inbound amount field that can exceed 2^53 needs a big-int-aware parser, not just a BigInt schema. (The evaluate response is only ex-units, which are small, so the live issue is the send path; fix the receive path too for correctness on amount-bearing Ogmios queries.)
Regression test
- given: a UTxO with token quantity 2^64-1 and lovelace 2^53+1, run toOgmiosUTxOs([utxo]) and serialize the additionalUtxo body the same way the request does
- before fix: amounts are corrupted (2^64-1 -> 18446744073709552000, 2^53+1 -> 2^53)
- after fix: the serialized payload contains the exact integers as unquoted JSON numbers, round-tripping unchanged
Must FAIL on main today and PASS after the fix.
Reference
GHSA-mrqw-3c7x-96mg
- Ngôn ngữ chính
- TypeScript
- Star
- 22
- Fork
- 33
- Merge trung bình
- 2 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 41
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của IntersectMBO/evolution-sdk
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
IntersectMBO/evolution-sdk#601 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
IntersectMBO/evolution-sdk#559 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
IntersectMBO/evolution-sdk#557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
IntersectMBO/evolution-sdk#541 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug external-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
IntersectMBO/evolution-sdk#530 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của IntersectMBO/evolution-sdk
Issue tương tự
-
[Bug]: [MCP/CLI] Bare loopback IP addresses (127.0.0.1:port) and hosts with ports fail to navigate due to erroneous scheme inferenceCó thể đã có người làm @alok-108 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/playwright#43263 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug priority:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
lingdojo/kana-dojo#32018 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
paperclipai/paperclip#15751 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
BuilderIO/agent-native#7275 ·
Maintainer thường phản hồi trong vòng 1 ngày