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

CCIP-3677 Observe different token data observers in parallel #210

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mateusz-sekara
Copy link
Contributor

No description provided.

@mateusz-sekara mateusz-sekara marked this pull request as ready for review October 7, 2024 09:35
@mateusz-sekara mateusz-sekara requested a review from a team as a code owner October 7, 2024 09:35
return nil, fmt.Errorf("merging token data together failed: %w", err)
}
case <-ctx.Done():
// Return whatever was processed so far when context is canceled
Copy link
Contributor

Choose a reason for hiding this comment

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

To be sure. failed ones will be picked up in the next round?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, if message is ready to be executed, it should be included in the outcome and transmitted as an exec report to the chain. All failed ones would be retried in the next round if consensus is not reached

@mateusz-sekara mateusz-sekara changed the title Observe different token data observers in parallel CCIP-3677 Observe different token data observers in parallel Oct 7, 2024
Copy link

github-actions bot commented Oct 8, 2024

Metric paralell-token-data-observation main
Coverage 73.2% 73.1%

return tokenDataObservations, nil
}

resultsCh := make(chan exectypes.TokenDataObservations, len(c.observers))
Copy link
Contributor

Choose a reason for hiding this comment

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

Some thoughts about the general approach.

  1. I'd like to see this be asynchronous to the Observe function. (i.e. persistent result channel + go routine collecting results).
  2. During Observe, send new/failed attestation requests out for observation and grab ones that are ready.
  3. Is there a timeout on the context?
  4. Channel size should be one or none: one or none.

}

for i := 0; i < len(c.observers); i++ {
select {
Copy link
Contributor

@winder winder Oct 8, 2024

Choose a reason for hiding this comment

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

The granularity of a result is an entire set of observations which causes problems when the context is done:

  1. The observers are notified to start returning accumulated attestations.
  2. The ctx.Done() case is hit and immediately returns accumulated attestations (which doesn't include results from 1).

This means we're very likely to ignore all attestations when the timeout is hit.

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.

3 participants