Skip to content

Commit

Permalink
Address informational-level audit findings
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Nov 25, 2024
1 parent 8d29ea0 commit 6d23b63
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 2 additions & 0 deletions llo/channel_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func VerifyChannelDefinitions(channelDefs llotypes.ChannelDefinitions) error {
return fmt.Errorf("invalid ChannelDefinition with ID %d: %v", channelID, err)
}
default:
// NOTE: Could add further report-format-specific validation here
// for future report formats
}
}
if len(uniqueStreamIDs) > MaxObservationStreamValuesLength {
Expand Down
2 changes: 1 addition & 1 deletion llo/json_report_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (cdc JSONReportCodec) Pack(digest types.ConfigDigest, seqNr uint64, report
p := packed{
ConfigDigest: digest,
SeqNr: seqNr,
Report: json.RawMessage(report), // TODO: check if its valid JSON
Report: json.RawMessage(report), // TODO: check if its valid JSON, MERC-3524
Sigs: sigs,
}
return json.Marshal(p)
Expand Down
13 changes: 7 additions & 6 deletions llo/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ const (
MaxReportLength = ocr3types.MaxMaxReportLength

// LLO-specific limits
// Maximum amount of channels that can be added per round (if more than
// this needs to be added, it will be added in batches until everything is
// up-to-date)
MaxObservationRemoveChannelIDsLength = 5
//
// Maximum amount of channels that can be removed per round (if more than
// this needs to be removed, it will be removed in batches until everything
// is up-to-date)
// this need to be removed, they will be removed in batches until
// everything is up-to-date)
MaxObservationRemoveChannelIDsLength = 5
// Maximum amount of channels that can be added/updated per round (if more
// than this need to be added, they will be added in batches until
// everything is up-to-date)
MaxObservationUpdateChannelDefinitionsLength = 5
// Maximum number of streams that can be observed per round
MaxObservationStreamValuesLength = 10_000
Expand Down
14 changes: 7 additions & 7 deletions llo/plugin_outcome.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ func (p *Plugin) outcome(outctx ocr3types.OutcomeContext, query types.Query, aos
"seqNr", outctx.SeqNr,
"stage", "Outcome",
)
outcome.ChannelDefinitions[defWithID.ChannelID] = defWithID.ChannelDefinition
} else if len(outcome.ChannelDefinitions) >= MaxOutcomeChannelDefinitionsLength {
p.Logger.Warnw("Adding channel FAILED. Cannot add channel, outcome already contains maximum number of channels",
"maxOutcomeChannelDefinitionsLength", MaxOutcomeChannelDefinitionsLength,
Expand All @@ -143,13 +142,14 @@ func (p *Plugin) outcome(outctx ocr3types.OutcomeContext, query types.Query, aos
// continue, don't break here because remaining channels might be a
// replacement rather than an addition, and this is still ok
continue
} else {
p.Logger.Debugw("Adding channel (new)",
"channelID", defWithID.ChannelID,
"addChannelDefinition", defWithID,
"seqNr", outctx.SeqNr,
"stage", "Outcome",
)
}
p.Logger.Debugw("Adding channel (new)",
"channelID", defWithID.ChannelID,
"addChannelDefinition", defWithID,
"seqNr", outctx.SeqNr,
"stage", "Outcome",
)
outcome.ChannelDefinitions[defWithID.ChannelID] = defWithID.ChannelDefinition
}

Expand Down

0 comments on commit 6d23b63

Please sign in to comment.