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 - Future decided no instance nil check #342

Merged
merged 4 commits into from
Feb 12, 2024

Conversation

MatheusFranco99
Copy link
Contributor

@MatheusFranco99 MatheusFranco99 commented Jan 5, 2024

Fix #235 by adding a nil check.

New test:

  • Future decided with no running instance

Copy link
Contributor

@MatusKysel MatusKysel left a comment

Choose a reason for hiding this comment

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

LGTM

return ssvMessage
}

multiSpecTest := &tests.MultiMsgProcessingSpecTest{
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need this test for proposer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The proposer and blinded proposer tests are in the end of the file

ssv/runner.go Outdated
@@ -196,7 +196,7 @@ func (b *BaseRunner) basePartialSigMsgProcessing(
// didDecideCorrectly returns true if the expected consensus instance decided correctly
func (b *BaseRunner) didDecideCorrectly(prevDecided bool, decidedMsg *qbft.SignedMessage) (bool, error) {
decided := decidedMsg != nil
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to write it differently, this is how we write stuff lie this in go and I also think is more readable and easier to reason about

if decidedMsg == nil {
 return false, nil
}
if b.State.RunningInstance == nil {
 return false, errors.New("decided wrong instance")
}

if decidedMsg.Message.Height != b.State.RunningInstance.GetHeight() {
 return false, errors.New("decided wrong instance")
}

Copy link
Contributor

Choose a reason for hiding this comment

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

let me know what you guys think, I know its not a part of this PR but I couldn't help but see this
@MatheusFranco99 , @GalRogozinski , @moshe-blox . its ok also to decide not to do it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I 100% agree. @GalRogozinski what do you think?

Copy link
Contributor

@y0sher y0sher left a comment

Choose a reason for hiding this comment

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

small code style comment, approved in case you don't want to do it now

@MatheusFranco99 MatheusFranco99 force-pushed the future-decided-no-instance-panic branch from 491ccef to a775ca0 Compare February 7, 2024 09:02
@GalRogozinski GalRogozinski merged commit 7e4ff9c into main Feb 12, 2024
2 checks passed
@GalRogozinski GalRogozinski deleted the future-decided-no-instance-panic branch February 12, 2024 08:19
if !decidedRunningInstance {

if b.State.RunningInstance == nil {
return false, errors.New("decided wrong instance")
Copy link
Contributor

Choose a reason for hiding this comment

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

we should return different err message here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree

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.

Future decide with no running instance panic
5 participants