Skip to content

Fetch block range from the network and archive to S3 #4105

@aaronbuchwald

Description

@aaronbuchwald

Implement a simple tool using the p2p network to fetch block range(s) from the network and archive them to S3.

Utilize the AvalancheGo p2p network directly to fetch blocks using the GetAncestors

icm-services provides an example of hooking into the p2p network here: https://github.com/ava-labs/icm-services/blob/ced17fde82783d31a249a0a58b39acd4315dfa03/peers/app_request_network.go#L109.

Since GetAncestors requires a blockID input and fetches from there, we need multiple checkpoints in order to parallelize. We can do this in a few ways:

  • provide an injected dependency to fetch the blockID at various heights that we assume not to call too frequently
  • use PullQuery / Chits request/response and leverage requestedHeight and preferredIDAtHeight + acceptedHeight to fetch the accepted block at a given height from arbitrary nodes (assuming they have the chain history to that point
  • inject the checkpoints in manually

Once we have these checkpoints, we can sync multiple block ranges in parallel using GetAncestors.

Alternatively, we could rely on an existing API service and either handle any rate limiting that occurs or assume that we'll have a required access token to bypass any rate limiting.

The service should gather all of the blocks and insert them into a single leveldb instance with a schema of (height -> block bytes) as used in

func blockKey(height uint64) []byte {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog 🧊

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions