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(interchain-token-service): use destination max target decimals for scaling #679

Closed
wants to merge 1 commit into from

Conversation

milapsheth
Copy link
Member

Description

Todos

  • Unit tests
  • Manual tests
  • Documentation
  • Connect epics/issues

Steps to Test

Expected Behaviour

Other Notes

@milapsheth milapsheth requested a review from a team as a code owner November 5, 2024 10:21
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 93.53%. Comparing base (d1b9ec6) to head (ea60ced).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...s/interchain-token-service/src/contract/execute.rs 33.33% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #679   +/-   ##
=======================================
  Coverage   93.52%   93.53%           
=======================================
  Files         237      237           
  Lines       35293    35290    -3     
=======================================
- Hits        33009    33007    -2     
+ Misses       2284     2283    -1     

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

@@ -366,7 +364,7 @@ fn destination_token_decimals(
{
source_chain_decimals
} else {
source_chain_config
destination_chain_config
Copy link
Contributor

@cjcobb23 cjcobb23 Nov 5, 2024

Choose a reason for hiding this comment

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

Is this right? I thought the original code was right, where the source chain sets the default rounding value. Though I do think this makes a little more sense, where the destination chain sets the max decimals that it supports.

Do we need a check for the case where the source chain max uint is greater than the destination chain max uint, but the source decimals is less than the destination chain max target decimals? Otherwise, this computation could actually scale the decimals up, if max target decimals is greater than source decimals.

Copy link
Collaborator

@fish-sammy fish-sammy Nov 5, 2024

Choose a reason for hiding this comment

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

How does it make more sense for the Sui config to decide it's OK to lose 12 decimals of ether from Ethereum? When we deploy a chain, we can't possibly know what tokens will be deployed to it and therefore calculate the max_target_decimals to make sense. We do have a rough idea of the tokens we could possibly deploy from that chain.

@@ -366,7 +364,7 @@ fn destination_token_decimals(
{
source_chain_decimals
} else {
source_chain_config
destination_chain_config
Copy link
Collaborator

@fish-sammy fish-sammy Nov 5, 2024

Choose a reason for hiding this comment

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

How does it make more sense for the Sui config to decide it's OK to lose 12 decimals of ether from Ethereum? When we deploy a chain, we can't possibly know what tokens will be deployed to it and therefore calculate the max_target_decimals to make sense. We do have a rough idea of the tokens we could possibly deploy from that chain.

@cjcobb23 cjcobb23 closed this Nov 11, 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