-
Notifications
You must be signed in to change notification settings - Fork 18
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
Parachain support #130
Merged
Merged
Parachain support #130
Conversation
This file contains 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
We now derive serialize and deserialize in no std. This is probably your problem here, as you only implement on std. |
Although I'm not sure _why_ it compiles. It seems like I have the generics to validate_block wrong.
Signed-off-by: muraca <mmuraca247@gmail.com>
Signed-off-by: muraca <mmuraca247@gmail.com>
muraca
requested changes
Nov 28, 2023
JoshOrndorff
commented
Nov 28, 2023
Co-authored-by: Matteo Muraca <56828990+muraca@users.noreply.github.com>
Co-authored-by: Matteo Muraca <56828990+muraca@users.noreply.github.com>
Co-authored-by: Matteo Muraca <56828990+muraca@users.noreply.github.com>
Co-authored-by: Matteo Muraca <56828990+muraca@users.noreply.github.com>
The only dev service is now in the parachain node.
Okay, I've addressed the review. There is a lot left to do here, but this is blocking several other things, and it is working pretty well. I'm going to merge it so other PRs can be resolved and we can get our first parachain milestone complete. |
This was referenced Nov 28, 2023
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is the bulk of the effort to enable parachain support (including template runtime and node and dev service).
Some prerequisites include #100 and #131.
Followups include #144, #146, #147, #149, and eventually even #148.
Parachain Core crate
The core of this PR is the
tuxedo-parachain-core
crate. It is an extention to the pre-existingtuxedo-core
crate that adds types and methods relevant to the parachain protocol.One design goal is that sovereign chain developers should not have to compile any of the heavy Polkadot or Cumulus crates. Therefore the parachain code is in a separate crate. The new crate has a re-export of the
tuxedo-core
crate. This allows parachain developers to depend only ontuxedo-parachain-core
and not risk mis-matching versions.Validate Block function and
register_validate_block!
macro.This PR also contains a working PoC of the
validate_block
function that will be used to validate parachain block on the relay chain validators. While the current implementation is good enough for testing, it still has a few security checks disabled, especially checking timestamp inherent, that need to be properly addressed before it is ready for any serious use.There are some tricks about shared memory involved in the parahcains protocol that do not need to be exposed to parachain runtime developers. For this reason, we wrap the
validate_block
function's implementation that does the unsafe memory operations internally. This is the same in FRAME.Parachain Inherent Piece
Another addition is a Tuxedo piece in the wardrobe called the "parachain piece". This piece is modeled after the timestamp piece and it is responsible for handling the parachain inherent. This piece is atypical in one important way: it has side effects. Specifically, it writes the relay chain parent number to a fixed storage location. The effects are isolated by a clean mutator interface. Still this design is not 100% UTXO native, and better ideas are welcome in followups.
Template Runtime
There is a new feature called
parachain
in thetuxedo-template-runtime
. When this feature is enabled the runtime has the parachain piece andvalidate_block
function included.Parachain Node
This PR is +11k lines of code, and a huge amount of that is in the parachain template node. This node is mostly copied directly from the upstream parachain template node in the SDK repo. This is the same approach we took in the sovereign node.
The only customized aspects are the inherent data providers, and the dev service.
Dev Service
The dev service is a way to test the parachain runtime without a backing relay chain. This is a technique that I invented in Moonbeam in moonbeam-foundation/moonbeam#204, moonbeam-foundation/moonbeam#260, and a few others.
First I built this into the existing sovereign node with a feature called
mock-parachain
. It is working there, but I think it is not that useful, and should probably be removed. Later I decided it made more sense to have the dev service in the parachain node, so it is there also.