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

fix(its): validate token manager address from token id #284

Closed
wants to merge 2 commits into from

Conversation

ahramy
Copy link
Contributor

@ahramy ahramy commented Sep 26, 2024

AXE-4705

  • validate token manager address from token id
  • coverage remains the same
----------------------------------------|----------|----------|----------|----------|----------------|
File                                    |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------------------------------------|----------|----------|----------|----------|----------------|
  InterchainTokenFactory.sol            |      100 |      100 |      100 |      100 |                |
  InterchainTokenService.sol            |      100 |      100 |      100 |      100 |                |

@ahramy ahramy requested a review from a team as a code owner September 26, 2024 21:42
@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.70%. Comparing base (b680103) to head (0b790eb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #284   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files          19       19           
  Lines         609      611    +2     
  Branches      125      126    +1     
=======================================
+ Hits          595      597    +2     
  Misses          5        5           
  Partials        9        9           
Flag Coverage Δ
97.70% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Foivos
Copy link
Contributor

Foivos commented Sep 27, 2024

The reason why those checks were not there is because they cost gas, and the call will revert anyway if the TokenManager does not exist. Furthermore, the way you are doing it the tokenManagerAddress is calculated twice, once for the check, and once in the TokenHandler. If we think we need the checks for sanity I would add them in the TokenHandler after the tokenManagerAddress is calculated. This would also avoid codesize bloating the service. If you want to make the check in the service then the tokenManagerAddress should be passed to the TokenHandler instead of the tokenId to avoid recalculating it.

@ahramy
Copy link
Contributor Author

ahramy commented Sep 27, 2024

The reason why those checks were not there is because they cost gas, and the call will revert anyway if the TokenManager does not exist. Furthermore, the way you are doing it the tokenManagerAddress is calculated twice, once for the check, and once in the TokenHandler. If we think we need the checks for sanity I would add them in the TokenHandler after the tokenManagerAddress is calculated. This would also avoid codesize bloating the service. If you want to make the check in the service then the tokenManagerAddress should be passed to the TokenHandler instead of the tokenId to avoid recalculating it.

Had offline discussion with Milap as well, I think we want to have a long-term solution for this. i.e. migration. Hence, closing this issue for now.

@ahramy ahramy closed this Sep 27, 2024
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.

3 participants