-
Notifications
You must be signed in to change notification settings - Fork 22
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
Drop duplicated value check call #367
base: main
Are you sure you want to change the base?
Conversation
@GalRogozinski Should we add a check inside |
@MatheusFranco99 |
@GalRogozinski |
@MatheusFranco99 |
@GalRogozinski |
Actually, thinking about it again, we would have something like: func (b *BaseRunner) decide(runner Runner, input *types.ConsensusData) error {
byts, err := input.Encode()
if err != nil {
return errors.Wrap(err, "could not encode ConsensusData")
}
// New check
if len(byts) == 0 {
return errors.Wrap(err, "...")
}
if err := runner.GetValCheckF()(byts); err != nil {
return errors.Wrap(err, "input data invalid")
}
// ... But |
@MatheusFranco99 You have a point though, that it is nice that this will be inside the value check. But this probably means that you need to add the check in each function. From a SW engineer perspective I would make a base function wrapper that does checks that should happen across all value checks and then calls an internal So for spec I would either use your snippet or add the empty check in each |
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.
Just a question: we are still covered test wise for empty values?
@@ -50,7 +50,7 @@ func (b *BaseRunner) ValidatePostConsensusMsg(runner Runner, psigMsgs *types.Par | |||
} | |||
|
|||
// TODO https://github.com/ssvlabs/ssv-spec/issues/142 need to fix with this issue solution instead. | |||
if b.State.DecidedValue == nil || len(b.State.DecidedValue) == 0 { |
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.
👍
@GalRogozinski |
Drop duplicated value check call as pointed by #325.
The tests for starting an instance with empty value, nil value and invalid value were dropped since the instance doesn't perform a value check anymore.
These tests can't be replicated into
Runner
tests because the input value for starting an instance is defined internally and not by an external argument.Closes #325.