Skip to content

Core: an approval that also sends coins is reviewed as a contract call - #1622

Closed
gemcoder21 wants to merge 1 commit into
mainfrom
security/approval-with-native-value
Closed

gemcoder21 wants to merge 1 commit into
mainfrom
security/approval-with-native-value

Conversation

@gemcoder21

Copy link
Copy Markdown
Contributor

A dapp transaction whose calldata is an ERC-20 approve or increaseAllowance, or a Permit2 approve, can also carry a native value. These calls are now reviewed as what they are, a contract call:

  1. decode_transaction_kind takes the transaction's value. An approval that also sends coins decodes as ContractCall, so the review shows the coins it sends, and the transaction scan checks the called contract instead of only the spender. A value that can't be read counts as sending coins.
  2. The dapp simulation runs the full balance-change simulation for such a call instead of the approval-only path, through the same has_native_value.
  3. WalletConnect Pay passes the value too; it already refuses an approval that sends value, so its behaviour is unchanged.
  4. docs/product/wallet_connector.md gets the matching row.

Both apps get this through Core.

Tests: cargo test -p gem_evm transaction (31 passed, new test_decode_approval_with_native_value), -p gem_wallet_connect (80 passed, new test_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.

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.
@gemcoder21

Copy link
Copy Markdown
Contributor Author

Superseded by #1631.

@gemcoder21 gemcoder21 closed this Oct 22, 2026
@gemcoder21
gemcoder21 deleted the security/approval-with-native-value branch October 22, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant