Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Jul 17, 2024
1 parent e59453c commit fb6eb58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion llo/channel_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func VerifyChannelDefinitions(channelDefs llotypes.ChannelDefinitions) error {
}
uniqueStreamIDs[strm.StreamID] = struct{}{}
}
// TODO: verify opts?
}
if len(uniqueStreamIDs) > MaxObservationStreamValuesLength {
return fmt.Errorf("too many unique stream IDs, got: %d/%d", len(uniqueStreamIDs), MaxObservationStreamValuesLength)
Expand Down
7 changes: 7 additions & 0 deletions llo/plugin_codecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func channelDefinitionsToProtoObservation(in llotypes.ChannelDefinitions) (out m
}

// TODO: Guard against untrusted inputs!
// MERC-3524
func (c protoObservationCodec) Decode(b types.Observation) (Observation, error) {
pbuf := &LLOObservationProto{}
err := proto.Unmarshal(b, pbuf)
Expand Down Expand Up @@ -123,6 +124,7 @@ func (c protoObservationCodec) Decode(b types.Observation) (Observation, error)
}

// TODO: Needs fuzz testing
// MERC-3524
func channelDefinitionsFromProtoObservation(channelDefinitions map[uint32]*LLOChannelDefinitionProto) llotypes.ChannelDefinitions {
if len(channelDefinitions) == 0 {
return nil
Expand Down Expand Up @@ -207,6 +209,7 @@ func channelDefinitionsToProtoOutcome(in llotypes.ChannelDefinitions) (out []*LL
}

// TODO: Needs thorough unit testing of all paths including nil handling
// MERC-3524
func StreamAggregatesToProtoOutcome(in StreamAggregates) (out []*LLOStreamAggregate, err error) {
if len(in) > 0 {
out = make([]*LLOStreamAggregate, 0, len(in))
Expand Down Expand Up @@ -257,6 +260,7 @@ func validAfterSecondsToProtoOutcome(in map[llotypes.ChannelID]uint32) (out []*L
}

// TODO: Guard against untrusted inputs!
// MERC-3524
func (protoOutcomeCodec) Decode(b ocr3types.Outcome) (outcome Outcome, err error) {
pbuf := &LLOOutcomeProto{}
err = proto.Unmarshal(b, pbuf)
Expand All @@ -280,6 +284,7 @@ func (protoOutcomeCodec) Decode(b ocr3types.Outcome) (outcome Outcome, err error
}

// TODO: Needs fuzz testing
// MERC-3524
func channelDefinitionsFromProtoOutcome(in []*LLOChannelIDAndDefinitionProto) (out llotypes.ChannelDefinitions) {
if len(in) > 0 {
out = make(map[llotypes.ChannelID]llotypes.ChannelDefinition, len(in))
Expand All @@ -302,6 +307,7 @@ func channelDefinitionsFromProtoOutcome(in []*LLOChannelIDAndDefinitionProto) (o
}

// TODO: Needs fuzz testing
// MERC-3524
func streamAggregatesFromProtoOutcome(in []*LLOStreamAggregate) (out StreamAggregates, err error) {
if len(in) > 0 {
out = make(StreamAggregates, len(in))
Expand All @@ -323,6 +329,7 @@ func streamAggregatesFromProtoOutcome(in []*LLOStreamAggregate) (out StreamAggre
}

// TODO: Needs fuzz testing
// MERC-3524
func validAfterSecondsFromProtoOutcome(in []*LLOChannelIDAndValidAfterSecondsProto) (out map[llotypes.ChannelID]uint32) {
if len(in) > 0 {
out = make(map[llotypes.ChannelID]uint32, len(in))
Expand Down
1 change: 0 additions & 1 deletion mercury/v3/mercury.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func (rp *reportingPlugin) Observation(ctx context.Context, repts types.ReportTi
return nil, fmt.Errorf("DataSource.Observe returned an error: %s", err)
}

// TODO: Move this to before Observe is called
observationTimestamp := time.Now()
if observationTimestamp.Unix() > math.MaxUint32 {
return nil, fmt.Errorf("current unix epoch %d exceeds max uint32", observationTimestamp.Unix())
Expand Down

0 comments on commit fb6eb58

Please sign in to comment.