From 13c17a91b2ab906892ec644d9017425234cc45f5 Mon Sep 17 00:00:00 2001 From: Augustus <14297860+augustbleeds@users.noreply.github.com> Date: Mon, 22 Apr 2024 06:02:41 -0700 Subject: [PATCH] add new datasource (#62) * add new ds * remove comment --- go.mod | 2 +- go.sum | 4 ++-- median/plugin.go | 12 ++++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index e0b295e..efb1308 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21.3 require ( github.com/hashicorp/go-plugin v1.6.0 github.com/smartcontractkit/chainlink-common v0.1.7-0.20240327133125-eed636b9a6df - github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052 + github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index dcacadf..f7ac6eb 100644 --- a/go.sum +++ b/go.sum @@ -213,8 +213,8 @@ github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+ github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= -github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052 h1:1WFjrrVrWoQ9UpVMh7Mx4jDpzhmo1h8hFUKd9awIhIU= -github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052/go.mod h1:SJEZCHgMCAzzBvo9vMV2DQ9onfEcIJCYSViyP4JI6c4= +github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c h1:lIyMbTaF2H0Q71vkwZHX/Ew4KF2BxiKhqEXwF8rn+KI= +github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/median/plugin.go b/median/plugin.go index 1780c60..5c19d95 100644 --- a/median/plugin.go +++ b/median/plugin.go @@ -32,8 +32,10 @@ func (p *Plugin) NewMedianFactory(ctx context.Context, provider types.MedianProv lggr := logger.With(p.Logger, ctxVals.Args()...) factory := median.NumericalMedianFactory{ - DataSource: dataSource, - JuelsPerFeeCoinDataSource: juelsPerFeeCoin, + DataSource: dataSource, + JuelsPerFeeCoinDataSource: juelsPerFeeCoin, + GasPriceSubunitsDataSource: &ZeroDataSource{}, + IncludeGasPriceSubunitsInObservation: false, Logger: logger.NewOCRWrapper(lggr, true, func(msg string) { ctx, cancelFn := p.stop.NewCtx() defer cancelFn() @@ -64,6 +66,12 @@ func (p *Plugin) NewMedianFactory(ctx context.Context, provider types.MedianProv return s, nil } +type ZeroDataSource struct{} + +func (d *ZeroDataSource) Observe(ctx context.Context, reportTimestamp ocrtypes.ReportTimestamp) (*big.Int, error) { + return new(big.Int), nil +} + type reportingPluginFactoryService struct { services.StateMachine lggr logger.Logger