-
Notifications
You must be signed in to change notification settings - Fork 24
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
QBFT Tests - Instance & Message #328
Conversation
"github.com/bloxapp/ssv-spec/qbft/spectest/tests" | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
) | ||
|
||
// InvalidPrepareJustificationsUnmarshalling tests unmarshalling invalid prepare justifications (during message.validate()) | ||
func InvalidPrepareJustificationsUnmarshalling() tests.SpecTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alonmuroch
It seems this is mainly testing ssz logic that is the repsonsibility of a 3rd party lib.
We can have this basic test but just wondering what is your view of testing such parts of the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering myself since Alon won't answer:
- for valid messages we need to make sure the encoding is consistent if the ssz lib changes
- invalid encodings in my eyes are optional to test. Since even if malformed object is created later validations should help here
qbft/spectest/tests/messages/prepare_justification_unmarshaling.go
Outdated
Show resolved
Hide resolved
qbft/spectest/tests/messages/round_change_justification_unmarshaling.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to discuss whether the MsgSpecTest
needs to be changed to have better validity checks.
Also we need to understand why we need CreateMsgTest
and MsgSpecTest
"github.com/bloxapp/ssv-spec/qbft/spectest/tests" | ||
"github.com/bloxapp/ssv-spec/types" | ||
"github.com/bloxapp/ssv-spec/types/testingutils" | ||
) | ||
|
||
// InvalidPrepareJustificationsUnmarshalling tests unmarshalling invalid prepare justifications (during message.validate()) | ||
func InvalidPrepareJustificationsUnmarshalling() tests.SpecTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering myself since Alon won't answer:
- for valid messages we need to make sure the encoding is consistent if the ssz lib changes
- invalid encodings in my eyes are optional to test. Since even if malformed object is created later validations should help here
|
||
return &tests.MsgSpecTest{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the issue here is that the test code is wrong... we should be doing BaseMsgValidation()
and not msg.Validate()
that is partial
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the instance BaseMsgValidation
or the controller one?
In the test structure we don't have any of these objects btw. Should I add it?
My only concern is that the other tests will probably need to change.
Another way would be to move this single test to ssv. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we open an issue and just remember to fix this when we do spec rethink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we just need @alonmuroch to explain us the test and we're done
Tests
Messages
message.Validate()
doesn't testroot
field. Should this test be dropped?message.Validate()
doesn't testroot
field. Should this test be dropped?Start Instance