-
Notifications
You must be signed in to change notification settings - Fork 355
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 cw20 ics20 packets #684
Conversation
for (denom, mut state) in states.into_iter() { | ||
// this checks if we have received some coins that are "in flight" and not yet accounted in the state | ||
let Coin { amount, .. } = deps.querier.query_balance(addr, &denom)?; | ||
let diff = state.outstanding - amount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let diff = state.outstanding - amount; | |
let diff = amount - state.outstanding; |
should be: cw-balance > state.outstanding ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This is why I need tests (to panic here), or good reviewers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still missing the handling for cw20 tokens...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9ad5fef but not sure how to test
Closes #662
We change the logic to always be the "v2" style, and no longer add a flag in the packet (which is rejected by the transfer module), but rather migrate current state to new format if possible (for 1 open channel, we can assign all current balance to inflight for this channel).
If there are production versions that have multiple open channels and need migration, please comment here, and we could possibly support that migration in the future (but it is much trickier).
cc: @giansalex
TODO: add a test for the migration code