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

feat(prospective-parachains): Implement FragmentChain #4337

Open
wants to merge 36 commits into
base: feat/parachain
Choose a base branch
from

Conversation

EclesioMeloJunior
Copy link
Member

Changes

  • Implements Fragment Chain a data structure used by prospective-parachains subsystems in order to keep the best backable chain of parachain blocks
  • The goal is to always choose the best candidate to back on-chain

Tests

Tests coverage from Polkadot-SDK

go test -timeout 10m github.com/ChainSafe/gossamer/dot/parachain/prospective-parachains/fragment-chain

Issues

Copy link
Contributor

@haikoschol haikoschol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some types, nits & questions

dot/parachain/util/.DS_Store Outdated Show resolved Hide resolved
dot/parachain/types/async_backing.go Outdated Show resolved Hide resolved
Copy link
Contributor

@axaysagathiya axaysagathiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a lot of unused/unnecessary methods. Can you please remove unused/unnecessary methods?
Also if you need some logic only in test please consider creating test helper function.

Copy link
Contributor

@jimjbrettj jimjbrettj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@@ -17,3 +22,90 @@ type AsyncBackingParams struct {
// When async backing is disabled, the only valid value is 0.
AllowedAncestryLen uint32 `scale:"2"`
}

// InboundHrmpLimitations constraints on inbound HRMP channels.
type InboundHrmpLimitations struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use this and the below code in any subsystem other than the prospective parachain subsystem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we only use in prospective-parachains pkg, however since this types are a representation of what the runtime uses to validate the constraints I think placing them here is the better approach, given that they are in the same level as CandidateHash, PersistedValidationData

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this package, we keep all the types that are used in multiple subsystems.

CandidateHashm and PersistedValidationData are the types we use in multiple subsystems.
As I can see In Rust implementation, the InboundHrmpLimitations type is only being used in prospective parachain.
Please move this to prospective parachain package

dot/parachain/types/types.go Show resolved Hide resolved
dot/parachain/types/types.go Outdated Show resolved Hide resolved
dot/parachain/prospective-parachains/errors.go Outdated Show resolved Hide resolved
dot/parachain/types/async_backing.go Show resolved Hide resolved
@@ -17,3 +22,90 @@ type AsyncBackingParams struct {
// When async backing is disabled, the only valid value is 0.
AllowedAncestryLen uint32 `scale:"2"`
}

// InboundHrmpLimitations constraints on inbound HRMP channels.
type InboundHrmpLimitations struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this package, we keep all the types that are used in multiple subsystems.

CandidateHashm and PersistedValidationData are the types we use in multiple subsystems.
As I can see In Rust implementation, the InboundHrmpLimitations type is only being used in prospective parachain.
Please move this to prospective parachain package

dot/parachain/types/types.go Outdated Show resolved Hide resolved
dot/parachain/prospective-parachains/errors.go Outdated Show resolved Hide resolved
Copy link
Contributor

@axaysagathiya axaysagathiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes.
You can merge after addressing the comments.


// UpgradeRestriction a possible restriction that prevents a parachain
// from performing an upgrade
type UpgradeRestriction struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write the unit test to ensure we are getting the correct encoding/decoding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address that in another PR under issue #4416, which means that this PR is blocked by that issue

dot/parachain/prospective-parachains/fragment_chain.go Outdated Show resolved Hide resolved
dot/parachain/prospective-parachains/fragment_chain.go Outdated Show resolved Hide resolved
dot/parachain/prospective-parachains/fragment_chain.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants