sei-protocol / sei-chain

Apache License 2.0
2.67k stars 797 forks source link

Reuse the same contract address when upgrading ERC->CW pointers #1663

Open codchen opened 1 month ago

codchen commented 1 month ago

Describe your changes and provide context

Previously pointer contract will be assigned a new address when it's upgraded to a new version, which is quite inconvenient to end users and applications. Since pointer contracts themselves are stateless, it is possible to reuse the same address for a new version of code. This PR implements that for the EVM->CW direction pointers. A similar change will be made for CW->EVM pointers

Testing performed to validate your change

unit test

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 61.92893% with 75 lines in your changes missing coverage. Please review.

Project coverage is 61.00%. Comparing base (b28413d) to head (ace530a).

:exclamation: Current head ace530a differs from pull request most recent head 8d0cab1

Please upload reports for the commit 8d0cab1 to get more accurate results.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663/graphs/tree.svg?width=650&height=150&src=pr&token=DG7ZZJ3PVV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) ```diff @@ Coverage Diff @@ ## main #1663 +/- ## ========================================== + Coverage 60.83% 61.00% +0.16% ========================================== Files 372 374 +2 Lines 26838 27537 +699 ========================================== + Hits 16327 16799 +472 - Misses 9419 9577 +158 - Partials 1092 1161 +69 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) | Coverage Δ | | |---|---|---| | [x/evm/keeper/pointer.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&filepath=x%2Fevm%2Fkeeper%2Fpointer.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0va2VlcGVyL3BvaW50ZXIuZ28=) | `80.00% <ø> (-9.64%)` | :arrow_down: | | [x/evm/gov.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&filepath=x%2Fevm%2Fgov.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0vZ292Lmdv) | `38.46% <50.00%> (-10.91%)` | :arrow_down: | | [x/evm/keeper/view.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&filepath=x%2Fevm%2Fkeeper%2Fview.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0va2VlcGVyL3ZpZXcuZ28=) | `71.42% <71.42%> (ø)` | | | [precompiles/pointer/pointer.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&filepath=precompiles%2Fpointer%2Fpointer.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-cHJlY29tcGlsZXMvcG9pbnRlci9wb2ludGVyLmdv) | `37.08% <16.66%> (+5.06%)` | :arrow_up: | | [x/evm/module.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&filepath=x%2Fevm%2Fmodule.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0vbW9kdWxlLmdv) | `52.77% <11.11%> (-3.11%)` | :arrow_down: | | [x/evm/keeper/pointer\_upgrade.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&filepath=x%2Fevm%2Fkeeper%2Fpointer_upgrade.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0va2VlcGVyL3BvaW50ZXJfdXBncmFkZS5nbw==) | `73.97% <73.97%> (ø)` | | | [x/evm/migrations/migrate\_all\_pointers.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663?src=pr&el=tree&filepath=x%2Fevm%2Fmigrations%2Fmigrate_all_pointers.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0vbWlncmF0aW9ucy9taWdyYXRlX2FsbF9wb2ludGVycy5nbw==) | `59.55% <59.55%> (ø)` | | ... and [29 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1663/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)