Skip to content

Conversation

@UlyanaAndrukhiv
Copy link
Contributor

@UlyanaAndrukhiv UlyanaAndrukhiv commented Dec 5, 2025

Close: #8204

Context

This PR implements the following checks to criteria validation:

  • Validate required executor IDs (ensure that all executor IDs provided through the criteria actually exist among the known execution nodes).
  • Validate required executor IDs count (ensure that the required executor number does not exceed the actual number of available executors).
  • Validate agreeing executors count (ensure that the agreeing executors count does not exceed the actual number of available executors).
  • Return error when the criteria cannot be met.
  • Return error when the requested block does not match the finalized block at the same height.

Additional updates:

  • Added tests.
  • Updated error handling for fork-aware endpoints.

@UlyanaAndrukhiv UlyanaAndrukhiv self-assigned this Dec 5, 2025
@UlyanaAndrukhiv UlyanaAndrukhiv marked this pull request as ready for review December 5, 2025 14:06
@UlyanaAndrukhiv UlyanaAndrukhiv requested a review from a team as a code owner December 5, 2025 14:06
Comment on lines 128 to 140
header, err := e.headers.ByBlockID(blockID)
if err != nil {
return nil, fmt.Errorf("failed to get header by block ID %v: %w", blockID, err)
}
// Lookup the finalized block ID at the height of the requested block
blockIDFinalized, err := e.headers.BlockIDByHeight(header.Height)
if err != nil {
return nil, fmt.Errorf("failed to lookup finalized block ID at height %d: %w", header.Height, err)
}
// If the requested block conflicts with finalized block, return error
if blockIDFinalized != blockID {
return nil, optimistic_sync.NewBlockFinalityMismatchError(blockID, blockIDFinalized)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the intention is to return a helpful error to the user if they are requesting data for a sealed block, and no ExecutionResults match their criteria. In this case, it's unlikely that their criteria will ever be met. Rather than returning PreconditionFailed indicating that their request may succeed in the future, we could return a more definitive error that their request did not match for a sealed block and probably never will. they may want to relax their criteria or investigate what went wrong.

I don't think I was totally clear in my last comment. what I was saying is you cannot do a height based comparison to check if a block is sealed for non-finalized blocks since there may be consensus forks (multiple blocks with the same height) up until finalization. The most efficient way to check if a block is sealed is:

  1. get the block's header
  2. check if it is finalized by:
    a. use BlockIDByHeight to check if a block is indexed for the height. If not, it's not finalized.
    b. check if the returned block ID matches the requested block ID. If not, it's not finalized.
  3. check if the block's height is <= the sealed block's height

Step 2 was missing in your original changes. Step 3 is missing in the current changes.

In either case, we only want to do this check and returned the improved error if we couldn't find a result that matched the criteria

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that — I had misunderstood the earlier comment. I’ve updated the logic in c26a53e.
Please take a look at the error handling in these changes.

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

Successfully merging this pull request may close these issues.

[DataAvailability] add a check for executors passed by a client

4 participants