Skip to content

Commit

Permalink
try fixing links
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Dec 8, 2023
1 parent 390e75f commit 9bd3962
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions specs/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,36 @@ Welcome to the go-header specifications.

go-header is a library for syncing blockchain data, such as block headers, over the P2P network in a trust-minimized way. It contains services for requesting and receiving headers from the P2P network, serving header requests from other nodes in the P2P network, storing headers, and syncing historical headers in case of fallbacks.

|Component|Description|
|---|---|
|[Subscriber](specs/p2p.md#subscriber)|listens for new headers from the P2P network|
|[ExchangeServer](specs/p2p.md#exchange-server)|serve header requests from other nodes in the P2P network|
|[Exchange](specs/p2p.md#exchange-client)|client that requests headers from other nodes in the P2P network|
|[Store](specs/store.md)|storing headers and making them available for access by other services such as exchange and syncer|
|[Syncer](specs/sync.md)|syncing of historical and new headers from the P2P network|
| Component | Description |
|----------------------------------|----------------------------------------------------------------------------------------------------|
| [Subscriber][Subscriber] | listens for new headers from the P2P network |
| [ExchangeServer][ExchangeServer] | serve header requests from other nodes in the P2P network |
| [Exchange][Exchange] | client that requests headers from other nodes in the P2P network |
| [Store][Store] | storing headers and making them available for access by other services such as exchange and syncer |
| [Syncer][Syncer] | syncing of historical and new headers from the P2P network |

The go-header library defines a clear interface (as described in the table below) for consumption. Any blockchain data implementing this interface can utilize go-header's P2P services. An example is defined in [headertest/dummy_header.go][dummy header]

|Method|Input|Output|Description|
|--|--|--|--|
| New | | H | New creates new instance of a header. |
| IsZero | | bool | IsZero reports whether Header is a zero value of it's concrete type. |
| ChainID | | string | ChainID returns identifier of the chain. |
| Hash | | Hash | Hash returns hash of a header. |
| Height | | uint64 | Height returns the height of a header. |
| LastHeader | | Hash | LastHeader returns the hash of last header before this header (aka. previous header hash). |
| Time | | time.Time | Time returns time when header was created. |
| Verify | H | error | Verify validates given untrusted Header against trusted Header. |
| Validate | | error | Validate performs stateless validation to check for missed/incorrect fields. |
| MarshalBinary | | []byte, error| MarshalBinary encodes the receiver into a binary form and returns the result. |
| UnmarshalBinary | []byte | error | UnmarshalBinary must be able to decode the form generated by MarshalBinary. UnmarshalBinary must copy the data if it wishes to retain the data after returning.|
| Method | Input | Output | Description |
|-----------------|--------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| New | | H | New creates new instance of a header. |
| IsZero | | bool | IsZero reports whether Header is a zero value of it's concrete type. |
| ChainID | | string | ChainID returns identifier of the chain. |
| Hash | | Hash | Hash returns hash of a header. |
| Height | | uint64 | Height returns the height of a header. |
| LastHeader | | Hash | LastHeader returns the hash of last header before this header (aka. previous header hash). |
| Time | | time.Time | Time returns time when header was created. |
| Verify | H | error | Verify validates given untrusted Header against trusted Header. |
| Validate | | error | Validate performs stateless validation to check for missed/incorrect fields. |
| MarshalBinary | | []byte, error | MarshalBinary encodes the receiver into a binary form and returns the result. |
| UnmarshalBinary | []byte | error | UnmarshalBinary must be able to decode the form generated by MarshalBinary. UnmarshalBinary must copy the data if it wishes to retain the data after returning. |

# References

[1] [Dummy Header][dummy header]
[1] [Dummy Header][https://github.com/celestiaorg/go-header/blob/main/headertest/dummy_header.go]

[dummy header]: https://github.com/celestiaorg/go-header/blob/main/headertest/dummy_header.go
[Subscriber]: ../../p2p/p2p.md#subscriber
[ExchangeServer]: ../../p2p/p2p.md#exchange-server
[Exchange]: ../../p2p/p2p.md#exchange-client
[Store]: ../../store/store.md
[Syncer]: ../../sync/sync.md

0 comments on commit 9bd3962

Please sign in to comment.