-
Notifications
You must be signed in to change notification settings - Fork 200
[DataAvailability] add a check for executors passed by a client #8233
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
base: feature/optimistic-sync
Are you sure you want to change the base?
[DataAvailability] add a check for executors passed by a client #8233
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| } | ||
| } | ||
|
|
||
| func (e *RequiredExecutorsCountExceededError) Error() 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.
it's a good idea to also include Unwrap methods to allow errors.Is and errors.As to work when the returned error is wrapped.
| return nil, fmt.Errorf("failed to retrieve execution IDs: %w", err) | ||
| } | ||
|
|
||
| err = e.validateRequiredExecutors(criteria.RequiredExecutors, executorIdentities) |
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.
since we're validating that the executors exist in the identity table, I think we need to use state.AtBlockID() to get the executors for the specific block queried. ENs generally don't change often, but this is more correct.
| sealedHeader, err := e.state.Sealed().Head() | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to lookup sealed header: %w", err) | ||
| } | ||
| header, err := e.headers.ByBlockID(blockID) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get header by block ID %v: %w", blockID, err) | ||
| } | ||
| // If block is sealed and criteria cannot be met return an error | ||
| if header.Height <= sealedHeader.Height && len(subsetENs) < len(criteria.RequiredExecutors) { | ||
| return nil, optimistic_sync.NewCriteriaNotMetError(blockID) | ||
| } |
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 check assumes that the provided block is finalized, but I don't think that's enforced anywhere. this requires an additional lookup of BlockIDByHeight to determine if the finalized blockID matches the provided blockID. if it is, the following check is OK. if it's not, then the requested block conflicts with a finalized (or sealed) block, which should also return a sentinel error.
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.
I think this is a nice user experience addition, but we should avoid doing the db lookups unless len(subsetENs) < len(criteria.RequiredExecutors)
| required flow.IdentifierList, | ||
| available flow.IdentityList, | ||
| ) error { | ||
| if len(available) < len(required) { |
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.
I think this should include a check that AgreeingExecutorsCount is less than the available executors
Close: #8204
Context
This PR implements the following checks to
criteriavalidation:required executor IDs(ensure that all executor IDs provided through the criteria actually exist among the known execution nodes).required executor IDscount (ensure that the required executor number does not exceed the actual number ofavailable executors).sealedbutcriteriacannot be met (if the block is already sealed and the provided criteria still cannot be satisfied, return an error to the user indicating that the criteria cannot be met).Additional updates: