sei-protocol / sei-chain

Apache License 2.0
2.7k stars 805 forks source link

Translate CW20 events into EVM events in shell receipts #1748

Closed codchen closed 3 months ago

codchen commented 3 months ago

Describe your changes and provide context

Add a post-DeliverTx hook that captures any relevant CW20 event and translate it into a corresponding ERC20 event. If a receipt already exists for that transaction (e.g. an EVM tx that called a CW20 contract via precompile), the translated event will be appended to the existing receipt and the bloom will be updated. Otherwise, a shell receipt will be created.

Testing performed to validate your change

unit tests

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 66.66667% with 58 lines in your changes missing coverage. Please review.

Project coverage is 60.79%. Comparing base (d25456d) to head (077d09f). Report is 4 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748/graphs/tree.svg?width=650&height=150&src=pr&token=DG7ZZJ3PVV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) ```diff @@ Coverage Diff @@ ## main #1748 +/- ## ========================================== - Coverage 60.81% 60.79% -0.03% ========================================== Files 373 374 +1 Lines 27116 27300 +184 ========================================== + Hits 16491 16596 +105 - Misses 9518 9581 +63 - Partials 1107 1123 +16 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) | Coverage Δ | | |---|---|---| | [app/app.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&filepath=app%2Fapp.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-YXBwL2FwcC5nbw==) | `66.08% <100.00%> (-0.16%)` | :arrow_down: | | [x/evm/module.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&filepath=x%2Fevm%2Fmodule.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0vbW9kdWxlLmdv) | `55.55% <100.00%> (-0.33%)` | :arrow_down: | | [x/dex/utils/context.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&filepath=x%2Fdex%2Futils%2Fcontext.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgvdXRpbHMvY29udGV4dC5nbw==) | `0.00% <0.00%> (ø)` | | | [precompiles/wasmd/wasmd.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&filepath=precompiles%2Fwasmd%2Fwasmd.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-cHJlY29tcGlsZXMvd2FzbWQvd2FzbWQuZ28=) | `59.55% <62.50%> (-0.17%)` | :arrow_down: | | [x/evm/keeper/receipt.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&filepath=x%2Fevm%2Fkeeper%2Freceipt.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0va2VlcGVyL3JlY2VpcHQuZ28=) | `50.74% <0.00%> (-9.97%)` | :arrow_down: | | [x/evm/keeper/deferred.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&filepath=x%2Fevm%2Fkeeper%2Fdeferred.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0va2VlcGVyL2RlZmVycmVkLmdv) | `57.89% <7.14%> (ø)` | | | [app/receipt.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748?src=pr&el=tree&filepath=app%2Freceipt.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-YXBwL3JlY2VpcHQuZ28=) | `78.10% <78.10%> (ø)` | | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1748/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)