-
Notifications
You must be signed in to change notification settings - Fork 94
fix(precompiles): return data for revert #224
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
Merged
vladjdk
merged 20 commits into
cosmos:main
from
cloudgray:fix(precompiles)/return-data-for-revert
Jul 4, 2025
Merged
fix(precompiles): return data for revert #224
vladjdk
merged 20 commits into
cosmos:main
from
cloudgray:fix(precompiles)/return-data-for-revert
Jul 4, 2025
Conversation
This file contains hidden or 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
…rrExecutionReverted
…f audit issue fix
vladjdk
reviewed
Jul 4, 2025
txArgs.Amount = delAmt.BigInt() | ||
txArgs.To = &contractTwoAddr | ||
|
||
reverReasonCheck := execRevertedCheck.WithErrContains( |
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.
nit: revert typo
vladjdk
approved these changes
Jul 4, 2025
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.
This is great, thank you!
9 tasks
Eric-Warehime
pushed a commit
that referenced
this pull request
Jul 17, 2025
commit 43cff363c5b90c9652960da00e62b737681804c2 Author: Kyuhyeon Choi <[email protected]> Date: Fri Jul 11 12:41:09 2025 +0900 test(precmopiles): apply revert reason check This commit is for resolving cherry-pick conflict. commit ec5a79edcc32c211e79ef04220153d60f68a9472 Author: Haber <[email protected]> Date: Sat Jul 5 05:37:53 2025 +0900 fix(precompiles): return data for revert (#224) * fix(vm/keeper): add return data of ApplyMessageWithConfig for ErrExecutionReverted * fix(precompile): modify return data of distribution precompile for revert error * test: remove redundant test case * chore(precompiles/staking): modify description for integration test case * chore: fix lint * fix(precompiles): modify return data of precompiles for revert error * fix: broken test cases after modifying precompile err to revert err * refactor:(precompiles) convert error that precompile.Run returns to ErrExecutionReverted * wip: test(precompiles/staking): fix test cases * chore: compile latest test contracts * fix(precompiles/staking): check revert reason or integration test cases * test(precompiles/staking): fix unit test * test(precompiles/distribution): improve integration test * test(precompiles/erc20): improve integration test * test(precompiles/ics20): improve integration test * test(precompiles/slashing): add slashing integration test for proof of audit issue fix * chore: fix lint * chore: fix lint commit a7cdcc537e0a33f36e8de36f0247bfe3a2a1d9dc Author: Kyuhyeon Choi <[email protected]> Date: Thu Jul 10 19:45:25 2025 +0900 fix(precompiles/common): hex address parsing method commit 5a937ecd545703515993e6af47def0574a398897 Author: Kyuhyeon Choi <[email protected]> Date: Tue Jul 8 09:49:35 2025 +0900 chore: fix lint commit c32a6e5128c592d5fc791fc13733fc52e18553bc Author: Kyuhyeon Choi <[email protected]> Date: Mon Jul 7 23:09:24 2025 +0900 feat(precompiles): add BalanceHandler to handle native balance change (#201) * feat(precompiles): add BalanceHandler to handle native balance change * refactor: remove parts of calling SetBalanceChangeEntries * chore: fix lint * chore(precompiles/distribution): remove unused helper function * chore(precompiles): modify comments * chore: restore modification to be applied later * chore: fix typo * chore: resolve conflict * chore: fix lint * test(precompiles/common) add unit test cases * chore: fix lint * fix(test): precompile test case that intermittently fails * refactor: move mock evm keeper to x/vm/types/mocks * chore: add KVStoreKeys() method to mock evmKeeper * refactoring balance handling * test(precompile/common): improve unit test for balance handler * refactor(precompiles): separate common logic * Revert "refactor(precompiles): separate common logic" This reverts commit 25b89f3. * Revert "Merge pull request #1 from zsystm/poc/precompiles-balance-handler" This reverts commit 46cd527, reversing changes made to b532fd5. --------- Co-Authored-By: zsystm <[email protected]> Co-Authored-By: Vlad J <[email protected]> commit 37e0f9a8cdd362c78d411bc4291e61b64bbc3dbc Author: Haber <[email protected]> Date: Mon Jul 7 10:28:01 2025 +0900 feat(precompiles): add BalanceHandler to handle native balance change (#201) * feat(precompiles): add BalanceHandler to handle native balance change * refactor: remove parts of calling SetBalanceChangeEntries * chore: fix lint * chore(precompiles/distribution): remove unused helper function * chore(precompiles): modify comments * chore: restore modification to be applied later * chore: fix typo * chore: resolve conflict * chore: fix lint * test(precompiles/common) add unit test cases * chore: fix lint * fix(test): precompile test case that intermittently fails * refactor: move mock evm keeper to x/vm/types/mocks * chore: add KVStoreKeys() method to mock evmKeeper * refactoring balance handling * test(precompile/common): improve unit test for balance handler * refactor(precompiles): separate common logic * Revert "refactor(precompiles): separate common logic" This reverts commit 25b89f3. * Revert "Merge pull request #1 from zsystm/poc/precompiles-balance-handler" This reverts commit 46cd527, reversing changes made to b532fd5. --------- Co-authored-by: zsystm <[email protected]> Co-authored-by: Vlad J <[email protected]> commit a5bf7d1f255ab43a28ac19d3348d56f20d3dbe29 Author: Haber <[email protected]> Date: Thu Jun 12 11:17:44 2025 +0900 refactor(precompiles): apply journal-based revert approach (#205) * refactor(precompiles): apply journal-based revert approach * refactor: remove unused Snapshot type * chore: fix lint
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
Problem
Solution
ErrExecutionReverted
as the error."Error(string)"
) as the return data.evm.Interpreter.SetReturnData()
to set that encoded data intoEVMInterpreter.returnData
.ApplyMessageWithConfig
ErrExecutionReverted
, set res.Ret toevm.Interpreter.ReturnData()
.EthereumTxResponse.Ret
returned in step 2, decode it withabi.UnpackRevert
, and print that as the reason.Result
As-Is
To-Be
Now, errors returned by the precompile are returned in the caller contract’s return data, and the test utilities have been updated so that the test code can verify them.
Closes: #223
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
main
branchReviewers Checklist
All items are required.
Please add a note if the item is not applicable
and please add your handle next to the items reviewed
if you only reviewed selected items.
I have...
Unreleased
section inCHANGELOG.md