Open ureeves opened 3 months ago
IMO, public keys in the Stake contract are always Provisioners. These Provisioners might or might not have an active/eligible Stake and might or might not have some rewards.
Following this reasoning, I'm not sure I would go for different maps.
I'm in favor however of untying the handling of the two fields, but I would keep them tied to the a Provisioners.
In the context of https://github.com/dusk-network/rusk/pull/1930, there was a rather large number of issues identified with the handling of stakes/rewards within the context of the stake contract.
As far as I can see, the issue boiled down to the following:
A "stake" being in the map for a given key does not mean an account is a provisioner. For this to be the case the stake must also have "stake amount". This leads to tremendously confusing handling in the contract, and further consequences for "diffing" the provisioners list.
I welcome discussion on this by @fed-franz and @herr-seppia to find a better way to handle this. My proposal would be to separate stakes from rewards in the contract by putting them into two different maps.