-
Notifications
You must be signed in to change notification settings - Fork 51
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
Data Preservers Assignments #563
Conversation
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.
Everything looks good to me so far. Let's start configuring runtimes and migrations for this
.rustfmt.toml
Outdated
max_width = 100 |
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.
Undo?
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 removed imports_granularity = "One"
which requires nightly and is apparently only used by me haha
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.
Yeah sorry for not using it, but I still think it has some value, similar to clippy warnings which we fix once in a while. And if you want to remove it it's better to open a separate PR
|
||
const profileId = await api.query.dataPreservers.nextProfileId(); | ||
txs.push( | ||
api.tx.dataPreservers.createProfile({ |
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.
In all zombienet tests we should use forceCreateProfile
, copy it from test/suites/parathreads/test_tanssi_parathreads.ts
This currently fails if you run
pnpm moonwall test zombie_tanssi_one_node
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.
it depends how we do it though, but in general yes, any batch call executed with sudo should do that
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.
It was only this test that was failing, I fixed it and pushed a commit
runtime/common/src/migrations.rs
Outdated
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.
This file doesn't compile with --features=try-runtime but I believe it's also broken in master, add a
use sp_runtime::DispatchError
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.
yes please! thank you tomasz
pallets/data-preservers/src/lib.rs
Outdated
} | ||
|
||
/// Implementation of `ProfileDeposit` based on the size of the SCALE-encoding. | ||
pub struct BytesProfileDeposit<BaseCost, ByteCost>(PhantomData<(BaseCost, ByteCost)>); |
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.
This is fairly generic ( you only have Profile that requires an encode) I am surprised substrate does not provide anyhting like this alreay. But in any case perhaps this does not belong here but rather somewhere more generic, so that it can be re-used by other pallets. What do you think?
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 found that substrate has something similar: https://github.com/paritytech/polkadot-sdk/blob/b65313e81465dd730e48d4ce00deb76922618375/substrate/frame/support/src/traits/storage.rs#L183
Essentially you can define a FootPrint structure with the count
and len
of profile
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.
We could even consider using HoldConsideration
https://github.com/paritytech/polkadot-sdk/blob/b65313e81465dd730e48d4ce00deb76922618375/substrate/frame/support/src/traits/tokens/fungible/mod.rs#L245
@@ -37,12 +38,14 @@ describeSuite({ | |||
const storedProfile = await polkadotJs.query.dataPreservers.profiles(profileId); | |||
expect(storedProfile.toJSON()).to.be.deep.equal({ | |||
account: general_user_bob.address, | |||
deposit: 10_190_000_000_000, | |||
deposit: 10_200_000_000_000, |
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.
Can we add start_assignemnt and force_start_assignment as well as stop_assignment tets here?
pallets/data-preservers/src/lib.rs
Outdated
@@ -120,22 +146,33 @@ pub mod pallet { | |||
+ Debug | |||
+ Eq | |||
+ CheckedAdd | |||
+ One; | |||
+ One | |||
+ Ord; | |||
|
|||
// Who can call set_boot_nodes? | |||
type SetBootNodesOrigin: EnsureOriginWithArg<Self::RuntimeOrigin, ParaId>; |
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.
Is this still used?
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.
Nice catch, I'll remove it :)
Modifies the pallet to support assignments.
TODO in this PR: