Skip to content

Conversation

@StephenButtolph
Copy link
Contributor

Why this should be merged

Currently coreth has a ton of duplicate code around the handling of contexts. This change should help use this code there.

How this works

How this was tested

Need to be documented in RELEASES.md?

Comment on lines +524 to +527
// Ensure that the blocks have at least one bit as a common prefix
for firstBlock.IDV.Bit(0) != secondBlock.IDV.Bit(0) {
secondBlock = snowmantest.BuildChild(snowmantest.Genesis)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test previously assumed that this was the case. In practice it was because all of our tests are deterministic, but adding an additional call to ids.GenerateTestNodeID() changed the seed.

This should now work generally.

BCLookup: aliaser,
Metrics: metrics.NewPrefixGatherer(),

WarpSigner: warp.NewSigner(secretKey, constants.UnitTestID, chainID),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was nil previously.

BCLookup: aliaser,
Metrics: metrics.NewPrefixGatherer(),
Log: logging.NoLog{},
SharedMemory: sharedMemory,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was nil previously.

SubnetID: constants.PrimaryNetworkID,
ChainID: chainID,
NodeID: ids.EmptyNodeID,
NodeID: ids.GenerateTestNodeID(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was invalid previously. We will never populate the empty ID here in prod.

CChainID: constants.PrimaryNetworkID,
}[chainID]
if !ok {
switch chainID {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically not required, but during my canoto work, I realized how crazy inefficient this map lookup is... It is also less code and probably more readable tbh

)

var (
PChainID = constants.PlatformChainID
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just wanted the order to align with the rest of the file... Not really needed

@StephenButtolph StephenButtolph marked this pull request as ready for review May 8, 2025 16:30
@StephenButtolph StephenButtolph moved this to In Progress 🏗️ in avalanchego May 8, 2025
@StephenButtolph StephenButtolph enabled auto-merge May 8, 2025 17:44
@StephenButtolph StephenButtolph added this pull request to the merge queue May 8, 2025
Merged via the queue into master with commit ef90699 May 8, 2025
25 checks passed
@StephenButtolph StephenButtolph deleted the fully-populate-context branch May 8, 2025 18:09
@github-project-automation github-project-automation bot moved this from In Progress 🏗️ to Done 🎉 in avalanchego May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants