Skip to content

Conversation

@StephenButtolph
Copy link
Contributor

Why this should be merged

Reduces the number of options required to provide to the newBlock test helper.

How this works

How this was tested

Need to be documented in RELEASES.md?

Comment on lines -160 to -161
// TestVerifyPrevIsLatest tests that a block with a prev digest that is not found in the block tracker
// successfully verifies the block if it is the latest accepted block.
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 was no longer relevant. It seems like this test was written for a previous version of the code.

Copy link
Contributor

@samliok samliok left a comment

Choose a reason for hiding this comment

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

overall I like the changes, just that one case i commented is weird

digest := computeDigest(bytes)
block.digest = digest

block.blockTracker = newBlockTracker(block)
Copy link
Contributor

@samliok samliok Jul 17, 2025

Choose a reason for hiding this comment

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

it feels weird to set the blockTracker with the block we are returning. This means newBlock.index() would succeed.

genesis := newBlock(t, newBlockConfig{})
err := genesis.blockTracker.indexBlock(ctx, genesis.digest)
require.NoError(t, err) // this should error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked offline and decided that calling indexBlock with a previously accepted hash is unexpected (and therefore undefined behavior).

@samliok samliok merged commit 0b8baab into simplex-tracker Jul 17, 2025
27 checks passed
@samliok samliok deleted the cleanup-block-creation branch July 17, 2025 15:28
@github-project-automation github-project-automation bot moved this to Done 🎉 in avalanchego Jul 17, 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.

3 participants