-
Notifications
You must be signed in to change notification settings - Fork 83
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
fix: avoid attaching values to precompiles #714
Conversation
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.
These changes look fine to me. Though I wonder if this is really needed. The normal EVM precompiles accept ETH (for example ecrecover has 53 ETH on mainnet), so why shouldn't our custom precompiles? I know that this is setting up some guardrails for users to not do something stupid, so it's probably a good thing overall, but it is a little inconsistent.
Anyway, assuming we do want to keep this change then I think it would be good to see integration tests for it as well. Something else to consider: do we want these errors to be Other
or do we want them to be Revert
? This has implications for how the errors get handled by the EVM and by our own infrastructure, which is another reason why I think writing integration tests is important (we will know how the error will manifest in the wild).
I was also quite confused as to why this was flagged in the audit. But, they seemed to make sure that its important enough to add. |
Task linked: CU-863g0gk0p AUR-19 Precompiles Allow Attached Value |
* fix: avoid attaching values to precompiles * fix: use the correct types * fix: lint errors * fix: more clippy errors * fix: more clippy errors
* fix: avoid attaching values to precompiles * fix: use the correct types * fix: lint errors * fix: more clippy errors * fix: more clippy errors
## [2.9.0] 2023-04-05 ### Added - Enabled XCC for mainnet release by [@birchmd]. ([#694]) - Added `set_owner` contract method which sets the owner of the contract by [@hskang9]. ([#690]) - New variant of submit function `submit_with_args` which accepts additional arguments along with the transaction such as the max gas price a user is ready to pay by [@aleksuss]. ([#696]) - Added the ability to create and fund XCC sub-accounts from external NEAR accounts by [@birchmd]. ([#735]) ### Changes - Replaced `rjson` with `serde_json` by [@aleksuss]. ([#677]) - Changed owner intended contract methods to now require owner or the contract itself by [@hskang9]. ([#676]) ### Fixes - Fixed nonce incorrectly being incremented on an out of fund failure by [@joshuajbouw]. ([#671]) - Fixed a check in promise results before executing cross contract calls (XCC) callbacks by [@birchmd]. ([#693]) - Fixed a reachable panic in `receive_erc20_tokens` by [@0x3bfc]. ([#709]) - Fixed a lack of minimum size checks when instantiating a new `EthGas` object by [@lempire123]. ([#722]) - Fixed a lack of division by 0 checks in `EthGas::Div()` by [@lempire123]. ([#718]) - Fixed the validation of the return of `exports:storage_remove` by [@0x3bfc]. ([#712]) - Fixed missing account validations of NEAR account IDs by [@0x3bfc]. ([#703]) - Fixed a reachable panic in the `exitToNear` and `exitToEthereum` precompiles if the input amount is greater than 1^128 when cast from a `U256` to `u128` by [@0x3bfc]. ([#681]) - Fixed a reachable panic in `modExp` due to arithmetic overflow by [@0x3bfc]. ([#688]) - Fixed the ability attaching values to Aurora specific precompiles, this no longer is possible, by [@0x3bfc]. ([#714]) - Fixed a return error if an ecrecover signature length is not exactly 65 by [@0x3bfc]. ([#717]) - Fixed size checks on input array passed to `exitToNear` and `exitToEthereum` precompiles by [@0x3bfc]. ([#684]) - Fixed missing gas costs in `exitToNear` and `exitToEthereum` precompiles by [@lempire123]. ([#687]) - Fixed a reachable panic due to out of memory in the `modExp` precompile by [@0x3bfc]. ([#689]) - Fixed an assurance that the `sender_id` has a balance greater than the amount in `ft_transfer_call` by [@0x3bfc]. ([#708]) - Fixed returning `0x` when a length cannot be cast as `usize` instead of returning an error in the `modExp` precompile by [@birchmd]. ([#737]) - Miscellaneous minor fixes by [@0x3bfc]. ([#738]) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Leandro Casuso Montero <leandro.montero@aurora.dev> Co-authored-by: Michael Birch <michael.birch@aurora.dev> Co-authored-by: Alexey Lapitsky <lex@realisticgroup.com> Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev> Co-authored-by: Alexey Lapitsky <alexey.lapitsky@aurora.dev> Co-authored-by: Hyungsuk Kang <hskang9@gmail.com> Co-authored-by: Ahmed Ali <ahmedaabdulwahed@gmail.com> Co-authored-by: lempire123 <61431140+lempire123@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description
The following precompiles allow attached tokens but will never use them: