-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pallets where there is no deposit charged for filling up the storage #2196
Comments
Working group leaders have their stake locked. And it could be slashed any time by a council. |
It seems the most practical way would be to something like
Now this object just grows to become big, within the given thread size bound, and the cleanup is constant time operation. SRlabs pointed out that even quite large reads/writes have negligible impact on benchmark, if any.
|
Correct! |
Isn't it still risky to have the storage filled up for a long time until a council member is alerted of this problem?
However, it could be abused as long as the proposal is not executed or rejected and for some proposals I believe that could be a long time especially if it's pending constitution. |
For the working group to prevent some user to apply multiple times we could check that the account hasn't applied for the same opening already. |
Proposed mitigations(For non-lead problems):
|
In terms of how this should be implemented, I suggest the same pattern as @shamil-gadelshin is using in the bounty module: a module specific account. |
The drawback of using that model seems to be that adding or updating a post requires to read/write the whole thread and as we talked about how much that impacts performance when a thread grows in size requires careful evaluation.
Maybe we could burn it? Since we don't need to incentivize the deletion of the thread because that's done automatically when a proposal decision is reached.
But since everything that is changed in the blog is done through proposals it already requires stakes to prevent any kind of spam and also it goes through the voting process. |
FYI: PostById from the |
No it is the same, I asked Shawn about this.
Lets get some numbers for that asap then, because this will impact many modules going forward. |
As it turns out the existential deposit might be too low, even lower than than the transaction fee which might be insufficient to prevent an attack from filling up the storage. As a solution we could add a fixed amount of tokens to be burned from the staking account candidate when storing it. |
Working group
|
Fixing this issue will result in adding several new "deposits value" settings. What if we start binding new prices to some well-known constant (let's say CENTS that we already have)? We could easily update all the prices changing only a single constant, and won't lose tuning flexibility for individual setting (price). We could start with new values and then gradually migrate the rest of the system. The only downside I can see - we lose "pretty values" using the automatic calculation (it's a minor issue, and we could fix it using a simple rounding function). @bedeho @conectado |
This sounds good, to fine tune each individual setting we would have different multiplier for each deposit? One downside from this approach is that you can't adjust the value for the weight to fee constant(assuming it depends on the value of CENTS) without changing the value of the deposits but this could be a desired property since those values should be related. |
Yes, you are correct. |
To check the viability of this model I created #2234 to benchmark DB weights to see what changes we should or shouldn't make to the weight function to account for the bigger storage size for a thread record.
Since there's no need to incentivize the deletion of a thread we can burn the deposit. |
We decided to solve both of these problem by requiring both extrinsics to have a minimum stake. This way we can use that stake as an anti-spam mechanism and as an incentive to cleanup working group's openings or membership's staking account candidates. The council, for the sake of simplicity, won't have a lock, we trust that since a council member that wants to abuse the |
Proposal Discussion & Forum pallet posts
In #2234 analyzed the cost of saving a big object such as having a This means that if we do this we should add certain complexity to the weight functions of those extrinsics(or in general) to take that into account, the different ways we could do that are discussed in the ticket. We decided to use another way to deal with the problems in The model we decided to use is the following:
We expect that:
|
Fixed. |
Problem
It was found during the audit that any forum user can use the forum's extrinsic
create_thread
to fill up the blockchain storage and exhaust the number of threads of a given category for a small fee since this requires no deposit.This problem exists in two forms across the runtime: Either we allow with no deposit filling up the storage of a given module with no bound or with bounds.
In the bounded case, this would allow a denial of service attack where other users won't be able to use the storage.
In the unbounded case, this'd allow to grow the storage maliciously.
There are different permission levels that'd allow a user to abuse these extrinsics, either a lead or a worker/member.
When a lead can fill up a bounded storage is not really a problem because there is no other user that it can be denied of service but I leave those cases in here just to keep them in mind.
Pallets
forum
create_thread
: Any forum user can create a thread, the thread storage for a given category is bounded.add_post
: Any forum user can create a post, the post storage for a given thread is bounded.create_category
: The lead can create categories with no cost, the category storage is bounded. (Same goes for sub-categories)working_group
add_opening
: A lead can use this extrinsic to create openings unbounded.apply_on_opening
: A working group member can apply multiple times, filling blockchain storage(when no stakes) unbounded.add_opening
+apply_on_opening
+fill_opening
: A lead can add an opening with no stakes, apply on it multiple times and fill it, and occupy completely the worker storage.membership
add_staking_account_candidate
: A user could use multiple accounts to fill up the blockchain storage, unbounded.proposals_discussion
add_post
: A member can add posts to any thread, unbounded.storage/data_directory
add_content
: A member can use it to fill up the storage unbounded.content_directory
add_curator_group
: A lead can add groups to fill up the storage unbounded.add_curator_to_group
: A lead can add curators to a group to fill it up bounded.service_discovery
:set_ipns_id
: Any worker can use it to fill up storage unbounded.data_object_type_registry
register_data_object_type
: A lead can use it to fill up storage unbounded.The text was updated successfully, but these errors were encountered: