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

Refactor LC handlers Tests #14834

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Inspector-Butters
Copy link
Contributor

What type of PR is this?
Other

What does this PR do? Why is it needed?
This PR refactors the light client handlers tests, and bundles them together, to make it easier and cleaner to add more tests.

Which issues(s) does this PR fix?
Part of #12991

Other notes for review
I don't think this PR needs a changelog entry since it's not user-facing and it does not add/remove/change functionality.


db := dbtesting.SetupDB(t)
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be done once before all tests


db := dbtesting.SetupDB(t)
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here


db := dbtesting.SetupDB(t)
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here


updates := make([]interfaces.LightClientUpdate, 2)
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

EnableLightClient: true,
})
defer resetFn()
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Comment on lines +929 to +930
config.MaxRequestLightClientUpdates = 2
params.OverrideBeaconConfig(config)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

})

}
t.Run("start period before altair", func(t *testing.T) {
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Root: make([]byte, 32),
}))
t.Run("missing update in the middle", func(t *testing.T) {
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

signedBlock, err := blocks.NewSignedBeaconBlock(block)
require.NoError(t, err)
t.Run("missing update at the beginning", func(t *testing.T) {
db := dbtesting.SetupDB(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

}

func TestLightClientHandler_GetLightClientOptimisticUpdateAltair(t *testing.T) {
func TestLightClientHandler_GetLightClientFinalityUpdate(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you only have Altair covered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants