Skip to content

Commit

Permalink
lint and fix CR integration tests cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija42 committed Dec 24, 2024
1 parent 6d9e500 commit 382f401
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 32 deletions.
45 changes: 18 additions & 27 deletions integration-tests/relayinterface/chain_components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,48 +131,39 @@ type SolanaChainComponentsInterfaceTester[T TestingT[T]] struct {
TestSelectionSupport
Helper SolanaChainComponentsInterfaceTesterHelper[T]
cr *chainreader.SolanaChainReaderService
chainReaderConfig config.ChainReader
contractReaderConfig config.ContractReader
}

func (it *SolanaChainComponentsInterfaceTester[T]) Setup(t T) {
t.Cleanup(func() {})

it.chainReaderConfig = config.ChainReader{
Namespaces: map[string]config.ChainReaderMethods{
it.contractReaderConfig = config.ContractReader{
Namespaces: map[string]config.ChainContractReader{
AnyContractName: {
Methods: map[string]config.ChainDataReader{
IDL: string(it.Helper.GetJSONEncodedIDL(t)),
Reads: map[string]config.ReadDefinition{
MethodReturningUint64: {
AnchorIDL: string(it.Helper.GetJSONEncodedIDL(t)),
Encoding: config.EncodingTypeBorsh,
Procedure: config.ChainReaderProcedure{
IDLAccount: "DataAccount",
OutputModifications: codec.ModifiersConfig{
&codec.PropertyExtractorConfig{FieldName: "U64Value"},
},
ChainSpecificName: "DataAccount",
ReadType: config.Account,
OutputModifications: codec.ModifiersConfig{
&codec.PropertyExtractorConfig{FieldName: "U64Value"},
},
},
MethodReturningUint64Slice: {
AnchorIDL: string(it.Helper.GetJSONEncodedIDL(t)),
Encoding: config.EncodingTypeBorsh,
Procedure: config.ChainReaderProcedure{
IDLAccount: "DataAccount",
OutputModifications: codec.ModifiersConfig{
&codec.PropertyExtractorConfig{FieldName: "U64Slice"},
},
ChainSpecificName: "DataAccount",
OutputModifications: codec.ModifiersConfig{
&codec.PropertyExtractorConfig{FieldName: "U64Slice"},
},
},
},
},
AnySecondContractName: {
Methods: map[string]config.ChainDataReader{
IDL: string(it.Helper.GetJSONEncodedIDL(t)),
Reads: map[string]config.ReadDefinition{
MethodReturningUint64: {
AnchorIDL: string(it.Helper.GetJSONEncodedIDL(t)),
Encoding: config.EncodingTypeBorsh,
Procedure: config.ChainReaderProcedure{
IDLAccount: "DataAccount",
OutputModifications: codec.ModifiersConfig{
&codec.PropertyExtractorConfig{FieldName: "U64Value"},
},
ChainSpecificName: "DataAccount",
OutputModifications: codec.ModifiersConfig{
&codec.PropertyExtractorConfig{FieldName: "U64Value"},
},
},
},
Expand All @@ -199,7 +190,7 @@ func (it *SolanaChainComponentsInterfaceTester[T]) GetContractReader(t T) types.
return it.cr
}

svc, err := chainreader.NewChainReaderService(it.Helper.Logger(t), it.Helper.RPCClient(), it.chainReaderConfig)
svc, err := chainreader.NewChainReaderService(it.Helper.Logger(t), it.Helper.RPCClient(), it.contractReaderConfig)

require.NoError(t, err)
require.NoError(t, svc.Start(ctx))
Expand Down
1 change: 1 addition & 0 deletions pkg/solana/chainreader/account_read_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/gagliardetto/solana-go/rpc"

"github.com/smartcontractkit/chainlink-common/pkg/types"

"github.com/smartcontractkit/chainlink-solana/pkg/solana/codec"
)

Expand Down
5 changes: 0 additions & 5 deletions pkg/solana/chainreader/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@ func (s *SolanaChainReaderService) init(namespaces map[string]config.ChainContra
return nil
}

type accountIDLTypes struct {
Account codec.IdlTypeDef
Types codec.IdlTypeDefSlice
}

func (s *SolanaChainReaderService) addAccountRead(namespace string, itemType string, idl codec.IDL, idlType codec.IdlTypeDef, readDefinition config.ReadDefinition) error {
inputAccountIDLDef := codec.NilIdlTypeDefTy
// TODO:
Expand Down

0 comments on commit 382f401

Please sign in to comment.