ChainSafe / ChainSafe/gossamer
Having a single import block entrypoint
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
## Issue summary
- Currently Gossamer has 2 main points where a block is imported, if the block is acquired through the network then we start the importing in the sync package, do the validations, execution and then pass it to `core.HandleBlockImport` to finish the block import handling block consensus messages and applying forced changes if needed. However, if the block was produced by the node the import is partially done in the `babe` package and then passed to `core.HandleProducedBlock`
- What I'm proposing here is to have a single point to handle/import blocks no matter how we acquire them, that way we can add a pipeline of checks and modifications (for example check if epochs were skipped) without repeating the logic in different places.
- In Substrate, this approach is used, also while importing the block is passed a set of parameters that help the import function to configure the import pipeline properly to a given block.
```go
func (...) Import(block *types.Block, importParams *BlockImportParams) error {
...
}
```
Contributor guide
Assessment
This issue has not been assessed yet.