From 2e571b2dea5a1e22cfca269b6ac034d7852264d4 Mon Sep 17 00:00:00 2001 From: Bruno Moura Date: Thu, 19 Mar 2026 13:16:17 +0000 Subject: [PATCH] pkg/types/llo: change ChannelDefinitions.AllowNilStreamValues to DisableNilStreamValues to enable compatible default behaviour --- pkg/types/llo/types.go | 12 +++++----- pkg/types/llo/types_test.go | 46 ++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/pkg/types/llo/types.go b/pkg/types/llo/types.go index def55d9f9..a0bc40b3a 100644 --- a/pkg/types/llo/types.go +++ b/pkg/types/llo/types.go @@ -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"` // Opts contains configuration data for use in report generation // for this channel, e.g. feed ID, expiry window, USD base fee etc // @@ -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 } diff --git a/pkg/types/llo/types_test.go b/pkg/types/llo/types_test.go index 3ae3b5223..4caad6f32 100644 --- a/pkg/types/llo/types_test.go +++ b/pkg/types/llo/types_test.go @@ -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", @@ -37,7 +37,7 @@ func Test_ChannelDefinitions_Serialization(t *testing.T) { }, "tombstone": false, "source": 2, - "allowNilStreamValues": true + "disableNilStreamValues": false } }` var channelDefinitions ChannelDefinitions @@ -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)) }) @@ -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() @@ -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", @@ -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)))