-
Notifications
You must be signed in to change notification settings - Fork 16
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
[CM-380] Identical Aggregator #771
Conversation
outcome[fmt.Sprintf("%d", idx)] = highestObservation | ||
} | ||
} | ||
valMap, err := values.NewMap(outcome) |
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.
I feel like there needs to be a special case for a single observation to be just the object that's not keyed. This is our use case and I think most will be that way.
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.
I thought about it too but unfortunately the return type of outcome is a Map, not a Value... hence the key overrides.
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.
right, but if there's only one observation, the single observation's value should be a value.Value. That way the one observation can be unwrapped.
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.
What I meant is that EncodableOutcome's type is values.Map so I can't assign Value to a Map... It needs at least one key.
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.
What I was thinking is that the outcome gets stored in a fixed struct:
struct EncoderOutcome {
Value any
}
Then you send the Value
to the encoder.
a141b0a
to
2080f7b
Compare
// If non-empty, must be of length ExpectedObservationsLen. | ||
KeyOverrides []string | ||
// If true, the encoder name and config will be overridden with the values | ||
// provided under configured indices of the observations array (as long as consensus is reached). |
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.
Not too happy with this approach... suggestions welcome.
@cedric-cordenier this is slightly different to what we discussed but I don't see how we can make a generic aggregator with only a single observation.
return nil, err | ||
} | ||
return &types.AggregationOutcome{ | ||
EncodableOutcome: values.ProtoMap(valMap), |
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.
Alternatively, you can make this a value.Value. There's no reason someone can't encode a number, a list of numbers etc.
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 actually assume that it needs to be a map since we add metadata to it. Any objection to leaving this as is and revisiting at a future date?
* [chore] Handle aliases in slices * More aliasing tests * Lint fix * Fix test --------- Co-authored-by: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com>
* [CAPPL-58] Further cleanup * [CAPPL-58] Add support for compression
* Generic case to handle both pointer type and raw type and simplify int unwrap * Handling interface and default * Small test fix --------- Co-authored-by: Cedric Cordenier <cedric.cordenier@smartcontract.com>
* Fix alias typing and tests * Fix ints * errors.new instead of fmt * Add array support to slice (#789)
3affcec
to
7abd311
Compare
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.
I think the mock in ocr3cap mock might need to change for this to work with it. Should we expose another wrapper to get multiple consensus or just hide at that point? I'm good either way.
Also, if we're only returning one of the signed reports, but there's actually an array, then line 30 should be of type []SignedReport and you would need to wrap the capability in sdk.ToListDefinition and on line 31 use step.Index(0) instead of step.
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.
Also, if we're only returning one of the signed reports, but there's actually an array, then line 30 should be of type []SignedReport and you would need to wrap the capability in sdk.ToListDefinition and on line 31 use step.Index(0) instead of step.
We only output one report atm, unless I'm misunderstanding the question?
No description provided.