Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions pkg/types/llo/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ type ChannelDefinition struct {
// Streams is the list of streams to be observed and aggregated
// by the protocol.
Streams []Stream `json:"streams"`
// AllowNilStreamValues controls whether channels with nil stream values
// are considered reportable.
// When true, nil stream values are allowed
// and the report codec needs to handle them accordingly.
AllowNilStreamValues bool `json:"allowNilStreamValues"`
// DisableNilStreamValues controls whether channels with nil stream values
// are considered reportable. When true, nil stream values are disabled
// (channel not reportable until all values present). When false (default),
// nil stream values are allowed and the report codec needs to handle them accordingly.
DisableNilStreamValues bool `json:"disableNilStreamValues"`
Comment on lines +263 to +267
// Opts contains configuration data for use in report generation
// for this channel, e.g. feed ID, expiry window, USD base fee etc
//
Expand Down Expand Up @@ -296,7 +296,7 @@ func (a ChannelDefinition) Equals(b ChannelDefinition) bool {
return false
}

if a.AllowNilStreamValues != b.AllowNilStreamValues {
if a.DisableNilStreamValues != b.DisableNilStreamValues {
return false
}

Expand Down
46 changes: 23 additions & 23 deletions pkg/types/llo/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Test_ChannelDefinitions_Serialization(t *testing.T) {
"opts": null,
"tombstone": false,
"source": 1,
"allowNilStreamValues": false
"disableNilStreamValues": true
},
"1": {
"reportFormat": "evm_premium_legacy",
Expand All @@ -37,7 +37,7 @@ func Test_ChannelDefinitions_Serialization(t *testing.T) {
},
"tombstone": false,
"source": 2,
"allowNilStreamValues": true
"disableNilStreamValues": false
}
}`
var channelDefinitions ChannelDefinitions
Expand Down Expand Up @@ -134,18 +134,18 @@ func Test_ChannelDefinition_Equals(t *testing.T) {
assert.False(t, a.Equals(b))
})

t.Run("different AllowNilStreamValues", func(t *testing.T) {
t.Run("different DisableNilStreamValues", func(t *testing.T) {
a := ChannelDefinition{
ReportFormat: ReportFormatJSON,
Streams: []Stream{{0, AggregatorMedian}, {1, AggregatorMode}},
Opts: nil,
AllowNilStreamValues: false,
ReportFormat: ReportFormatJSON,
Streams: []Stream{{0, AggregatorMedian}, {1, AggregatorMode}},
Opts: nil,
DisableNilStreamValues: true,
}
b := ChannelDefinition{
ReportFormat: ReportFormatJSON,
Streams: []Stream{{0, AggregatorMedian}, {1, AggregatorMode}},
Opts: nil,
AllowNilStreamValues: true,
ReportFormat: ReportFormatJSON,
Streams: []Stream{{0, AggregatorMedian}, {1, AggregatorMode}},
Opts: nil,
DisableNilStreamValues: false,
}
assert.False(t, a.Equals(b))
})
Expand Down Expand Up @@ -208,18 +208,18 @@ func Test_ChannelDefinitions_Value(t *testing.T) {
t.Run("valid JSON", func(t *testing.T) {
c := ChannelDefinitions{
0: {
ReportFormat: ReportFormatJSON,
Streams: []Stream{{1, AggregatorMedian}, {2, AggregatorMode}},
Opts: nil,
Source: 1,
AllowNilStreamValues: false,
ReportFormat: ReportFormatJSON,
Streams: []Stream{{1, AggregatorMedian}, {2, AggregatorMode}},
Opts: nil,
Source: 1,
DisableNilStreamValues: true,
},
1: {
ReportFormat: ReportFormatEVMPremiumLegacy,
Streams: []Stream{{1, AggregatorMedian}, {2, AggregatorMedian}, {3, AggregatorQuote}},
Opts: []byte(`{"baseUSDFee":"0.1","expirationWindow":86400,"feedId":"0x0003aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","multiplier":"1000000000000000000"}`),
Source: 2,
AllowNilStreamValues: true,
ReportFormat: ReportFormatEVMPremiumLegacy,
Streams: []Stream{{1, AggregatorMedian}, {2, AggregatorMedian}, {3, AggregatorQuote}},
Opts: []byte(`{"baseUSDFee":"0.1","expirationWindow":86400,"feedId":"0x0003aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","multiplier":"1000000000000000000"}`),
Source: 2,
DisableNilStreamValues: false,
},
}
v, err := c.Value()
Expand All @@ -234,7 +234,7 @@ func Test_ChannelDefinitions_Value(t *testing.T) {
"opts": null,
"tombstone": false,
"source": 1,
"allowNilStreamValues": false
"disableNilStreamValues": true
},
"1": {
"reportFormat": "evm_premium_legacy",
Expand All @@ -251,7 +251,7 @@ func Test_ChannelDefinitions_Value(t *testing.T) {
},
"tombstone": false,
"source": 2,
"allowNilStreamValues": true
"disableNilStreamValues": false
}
}`
assert.JSONEq(t, expectedJSON, string(v.([]byte)))
Expand Down
Loading