Skip to content

Implement parachain inherents#2566

Merged
kishansagathiya merged 125 commits intodevelopmentfrom
kishan/feat/parachain-inherents
Oct 7, 2022
Merged

Implement parachain inherents#2566
kishansagathiya merged 125 commits intodevelopmentfrom
kishan/feat/parachain-inherents

Conversation

@kishansagathiya
Copy link
Copy Markdown
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

@kishansagathiya kishansagathiya marked this pull request as ready for review May 25, 2022 15:26
Copy link
Copy Markdown
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.

Comment thread dot/types/inherents.go Outdated
Comment thread dot/types/inherents.go Outdated
Comment thread dot/types/inherents.go Outdated
Comment thread lib/babe/build.go Outdated
Comment thread lib/babe/build.go Outdated
Comment thread lib/runtime/wasmer/imports.go Outdated
Comment thread lib/runtime/wasmer/imports.go Outdated
Comment thread lib/runtime/wasmer/imports.go Outdated
Comment thread lib/babe/build.go Outdated
Comment thread lib/babe/build.go Outdated
kishansagathiya and others added 7 commits May 30, 2022 14:17
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Comment thread dot/types/inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
Comment thread lib/babe/parachain_inherents.go Outdated
@timwu20
Copy link
Copy Markdown
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.

Comment thread dot/types/inherents.go Outdated
Comment thread dot/types/inherents.go
Comment thread pkg/scale/encode.go Outdated
Comment thread lib/babe/build.go
@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
Copy Markdown

🎉 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