Skip to content

Commit

Permalink
addressed feedback comments
Browse files Browse the repository at this point in the history
  • Loading branch information
silaslenihan committed Dec 13, 2024
1 parent dee7d72 commit 99d006d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 42 deletions.
2 changes: 2 additions & 0 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
github.com/linkedin/goavro/v2 v2.12.0 h1:rIQQSj8jdAUlKQh6DttK8wCRv4t4QO09g1C4aBWXslg=
github.com/linkedin/goavro/v2 v2.12.0/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk=
github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8=
github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4=
github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY=
Expand Down
9 changes: 4 additions & 5 deletions integration-tests/relayinterface/lookups_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package relayinterface

import (
"context"
"reflect"
"testing"
"time"
Expand Down Expand Up @@ -153,7 +152,7 @@ func TestPDALookups(t *testing.T) {
IsWritable: true,
}

ctx := context.Background()
ctx := tests.Context(t)
result, err := pdaLookup.Resolve(ctx, nil, nil, nil)
require.NoError(t, err)
require.Equal(t, expectedMeta, result)
Expand Down Expand Up @@ -184,7 +183,7 @@ func TestPDALookups(t *testing.T) {
IsWritable: true,
}

ctx := context.Background()
ctx := tests.Context(t)
args := map[string]interface{}{
"test_seed": seed1,
"another_seed": seed2,
Expand All @@ -206,7 +205,7 @@ func TestPDALookups(t *testing.T) {
IsWritable: true,
}

ctx := context.Background()
ctx := tests.Context(t)
args := map[string]interface{}{
"test_seed": []byte("data"),
}
Expand Down Expand Up @@ -242,7 +241,7 @@ func TestPDALookups(t *testing.T) {
IsWritable: true,
}

ctx := context.Background()
ctx := tests.Context(t)
args := map[string]interface{}{
"test_seed": seed1,
"another_seed": seed2,
Expand Down
13 changes: 3 additions & 10 deletions pkg/solana/chainwriter/ccip_example_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package chainwriter

import (
"fmt"

commoncodec "github.com/smartcontractkit/chainlink-common/pkg/codec"
)

func TestConfig() {
Expand All @@ -22,14 +20,9 @@ func TestConfig() {
executionReportSingleChainIDL := `{"name":"ExecutionReportSingleChain","type":{"kind":"struct","fields":[{"name":"source_chain_selector","type":"u64"},{"name":"message","type":{"defined":"Any2SolanaRampMessage"}},{"name":"root","type":{"array":["u8",32]}},{"name":"proofs","type":{"vec":{"array":["u8",32]}}}]}},{"name":"Any2SolanaRampMessage","type":{"kind":"struct","fields":[{"name":"header","type":{"defined":"RampMessageHeader"}},{"name":"sender","type":{"vec":"u8"}},{"name":"data","type":{"vec":"u8"}},{"name":"receiver","type":{"array":["u8",32]}},{"name":"extra_args","type":{"defined":"SolanaExtraArgs"}}]}},{"name":"RampMessageHeader","type":{"kind":"struct","fields":[{"name":"message_id","type":{"array":["u8",32]}},{"name":"source_chain_selector","type":"u64"},{"name":"dest_chain_selector","type":"u64"},{"name":"sequence_number","type":"u64"},{"name":"nonce","type":"u64"}]}},{"name":"SolanaExtraArgs","type":{"kind":"struct","fields":[{"name":"compute_units","type":"u32"},{"name":"allow_out_of_order_execution","type":"bool"}]}}`

executeConfig := MethodConfig{
FromAddress: userAddress,
InputModifications: commoncodec.ModifiersConfig{
// remove merkle root since it isn't a part of the on-chain type
&commoncodec.DropModifierConfig{
Fields: []string{"Message.ExtraArgs.MerkleRoot"},
},
},
ChainSpecificName: "execute",
FromAddress: userAddress,
InputModifications: nil,
ChainSpecificName: "execute",
// LookupTables are on-chain stores of accounts. They can be used in two ways:
// 1. As a way to store a list of accounts that are all associated together (i.e. Token State registry)
// 2. To compress the transactions in a TX and reduce the size of the TX. (The traditional way)
Expand Down
7 changes: 1 addition & 6 deletions pkg/solana/chainwriter/chain_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (s *SolanaChainWriterService) SubmitTransaction(ctx context.Context, contra
}

// Prepare transaction
programID, err := solana.PublicKeyFromBase58(contractName)
programID, err := solana.PublicKeyFromBase58(toAddress)
if err != nil {
return errorWithDebugID(fmt.Errorf("error parsing program ID: %w", err), debugID)
}
Expand Down Expand Up @@ -281,11 +281,6 @@ func (s *SolanaChainWriterService) SubmitTransaction(ctx context.Context, contra
return nil
}

var (
_ services.Service = &SolanaChainWriterService{}
_ types.ContractWriter = &SolanaChainWriterService{}
)

// GetTransactionStatus returns the current status of a transaction in the underlying chain's TXM.
func (s *SolanaChainWriterService) GetTransactionStatus(ctx context.Context, transactionID string) (types.TransactionStatus, error) {
return s.txm.GetTransactionStatus(ctx, transactionID)
Expand Down
22 changes: 1 addition & 21 deletions pkg/solana/chainwriter/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func GetValuesAtLocation(args any, location string) ([][]byte, error) {
}

func GetDebugIDAtLocation(args any, location string) (string, error) {
debugIDList, err := GetValueAtLocation(args, location)
debugIDList, err := GetValuesAtLocation(args, location)
if err != nil {
return "", err
}
Expand All @@ -67,26 +67,6 @@ func GetDebugIDAtLocation(args any, location string) (string, error) {
return debugID, nil
}

func GetValueAtLocation(args any, location string) ([][]byte, error) {
path := strings.Split(location, ".")

valueList, err := traversePath(args, path)
if err != nil {
return nil, err
}

var values [][]byte
for _, value := range valueList {
byteArray, ok := value.([]byte)
if !ok {
return nil, fmt.Errorf("invalid value format at path: %s", location)
}
values = append(values, byteArray)
}

return values, nil
}

func errorWithDebugID(err error, debugID string) error {
if debugID == "" {
return err
Expand Down

0 comments on commit 99d006d

Please sign in to comment.