ojo-network / ojo

Apache License 2.0
53 stars 30 forks source link

Gov prop randomly fails when adding same denoms to accept and mandatory list #257

Open zarazan opened 1 year ago

zarazan commented 1 year ago

Summary of Bug

When passing a governance proposal to add an asset to the mandatory and accept list at the same time there is a random chance (due to the nature of golangs range map implementation) that the validation will hit the MandatoryList first. When this happens the accept list does not contain all denoms in the mandatory list and the gov prop fails. Instead of looping over the keys and using a case statement we could explicitly set the order of validation.

Code location: https://github.com/ojo-network/ojo/blob/main/x/oracle/keeper/msg_server.go#L158-L189

Another possible solution: https://github.com/ojo-network/ojo/issues/256


For Admin Use

zarazan commented 1 year ago

When checking for equality between the accept and mandatory list the exponent IS used. This will make updating a denoms exponent difficult as well.