telosnetwork / telos-decide

Telos Decide is a Governance Engine for the Telos Blockchain Network.
https://docs.telos.net/developers/services/telos-decide
MIT License
29 stars 24 forks source link

Claiming worker rewards does not work as expected #14

Open villesundell opened 4 years ago

villesundell commented 4 years ago

Describe the bug Currently anyone can help anyone by claiming their worker rewards. This is a good feature, and is a good smart contract design convention (do not place unneeded restrains).

However, if the account is a new one, claiming would not be successful, since it tries to use claimant's RAM, which is not available if the action caller is not claimant.

Expected behavior Either: 1) Only claimant can claim their rewards Or: 2) Error should be raised Or: 3) RAM ownership should be re-thought

Additional context Problematic line is this: https://github.com/telosnetwork/telos-decide/blob/b17261e830d2549dfc54e0f9a0e5eb357e5c8a95/contracts/decide/src/worker.cpp#L152

DouglasHorn commented 3 years ago

Of these options, #2, Raising an error message for not enough RAM is probably the easiest and a sufficient fix. There are times when an account would want to claim for another.