Skip to content
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

Weights, fees and storage bloat #660

Open
10 of 18 tasks
sander2 opened this issue Jul 1, 2022 · 2 comments
Open
10 of 18 tasks

Weights, fees and storage bloat #660

sander2 opened this issue Jul 1, 2022 · 2 comments

Comments

@sander2
Copy link
Member

sander2 commented Jul 1, 2022

We need to improve our weights and fees, as well as how we handle storage bloat. We need to do this to prevent DoS attacks. This includes:

  • Charging for storage. A lot of calls add items to storage but we don't charge based on size
  • We need to remove old state when it becomes irrelevant
  • We need to implement existential deposits
    • Perhaps also for vaults - vaults that have almost no collateral can be removed
  • We need to parametrize the weights of functions better so that we address their actual complexity (instead of using a fixed value)
  • We need to re-run the benchmarks on a machine that represent the typical node hardware
  • Functions that need to improve their weight determination include all functions that deal with bitcoin transactions. We might want to use pre-parsed structs rather than raw bytes to make that easier.
  • We need to address unbounded iteration in e.g. execute_issue
  • We should re-evaluate the amount we charge per byte in the extrinsic
  • We should re-evaluate how we determine xcm fees
  • Some of our dependencies use configurable weights. We currently use the default but we may want to override them
  • Pallets should not use #[pallet::without_storage_info]. See my stackoverflow question
    • All storage items should implement MaxEncodedLen
  • We should start using dispatch classes. See https://docs.substrate.io/build/tx-weights-fees/
  • Attach #[pallet::whitelist_storage] to storage items that are read every block
  • Look into base weight
  • External pallets that we should reconsider config of:
    • pallet_transaction_payment
@gregdhill gregdhill modified the milestone: Interlay De-Fi Hub Apr 28, 2023
@sander2
Copy link
Member Author

sander2 commented Jun 21, 2023

From SR-labs:

Extrinsics with missing storage deposits/fees could clutter the blockchain storage

Summary

Storage deposit fees are missing for multiple crates: example btc-relay, clients-info and democracy. An attacker could clutter the storage by calling extrinsics that save data into the blockchain database multiple times. A similar issue was also reported on the previous audit about missing storage deposits.

Issue details

The following extrinsic are affected:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Development 🏗️
Development

No branches or pull requests

2 participants