-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add sf.firehose.v2.EndpointInfo/Info endpoint and logic #60
Conversation
Testing like this:
with firecore running like this:
It should work with or without the |
…ore without setting the 'base/extended/hybrid' feature
CHANGELOG.md
Outdated
* Add a well-known list of chains (hard-coded in `wellknown/chains.go` to help automatically determine the 'advertise' flag values) | ||
* The new info endpoint adds a mandatory fetching of the first streamable block on startup, with a failure if no block can be fetched after 3 minutes and you are running `firehose` or `substreams-tier1` service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also talk about how a well-known chain is determined, what checks we perform to infer it.
firehose/info/endpoint_info.go
Outdated
for { | ||
if ctx.Err() != nil { | ||
return nil | ||
} | ||
|
||
block, err := bstream.FetchBlockFromMergedBlocksStore(ctx, blockNum, mergedBlocksStore) | ||
if err != nil { | ||
continue | ||
} | ||
return block | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would require a sleep too, if something is severly broken and FetchBlockFromMergedBlocksStore
return rapidly an error, this might burn CPUs.
firehose/info/endpoint_info.go
Outdated
block, err := bstream.FetchBlockFromOneBlockStore(ctx, blockNum, "", oneBlockStore) | ||
if err != nil { | ||
continue | ||
} | ||
return block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for sleep
well-known/chains.go
Outdated
} | ||
|
||
type Chain struct { | ||
Name string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the canonical network ID of The Graph? If yes, we should document the field.
|
||
type Chain struct { | ||
Name string | ||
Aliases []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Aliases []string | ||
// Genesis block here is actually the "lowest possible" first streamable block through firehose blocks. | ||
// In most cases, it matches the "genesis block" of the chain. | ||
GenesisBlockID string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document expected format, which I think it's chain specific. Probably good to document how to retrieve it too, so PR are easy to submit.
Add
sf.firehose.v2.EndpointInfo/Info
service on Firehose and Substreams endpoints. This involves the following new flags:advertise-chain-name
Canonical name of the chain, from the list here: https://thegraph.com/docs/en/developing/supported-networks/ (required)advertise-chain-aliases
Alternate names for that chain (optional)advertise-block-features
Only required for ethereum blocks, automatically discovered if run fromfirehose-ethereum
programadvertise-block-id-encoding
Required, one of [BLOCK_ID_ENCODING_BASE58, BLOCK_ID_ENCODING_BASE64, BLOCK_ID_ENCODING_HEX, BLOCK_ID_ENCODING_0X_HEX]The new info endpoint adds a mandatory fetching of the first streamable block on startup, with a failure if no block can be fetched after 3 minutes and you are running
firehose
orsubstreams-tier1
service.