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

Fix: Monitor/fix reported checkpoint BTC height query bugs #299

Merged
merged 4 commits into from
Feb 2, 2023

Conversation

gitferry
Copy link
Contributor

@gitferry gitferry commented Feb 2, 2023

This PR fixed the bugs found during integration tests with the vigilante monitor. The ReportedCheckpointBtcHeight did not work because of the incorrect setting of hooks. This PR also added fuzz tests for the monitor queries.

Copy link
Member

@SebastianElvis SebastianElvis left a comment

Choose a reason for hiding this comment

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

Thanks! Have to say hooks are quite cryptic to deal with due to the use of concrete keepers 😢 Still remember @vitsalis and I had a long debugging session for the same sort of bugs.

app/app.go Outdated
@@ -507,10 +507,11 @@ func NewBabylonApp(
app.GetSubspace(checkpointingtypes.ModuleName),
privSigner.ClientCtx,
)
app.CheckpointingKeeper = *checkpointingKeeper.SetHooks(
checkpointingtypes.NewMultiCheckpointingHooks(app.EpochingKeeper.Hooks(), app.ZoneConciergeKeeper.Hooks()),
checkpointingKeeper.SetHooks(
Copy link
Member

Choose a reason for hiding this comment

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

Not fully sure why do we remove app.CheckpointingKeeper = * here. Here * does a dereference, thus copies a new instance of the checkpointing keeper. That is, with app.CheckpointingKeeper = *, app.CheckpointingKeeper is a different object than checkpointingKeeper. Although reusing checkpointingKeeper should work as well, copying a new object seems more clear. your call

app/app.go Outdated
)
app.ZoneConciergeKeeper.SetCheckpointingKeeper(app.CheckpointingKeeper)
app.CheckpointingKeeper = checkpointingKeeper
app.ZoneConciergeKeeper.SetCheckpointingKeeper(checkpointingKeeper)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
app.ZoneConciergeKeeper.SetCheckpointingKeeper(checkpointingKeeper)
app.ZoneConciergeKeeper.SetCheckpointingKeeper(app.CheckpointingKeeper)

just to ensure that future PRs do not affect this piece of code due to the deference bugs 😓

Copy link
Member

@vitsalis vitsalis left a comment

Choose a reason for hiding this comment

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

Nice!

@gitferry gitferry merged commit 0a0c300 into dev Feb 2, 2023
@gitferry gitferry deleted the monitor-fix-api-bugs branch February 2, 2023 12:29
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.

3 participants