-
Notifications
You must be signed in to change notification settings - Fork 242
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
Domain registry for domains v2 #1614
Conversation
3745fbb
to
285919d
Compare
// TODO: initialize the genesis block in the domain block tree once we can drive the | ||
// genesis ER from genesis config through host function |
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.
Same as genesis_block_hash
, the genesis ER is initialized on the instantiation, not the genesis block.
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.
The genesis block here is referring to the block in the block tree, not the actual domain block.
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's obviously confusing, I know the confusion essentially comes from the block tree though 🤷♂️
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.
Will do another round in a bit. Overall make sense.
Please leave stake related things with a TODO and I'll those gaps in my PR.
285919d
to
21c06d8
Compare
This PR was rebased regarding to a lot of renaming and resolving conflicts with the main branch. |
21c06d8
to
ea2257f
Compare
These items will be used in later commit Signed-off-by: linning <[email protected]>
Required by upcoming changes, also considered changing DomainId to a type alias of u32, will be great to have some feedbacks Signed-off-by: linning <[email protected]>
Signed-off-by: linning <[email protected]>
Signed-off-by: linning <[email protected]>
ea2257f
to
e0eed54
Compare
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.
Some nits and suggestions but overall make sense!
Also noticed that there are no tests for this. Please add tests
#[derive(TypeInfo, Debug, Encode, Decode, Clone, PartialEq, Eq)] | ||
pub struct DomainConfig { | ||
/// A user defined name for this domain, should be a human-readable UTF-8 encoded string. | ||
pub domain_name: Vec<u8>, |
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.
Isn't there a BoundedVec for this purpose ?
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.
No, the domain_name
is constructed by the user not by the runtime, thus we still need to check it manually, and after the domain is instantiated, domain_name
is not supposed to change.
crates/pallet-domains/src/lib.rs
Outdated
@@ -211,6 +266,10 @@ mod pallet { | |||
DomainRuntimeUpgraded { | |||
runtime_id: RuntimeId, | |||
}, | |||
DomainInstantiated { | |||
domain_id: DomainId, | |||
runtime_id: RuntimeId, |
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.
not sure if the runtime_id
is useful here as this is part of the domain object, no ?
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.
Runtime event is used to send notifications about changes or conditions in the runtime to external entities like users, chain explorers, or dApps. I think runtime_id
is important info about the domain instance that is worth delivery (just like runtime_type
in DomainRuntimeCreated
event).
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.
Not sure I agree here. Events should signal that domain was created with a specific DomainId. Rest of the information should be fetched from the state as required. If we add runtime_id
then we should add runtime_type
as well as just runtime_id
is useless by itself since users or chain explorers or dapps will have to make state call to fetch that information.
IMO, events should hold as minimum details as possible but still points to bigger information on the state
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.
Okay, I don't have strong opinion here, the runtime_id
is removed now PTAL.
Signed-off-by: linning <[email protected]>
Signed-off-by: linning <[email protected]>
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.
A few nits, otherwise lgtm.
// TODO: initialize the genesis block in the domain block tree once we can drive the | ||
// genesis ER from genesis config through host function |
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's obviously confusing, I know the confusion essentially comes from the block tree though 🤷♂️
type DomainInstantiationDeposit: Get<BalanceOf<Self>>; | ||
|
||
/// The currency trait. | ||
type Currency: LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>; |
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 just realize that we shouldn't continue using LockableCurrency
as it has been deprecated since paritytech/substrate#12951. Now that we're starting the domains from scratch, better not use the deprecated interfaces from day one. Non-blocker, can be resolved in another PR after. cc @vedhavyas
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.
Okay, will resolve it in my upcoming PR.
Signed-off-by: linning <[email protected]>
#close #1591
This PR implements Domain registry as described in the V2 Domains spec
There are some TODOs left regarding to #1612.
Code contributor checklist: