Skip to content
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

chainHead: Fetch block justifications #140

Open
lexnv opened this issue Feb 27, 2024 · 3 comments
Open

chainHead: Fetch block justifications #140

lexnv opened this issue Feb 27, 2024 · 3 comments

Comments

@lexnv
Copy link
Contributor

lexnv commented Feb 27, 2024

We don't expose a justification method on the chainHead class and this information might be useful for some developers.

I wondered if we should add this method before stabilizing the chainHead to version 1 to have a more complete API.

From the Substrate perspective, this is quite trivial to implement. I'm not sure what the implementation would look like for the light clients.

Would love to get your thoughts on this 🙏

// cc @paritytech/subxt-team @tomaka @josepot

@josepot
Copy link
Contributor

josepot commented Feb 27, 2024

this information might be useful for some developers

could you please enumerate some of the use cases? 🙏

@lexnv
Copy link
Contributor Author

lexnv commented Feb 28, 2024

I'm not entirely familiar with the justifications, to be honest. Bridges are using justifications heavily in their code. It might enable some developers to check the integrity of those blocks by inspecting the justification. Anything related to consensus engines I think might benefit from fetching the justifications.
Pierre mentioned them in this issue: smol-dot/smoldot#1638 (comment), however, I think light-clients will use the p2p protocol instead of the RPC method.

Have opened this issue to gather some feedback and ideas. Since we plan to stabilize the chainHead API soon, I wanted to bring this up before we bump the version 🙏

@tomaka
Copy link
Contributor

tomaka commented Feb 28, 2024

The topic of having a function that allows querying a block's justification has come surprisingly often.

If there's no practical reason why it should be possible to download a block's justification, then I'm against adding a function that lets you do that. This also concern things like the block number, list of GrandPa votes, list of authorities, etc.

Justifications in particular are especially problematic because:

  • They're not deterministic. Different nodes can have different justifications.
  • Some blocks must have a justification (the epoch transition blocks), but for the other blocks, which block has a justification and which doesn't is entirely at the discretion of the node.
  • There are GrandPa justifications and BEEFY justifications. BEEFY justifications lag behind.

I want to highlight the fact that "justifications" are a poorly-defined concept, and just because Substrate has a function that allows reading the justifications of a block and that this function is easy to call is not an argument why we should expose this concept from the JSON-RPC API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants