-
Notifications
You must be signed in to change notification settings - Fork 81
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
Prevent subtraction underflow in CrossContractCall #888
Merged
aleksuss
merged 4 commits into
aurora-is-near:develop
from
guidovranken:fix-callback_count-underflow
Jan 19, 2024
Merged
Prevent subtraction underflow in CrossContractCall #888
aleksuss
merged 4 commits into
aurora-is-near:develop
from
guidovranken:fix-callback_count-underflow
Jan 19, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
birchmd
approved these changes
Jan 9, 2024
aleksuss
approved these changes
Jan 10, 2024
Probably this PR should be merged after #885. |
aleksuss
added a commit
that referenced
this pull request
Feb 6, 2024
<!-- Thanks for submitting a pull request! Here are some helpful tips: * Always create branches on and target the `develop` branch. * Run all the tests locally and ensure that they are passing. * Run `make format` to ensure that the code is formatted. * Run `make check` to ensure that all checks passed successfully. * Small commits and contributions that attempt one single goal is preferable. * If the idea changes or adds anything functional which will affect users, an AIP discussion is required first on the Aurora forum: https://forum.aurora.dev/discussions/AIPs%20(Aurora%20Improvement%20Proposals). * Avoid breaking the public API (namely in engine/src/lib.rs) unless required. * If your PR is a WIP, ensure that you enable "draft" mode. * Your first PRs won't use the CI automatically unless a maintainer starts. If this is not your first PR, please do NOT abuse the CI resources. Checklist: - [ ] I have performed a self-review of my code - [ ] I have documented my code, particularly in the hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] I have added tests to prove my fix or new feature is effective and works - [ ] Any dependent changes have been merged - [ ] The PR is targeting the `develop` branch and not `master` - [ ] I have pre-squashed my commits into a single commit and rebased. --> ## Description `call.promise_count()` can be 0, in which case `call.promise_count() - 1` causes a subtraction underflow: https://github.com/aurora-is-near/aurora-engine/blob/1213f2c7c035aa523601fced8f75bef61b4728ab/engine-precompiles/src/xcc.rs#L141 This PR makes the function return to caller with an error if (and only if) this is the case. ## Performance / NEAR gas cost considerations ## Testing Fuzzing. ## How should this be reviewed ## Additional information --------- Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev> Co-authored-by: Michael Birch <michael.birch@aurora.dev>
Merged
aleksuss
added a commit
that referenced
this pull request
Feb 6, 2024
## 3.6.0 2024-02-06 ### Fixes - Fixed underflow in the modexp gas calculation by [@guidovranken]. ([#883]) - Prevented subtraction underflow in th xcc module by [@guidovranken]. ([#888]) - Fixed balance and gas overflows in the xcc module by [@guidovranken]. ([#889]) ### Changes - CI was updated by changing self-hosted runner to the GitHub heavy by [@aleksuss]. ([#881]) - Removed a logic of fee calculation in the eth-connector by [@karim-en]. ([#882]) - Version of the rust nightly was updated to 2023-12-15 by [@RomanHodulak]. ([#885]) [#881]: #881 [#882]: #882 [#883]: #883 [#885]: #885 [#888]: #888 [#889]: #889 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Guido Vranken <guidovranken@users.noreply.github.com> Co-authored-by: Karim <karim@aurora.dev> Co-authored-by: Roman Hodulák <roman.hodulak@aurora.dev> Co-authored-by: Michael Birch <birchmd8@gmail.com> Co-authored-by: Michael Birch <michael.birch@aurora.dev> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
call.promise_count()
can be 0, in which casecall.promise_count() - 1
causes a subtraction underflow:aurora-engine/engine-precompiles/src/xcc.rs
Line 141 in 1213f2c
This PR makes the function return to caller with an error if (and only if) this is the case.
Performance / NEAR gas cost considerations
Testing
Fuzzing.
How should this be reviewed
Additional information