Joystream / audits

Repo for organizing & collaborating on audits.
2 stars 0 forks source link

In referendums, the voting stake is only locked for balances transfer #8

Open redzsina opened 3 years ago

redzsina commented 3 years ago

Summary

In runtime-modules/referendum/src/lib.rs, in fn vote the voting stake is only locked for balances transfer, but not for paying fees, tips or transaction costs; enabling users to use up their staked balance for these actions. We suggest to change the limits of the staking lock to WithdrawReasons::all().

Issue description

In runtime-modules/referendum/src/lib.rs, in fn vote the voting stake is only locked for balances transfer, but not for paying fees, tips or transaction costs:

T::StakingHandler::lock_with_reasons(account_id, *stake, WithdrawReason::Transfer.into());

This enables voters to still use the balance locked as a voting stake for paying (system) transaction costs, reserving funds, paying higher-level fees or tips for transaction inclusion.

Risk

Users that participate in voting in referendums could still use their staked balance for paying transaction costs, fees, etc. This undermines the purpose of staking and could encourage users to act dishonestly without punishment.

Mitigation

We suggest to change the limits of the staking lock to WithdrawReasons::all().