sei-chain
sei-chain copied to clipboard
[oak audit] Deposit Rent with new owner claim should not fail
Describe your changes and provide context
Problem: In the ContractDepositRent function, there is logic for a new owner to claim a contract when the contract.RentBalance==0. However, in x/dex/keeper/msgserver/ msg_server_contract_deposit_rent.go:48, the SendCoins operation is executed from the old creatorAddr, not the msg.Sender. Thus, this function will always fail when called by any address which is not the current owner, rendering the claim functionality unusable.
Fix:
- Added a check and change the address to be msg.sender
- Added a unit test
Testing performed to validate your change
Added unit test
| Package | Line Rate | Complexity | Health |
|---|---|---|---|
| github.com/sei-protocol/sei-chain/aclmapping/bank | 83% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/aclmapping/dex | 100% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/aclmapping/oracle | 100% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/aclmapping/staking | 82% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/aclmapping/tokenfactory | 96% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/aclmapping/utils | 0% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/aclmapping/wasm | 83% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/app | 61% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/app/antedecorators | 76% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/oracle/price-feeder/config | 85% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/oracle/price-feeder/oracle | 67% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/oracle/price-feeder/oracle/provider | 49% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/oracle/price-feeder/router/v1 | 45% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/store/whitelist/cachemulti | 100% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/store/whitelist/kv | 100% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/store/whitelist/multi | 100% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/utils | 46% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/utils/datastructures | 90% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/utils/logging | 100% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/dex | 58% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/x/dex/cache | 87% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/dex/client/cli/query | 23% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/dex/contract | 51% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/x/dex/exchange | 94% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/dex/keeper | 63% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/x/dex/keeper/abci | 29% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/dex/keeper/msgserver | 79% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/dex/keeper/query | 82% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/dex/migrations | 88% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/dex/types | 1% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/dex/types/utils | 100% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/dex/types/wasm | 83% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/epoch | 11% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/epoch/keeper | 66% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/x/epoch/types | 2% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/mint | 0% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/mint/keeper | 61% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/x/mint/simulation | 95% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/mint/types | 3% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/nitro/client/cli | 45% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/nitro/keeper | 80% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/nitro/replay | 63% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/x/oracle | 67% | 0 | ➖ |
| github.com/sei-protocol/sei-chain/x/oracle/keeper | 83% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/oracle/simulation | 18% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/oracle/types | 3% | 0 | ❌ |
| github.com/sei-protocol/sei-chain/x/tokenfactory/keeper | 85% | 0 | ✔ |
| github.com/sei-protocol/sei-chain/x/tokenfactory/types | 2% | 0 | ❌ |
| Summary | 15% (5156 / 34223) | 0 | ❌ |