fix: distribution precompile 32-byte withdraw address inflates native…#16
fix: distribution precompile 32-byte withdraw address inflates native…#16mattkii wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
11ac5c6 to
a7e1839
Compare
e52c33e to
cc5caea
Compare
cc5caea to
c8f7153
Compare
There was a problem hiding this comment.
Pull request overview
Fixes a native-supply inflation bug in the distribution precompile’s balance mirroring by ensuring only SDK accounts with a bijective 20-byte EVM mapping are mirrored into the EVM StateDB.
Changes:
- Add an
isMirrorableEVMAddressguard to skip mirroring balance events for non-20-byte SDK addresses (preventscommon.BytesToAddresstruncation collisions). - Add a regression test covering the 32-byte address mirroring case.
- Update system/solidity test infrastructure (systemtest helper usage, consensus-timeout defaults, truffle/solc configuration, and a targeted test skip).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/systemtests/upgrade_test.go | Updates systemtest helper invocation for awaiting upgrade height. |
| tests/systemtests/suite/test_suite.go | Ensures ModifyConsensusTimeout uses default node args when none are provided. |
| tests/systemtests/mempool/test_replacement.go | Skips a known-flaky DynamicFeeTx replacement scenario across nodes. |
| tests/systemtests/mempool/test_broadcast.go | Changes per-case setup in tx broadcasting tests (removes prior “no blocks produced” assertion). |
| tests/solidity/suites/opcode/truffle-config.js | Pins solc to a local soljson.js path for deterministic compilation. |
| tests/solidity/suites/opcode/package.json | Adds solc@0.5.17 for the opcode suite. |
| tests/solidity/suites/exception/truffle-config.js | Pins solc to a local soljson.js path. |
| tests/solidity/suites/eip1559/truffle-config.js | Pins solc to a local soljson.js path. |
| tests/solidity/suites/basic/truffle-config.js | Pins solc to a local soljson.js path. |
| tests/solidity/package.json | Adds solc@0.8.18 to the solidity test harness dependencies. |
| precompiles/common/balance_handler.go | Skips mirroring for non-20-byte SDK addresses to prevent truncated-address duplication in EVM state. |
| precompiles/common/balance_handler_test.go | Adds a regression test for skipping 32-byte address mirroring. |
| Makefile | Updates the legacy binary build checkout ref used by system tests. |
| CHANGELOG.md | Documents the bug fix in the changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
203ea0c to
cc72173
Compare
cc72173 to
ceddeaf
Compare
Description
Fixes the distribution-precompile 32-byte withdraw address supply-inflation bug. When a balance event's account is not exactly 20 bytes (e.g. a 32-byte bech32 withdraw, module, or CosmWasm contract account),
common.BytesToAddresstruncates it to the trailing 20 bytes, causing the StateDB commit to mint a duplicate balance and inflate native supply.AfterBalanceChangenow skips mirroring any non-20-byte account (isMirrorableEVMAddressguard) in theCoinSpent,CoinReceived, andFractionalBalanceChangecases, so only bijective SDK↔EVM accounts are mirrored.Most critical to review:
precompiles/common/balance_handler.goAuthor 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...
mainbranch — N/A: targetsfeat/v0.6.0(thev0.6.0-fork.1release lineage kiichain pins); av0.6.0-fork.2tag will follow