Skip to content

Commit

Permalink
BCI-1426: Add GasPriceSubunits Data Source Pipeline (#13200)
Browse files Browse the repository at this point in the history
* initial

* incorporate gasPriceSubunits data source

* update deps

* add in data source

* comment

* update plugin config

* add changeset

* update chainlink-common & chainlink-feeds

* lint fixes

* lint

---------

Co-authored-by: Bolek <1416262+bolekk@users.noreply.github.com>
  • Loading branch information
augustbleeds and bolekk committed Jun 17, 2024
1 parent 97e8d48 commit 0115ac1
Show file tree
Hide file tree
Showing 19 changed files with 186 additions and 75 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-plums-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Add option to include GasPriceSubunits pipeline to include gasPriceSubunits in median ocr2 transmission (only to be used with Starknet chain for now) #added #nops #updated
6 changes: 3 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
golang 1.21.7
mockery 2.42.2
nodejs 16.16.0
pnpm 8.11.0
postgres 13.3
nodejs 20.13.1
pnpm 8.15.8
postgres 15.1
helm 3.10.3
zig 0.11.0
golangci-lint 1.55.2
Expand Down
11 changes: 9 additions & 2 deletions core/internal/features/ocr2/features_ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ fromBlock = %d
}))
t.Cleanup(servers[s].Close)
u, _ := url.Parse(servers[i].URL)
bridgeName := fmt.Sprintf("bridge%d", i)
require.NoError(t, apps[i].BridgeORM().CreateBridgeType(testutils.Context(t), &bridges.BridgeType{
Name: bridges.BridgeName(fmt.Sprintf("bridge%d", i)),
Name: bridges.BridgeName(bridgeName),
URL: models.WebURL(*u),
}))

