sei-protocol / sei-chain

Apache License 2.0
2.7k stars 805 forks source link

Only send unlocked tokens upon address association #1737

Closed codchen closed 3 months ago

codchen commented 3 months ago

Describe your changes and provide context

It is possible for a cast address to hold locked tokens since anyone (e.g. an attacker) can create vesting account for anyone before the account is first referenced on chain. So when consolidating balances we should only transfer the unlocked part. Any locked tokens under cast addresses will be frozen, since there is no real use case for creating vesting account for cast addresses.

Testing performed to validate your change

unit tests

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 60.66%. Comparing base (e8e4b3b) to head (ac26511). Report is 86 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1737/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/1737?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 #1737 +/- ## ========================================== - Coverage 61.64% 60.66% -0.99% ========================================== Files 365 372 +7 Lines 26178 27024 +846 ========================================== + Hits 16138 16393 +255 - Misses 8967 9532 +565 - Partials 1073 1099 +26 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1737?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/ante/preprocess.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1737?src=pr&el=tree&filepath=x%2Fevm%2Fante%2Fpreprocess.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9ldm0vYW50ZS9wcmVwcm9jZXNzLmdv) | `75.17% <85.71%> (-2.52%)` | :arrow_down: | ... and [39 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1737/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)