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

Implement parachain inherents #2566

Merged
merged 125 commits into from
Oct 7, 2022

Conversation

kishansagathiya
Copy link
Contributor

@kishansagathiya kishansagathiya commented May 23, 2022

Changes

  • Implements parachn0 inherent

Tests

go test -tags integration github.com/ChainSafe/gossamer

Issues

Fixes #2426

Primary Reviewer

@timwu20

Copy link
Contributor

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

It looks like many exported types got added to lib/babe.
Are you sure we really do need those types? I would suggest just relying on variable names to reduce complexity. At the very least, these types should be unexported since they are not used outside the babe package.

dot/types/inherents.go Outdated Show resolved Hide resolved
dot/types/inherents.go Outdated Show resolved Hide resolved
dot/types/inherents.go Outdated Show resolved Hide resolved
lib/babe/build.go Outdated Show resolved Hide resolved
lib/babe/build.go Outdated Show resolved Hide resolved
lib/runtime/wasmer/imports.go Outdated Show resolved Hide resolved
lib/runtime/wasmer/imports.go Outdated Show resolved Hide resolved
lib/runtime/wasmer/imports.go Outdated Show resolved Hide resolved
lib/babe/build.go Outdated Show resolved Hide resolved
lib/babe/build.go Outdated Show resolved Hide resolved
dot/types/inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
lib/babe/parachain_inherents.go Outdated Show resolved Hide resolved
@timwu20
Copy link
Contributor

timwu20 commented Sep 29, 2022

@timwu20 When you try to scale encode a struct, its private (not exported) field can be read by our scale package. I observed this with InherentsData struct which has data unexported. With that in mind, does it make sense to keep things exported in parachain inherents struct?
@qdm12

That's interesting. Most Go codecs usually don't have access to unexported fields, should we do the same thing @timwu20 ? Or is there a use case where we need access to unexported fields?

That's how they implemented InherentData in substrate. They manually encode it, and the trait ensures that the type that you are using can be scale encoded.

dot/types/inherents.go Outdated Show resolved Hide resolved
dot/types/inherents.go Show resolved Hide resolved
pkg/scale/encode.go Outdated Show resolved Hide resolved
lib/babe/build.go Show resolved Hide resolved
@kishansagathiya kishansagathiya merged commit 14dda74 into development Oct 7, 2022
@kishansagathiya kishansagathiya deleted the kishan/feat/parachain-inherents branch October 7, 2022 15:32
EclesioMeloJunior pushed a commit that referenced this pull request Oct 12, 2022
- Added support for parachain inherent and newheads
- Improved inherentsData's encode function
- Made inherent identifers enums
- Common setInherent function
@github-actions
Copy link

🎉 This PR is included in version 0.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

Implement Parachain Inherents
4 participants