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

Only emit cosmos events if no error in precompiles #1744

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

codchen
Copy link
Collaborator

@codchen codchen commented Jun 24, 2024

Describe your changes and provide context

Although we recently made a change to mark EVM txs that encountered as failed on cosmos level, so that events emit by any cosmwasm contract as part of the EVM tx won't be persisted, this does not prevent similar issue from happening if the cosmwasm call error is caught and handled by the invoking solidity contract. In such cases, events from the failed CW call would still emit, which is not desired. The impact of this depends on whether there is any application depending on CW events for mission-critical flows, which is unclear right now.

UPDATE: in order to have this treatment for all modules, not just wasm, this PR included a rather large refactor to precompiles so that common logic (like the event logic introduced by this PR) can go into a base class. No behavioral change is expected from this refactor, so existing tests should still hold (aside from necessary field/struct name changes)

Testing performed to validate your change

unit tests

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 77.48691% with 43 lines in your changes missing coverage. Please review.

Project coverage is 60.88%. Comparing base (4f2d742) to head (382466f).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1744      +/-   ##
==========================================
+ Coverage   60.63%   60.88%   +0.24%     
==========================================
  Files         372      372              
  Lines       27024    26838     -186     
==========================================
- Hits        16386    16339      -47     
+ Misses       9539     9406     -133     
+ Partials     1099     1093       -6     
Files Coverage Δ
precompiles/gov/gov.go 60.71% <100.00%> (-1.06%) ⬇️
precompiles/staking/staking.go 63.11% <100.00%> (-0.46%) ⬇️
precompiles/bank/bank.go 58.00% <94.11%> (-2.63%) ⬇️
precompiles/distribution/distribution.go 79.61% <92.85%> (+6.52%) ⬆️
precompiles/wasmd/wasmd.go 60.49% <93.33%> (-2.13%) ⬇️
precompiles/json/json.go 47.36% <77.77%> (+3.33%) ⬆️
precompiles/pointer/pointer.go 32.01% <77.77%> (-1.62%) ⬇️
precompiles/pointerview/pointerview.go 50.00% <77.77%> (+1.42%) ⬆️
precompiles/ibc/ibc.go 46.86% <76.92%> (+1.51%) ⬆️
precompiles/oracle/oracle.go 62.50% <66.66%> (+7.32%) ⬆️
... and 1 more

... and 2 files with indirect coverage changes

@codchen codchen changed the title Only emit cosmwasm events if no error Only emit cosmos events if no error in precompiles Jun 24, 2024
@codchen codchen force-pushed the partial-rollback-events branch from c11fdb4 to ef80495 Compare June 24, 2024 09:54
@codchen codchen force-pushed the partial-rollback-events branch from 5212893 to 382466f Compare June 25, 2024 14:26
@codchen codchen merged commit b28413d into main Jun 25, 2024
50 checks passed
@codchen codchen deleted the partial-rollback-events branch June 25, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants