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

Incorrect Deposit value displayed - Parathread registration #10668

Closed
DrW3RK opened this issue Jun 14, 2024 · 6 comments · Fixed by #10671
Closed

Incorrect Deposit value displayed - Parathread registration #10668

DrW3RK opened this issue Jun 14, 2024 · 6 comments · Fixed by #10671

Comments

@DrW3RK
Copy link
Contributor

DrW3RK commented Jun 14, 2024

Due to the issue discussed here paritytech/polkadot-sdk#2372 the deposit needed defaults to MAX_CODE_SIZE paritytech/polkadot-sdk#3020

The fee for this transaction is hefty, with around 5 KSM and 40 DOT simply lost because the UI shows a lower value. More info here https://substrate.stackexchange.com/questions/11588/how-to-calculate-required-reserved-deposit-to-register-a-parachain-on-kusama-w

image
@TarikGul
Copy link
Member

This is the current code that calculates the "reserve deposit":

  const reservedDeposit = useMemo(
    () => (api.consts.registrar.paraDeposit as BalanceOf)
      .add((api.consts.registrar.dataDepositPerByte as BalanceOf).muln(wasm ? wasm.length : 0))
      .iadd((api.consts.registrar.dataDepositPerByte as BalanceOf).muln(genesisState ? genesisState.length : 0)),
    [api, wasm, genesisState]
  );

Also can be seen here. So If I am understand this correctly, we can replace all this logic with just MAX_CODE_SIZE?

@DrW3RK
Copy link
Contributor Author

DrW3RK commented Jun 14, 2024

That is correct.

@TarikGul
Copy link
Member

Okay, cool thanks for the input, will get this adjusted!

@DrW3RK
Copy link
Contributor Author

DrW3RK commented Jun 14, 2024

On a closer look, the MAX_CODE_SIZE applies only to wasm. The genesis state length can vary. https://github.com/paritytech/polkadot-sdk/blob/ae0b3bf6733e7b9e18badb16128a6b25bef1923b/polkadot/runtime/common/src/paras_registrar/mod.rs#L682

@TarikGul
Copy link
Member

Ahh okay so we're just replacing the wasm.length! Thanks

@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jun 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants