diff --git a/go.mod b/go.mod index 93585bd..e0b295e 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,8 @@ go 1.21.3 require ( github.com/hashicorp/go-plugin v1.6.0 - github.com/smartcontractkit/chainlink-common v0.1.7-0.20240324182820-92b84cfb6373 - github.com/smartcontractkit/libocr v0.0.0-20240322223357-61738d25af14 + github.com/smartcontractkit/chainlink-common v0.1.7-0.20240327133125-eed636b9a6df + github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052 github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index 2892bc4..dcacadf 100644 --- a/go.sum +++ b/go.sum @@ -207,19 +207,17 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240324182820-92b84cfb6373 h1:zlPLi+aJRwOp4Y/JlHSqKnBd038rCCUzgDSYszbmySI= -github.com/smartcontractkit/chainlink-common v0.1.7-0.20240324182820-92b84cfb6373/go.mod h1:kmBPIyrTt8Q3HuSC3qdK96uwr4edw9SYbxjWmle7la4= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240327133125-eed636b9a6df h1:AKjckaIV8R53dLJwoQ3VlUI56L34Ca+nkkzjR1784zY= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20240327133125-eed636b9a6df/go.mod h1:u2XnvJHl7sQ9HMlRnVLsOKgV9ihk0RGIYywB12p9gQQ= github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo= 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-20240322223357-61738d25af14 h1:sGlxJ7y3guP20ohhn23XDj5kPXf+sOR7iFJaWjIvao0= -github.com/smartcontractkit/libocr v0.0.0-20240322223357-61738d25af14/go.mod h1:SJEZCHgMCAzzBvo9vMV2DQ9onfEcIJCYSViyP4JI6c4= +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/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= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= diff --git a/median/report_codec.go b/median/report_codec.go index 3e7a732..971c6d5 100644 --- a/median/report_codec.go +++ b/median/report_codec.go @@ -19,7 +19,7 @@ type reportCodec struct { var _ median.ReportCodec = &reportCodec{} -func (r *reportCodec) BuildReport(ctx context.Context, observations []median.ParsedAttributedObservation) (ocrtypes.Report, error) { +func (r *reportCodec) BuildReport(observations []median.ParsedAttributedObservation) (ocrtypes.Report, error) { if len(observations) == 0 { return nil, fmt.Errorf("cannot build report from empty attributed observations") } @@ -27,7 +27,7 @@ func (r *reportCodec) BuildReport(ctx context.Context, observations []median.Par return r.codec.Encode(context.Background(), aggregate(observations), typeName) } -func (r *reportCodec) MedianFromReport(ctx context.Context, report ocrtypes.Report) (*big.Int, error) { +func (r *reportCodec) MedianFromReport(report ocrtypes.Report) (*big.Int, error) { agg := &aggregatedAttributedObservation{} if err := r.codec.Decode(context.Background(), report, agg, typeName); err != nil { return nil, err @@ -38,6 +38,6 @@ func (r *reportCodec) MedianFromReport(ctx context.Context, report ocrtypes.Repo return agg.Observations[medianObservation], nil } -func (r *reportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { +func (r *reportCodec) MaxReportLength(n int) (int, error) { return r.codec.GetMaxDecodingSize(context.Background(), n, typeName) } diff --git a/median/report_codec_test.go b/median/report_codec_test.go index 57b95f3..ab7deaf 100644 --- a/median/report_codec_test.go +++ b/median/report_codec_test.go @@ -11,8 +11,6 @@ import ( "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestReportCodec(t *testing.T) { @@ -61,7 +59,7 @@ func TestReportCodec(t *testing.T) { }, } - encoded, err := rc.BuildReport(tests.Context(t), anyReports) + encoded, err := rc.BuildReport(anyReports) require.NoError(t, err) assert.Equal(t, types.Report(anyEncodedReport), encoded) }) @@ -75,11 +73,10 @@ func TestReportCodec(t *testing.T) { }, } - ctx := tests.Context(t) - _, err := rc.BuildReport(ctx, nil) + _, err := rc.BuildReport(nil) assert.Error(t, err) - _, err = rc.BuildReport(ctx, []median.ParsedAttributedObservation{}) + _, err = rc.BuildReport([]median.ParsedAttributedObservation{}) assert.Error(t, err) }) @@ -93,7 +90,7 @@ func TestReportCodec(t *testing.T) { }, } - _, err := rc.BuildReport(tests.Context(t), anyReports) + _, err := rc.BuildReport(anyReports) assert.Equal(t, anyError, err) }) @@ -106,7 +103,7 @@ func TestReportCodec(t *testing.T) { }, } - medianVal, err := rc.MedianFromReport(tests.Context(t), anyEncodedReport) + medianVal, err := rc.MedianFromReport(anyEncodedReport) require.NoError(t, err) assert.Equal(t, big.NewInt(250), medianVal) }) @@ -121,7 +118,7 @@ func TestReportCodec(t *testing.T) { }, } - _, err := rc.MedianFromReport(tests.Context(t), anyEncodedReport) + _, err := rc.MedianFromReport(anyEncodedReport) assert.Equal(t, anyError, err) }) @@ -136,7 +133,7 @@ func TestReportCodec(t *testing.T) { }, } - length, err := rc.MaxReportLength(tests.Context(t), anyN) + length, err := rc.MaxReportLength(anyN) require.NoError(t, err) assert.Equal(t, anyLen, length) }) @@ -150,7 +147,7 @@ func TestReportCodec(t *testing.T) { }, } - _, err := rc.MaxReportLength(tests.Context(t), 10) + _, err := rc.MaxReportLength(10) assert.Equal(t, anyError, err) }) }