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

audit(erc20): state machine audit #547

Merged
merged 6 commits into from
May 3, 2022
Merged

Conversation

danburck
Copy link
Contributor

@danburck danburck commented May 3, 2022

Description

This PR adds minor improvements from performing a state machine audit on the x/erc20 module:

  • improved comments
  • moved evm relevant helper methods to evm.go
  • updated specs

Open questions:

  • are the migrations necessary?

Future improvements

  • Toggle token pair: Should we revert the token transfer through the hook if a token pair is disabled?
  • Add tests make sure that if ConvertERC20 is called, that the Hook doesn't trigger

@linear
Copy link

linear bot commented May 3, 2022

@github-actions github-actions bot added the docs label May 3, 2022
@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #547 (8f91db5) into main (4da7c8d) will decrease coverage by 0.06%.
The diff coverage is 77.85%.

❗ Current head 8f91db5 differs from pull request most recent head 2ea056b. Consider uploading reports for the commit 2ea056b to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #547      +/-   ##
==========================================
- Coverage   81.64%   81.57%   -0.07%     
==========================================
  Files         115      115              
  Lines        6275     6318      +43     
==========================================
+ Hits         5123     5154      +31     
- Misses        997     1009      +12     
  Partials      155      155              
Impacted Files Coverage Δ
x/erc20/keeper/evm.go 67.97% <66.66%> (-0.30%) ⬇️
x/erc20/keeper/msg_server.go 77.94% <66.66%> (+0.04%) ⬆️
x/erc20/keeper/proposals.go 87.67% <83.01%> (+1.67%) ⬆️
x/erc20/keeper/mint.go 87.17% <85.00%> (-1.29%) ⬇️
x/erc20/keeper/evm_hooks.go 88.60% <100.00%> (-0.29%) ⬇️

@danburck danburck changed the title ENG 218 erc20 state machine audit audit(erc20): state machine audit May 3, 2022
@danburck danburck marked this pull request as ready for review May 3, 2022 15:13
@danburck danburck requested a review from hanchon as a code owner May 3, 2022 15:13
@fedekunze
Copy link
Contributor

fedekunze commented May 3, 2022

are the migrations necessary?

No, because we don't need to migrate the state

Toggle token pair: Should we revert the token transfer through the hook if a token pair is disabled?

I think just disabling the transfers is enough. If we reverted then it would disable and affect all ERC20 transfers for that contract

Copy link
Contributor

@fedekunze fedekunze 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 enabled auto-merge (squash) May 3, 2022 15:19
@fedekunze fedekunze merged commit 21a717e into main May 3, 2022
@fedekunze fedekunze deleted the ENG-218-erc20-state-machine-audit branch May 3, 2022 15:23
loredanacirstea added a commit to loredanacirstea/evmos that referenced this pull request May 6, 2022
* loredana/ENG-214-add-epoch-types: (40 commits)
  Update evmos v3 -> v4 after latest changes
  Add year and hour epochs
  Update evmos v3 -> v4 after latest changes
  uncomment check
  feat: Inbound / outbound peers & default seeds (evmos#541)
  upgrade: Update Evmos go.mod version `v3` -> `v4` (evmos#557)
  Add change log
  Add migration logic for epoch change
  Fix epochs unit tests
  Revert to ascending order
  Store epoch information by duration and by identifier
  audit(erc20): add types tests and update comments (evmos#550)
  [ENG-219] bump erc20 test coverage (evmos#546)
  audit(erc20): state machine audit (evmos#547)
  audit(erc20): Changes from api audit (evmos#544)
  imp: update default min-gas-prices (evmos#543)
  imp: use constants for epochs IDs (evmos#539)
  fix: upgrade client router key (evmos#537)
  impr(`inflation`): Rename total supply endpoint (evmos#536)
  fix: `buf protoc` was moved to `buf alpha protoc` (evmos#462)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants