Repository navigation
Validate Max Aggregatable Exponent Consensus - #822
silaslenihan wants to merge 7 commits into
Conversation
| return fmt.Errorf("observation from observer %d is missing input for request %s", ao.Observer, requestID) | ||
| } | ||
|
|
||
| if valueInput, ok := reqObs.Input.GetObservation().(*sdk.SimpleConsensusInputs_Value); ok { |
There was a problem hiding this comment.
@silaslenihan is this valueInput coming from the user ? Asking because if we return error here, one user's bad input can kill the round observation of all nodes ?
There was a problem hiding this comment.
Good point, it is possible for a user bad input to cause this. To combat that I moved the validation to the capability boundry so that it validates before the request enters the OCR store.
| func(val *valuespb.Value) (decimal.Decimal, error) { | ||
| var d decimal.Decimal | ||
| if exp := val.GetDecimalValue().GetExponent(); exp > maxDecimalExponent || exp < -maxDecimalExponent { | ||
| if exp := val.GetDecimalValue().GetExponent(); exp > MaxAggregatableExponent || exp < -MaxAggregatableExponent { |
There was a problem hiding this comment.
will this ever happen if we ValidateObservation ?
There was a problem hiding this comment.
It shouldn't normally, but this was mainly preserving existing logic in case something unexpected happens in the OCR flow / protecting against future changes with this simple guard.
462f6d0 to
1d118a6
Compare
|





No description provided.