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

Remove snow.DefaultContextTest #2518

Merged
merged 34 commits into from
Dec 22, 2023
Merged

Remove snow.DefaultContextTest #2518

merged 34 commits into from
Dec 22, 2023

Conversation

dhrubabasu
Copy link
Contributor

@dhrubabasu dhrubabasu commented Dec 20, 2023

Why this should be merged

We should be using snowtest.Context() in most places.

How this works

Replace

How this was tested

CI

@dhrubabasu dhrubabasu added testing This primarily focuses on testing cleanup Code quality improvement labels Dec 20, 2023
@dhrubabasu dhrubabasu added this to the v1.10.18 milestone Dec 20, 2023
@dhrubabasu dhrubabasu self-assigned this Dec 20, 2023
@dhrubabasu dhrubabasu marked this pull request as ready for review December 20, 2023 00:36
Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

change looks fine, but compilation is broken. WIll approve once CI gets to green

@dhrubabasu dhrubabasu requested a review from abi87 December 21, 2023 22:21
@@ -96,22 +96,3 @@ type ConsensusContext struct {
// True iff this chain is currently state-syncing
StateSyncing utils.Atomic[bool]
}

func DefaultContextTest() *Context {
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Comment on lines 41 to 58
func EmptyContext() *snow.Context {
sk, err := bls.NewSecretKey()
if err != nil {
panic(err)
}
pk := bls.PublicFromSecretKey(sk)
return &snow.Context{
NetworkID: 0,
SubnetID: ids.Empty,
ChainID: ids.Empty,
NodeID: ids.EmptyNodeID,
PublicKey: pk,
Log: logging.NoLog{},
BCLookup: ids.NewAliaser(),
Metrics: metrics.NewOptionalGatherer(),
ChainDataDir: "",
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is what we had before... but I still hate this... Are there places that we currently use EmptyContext that we could just be using Context?

Copy link
Contributor Author

@dhrubabasu dhrubabasu Dec 22, 2023

Choose a reason for hiding this comment

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

Removed EmptyContext altogether :)

@dhrubabasu dhrubabasu changed the title Move snow.DefaultContextTest to snowtest.EmptyContext Remove usage of snow.DefaultContextTest Dec 22, 2023
@dhrubabasu dhrubabasu changed the title Remove usage of snow.DefaultContextTest Remove snow.DefaultContextTest Dec 22, 2023
@StephenButtolph StephenButtolph added this pull request to the merge queue Dec 22, 2023
Merged via the queue into dev with commit a809807 Dec 22, 2023
17 checks passed
@StephenButtolph StephenButtolph deleted the default-context-test branch December 22, 2023 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code quality improvement testing This primarily focuses on testing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants