ChainSafe / ChainSafe/gossamer
fetch collation
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
### Description
- Retrieves the collation from network
- The collator validator-side subsystem uses a field called `collation_requests` to receive responses from dispatch requests
- The function `request_collation` creates the request and a return channel, the request is sent to network-bridge and the return channel keeps in the `collation_requests` as well as a cancellation token so at any time we can cancel/shutdown the ongoing request.
- The collator validator-side has a field called `collation_fetch_timeouts` that is a unordered future (channel) that is populated when a new request collation is sent and will trigger after `1 second` (MAX_UNSHARED_DOWNLOAD_TIME) to cancel the related ongoing request.
- It supports versioned requests depending on the peer's version we are requesting.
- [ ] Supports cancelation (through `context.Context`)
- [ ] Make sure to start the timeout based on `MAX_UNSHARED_DOWNLOAD_TIME`
- [ ] Supports `request_v2::CollationFetchingRequest` (`{ relay_parent, para_id }`)
- [ ] Supports `request_v1::CollationFetchingRequest` (`{ relay_parent, para_id, candidate_hash }`)
### Approach
Using the same struct that is used by `availability-distribution` with `NewOutgoingRequest`, just need to forward the `request.Result` channel to the subsytem main loop (maybe using a new goroutine)
https://github.com/ChainSafe/gossamer/blob/6d3e72d0b9edd225e2a094f2d89c4cede4d64752/dot/parachain/availability-distribution/fetch_chunk_task.go#L92
### Links
- https://github.com/paritytech/polkadot-sdk/blob/c679ed79a1de575d4c3d5b8878b3e401b024f2f2/polkadot/node/network/collator-protocol/src/validator_side/mod.rs#L578
Contributor guide
Assessment
This issue has not been assessed yet.