Skip to content

Process headers on broadcast feed connect - #883

Merged
PlasmaPower merged 25 commits into
masterfrom
feed-header
Aug 10, 2022
Merged

Process headers on broadcast feed connect#883
PlasmaPower merged 25 commits into
masterfrom
feed-header

Conversation

@joshuacolvin0

Copy link
Copy Markdown
Member

On initial feed connection:

  1. Client sends server the feed client version and requested message sequence number
  2. Server validates that feed version number is accepted, and sends any cached messages with sequence number equal to or greater than requested sequence number
  3. Server replies to client with the feed server version and the chain id
  4. Client validates the feed server version and chain id, aborting program if either are unexpected.

On initial feed connection, client sends feed client version and requested message sequence number.  Server validates that feed version number is accepted, and does not send any cached messages before requiested sequence number.
Server responds to initial connection with feed server version and the chain id.  Client validates server version and chain id, quitting with an error if unexpected values are returned.
@cla-bot cla-bot Bot added the cla-signed label Aug 1, 2022
@codecov

codecov Bot commented Aug 2, 2022

Copy link
Copy Markdown

Codecov Report

Merging #883 (edbd64d) into master (cb46e58) will decrease coverage by 4.03%.
The diff coverage is 64.28%.

❗ Current head edbd64d differs from pull request most recent head cc4cb29. Consider uploading reports for the commit cc4cb29 to get more accurate results

@@            Coverage Diff             @@
##           master     #883      +/-   ##
==========================================
- Coverage   51.81%   47.78%   -4.04%     
==========================================
  Files         228      217      -11     
  Lines       28530    24585    -3945     
  Branches      502      502              
==========================================
- Hits        14784    11747    -3037     
+ Misses      12199    11275     -924     
- Partials     1547     1563      +16     

Comment thread arbnode/node.go Outdated
Comment thread arbnode/node.go Outdated
Comment thread broadcastclient/broadcastclient.go
Comment thread wsbroadcastserver/wsbroadcastserver.go Outdated
Comment thread broadcastclient/broadcastclient.go Outdated
Comment thread broadcaster/sequencenumbercatchupbuffer.go Outdated
func (b *SequenceNumberCatchupBuffer) OnDoBroadcast(bmi interface{}) error {
broadcastMessage, ok := bmi.(BroadcastMessage)
if !ok {
log.Crit("Requested to broadcast messasge of unknown type")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's do it in a separate PR as it's unrelated, but it seems like we could use generics around here and in the client manager to add type safety

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

Comment thread broadcaster/sequencenumbercatchupbuffer.go
Comment thread system_tests/common_test.go Outdated
t *testing.T,
ctx context.Context,
isSequencer bool,
feedErrChan chan error,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of passing the feedErrChan around everywhere, maybe CreateTestNode* could start a background goroutine that selects on feedErrChan and context cancellation, and fails the test if feedErrChan gets an error.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

testBlockValidatorSimple calls both CreateTestNodeOnL1WithConfig and Create2ndNodeWithConfig, want to make sure test aborts if either one fails.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My thinking was that we could call t.Fail in a background goroutine which reads from feedErrChan. It's a bit inconvenient to need to pass around feedErrChan as-is.

Comment thread wsbroadcastserver/wsbroadcastserver.go Outdated
@PlasmaPower

Copy link
Copy Markdown
Contributor

Mostly LGTM but has merge conflicts. I would also appreciate it if we didn't have to explicitly handle feedErrChan in every test (as opposed to it automatically being processed in the background).

@joshuacolvin0

Copy link
Copy Markdown
Member Author

Mostly LGTM but has merge conflicts. I would also appreciate it if we didn't have to explicitly handle feedErrChan in every test (as opposed to it automatically being processed in the background).

Reducing feedErrChan because we can depend on ctx cancellation in most cases, and other timeouts in other cases. There might be a few places where feed error is not properly reported, but the majority will be fine.

joshuacolvin0 and others added 8 commits August 7, 2022 00:44
In most cases code can depend on ctx cancellation instead of passing around feedErrChan.  Other places already have a reasonable timeout.  There might be a few corner cases where feed errors are not properly reported during unit tests, but production code is fine.

@PlasmaPower PlasmaPower left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants