sei-protocol / sei-chain

Apache License 2.0
2.67k stars 797 forks source link

Validate pointer version set by gov #1696

Closed codchen closed 1 month ago

codchen commented 1 month ago

Describe your changes and provide context

Before we make pointer contract address stable, we want no pointer upgrade to happen. However if someone registers a contract via gov with a version number lower than the current version and then run a regular pointer deployment, they will upgrade the gov-deployed contract. This PR restricts the version being passed by the gov proposal to be at least as large as the current version. We may remove this restriction once the stable address change is in and upgrades become allowed.

Testing performed to validate your change

unit test

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 60.73%. Comparing base (382b11f) to head (7c80e85).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1696/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/1696?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 #1696 +/- ## ========================================== + Coverage 60.70% 60.73% +0.02% ========================================== Files 368 368 Lines 26958 26973 +15 ========================================== + Hits 16364 16381 +17 + Misses 9482 9478 -4 - Partials 1112 1114 +2 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1696?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/gov.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1696?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) | `100.00% <100.00%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1696/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)