-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Stake handler must truncate decimal input #887
Comments
Do we want this to be true for all modules, or just staking. (I.e. should we alter NewRatFromDecimal, or wherever its called in staking) Also what precision would be reasonable, 5 values after the decimal point? |
Yeah I mean this is only really used when parsing input from the CLI or from LCD - I think we can add a new input to the function |
Cool! I'll write a PR for this once unbonding is merged. |
Wait fixing the UI layer doesn't prevent txs with large rationals from verifying. (Since txs could be sent w/o going through the UI) Should size of the rationals also be enforced in the handler, and if so, how should that be done? |
I think this should additionally checked in validate basic for |
This commit sets the maximum number of decimal points that can be passed in from messages. This is enforced on the validate basic of MsgBeginUnbonding and MsgBeginRedelegation. The cli has been updated to truncate the user input to the specified precision. This also updates types/rational to return big ints for Num() and Den(). Closes #887
* x/stake: Limit the size of rationals from user input This commit sets the maximum number of decimal points that can be passed in from messages. This is enforced on the validate basic of MsgBeginUnbonding and MsgBeginRedelegation. The cli has been updated to truncate the user input to the specified precision. This also updates types/rational to return big ints for Num() and Den(). Closes #887 * Switch NewFromDecimal to error instead of truncating
* x/stake: Limit the size of rationals from user input This commit sets the maximum number of decimal points that can be passed in from messages. This is enforced on the validate basic of MsgBeginUnbonding and MsgBeginRedelegation. The cli has been updated to truncate the user input to the specified precision. This also updates types/rational to return big ints for Num() and Den(). Closes #887 * Switch NewFromDecimal to error instead of truncating
To ensure that a transaction can't pass in huge rational values (and cause slow math, generally slowing down the blockchain) we must truncate the decimal-string value which comes in with transactions to the stake handler
The text was updated successfully, but these errors were encountered: