warden-protocol / wardenprotocol

Monorepo for the Warden Protocol.
https://wardenprotocol.org
Apache License 2.0
1.09k stars 96 forks source link

Index for Space Owners is not updated when an Owner is removed #423

Closed Pitasi closed 5 days ago

Pitasi commented 2 weeks ago

Repro steps:

just localnet

# create space #2
wardend tx warden new-space --from shulgin --yes | wardend q wait-tx 

# add new owner (any address will work)
wardend tx warden new-action add-space-owner --space-id 2 --new-owner warden1khts57dga9qxg0tnpswthzpyrww22v6s2t5daw --yes --from shulgin | wardend q wait-tx

# query spaces by owner, using the new address, you'll get space #2
wardend q warden spaces-by-owner --owner warden1khts57dga9qxg0tnpswthzpyrww22v6s2t5daw

# remove owner
wardend tx warden new-action remove-space-owner --space-id 2 --owner warden1khts57dga9qxg0tnpswthzpyrww22v6s2t5daw --yes --from shulgin | wardend q wait-tx

# query again, you'll still get space #2 even if it's no longer owner
wardend q warden spaces-by-owner --owner warden1khts57dga9qxg0tnpswthzpyrww22v6s2t5daw

the issue lies in this function, that is correctly called by remove-space-owner but doesn't actually remove previous owners: https://github.com/warden-protocol/wardenprotocol/blob/4602930d4efce26b4d7158fa662a4d86a416a065/warden/x/warden/keeper/spaces.go#L55