Skip to content

Commit

Permalink
Use lenient codec from type codec to allow extra bits
Browse files Browse the repository at this point in the history
  • Loading branch information
nolag committed Apr 18, 2024
1 parent c808024 commit 59620d5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/pelletier/go-toml/v2 v2.1.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.17.0
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240415221539-61f49438443a
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240417194609-e703d51e5e19
github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052
github.com/stretchr/testify v1.9.0
go.uber.org/multierr v1.11.0
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYf
github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.16.0 h1:SE9m0W6DEfgIVCJX7xU+iv/hUl4m/nxqMTnCdMxDpJ8=
github.com/hashicorp/consul/sdk v0.16.0/go.mod h1:7pxqqhqoaPqnBnzXD1StKed62LqJeClzVsUEy85Zr0A=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
Expand Down Expand Up @@ -444,8 +446,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240415221539-61f49438443a h1:TNy4hMoRWCoq9KzrJ0G1aaX1sY75LisvwvVHl71vWPo=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240415221539-61f49438443a/go.mod h1:kstYjAGqBswdZpl7YkSPeXBDVwaY1VaR6tUMPWl8ykA=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240417194609-e703d51e5e19 h1:Xw5q1b9omof2tpMrUIHhb/Gg7ltuu5QbODgRKYSRehI=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240417194609-e703d51e5e19/go.mod h1:kstYjAGqBswdZpl7YkSPeXBDVwaY1VaR6tUMPWl8ykA=
github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss=
github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/lib/pq v1.10.9
github.com/onsi/gomega v1.30.0
github.com/rs/zerolog v1.30.0
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240415221539-61f49438443a
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240417194609-e703d51e5e19
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240216142700-c5869534c19e
github.com/smartcontractkit/chainlink-testing-framework v1.28.2
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240415213707-06bad6e44ff7
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,8 @@ 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.20240415221539-61f49438443a h1:TNy4hMoRWCoq9KzrJ0G1aaX1sY75LisvwvVHl71vWPo=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240415221539-61f49438443a/go.mod h1:kstYjAGqBswdZpl7YkSPeXBDVwaY1VaR6tUMPWl8ykA=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240417194609-e703d51e5e19 h1:Xw5q1b9omof2tpMrUIHhb/Gg7ltuu5QbODgRKYSRehI=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240417194609-e703d51e5e19/go.mod h1:kstYjAGqBswdZpl7YkSPeXBDVwaY1VaR6tUMPWl8ykA=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8 h1:I326nw5GwHQHsLKHwtu5Sb9EBLylC8CfUd7BFAS0jtg=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240213120401-01a23955f9f8/go.mod h1:a65NtrK4xZb01mf0dDNghPkN2wXgcqFQ55ADthVBgMc=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo=
Expand Down
7 changes: 3 additions & 4 deletions pkg/solana/chainreader/chain_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/stretchr/testify/require"

codeccommon "github.com/smartcontractkit/chainlink-common/pkg/codec"
"github.com/smartcontractkit/chainlink-common/pkg/codec/encodings"
"github.com/smartcontractkit/chainlink-common/pkg/codec/encodings/binary"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
commontestutils "github.com/smartcontractkit/chainlink-common/pkg/loop/testutils"
Expand Down Expand Up @@ -263,7 +262,7 @@ func TestSolanaChainReaderService_GetLatestValue(t *testing.T) {
})
}

func newTestIDLAndCodec(t *testing.T) (string, codec.IDL, encodings.CodecFromTypeCodec) {
func newTestIDLAndCodec(t *testing.T) (string, codec.IDL, types.RemoteCodec) {
t.Helper()

var idl codec.IDL
Expand All @@ -283,7 +282,7 @@ func newTestIDLAndCodec(t *testing.T) (string, codec.IDL, encodings.CodecFromTyp
return testutils.JSONIDLWithAllTypes, idl, entry
}

func newTestConfAndCodec(t *testing.T) (encodings.CodecFromTypeCodec, config.ChainReader) {
func newTestConfAndCodec(t *testing.T) (types.RemoteCodec, config.ChainReader) {
t.Helper()

rawIDL, _, testCodec := newTestIDLAndCodec(t)
Expand Down Expand Up @@ -714,7 +713,7 @@ func (r *chainReaderInterfaceTester) MaxWaitTimeForEvents() time.Duration {
return maxWaitTime
}

func makeTestCodec(t *testing.T, rawIDL string, encoding config.EncodingType) encodings.CodecFromTypeCodec {
func makeTestCodec(t *testing.T, rawIDL string, encoding config.EncodingType) types.RemoteCodec {
t.Helper()

var idl codec.IDL
Expand Down
6 changes: 3 additions & 3 deletions pkg/solana/codec/solana.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func NewNamedModifierCodec(original types.RemoteCodec, itemType string, modifier
}

// NewIDLCodec is for Anchor custom types
func NewIDLCodec(idl IDL, builder encodings.Builder) (encodings.CodecFromTypeCodec, error) {
accounts := make(map[string]encodings.TypeCodec)
func NewIDLCodec(idl IDL, builder encodings.Builder) (types.RemoteCodec, error) {
accounts := make(encodings.LenientCodecFromTypeCodec)

refs := &codecRefs{
builder: builder,
Expand All @@ -86,7 +86,7 @@ func NewIDLCodec(idl IDL, builder encodings.Builder) (encodings.CodecFromTypeCod
accounts[name] = accCodec
}

return encodings.CodecFromTypeCodec(accounts), nil
return accounts, nil
}

type codecRefs struct {
Expand Down
3 changes: 1 addition & 2 deletions pkg/solana/codec/solana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/require"

codeccommon "github.com/smartcontractkit/chainlink-common/pkg/codec"
"github.com/smartcontractkit/chainlink-common/pkg/codec/encodings"
"github.com/smartcontractkit/chainlink-common/pkg/codec/encodings/binary"
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
Expand Down Expand Up @@ -119,7 +118,7 @@ func TestNewIDLCodec_CircularDependency(t *testing.T) {
assert.ErrorIs(t, err, types.ErrInvalidConfig)
}

func newTestIDLAndCodec(t *testing.T) (string, codec.IDL, encodings.CodecFromTypeCodec) {
func newTestIDLAndCodec(t *testing.T) (string, codec.IDL, types.RemoteCodec) {
t.Helper()

var idl codec.IDL
Expand Down

0 comments on commit 59620d5

Please sign in to comment.