[BUG] Precision Loss from Floating Point Math

Đang mở
#71 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

@Rav1Chauhan đang làm issue này rồi.

Từ ngày 24/2/2026.

  • #90 của @Rav1Chauhan — đang mở

Đá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
20/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
blockchain, javascript
Lĩnh vực
fintech-quant, payments

Hướng nghiên cứu

Start with src/helpers.js and inspect calculateBcUsdEquivalent, especially the conversion from large amounts to USD. Reproduce the reported precision loss with a very large amount, such as the 10^18 wei equivalent, and compare the result with the expected precision. Done means currency calculations retain precision until display; an open linked pull request already addresses this issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

[y] I have checked for duplicate issues

Description:
Conversion functions for USD equivalents use native JS parseFloat and multipliers like 1e6. This causes rounding errors for large currency amounts.

How to Reproduce:
Call calculateBcUsdEquivalent with a very large amountFloat (e.g., 10^18 wei equivalent).

Actual Behaviour:
Resulting values lose precision after the 15th significant digit, which is unacceptable for financial software.

Expected Behaviour:
All currency calculations must stay within BigInt or a dedicated library like bignumber.js until the final display stage.

Location: StablePay/djed-sdk/src/helpers.js

[y] I want to work on this issue

Ngôn ngữ chính
JavaScript
Star
16
Fork
29
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của StabilityNexus/StablePay

Tất cả issue của StabilityNexus/StablePay

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.