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

Bringing back 1 x filters #281

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

zajko
Copy link
Contributor

@zajko zajko commented Apr 19, 2024

Rationale
As a user of sidecar that's used to consume 1.x style sse events I want to be still able to listen to events after 2.0 changes.
Notes
The goal of this effort is to recreate the sse filter endpoints from 1.x. For now the endpoints will be satureated with 2.x style SSE events, but before release we need to translate them to 1.x format.

Work done
Sidecars SSE server has 3 more endpoints:

  • /main -> transmits ApiVersion, FinalitySignature and Shutdown events
  • /deploys -> transmits ApiVersion, TransactionAccepted and Shutdown events
  • /sigs -> transmits ApiVersion, BlockAdded, TransactionProcessed, TransactionExpired, Fault, Step and Shutdown events

@zajko zajko changed the base branch from dev to feat-2.0 April 19, 2024 14:14
@zajko zajko force-pushed the bringing_back_1_x_filters branch from 7034382 to 81ea06d Compare April 19, 2024 14:53
@zajko zajko requested review from rafal-ch and jacek-casper April 22, 2024 07:33
@zajko zajko force-pushed the bringing_back_1_x_filters branch 5 times, most recently from 3ef97c6 to 651ff9f Compare April 22, 2024 10:01
pub(crate) fn new(
config: Config,
storage_path: PathBuf,
enable_legacy_filters: bool,

Choose a reason for hiding this comment

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

A nit, but I'd rather avoid a bool flag here, as I can imagine that our "standard" filters will become legacy and the legacy ones will become "legacier" :)

How about an enum Filters { V1_x, V2_x } or something along these lines?

event_sidecar/src/event_stream_server/sse_server.rs Outdated Show resolved Hide resolved
Comment on lines 789 to 790
// `EventFilter::Signatures` should filter out everything except `ApiVersion`s and
// `FinalitySignature`s.

Choose a reason for hiding this comment

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

Suggested change
// `EventFilter::Signatures` should filter out everything except `ApiVersion`s and
// `FinalitySignature`s.
// `EventFilter::Signatures` should filter out everything except `ApiVersion`s,
// `FinalitySignature`s and `Shutdown`s.

However, I'd consider removing these comments completely because they usually rot and the code is self explanatory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right

@rafal-ch
Copy link

Plase consider adding the new flag to the example configs and perhaps a readme file.

Copy link

@rafal-ch rafal-ch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

…r now it provides 2.x SSE events.

Applying code review suggestions
@zajko zajko force-pushed the bringing_back_1_x_filters branch from e32da8d to f382467 Compare April 26, 2024 13:07
@zajko zajko merged commit c91da28 into casper-network:feat-2.0 Apr 26, 2024
2 checks passed
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.

2 participants