Repository navigation
Core: an approval that also sends coins is reviewed as a contract call - #1622
Closed
gemcoder21 wants to merge 1 commit into
Closed
gemcoder21 wants to merge 1 commit into
gemcoder21 wants to merge 1 commit into
Conversation
decode_transaction_kind takes the transaction value: an ERC-20 approve or increaseAllowance, or a Permit2 approve, that also sends native coins decodes as a contract call, so the review shows the coins it sends and the transaction scan checks the called contract. The dapp simulation runs the full balance-change simulation for such a call instead of the approval-only path. A value that can't be read counts as sending coins.
Contributor
Author
|
Superseded by #1631. |
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
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.
A dapp transaction whose calldata is an ERC-20
approveorincreaseAllowance, or a Permit2approve, can also carry a nativevalue. These calls are now reviewed as what they are, a contract call:decode_transaction_kindtakes the transaction'svalue. An approval that also sends coins decodes asContractCall, so the review shows the coins it sends, and the transaction scan checks the called contract instead of only the spender. Avaluethat can't be read counts as sending coins.has_native_value.docs/product/wallet_connector.mdgets the matching row.Both apps get this through Core.
Tests:
cargo test -p gem_evm transaction(31 passed, newtest_decode_approval_with_native_value),-p gem_wallet_connect(80 passed, newtest_decode_ethereum_approval_with_value_is_contract_call),-p payment wallet_connect_pay(17 passed),-p gemstone -- simulation scan wallet_connect(81 passed); clippy with the repo's lints and rustfmt are clean.