Expand Down Expand Up @@ -488,9 +489,15 @@ juelsPerFeeCoinSource = """
answer1 [type=median index=0];
"""
gasPriceSource = """
// data source
dsp [type=bridge name="%s"];
dsp_parse [type=jsonparse path="data"];
dsp -> dsp_parse;
"""
[pluginConfig.juelsPerFeeCoinCache]
updateInterval = "1m"
`, ocrContractAddress, kbs[i].ID(), transmitters[i], fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i, blockBeforeConfig.Number().Int64(), chainReaderSpec, fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i), nil)
`, ocrContractAddress, kbs[i].ID(), transmitters[i], bridgeName, i, slowServers[i].URL, i, blockBeforeConfig.Number().Int64(), chainReaderSpec, bridgeName, i, slowServers[i].URL, i, bridgeName), nil)
require.NoError(t, err)
err = apps[i].AddJobV2(testutils.Context(t), &ocrJob)
require.NoError(t, err)
Expand Down
8 changes: 4 additions & 4 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/prometheus/client_golang v1.17.0
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/chainlink-automation v1.0.3
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240429120925-907b29311feb
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614192253-77cca30c8a12
github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c
Expand Down Expand Up @@ -53,7 +53,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/NethermindEth/juno v0.3.1 // indirect
github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 // indirect
github.com/NethermindEth/starknet.go v0.7.1-0.20240401080518-34a506f3cfdb // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/XSAM/otelsql v0.27.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
Expand Down Expand Up @@ -258,9 +258,9 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.10 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240419213354-ea34a948e2ee // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240617141425-d184a59a6b42 // indirect
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240422172640-59d47c73ba58 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240325075535-0f7eb05ee595 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240617160336-d23102a8ba32 // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect
github.com/smartcontractkit/wsrpc v0.8.1 // indirect
Expand Down
16 changes: 8 additions & 8 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/NethermindEth/juno v0.3.1 h1:AW72LiAm9gqUeCVJWvepnZcTnpU4Vkl0KzPMxS+42FA=
github.com/NethermindEth/juno v0.3.1/go.mod h1:SGbTpgGaCsxhFsKOid7Ylnz//WZ8swtILk+NbHGsk/Q=
github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 h1:9SBvy3eZut1X+wEyAFqfb7ADGj8IQw7ZnlkMwz0YOTY=
github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1/go.mod h1:V6qrbi1+fTDCftETIT1grBXIf+TvWP/4Aois1a9EF1E=
github.com/NethermindEth/starknet.go v0.7.1-0.20240401080518-34a506f3cfdb h1:Mv8SscePPyw2ju4igIJAjFgcq5zCQfjgbz53DwYu5mc=
github.com/NethermindEth/starknet.go v0.7.1-0.20240401080518-34a506f3cfdb/go.mod h1:gQkhWpAs9/QR6reZU2xoi1UIYlMS64FLTlh9CrgHH/Y=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
Expand Down Expand Up @@ -1185,18 +1185,18 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq
github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.3 h1:h/ijT0NiyV06VxYVgcNfsE3+8OEzT3Q0Z9au0z1BPWs=
github.com/smartcontractkit/chainlink-automation v1.0.3/go.mod h1:RjboV0Qd7YP+To+OrzHGXaxUxoSONveCoAK2TQ1INLU=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240429120925-907b29311feb h1:nJ9dkgvX5vdpFWhYufnRUAiNvNHsXkoBL6C0bDerq/k=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240429120925-907b29311feb/go.mod h1:GTDBbovHUSAUk+fuGIySF2A/whhdtHGaWmU61BoERks=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614192253-77cca30c8a12 h1:L+sWJRyl7veCiHeOAjEaiahodvU+ACRzVKhfVsfQMdg=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614192253-77cca30c8a12/go.mod h1:IZaCD+a40hs6uL7s5r1gBwL5G+hP3LU6lfOVh21c6T8=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240419213354-ea34a948e2ee h1:eFuBKyEbL2b+eyfgV/Eu9+8HuCEev+IcBi+K9l1dG7g=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240419213354-ea34a948e2ee/go.mod h1:uATrrJ8IsuBkOBJ46USuf73gz9gZy5k5bzGE5/ji/rc=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540/go.mod h1:sjAmX8K2kbQhvDarZE1ZZgDgmHJ50s0BBc/66vKY2ek=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab h1:Ct1oUlyn03HDUVdFHJqtRGRUujMqdoMzvf/Cjhe30Ag=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab/go.mod h1:RPUY7r8GxgzXxS1ijtU1P/fpJomOXztXgUbEziNmbCA=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240617141425-d184a59a6b42 h1:9Xn2xfKdHORnbzU3A5JodXNNLPf8gp0wSaBR5hNFDUA=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240617141425-d184a59a6b42/go.mod h1:PJlzwLaYsA7YcAKXdysMjNONeIolPrRjT9v/AMo4Er0=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240422172640-59d47c73ba58 h1:jc4ab5QrKZfkICyxJysCt7mSExuSPbePjgZsnJR3nRQ=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240422172640-59d47c73ba58/go.mod h1:oV5gIuSKrPEcjQ6uB6smBsm5kXHxyydVLNyAs4V9CoQ=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240325075535-0f7eb05ee595 h1:y6ks0HsSOhPUueOmTcoxDQ50RCS1XINlRDTemZyHjFw=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240325075535-0f7eb05ee595/go.mod h1:vV6WfnVIbK5Q1JsIru4YcTG0T1uRpLJm6t2BgCnCSsg=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240617160336-d23102a8ba32 h1:9yNZQT/Iel7k7Lo/+PKr/F1LXCasF/Mo0Y1SNgzOD/o=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240617160336-d23102a8ba32/go.mod h1:Fqkjgw9r7sT0D6OvRyygm1sqeBE1XNtbmHkz9RFhNZg=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 h1:LQmRsrzzaYYN3wEU1l5tWiccznhvbyGnu2N+wHSXZAo=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs=
github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo=
Expand Down
16 changes: 16 additions & 0 deletions core/services/feeds/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];
"""
gasPriceSubunitsSource = """
ds1 [type=bridge name=voter_turnout];
ds1_parse [type=jsonparse path="one,two"];
ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];
"""
[pluginConfig.juelsPerFeeCoinCache]
updateInterval = "1m"
`
Expand Down Expand Up @@ -978,6 +985,7 @@ ds1_parse [type=jsonparse path="one,two"];
ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];
# omit gasPriceSubunitsSource intentionally
"""
`

Expand Down Expand Up @@ -2293,6 +2301,13 @@ ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];
"""
gasPriceSubunitsSource = """
ds1 [type=bridge name=voter_turnout];
ds1_parse [type=jsonparse path="one,two"];
ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];
"""
[pluginConfig.juelsPerFeeCoinCache]
updateInterval = "30s"
`
Expand Down Expand Up @@ -2324,6 +2339,7 @@ ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];
"""
# intentionally do not set gasPriceSubunitsSource for this pipeline example to cover case when none is set
[pluginConfig.juelsPerFeeCoinCache]
updateInterval = "20m"
`
Expand Down
28 changes: 20 additions & 8 deletions core/services/job/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,28 @@ func (o *orm) CreateJob(ctx context.Context, jb *Job) error {

if jb.OCR2OracleSpec.PluginType == types.Median {
var cfg medianconfig.PluginConfig
err2 := json.Unmarshal(jb.OCR2OracleSpec.PluginConfig.Bytes(), &cfg)
if err2 != nil {
return errors.Wrap(err2, "failed to parse plugin config")

validatePipeline := func(p string) error {
pipeline, pipelineErr := pipeline.Parse(p)
if pipelineErr != nil {
return pipelineErr
}
return tx.AssertBridgesExist(ctx, *pipeline)
}
feePipeline, err2 := pipeline.Parse(cfg.JuelsPerFeeCoinPipeline)
if err2 != nil {
return err2

errUnmarshal := json.Unmarshal(jb.OCR2OracleSpec.PluginConfig.Bytes(), &cfg)
if errUnmarshal != nil {
return errors.Wrap(errUnmarshal, "failed to parse plugin config")
}
if err2 = tx.AssertBridgesExist(ctx, *feePipeline); err2 != nil {
return err2

if errFeePipeline := validatePipeline(cfg.JuelsPerFeeCoinPipeline); errFeePipeline != nil {
return errFeePipeline
}

if cfg.HasGasPriceSubunitsPipeline() {
if errGasPipeline := validatePipeline(cfg.GasPriceSubunitsPipeline); errGasPipeline != nil {
return errGasPipeline
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion core/services/ocr2/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ func MustInsertOCROracleSpec(t *testing.T, db *sqlx.DB, transmitterAddress types
ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];`
config := medianconfig.PluginConfig{JuelsPerFeeCoinPipeline: mockJuelsPerFeeCoinSource}
mockGasPriceSubunitsSource := `ds1 [type=bridge name=voter_turnout];
ds1_parse [type=jsonparse path="one,two"];
ds1_multiply [type=multiply times=1.23];
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];`
config := medianconfig.PluginConfig{JuelsPerFeeCoinPipeline: mockJuelsPerFeeCoinSource, GasPriceSubunitsPipeline: mockGasPriceSubunitsSource}
jsonConfig, err := json.Marshal(config)
require.NoError(t, err)

Expand Down
19 changes: 17 additions & 2 deletions core/services/ocr2/plugins/median/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package config

import (
"strings"
"time"

"github.com/pkg/errors"
Expand All @@ -13,8 +14,11 @@ import (
)

// The PluginConfig struct contains the custom arguments needed for the Median plugin.
// To avoid a catastrophic libocr codec error, you must make sure that either all nodes in the same DON
// (1) have no GasPriceSubunitsPipeline or all nodes in the same DON (2) have a GasPriceSubunitsPipeline
type PluginConfig struct {
JuelsPerFeeCoinPipeline string `json:"juelsPerFeeCoinSource"`
GasPriceSubunitsPipeline string `json:"gasPriceSubunitsSource"`
JuelsPerFeeCoinPipeline string `json:"juelsPerFeeCoinSource"`
// JuelsPerFeeCoinCache is disabled when nil
JuelsPerFeeCoinCache *JuelsPerFeeCoinCache `json:"juelsPerFeeCoinCache"`
}
Expand All @@ -26,7 +30,7 @@ type JuelsPerFeeCoinCache struct {
}

// ValidatePluginConfig validates the arguments for the Median plugin.
func ValidatePluginConfig(config PluginConfig) error {
func (config *PluginConfig) ValidatePluginConfig() error {
if _, err := pipeline.Parse(config.JuelsPerFeeCoinPipeline); err != nil {
return errors.Wrap(err, "invalid juelsPerFeeCoinSource pipeline")
}
Expand All @@ -41,5 +45,16 @@ func ValidatePluginConfig(config PluginConfig) error {
}
}

// Gas price pipeline is optional
if !config.HasGasPriceSubunitsPipeline() {
return nil
} else if _, err := pipeline.Parse(config.GasPriceSubunitsPipeline); err != nil {
return errors.Wrap(err, "invalid gasPriceSubunitsSource pipeline")
}

return nil
}

func (config *PluginConfig) HasGasPriceSubunitsPipeline() bool {
return strings.TrimSpace(config.GasPriceSubunitsPipeline) != ""
}
9 changes: 6 additions & 3 deletions core/services/ocr2/plugins/median/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func TestValidatePluginConfig(t *testing.T) {
{"foo pipeline", "foo", models.Interval(time.Minute), fmt.Errorf("invalid juelsPerFeeCoinSource pipeline: UnmarshalTaskFromMap: unknown task type: \"\"")},
} {
t.Run(tc.name, func(t *testing.T) {
assert.EqualError(t, ValidatePluginConfig(PluginConfig{JuelsPerFeeCoinPipeline: tc.pipeline}), tc.expectedError.Error())
pc := PluginConfig{JuelsPerFeeCoinPipeline: tc.pipeline}
assert.EqualError(t, pc.ValidatePluginConfig(), tc.expectedError.Error())
})
}
})
Expand All @@ -36,7 +37,8 @@ func TestValidatePluginConfig(t *testing.T) {
{"cache duration above maximum", `ds1 [type=bridge name=voter_turnout];`, models.Interval(time.Minute*20 + time.Second), fmt.Errorf("juelsPerFeeCoinSourceCache update interval: 20m1s is above 20 minute maximum")},
} {
t.Run(tc.name, func(t *testing.T) {
assert.EqualError(t, ValidatePluginConfig(PluginConfig{JuelsPerFeeCoinPipeline: tc.pipeline, JuelsPerFeeCoinCache: &JuelsPerFeeCoinCache{UpdateInterval: tc.cacheDuration}}), tc.expectedError.Error())
pc := PluginConfig{JuelsPerFeeCoinPipeline: tc.pipeline, JuelsPerFeeCoinCache: &JuelsPerFeeCoinCache{UpdateInterval: tc.cacheDuration}}
assert.EqualError(t, pc.ValidatePluginConfig(), tc.expectedError.Error())
})
}
})
Expand All @@ -48,7 +50,8 @@ func TestValidatePluginConfig(t *testing.T) {
{"valid duration and valid pipeline", `ds1 [type=bridge name=voter_turnout];`, models.Interval(time.Minute * 20), nil},
} {
t.Run(s.name, func(t *testing.T) {
assert.Nil(t, ValidatePluginConfig(PluginConfig{JuelsPerFeeCoinPipeline: s.pipeline}))
pc := PluginConfig{JuelsPerFeeCoinPipeline: s.pipeline}
assert.Nil(t, pc.ValidatePluginConfig())
})
}
})
Expand Down
18 changes: 15 additions & 3 deletions core/services/ocr2/plugins/median/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"time"

libocr_median "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median"
libocr "github.com/smartcontractkit/libocr/offchainreporting2plus"

"github.com/smartcontractkit/chainlink-common/pkg/loop"
Expand Down Expand Up @@ -69,7 +70,7 @@ func NewMedianServices(ctx context.Context,
if err != nil {
return
}
err = config.ValidatePluginConfig(pluginConfig)
err = pluginConfig.ValidatePluginConfig()
if err != nil {
return
}
Expand Down Expand Up @@ -136,6 +137,17 @@ func NewMedianServices(ctx context.Context,
srvs = append(srvs, juelsPerFeeCoinSourceCache)
}

var gasPriceSubunitsDataSource libocr_median.DataSource
if pluginConfig.HasGasPriceSubunitsPipeline() {
gasPriceSubunitsDataSource = ocrcommon.NewInMemoryDataSource(pipelineRunner, jb, pipeline.Spec{
ID: jb.ID,
DotDagSource: pluginConfig.GasPriceSubunitsPipeline,
CreatedAt: time.Now(),
}, lggr)
} else {
gasPriceSubunitsDataSource = &median.ZeroDataSource{}
}

if cmdName := env.MedianPlugin.Cmd.Get(); cmdName != "" {
// use unique logger names so we can use it to register a loop
medianLggr := lggr.Named("Median").Named(spec.ContractID).Named(spec.GetID())
Expand All @@ -155,11 +167,11 @@ func NewMedianServices(ctx context.Context,
abort()
return
}
median := loop.NewMedianService(lggr, telem, cmdFn, medianProvider, dataSource, juelsPerFeeCoinSource, errorLog)
median := loop.NewMedianService(lggr, telem, cmdFn, medianProvider, dataSource, juelsPerFeeCoinSource, gasPriceSubunitsDataSource, errorLog)
argsNoPlugin.ReportingPluginFactory = median
srvs = append(srvs, median)
} else {
argsNoPlugin.ReportingPluginFactory, err = median.NewPlugin(lggr).NewMedianFactory(ctx, medianProvider, dataSource, juelsPerFeeCoinSource, errorLog)
argsNoPlugin.ReportingPluginFactory, err = median.NewPlugin(lggr).NewMedianFactory(ctx, medianProvider, dataSource, juelsPerFeeCoinSource, gasPriceSubunitsDataSource, errorLog)
if err != nil {
err = fmt.Errorf("failed to create median factory: %w", err)
abort()
Expand Down
4 changes: 2 additions & 2 deletions core/services/ocr2/validate/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ answer1 [type=median index=0];
assert.Equal(t, "median", string(r.PluginType))
var pc medianconfig.PluginConfig
require.NoError(t, json.Unmarshal(r.PluginConfig.Bytes(), &pc))
require.NoError(t, medianconfig.ValidatePluginConfig(pc))
require.NoError(t, pc.ValidatePluginConfig())
var oss validate.OCR2OnchainSigningStrategy
require.NoError(t, json.Unmarshal(r.OnchainSigningStrategy.Bytes(), &oss))
},
Expand Down Expand Up @@ -901,7 +901,7 @@ UpdateInterval="1m"
assert.Equal(t, "median", string(r.PluginType))
var pc medianconfig.PluginConfig
require.NoError(t, json.Unmarshal(r.PluginConfig.Bytes(), &pc))
require.NoError(t, medianconfig.ValidatePluginConfig(pc))
require.NoError(t, pc.ValidatePluginConfig())
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/Masterminds/sprig/v3 v3.2.3
github.com/NethermindEth/juno v0.3.1
github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1
github.com/NethermindEth/starknet.go v0.7.1-0.20240401080518-34a506f3cfdb
github.com/XSAM/otelsql v0.27.0
github.com/avast/retry-go/v4 v4.5.1
github.com/btcsuite/btcd/btcec/v2 v2.3.2
Expand Down Expand Up @@ -72,12 +72,12 @@ require (
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/chain-selectors v1.0.10
github.com/smartcontractkit/chainlink-automation v1.0.3
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240429120925-907b29311feb
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240614192253-77cca30c8a12
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240419213354-ea34a948e2ee
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240617141425-d184a59a6b42
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240422172640-59d47c73ba58
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240325075535-0f7eb05ee595
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240617160336-d23102a8ba32
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1
Expand Down
Loading

0 comments on commit 0115ac1

Please sign in to comment.