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

refactor(minor-interchain-token-service): change max uint to max bits #760

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cjcobb23
Copy link
Contributor

@cjcobb23 cjcobb23 commented Feb 11, 2025

Todos

need to migrate the existing chain configs

https://axelarnetwork.atlassian.net/browse/AXE-7486

@cjcobb23 cjcobb23 requested a review from a team as a code owner February 11, 2025 19:00
Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 93.35%. Comparing base (1a8a4cc) to head (a1f09b0).

Files with missing lines Patch % Lines
contracts/interchain-token-service/src/contract.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #760      +/-   ##
==========================================
- Coverage   93.36%   93.35%   -0.01%     
==========================================
  Files         225      225              
  Lines       36359    36366       +7     
==========================================
+ Hits        33947    33951       +4     
- Misses       2412     2415       +3     

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

@fish-sammy
Copy link
Collaborator

fish-sammy commented Feb 13, 2025

What's the reason for making this change? Easier to configure?

Ok(res) => res.gt(&Uint256::zero()),
// this overflow error occurs when trying to shift 256 bits or more.
// But this can only happen if max_bits is >= 256, and amount itself is only 256 bits.
// So in this can, amount cannot possibly overflow the max uint of the target chain
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// So in this can, amount cannot possibly overflow the max uint of the target chain
// So in this case, amount cannot possibly overflow the max uint of the target chain

@@ -60,8 +59,8 @@ pub struct ChainConfig {

#[cw_serde]
pub struct TruncationConfig {
pub max_uint: nonempty::Uint256, // The maximum uint value that is supported by the chain's token standard
pub max_decimals_when_truncating: u8, // The maximum number of decimals that is preserved when deploying from a chain with a larger max_uint
pub max_uint_bits: u32, // The maximum number of bits used by the chain to represent unsigned integers
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have a nonempty::u32? zero wouldn't make sense here.

@@ -41,15 +41,15 @@ pub struct ChainConfig {

#[cw_serde]
pub struct TruncationConfig {
pub max_uint: nonempty::Uint256, // The maximum uint value that is supported by the chain's token standard
pub max_decimals_when_truncating: u8, // The maximum number of decimals that is preserved when deploying from a chain with a larger max_uint
pub max_uint_bits: u32, // The maximum number of bits used to represent unsigned integer values that is supported by the chain's token standard
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

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.

2 participants