forked from cosmos/ibc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move header sync to block and create symlink in specs (cosmos#1251)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. --> ## Overview Closes: cosmos#1249 Also, fixes `markdown-lint` CI checks. <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. --> ## Checklist <!-- Please complete the checklist to ensure that the PR is ready to be reviewed. IMPORTANT: PRs should be left in Draft until the below checklist is completed. --> - [ ] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [ ] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords Co-authored-by: Ganesha Upadhyaya <ganeshrvce@gmail.com>
- Loading branch information
1 parent
5819a12
commit 1c915cf
Showing
2 changed files
with
57 additions
and
56 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Header Sync | ||
|
||
## Abstract | ||
|
||
The nodes in the P2P network sync headers using the header sync service that implements the [go-header][go-header] interface. The header sync service consists of several components as listed below. | ||
|
||
|Component|Description| | ||
|---|---| | ||
|store| a `headerEx` prefixed [datastore][datastore] where synced headers are stored| | ||
|subscriber | a [libp2p][libp2p] node pubsub subscriber| | ||
|P2P server| a server for handling header requests between peers in the P2P network| | ||
|exchange| a client that enables sending in/out-bound header requests from/to the P2P network| | ||
|syncer| a service for efficient synchronization for headers. When a P2P node falls behind and wants to catch up to the latest network head via P2P network, it can use the syncer.| | ||
|
||
## Details | ||
|
||
All three types of nodes (sequencer, full, and light) run the header sync service to maintain the cannonical view of the rollup chain (with respect to the P2P network). | ||
|
||
The header sync service inherits the `ConnectionGater` from the node's P2P client which enables blocking and allowing peers as needed by specifying the `P2PConfig.BlockedPeers` and `P2PConfig.AllowedPeers`. | ||
|
||
`NodeConfig.BlockTime` is used to configure the syncer such that it can effectively decide the outdated headers while it receives headers from the P2P network. | ||
|
||
Both header and block sync utilizes [go-header][go-header] library and runs two separate sync services, for the headers and blocks. This distinction is mainly to serve light nodes which do not store blocks, but only headers synced from the P2P network. | ||
|
||
### Consumption of Header Sync | ||
|
||
The sequencer node, upon successfully creating the block, publishes the signed block header to the P2P network using the header sync service. The full/light nodes run the header sync service in the background to receive and store the signed headers from the P2P network. Currently the full/light nodes do not consume the P2P synced headers, however they have future utilities in performing certain checks. | ||
|
||
## Assumptions | ||
|
||
* The header sync store is created by prefixing `headerSync` the main datastore. | ||
* The genesis `ChainID` is used to create the `PubsubTopicID` in [go-header][go-header]. For example, for ChainID `gm`, the pubsub topic id is `/gm/header-sub/v0.0.1`. Refer to go-header specs for further details. | ||
* The header store must be initialized with genesis header before starting the syncer service. The genesis header can be loaded by passing the genesis header hash via `NodeConfig.TrustedHash` configuration parameter or by querying the P2P network. This imposes a time constraint that full/light nodes have to wait for the sequencer to publish the genesis header to the P2P network before starting the header sync service. | ||
* The Header Sync works only when the node is connected to the P2P network by specifying the initial seeds to connect to via the `P2PConfig.Seeds` configuration parameter. | ||
* The node's context is passed down to all the components of the P2P header sync to control shutting down the service either abruptly (in case of failure) or gracefully (during successful scenarios). | ||
|
||
## Implementation | ||
|
||
The header sync implementation can be found in [node/header_sync.go][header sync]. The full and light nodes create and start the header sync service under [full][fullnode] and [light][lightnode]. | ||
|
||
## References | ||
|
||
[1] [Header Sync][header sync] | ||
|
||
[2] [Full Node][fullnode] | ||
|
||
[3] [Light Node][lightnode] | ||
|
||
[4] [go-header][go-header] | ||
|
||
[header sync]: https://github.com/rollkit/rollkit/blob/main/block/header_sync.go | ||
[fullnode]: https://github.com/rollkit/rollkit/blob/main/node/full.go | ||
[lightnode]: https://github.com/rollkit/rollkit/blob/main/node/light.go | ||
[go-header]: https://github.com/celestiaorg/go-header | ||
[libp2p]: https://github.com/libp2p/go-libp2p | ||
[datastore]: https://github.com/ipfs/go-datastore |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../block/header-sync.md |