5

The Polkadot runtime has a large number of parameter values that determine how much a user has to lock up as a deposit when creating a state object. The motivation seems to be something like a state-rent, inducing owner to cleanup object at some point in the future to recover the funds. Here is one example

pub const PreimageBaseDeposit: Balance = deposit(2, 64);

https://github.com/paritytech/polkadot/blob/d21399ad3b5a188df37665b72d2d1d48ca5c0e1d/runtime/polkadot/src/lib.rs#L280

All of these places seem to use a utility routine deposit, which looks like this

pub const fn deposit(items: u32, bytes: u32) -> Balance {
    items as Balance * 20 * DOLLARS + (bytes as Balance) * 100 * MILLICENTS
}

https://github.com/paritytech/polkadot/blob/d21399ad3b5a188df37665b72d2d1d48ca5c0e1d/runtime/polkadot/constants/src/lib.rs#L35

where DOLLARS and MILLICENTS are constants for the number of currency units that are approximately worth the corresponding value in USD.

It is however not clear what exactly the rationale is for the form of this deposit function, nor where the magic values 20 and 100 come from.

1 Answer 1

5

This is all about economic security.

Most of the operations that allow a user to consume some state on the blockchain should require a deposit, otherwise that blockchain is vulnerable to all sort of sibyl attacks from the get go.

The typical attack scenario would be, for example, for an attacker to create storage items onchain and bloat the state.

With that, you need to decide on deposits that are high enough such that the cost of an attack is high enough.

How to deduce this exact number is then up to a particular chain, how strict it wants to be in terms of security and deposits for storage items, and even things like the total liquid market cap.

1
  • Appreciate it. I am asking more specifically what the logic of this particular scheme is, lots of parachains use it. Jul 30, 2022 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.