Skip to content
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

imp(erc20: Emit additional approval event in case of transferFrom #2088

Merged
merged 5 commits into from Nov 28, 2023

Conversation

MalteHerrmann
Copy link
Contributor

Description

This PR aligns our ERC20 EVM extension further with the Solidity implementations by emitting an additional approval event in case of a transferFrom transaction.

@MalteHerrmann MalteHerrmann requested a review from a team as a code owner November 27, 2023 17:33
@MalteHerrmann MalteHerrmann requested review from facs95 and GAtom22 and removed request for a team November 27, 2023 17:33
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Merging #2088 (b6722fc) into main (97307ca) will increase coverage by 0.07%.
Report is 1 commits behind head on main.
The diff coverage is 43.75%.

❗ Current head b6722fc differs from pull request most recent head a9167f7. Consider uploading reports for the commit a9167f7 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2088      +/-   ##
==========================================
+ Coverage   70.14%   70.22%   +0.07%     
==========================================
  Files         339      353      +14     
  Lines       25499    25931     +432     
==========================================
+ Hits        17887    18209     +322     
- Misses       6675     6776     +101     
- Partials      937      946       +9     
Files Coverage Δ
precompiles/erc20/tx.go 72.54% <43.75%> (-12.07%) ⬇️

... and 17 files with indirect coverage changes

precompiles/erc20/tx.go Show resolved Hide resolved
Copy link
Contributor

@Vvaradinov Vvaradinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

precompiles/erc20/tx.go Outdated Show resolved Hide resolved
precompiles/erc20/tx.go Show resolved Hide resolved
Copy link
Contributor

@0xstepit 0xstepit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@fedekunze fedekunze merged commit a54c84e into main Nov 28, 2023
23 of 26 checks passed
@fedekunze fedekunze deleted the malte/emit-additional-approve-event-in-transfer branch November 28, 2023 11:51
Comment on lines +430 to 434
// FIXME: This is not working for the case where we transfer from the own account
// because the allowance is not removed on the SDK side.
is.ExpectNoSendAuthzForContract(
callType, contractsData,
owner.Addr, owner.Addr,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The case where we transferFrom the owner address will not be possible to fully support without adjusting our Cosmos SDK fork, since in Cosmos it's not supported to create authorizations for the same account. This is possible in ERC20s though.

However, the current alignment leads to the shown problem in this test - once set up through the EVM extension, the allowance is not reduced because in tx.go we use p.AuthzKeeper.DispatchActions(...). In that function, the case where granter == grantee is being skipped:

https://github.com/evmos/cosmos-sdk/blob/v0.47.5-evmos/x/authz/keeper/keeper.go#L97-L133

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.

None yet

4 participants