-
Notifications
You must be signed in to change notification settings - Fork 839
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 ProtocolContext
and ConsensusContext
creation
#7792
base: main
Are you sure you want to change the base?
Conversation
@fab-10 Could we use a builder pattern instead? The builder could hide the multi step creation from the user. |
I thought about it, but in this case it is not possible since |
814e0e8
to
d05d9b9
Compare
d05d9b9
to
a9fa61e
Compare
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.
Looks like a good tradeoff to get rid of the cyclic dependency
@@ -724,6 +725,7 @@ public BesuController build() { | |||
} | |||
|
|||
protocolContext.setSynchronizer(synchronizer); | |||
protocolContext.seal(); |
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.
👍
another option could be to seal the context as part of setting the synchronizer. One less step to 'forget' for future implementers.
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.
thanks @garyschulte for reviewing, but this part has been superseded by this new PR #7862 to remove the synchronizer from ProtocolContext
94f1696
to
0534717
Compare
ProtocolContext
and ConsensusContext
creation
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
0534717
to
037b085
Compare
@daniellehrner @garyschulte please take another look, the PR has changed from the first version, since with the previous PRs there is more the need to create a partially initialized |
PR description
Built on top of #7791, #7862 and #7863
There are no functional changes in this PR, since it is refactor only. The goal is to simplify the ProtocolContext creation,
Moreover the ConsensusContext is now created before the ProtocolContext, removing the need of the factory.
Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests