Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions core/services/ocr2/plugins/vault/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ func (r *ReportingPlugin) StateTransition(ctx context.Context, seqNr uint64, aq
store := NewWriteStore(keyValueReadWriter)

obsMap := map[string][]*vaultcommon.Observation{}
oidsToReqIDs := map[uint8][]string{}
for _, ao := range aos {
obs := &vaultcommon.Observations{}
if err := proto.Unmarshal([]byte(ao.Observation), obs); err != nil {
Expand All @@ -927,13 +928,22 @@ func (r *ReportingPlugin) StateTransition(ctx context.Context, seqNr uint64, aq
obsMap[o.Id] = []*vaultcommon.Observation{}
}
obsMap[o.Id] = append(obsMap[o.Id], o)

if _, ok := oidsToReqIDs[uint8(ao.Observer)]; !ok {
oidsToReqIDs[uint8(ao.Observer)] = []string{}
}
oidsToReqIDs[uint8(ao.Observer)] = append(oidsToReqIDs[uint8(ao.Observer)], o.Id)
}
}

r.lggr.Debugw("stateTransition started", "oracleIDsToRequestIDs", oidsToReqIDs)

os := &vaultcommon.Outcomes{
Outcomes: []*vaultcommon.Outcome{},
}
for id, obs := range obsMap {

for _, id := range slices.Sorted(maps.Keys(obsMap)) {
obs := obsMap[id]
// For each observation we've received for a given Id,
// we'll sha it and store it in `shaToObs`.
// This means that each entry in `shaToObs` will contain a list of all
Expand Down Expand Up @@ -963,7 +973,7 @@ func (r *ReportingPlugin) StateTransition(ctx context.Context, seqNr uint64, aq
}

if len(chosen) == 0 {
r.lggr.Warnw("insufficient observations found for id", "id", id, "threshold", threshold)
r.lggr.Warnw("insufficient observations found for id", "id", id, "threshold", threshold, "shaToObs", shaToObs)
continue
}

Expand Down
Loading