Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates referral fee types #10963

Merged
merged 6 commits into from
Feb 13, 2025
Merged

Conversation

Rotorsoft
Copy link
Contributor

Link to Issue

Closes: #10951

Description of Changes

  • Changes numeric types from float to decimal(78,0) per standard
  • Avoids conversions in the backend
  • Fixes queries to convert from decimal to js number

Other Considerations

  • UI should do the conversion

Copy link
Contributor

@rbennettcw rbennettcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with all said.

Another perspective on this (since I just spent a week working on fractional vote weight support in UI): the client should always receive WEI in string representation.

The backend should either pass to client as a string, or (if calculations are required), parse as BigInt then pass to client as string. That way, no precision is lost during deserialization.

The problem with double precision in the query is that it parses the value as Number (float) on the backend, which immediately loses precision.

JS floats lose precision after ~16 decimals at first, then the bigger the number gets, the more precision is lost in the decimals. WEI numbers can get pretty big (1 million ERC20 is usually 10^24 WEI), so it's a real issue now that we render fractional vote weights in the UI.

@Rotorsoft Rotorsoft merged commit 5a704c1 into master Feb 13, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change fees data type from double to bigint
3 participants