-
Notifications
You must be signed in to change notification settings - Fork 81
feat: Add recovery pallet in runtime. #1105
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
Open
nakul1010
wants to merge
3
commits into
master
Choose a base branch
from
nakul/feat_recovery_pallet
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
178 changes: 178 additions & 0 deletions
178
parachain/runtime/interlay/src/weights/pallet_recovery.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
|
|
||
| //! Autogenerated weights for `pallet_recovery` | ||
| //! | ||
| //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev | ||
| //! DATE: 2023-06-26, STEPS: `50`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
| //! WORST CASE MAP SIZE: `1000000` | ||
| //! HOSTNAME: `Nakul`, CPU: `<UNKNOWN>` | ||
| //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("interlay-dev"), DB CACHE: 1024 | ||
|
|
||
| // Executed Command: | ||
| // ./target/release/interbtc-parachain | ||
| // benchmark | ||
| // pallet | ||
| // --pallet | ||
| // pallet_recovery | ||
| // --extrinsic | ||
| // * | ||
| // --chain | ||
| // interlay-dev | ||
| // --execution=wasm | ||
| // --wasm-execution=compiled | ||
| // --steps | ||
| // 50 | ||
| // --repeat | ||
| // 10 | ||
| // --output | ||
| // weights.rs | ||
|
|
||
| #![cfg_attr(rustfmt, rustfmt_skip)] | ||
| #![allow(unused_parens)] | ||
| #![allow(unused_imports)] | ||
|
|
||
| use frame_support::{traits::Get, weights::Weight}; | ||
| use sp_std::marker::PhantomData; | ||
|
|
||
| /// Weight functions for `pallet_recovery`. | ||
| pub struct WeightInfo<T>(PhantomData<T>); | ||
| impl<T: frame_system::Config> pallet_recovery::WeightInfo for WeightInfo<T> { | ||
| /// Storage: Recovery Proxy (r:1 w:0) | ||
| /// Proof: Recovery Proxy (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) | ||
| fn as_recovered() -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `111` | ||
| // Estimated: `3545` | ||
| // Minimum execution time: 9_000_000 picoseconds. | ||
| Weight::from_parts(9_000_000, 0) | ||
| .saturating_add(Weight::from_parts(0, 3545)) | ||
| .saturating_add(T::DbWeight::get().reads(1)) | ||
| } | ||
| /// Storage: Recovery Proxy (r:0 w:1) | ||
| /// Proof: Recovery Proxy (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) | ||
| fn set_recovered() -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `0` | ||
| // Estimated: `0` | ||
| // Minimum execution time: 8_000_000 picoseconds. | ||
| Weight::from_parts(9_000_000, 0) | ||
| .saturating_add(Weight::from_parts(0, 0)) | ||
| .saturating_add(T::DbWeight::get().writes(1)) | ||
| } | ||
| /// Storage: Recovery Recoverable (r:1 w:1) | ||
| /// Proof: Recovery Recoverable (max_values: None, max_size: Some(351), added: 2826, mode: MaxEncodedLen) | ||
| /// Storage: Tokens Accounts (r:1 w:1) | ||
| /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) | ||
| /// The range of component `n` is `[1, 9]`. | ||
| fn create_recovery(n: u32, ) -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `334 + n * (27 ±0)` | ||
| // Estimated: `7396` | ||
| // Minimum execution time: 25_000_000 picoseconds. | ||
| Weight::from_parts(25_772_388, 0) | ||
| .saturating_add(Weight::from_parts(0, 7396)) | ||
| // Standard Error: 9_460 | ||
| .saturating_add(Weight::from_parts(112_594, 0).saturating_mul(n.into())) | ||
| .saturating_add(T::DbWeight::get().reads(2)) | ||
| .saturating_add(T::DbWeight::get().writes(2)) | ||
| } | ||
| /// Storage: Recovery Recoverable (r:1 w:0) | ||
| /// Proof: Recovery Recoverable (max_values: None, max_size: Some(351), added: 2826, mode: MaxEncodedLen) | ||
| /// Storage: Recovery ActiveRecoveries (r:1 w:1) | ||
| /// Proof: Recovery ActiveRecoveries (max_values: None, max_size: Some(389), added: 2864, mode: MaxEncodedLen) | ||
| /// Storage: Tokens Accounts (r:1 w:1) | ||
| /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) | ||
| fn initiate_recovery() -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `689` | ||
| // Estimated: `11250` | ||
| // Minimum execution time: 31_000_000 picoseconds. | ||
| Weight::from_parts(32_000_000, 0) | ||
| .saturating_add(Weight::from_parts(0, 11250)) | ||
| .saturating_add(T::DbWeight::get().reads(3)) | ||
| .saturating_add(T::DbWeight::get().writes(2)) | ||
| } | ||
| /// Storage: Recovery Recoverable (r:1 w:0) | ||
| /// Proof: Recovery Recoverable (max_values: None, max_size: Some(351), added: 2826, mode: MaxEncodedLen) | ||
| /// Storage: Recovery ActiveRecoveries (r:1 w:1) | ||
| /// Proof: Recovery ActiveRecoveries (max_values: None, max_size: Some(389), added: 2864, mode: MaxEncodedLen) | ||
| /// The range of component `n` is `[1, 9]`. | ||
| fn vouch_recovery(n: u32, ) -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `190 + n * (64 ±0)` | ||
| // Estimated: `7670` | ||
| // Minimum execution time: 16_000_000 picoseconds. | ||
| Weight::from_parts(17_310_945, 0) | ||
| .saturating_add(Weight::from_parts(0, 7670)) | ||
| // Standard Error: 12_247 | ||
| .saturating_add(Weight::from_parts(76_001, 0).saturating_mul(n.into())) | ||
| .saturating_add(T::DbWeight::get().reads(2)) | ||
| .saturating_add(T::DbWeight::get().writes(1)) | ||
| } | ||
| /// Storage: Recovery Recoverable (r:1 w:0) | ||
| /// Proof: Recovery Recoverable (max_values: None, max_size: Some(351), added: 2826, mode: MaxEncodedLen) | ||
| /// Storage: Recovery ActiveRecoveries (r:1 w:0) | ||
| /// Proof: Recovery ActiveRecoveries (max_values: None, max_size: Some(389), added: 2864, mode: MaxEncodedLen) | ||
| /// Storage: Recovery Proxy (r:1 w:1) | ||
| /// Proof: Recovery Proxy (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) | ||
| /// The range of component `n` is `[1, 9]`. | ||
| fn claim_recovery(n: u32, ) -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `222 + n * (64 ±0)` | ||
| // Estimated: `11215` | ||
| // Minimum execution time: 20_000_000 picoseconds. | ||
| Weight::from_parts(20_687_810, 0) | ||
| .saturating_add(Weight::from_parts(0, 11215)) | ||
| // Standard Error: 8_550 | ||
| .saturating_add(Weight::from_parts(75_150, 0).saturating_mul(n.into())) | ||
| .saturating_add(T::DbWeight::get().reads(3)) | ||
| .saturating_add(T::DbWeight::get().writes(1)) | ||
| } | ||
| /// Storage: Recovery ActiveRecoveries (r:1 w:1) | ||
| /// Proof: Recovery ActiveRecoveries (max_values: None, max_size: Some(389), added: 2864, mode: MaxEncodedLen) | ||
| /// Storage: Tokens Accounts (r:2 w:2) | ||
| /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) | ||
| /// The range of component `n` is `[1, 9]`. | ||
| fn close_recovery(n: u32, ) -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `612 + n * (59 ±0)` | ||
| // Estimated: `10024` | ||
| // Minimum execution time: 40_000_000 picoseconds. | ||
| Weight::from_parts(40_937_810, 0) | ||
| .saturating_add(Weight::from_parts(0, 10024)) | ||
| // Standard Error: 13_523 | ||
| .saturating_add(Weight::from_parts(215_501, 0).saturating_mul(n.into())) | ||
| .saturating_add(T::DbWeight::get().reads(3)) | ||
| .saturating_add(T::DbWeight::get().writes(3)) | ||
| } | ||
| /// Storage: Recovery ActiveRecoveries (r:1 w:0) | ||
| /// Proof: Recovery ActiveRecoveries (max_values: None, max_size: Some(389), added: 2864, mode: MaxEncodedLen) | ||
| /// Storage: Recovery Recoverable (r:1 w:1) | ||
| /// Proof: Recovery Recoverable (max_values: None, max_size: Some(351), added: 2826, mode: MaxEncodedLen) | ||
| /// Storage: Tokens Accounts (r:1 w:1) | ||
| /// Proof: Tokens Accounts (max_values: None, max_size: Some(115), added: 2590, mode: MaxEncodedLen) | ||
| /// The range of component `n` is `[1, 9]`. | ||
| fn remove_recovery(n: u32, ) -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `465 + n * (59 ±0)` | ||
| // Estimated: `11250` | ||
| // Minimum execution time: 27_000_000 picoseconds. | ||
| Weight::from_parts(27_750_621, 0) | ||
| .saturating_add(Weight::from_parts(0, 11250)) | ||
| // Standard Error: 7_853 | ||
| .saturating_add(Weight::from_parts(56_002, 0).saturating_mul(n.into())) | ||
| .saturating_add(T::DbWeight::get().reads(3)) | ||
| .saturating_add(T::DbWeight::get().writes(2)) | ||
| } | ||
| /// Storage: Recovery Proxy (r:1 w:1) | ||
| /// Proof: Recovery Proxy (max_values: None, max_size: Some(80), added: 2555, mode: MaxEncodedLen) | ||
| fn cancel_recovered() -> Weight { | ||
| // Proof Size summary in bytes: | ||
| // Measured: `111` | ||
| // Estimated: `3545` | ||
| // Minimum execution time: 10_000_000 picoseconds. | ||
| Weight::from_parts(10_000_000, 0) | ||
| .saturating_add(Weight::from_parts(0, 3545)) | ||
| .saturating_add(T::DbWeight::get().reads(1)) | ||
| .saturating_add(T::DbWeight::get().writes(1)) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you decide on these parameters?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had taken reference from the frame config set, but after re-reviewing, I suggest setting one of the following configs defined below.
INTR Config based on KSM Config set
Current Market Price
INTR Config based on Dollar, this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Polkadot yet not have added the recovery pallet into the runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't those values very very high? We require 250 vINTR for governance proposals and these would require a lot more INTR to actually use this feature. So only very few people could use this.
What's the downside of setting this to much lower values so that you could set this up with say max 500 INTR?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nud3l, I agree that we can reduce the value of
ConfigDepositBaseto 100 INTR to make it more accessible. However, it is important to keep theRecoveryDepositat a sufficiently high level. This is because theRecoveryDepositamount is refunded if the recovery process is successful.If we set the
RecoveryDepositvalue too low, there is a risk that a malicious rescuer could attempt to recover the account, and if the account holder cancels the recovery process, the malicious rescuer would only lose a minimal amount due to the lowRecoveryDepositvalue.It's worth noting that the
RecoveryDepositonly needs to be reserved if the account recovery process is on and not when setting up the account recovery.