-
Notifications
You must be signed in to change notification settings - Fork 94
fix(ics20): correct balance accounting issue with test coverage #219
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(ics20): correct balance accounting issue with test coverage #219
Conversation
- Make gas limit configurable for testing lower gas limit scenario - Get ibctesting.AppCreator when create coordinator, so other applications can leverage this test suits. - Make GenerateContractCallArgs as separate function. This doens't have to be a member method of TxFactory implementation. un-necessary dependency. - SendEvmTx now supports contract creation.
Previous ibc test suite uses different bond denom ("stake) with EVM denom ("aatom"). Even though it could be different technically, but we need to make sure everything works correctly with default config (bond denom == evm denom). Wit this commit, we can make sure IBC and ICS20 transfers with default config should work well. Updated test util for writing test cases more easily.
Currently, Arguments.Copy in geth panics if there are type mismatch. Returning error instead makes more sense
|
||
// Run Ginkgo integration tests | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Distribution Precompile Suite") |
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.
This name should be changed
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.
Applied in 496af19
return len(code) > 0 | ||
} | ||
|
||
_ = Describe("Calling ICS20 precompile", func() { |
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.
Rename this to Calling ICS20 Precompile from callerContract.
We'll eventually need to add EOA calls to tests as well
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.
Applied in 496af19
Description
This PR fixes a bug in the ICS20 precompile where the balance delta reflected in the stateDB did not correctly account for the adjusted amount when the input transfer amount was set to
UnboundedSpendLimit
.In such cases, the actual amount transferred is reduced to the sender’s spendable balance by the IBC transfer module internally, but the precompile logic still emitted balance change entries based on the original (unbounded) value. This could lead to inconsistencies between the Cosmos bank state and the EVM stateDB.
Fix Summary
The ics20 precompile now mirrors the same adjustment logic
so that
SetBalanceChangeEntries
correctly reflects the actual transferred amount.Test Covergage Improvements
In addition to the fix, this PR significantly improves the test coverage of the ICS20 precompile
Ensured test environment uses a consistent configuration with the same denom for both staking and EVM (
bond_denom == evm_denom
) to avoid confusion in test assumptions and better align with default settings.Test Utility Enhancements
GenerateContractCallArgs
as a standalone function to remove unnecessary dependency coupling from TxFactory.SendEvmTx
to support contract creation and configurable gas limits, enabling more flexible test case writing (e.g., low gas limit failure cases).Closes: #199 #221
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
main
branchReviewers Checklist
All items are required.
Please add a note if the item is not applicable
and please add your handle next to the items reviewed
if you only reviewed selected items.
I have...
Unreleased
section inCHANGELOG.md