-
Notifications
You must be signed in to change notification settings - Fork 674
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 common.Engine API #3406
Conversation
26015d1
to
4a200b1
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.
nice work! did a fuzzing without problem
a839591
to
3cacae5
Compare
chains/manager.go
Outdated
@@ -1013,17 +1017,19 @@ func (m *manager) createAvalancheChain( | |||
avalancheBootstrapperConfig.StopVertexID = m.Upgrades.CortinaXChainStopVertexID | |||
} | |||
|
|||
avalancheBootstrapper, err := avbootstrap.New( | |||
var avalancheBootstrapper common.BootstrapableEngine | |||
avBoot, err := avbootstrap.New( |
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.
I don't think we actually need the avBoot
var.
avBoot, err := avbootstrap.New( | |
avalancheBootstrapper, err = avbootstrap.New( |
I think the only place we use avBoot
we could just use avalancheBootstrapper
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.
avbootstrap.New
now returns a concrete type.
common.TraceBootstrapableEngine
returns an interface type, so we cannot override the original reference of the bootstrapper any longer.
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.
I understand that, but avalancheBootstrapper
has type common.TraceBootstrapableEngine
. We can assign to it directly here without creating an intermediate variable avBoot
.
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.
Got it, thanks for clarifying.
Fixed!
3cacae5
to
50841e1
Compare
Halt() is only used for the bootstrapper engine, and not invoked on other engine types. Context() is only used in tests. Therefore, this commit removes these methods from the common engine API to simplify it. Signed-off-by: Yacov Manevich <[email protected]>
50841e1
to
438f527
Compare
Why this should be merged
Halt() is only used for the bootstrapper engine, and not invoked on other engine types.
Context() is only used in tests.
Therefore, this commit removes these methods from the common engine API to simplify it.
How this works
Tidies up some code.
How this was tested
Unit tests