Joystream / Joystream/audits

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

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

S1 - low
Dominant language
No language data
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

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().

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in runtime-modules/referendum/src/lib.rs at fn vote and inspect the lock_with_reasons call and its withdrawal-reason argument. Confirm the voting stake is restricted from fees, tips, transaction costs, and other withdrawals, then verify the lock uses all withdrawal reasons.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.