-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
Simplify INetwork Interface #5187
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
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 does look a lot cleaner and I did not find any big issues but can't really approve this as I am not familiar with the code and the impact of those changes.
@@ -122,6 +122,21 @@ export type GossipModules = { | |||
chain: IBeaconChain; | |||
}; | |||
|
|||
export type GossipBeaconNode = { |
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.
shouldn't this rather be an interface
?
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.
Definitely could be an interface. I don't know that we have clear project-wide opinions on the use of one vs the either.
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.
IMO if it is implemented by a class within the project directly or even outside in an external library I would use interface
otherwise should just use type
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.
Yeah, type
here is a bit sloppy. Can clean it up in a future PR.
I'm continuing to do some work to clean this up, aiming to move the network to a worker, so will continue touching these pieces of code.
networkStub.getMetadata.returns( | ||
Promise.resolve({ | ||
attnets: BitArray.fromBoolArray([true]), | ||
syncnets: BitArray.fromBitLen(0), | ||
seqNumber: BigInt(1), | ||
}) | ||
); |
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.
might just be able to do
networkStub.getMetadata.returns( | |
Promise.resolve({ | |
attnets: BitArray.fromBoolArray([true]), | |
syncnets: BitArray.fromBitLen(0), | |
seqNumber: BigInt(1), | |
}) | |
); | |
networkStub.getMetadata.resolves( | |
attnets: BitArray.fromBoolArray([true]), | |
syncnets: BitArray.fromBitLen(0), | |
seqNumber: BigInt(1), | |
); |
there are more cases below
Noted we should probably have two classes, one interacting with everything else in the main thread and one for the worker - main thread comms |
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.
lgtm
🎉 This PR is included in v1.6.0 🎉 |
Motivation
Another step towards #4856
The
INetwork
class should be simplified in preparation for moving it to a worker.Description
GossipsubBeaconNode