MSgCreateValidator
and MsgUpdateValidator
race condition
#219
Labels
Cat: base
Related to the basics of a chain (blocks, transactions, etc)
Cat: x/staking
Related to the staking module
Status: WIP
This is currently being worked on
Type: Bug
Something isn't working
Bug description
Currently there is a possible bug while handling
MsgCreateValidator
andMsgUpdateValidator
transactions that is due to a race condition. Suppose that a validator performs the following actions:X
, it sends aMsgCreateValidator
transaction with commission of 10%X+10
, it sends aMsgUpdateValidator
transaction updating other details but not the commission.Suppose also that the
MsgUpdateValidator
is parsed before theMsgCreateValidator
transaction. What would happen is the following:MsgUpdateValidator
and, since the commission is not set, it stores a commission of 0%MsgCreateValidator
with the correct commission, but since the latest commission as a higher height, it is never updated and the correct commission (which should be 10%) is never stored.Expected behavior
The
MsgCreateValidator
should store the correct infos, and theMsgUpdateValidator
should not update the wrong fields.Possible solution
We might investigate whether is worth using some custom values to identify these cases. For example setting a commission of -1 for those validators who have not their commission set yet. Then the
MsgCreateValidator
will update those values accordingly.The text was updated successfully, but these errors were encountered: