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

add the Precision Loss part in staking guide #338

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/bnb-smart-chain/staking/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ function claimBatch(address[] calldata operatorAddresses, uint256[] calldata req
- `operatorAddress`: The operator addresses of the validators.
- `requestNumber`: The numbers of unbonding requests to claim from the validators.

## Precision Loss
During the conversion process between credit tokens and BNB, it is inevitably encounter the usage of integer division,
which may results in a precision loss. It can lead to tangible issues. For example, a user who delegates 1 BNB and then
decides to undelegate immediately. Due to the aforementioned precision loss, they will only be able to claim back 0.99..99 BNB,
which is essentially 1 minus a tiny fraction (1e-18) of BNB.

In staking pools like Lido and Rocket Pool, users might encounter similar issues.
However, these issues can be effectively addressed through thoughtful product design.
For instance, when displaying information to users, rounding up to only preserve eight decimal places could be one solution.
Or instead of undelegating, users can exchange their credit tokens for BNB, with the exact conversion results prominently displayed.

## FAQs

### What is validator's credit contract?
Expand Down
Loading