-
Notifications
You must be signed in to change notification settings - Fork 219
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
feat: add overflow checks to change and fee calculations #5834
feat: add overflow checks to change and fee calculations #5834
Conversation
Test Results (Integration tests) 2 files + 2 11 suites +11 23m 29s ⏱️ + 23m 29s For more details on these failures, see this check. Results for commit abdf660. ± Comparison against base commit 1d1332d. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
utACK
base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, a small nit though
base_layer/core/src/transactions/transaction_protocol/transaction_initializer.rs
Outdated
Show resolved
Hide resolved
d1a7416
to
663c40f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually tested that reverting any of the changes will correctly fail a corresponding unit test.
ACK |
ab06732
to
0d77212
Compare
- Added overflow checks to sender transaction protocol. It is possible to crash the system in the change calculation before the transaction is validated; this PR prevents it. - Added an additinal unit test to verify three overflow errors are handled.
0d77212
to
dd63e81
Compare
Description
fn test_sender_transaction_protocol_for_overflow
) to verify three sender transaction protocol overflow errors are handled.fn test_fee_overflow
) to verify the two fee overflow errors are handled.Minotari
andMicroMinotari
string conversion issue (Minotari struct uses floating math in display #5839) for big numbers (with unit test) to allow for the proper error message to be printed in thefn test_fee_overflow
unit test.Motivation and Context
It is possible to crash the system in the change calculation before the transaction is validated; this PR prevents it.
It is possible to crash the system with carefully crafted fees added to transactions and blocks; this PR prevents it.
How Has This Been Tested?
Added additional unit tests.
What process can a PR reviewer use to test or verify this change?
See unit tests and code changes.
Breaking Changes