Skip to content

Commit 2dfd8e9

Browse files
committed
Add vendored CCTP contract binaries
1 parent 8abeb5f commit 2dfd8e9

File tree

6 files changed

+14
-1
lines changed

6 files changed

+14
-1
lines changed

chains/solana/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
contracts/target/*
99
!contracts/target/idl/
1010
!contracts/target/types/
11+
!contracts/target/vendor/
12+
!contracts/target/vendor/*
1113
contracts/programs/*/target
1214
contracts/.anchor
1315
# keypair used by anchor/anchor test
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder contains the binaries of third-party programs that we use in our testing.
Binary file not shown.
Binary file not shown.

chains/solana/contracts/tests/testutils/anchor.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,15 @@ func SetupTestValidatorWithAnchorPrograms(t *testing.T, pathToAnchorConfig strin
9898

9999
flags := []string{}
100100
for k, v := range anchorData.Programs.Localnet {
101-
flags = append(flags, "--upgradeable-program", v, filepath.Join(ContractsDir, k+".so"), upgradeAuthority)
101+
filename := k + ".so"
102+
file := filepath.Join(ContractsDir, filename) // try target/deploy binaries first
103+
if _, err := os.Stat(file); os.IsNotExist(err) {
104+
file = filepath.Join(VendorContractsDir, filename) // try target/vendor binaries next
105+
if _, err := os.Stat(file); os.IsNotExist(err) {
106+
require.FailNowf(t, "Program file not found", "Could not find program file %s in either %s or %s", filename, ContractsDir, VendorContractsDir)
107+
}
108+
}
109+
flags = append(flags, "--upgradeable-program", v, file, upgradeAuthority)
102110
}
103111
url, _ := SetupLocalSolNodeWithFlags(t, flags...)
104112
return url

chains/solana/contracts/tests/testutils/project_path.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ var (
1111
ProjectRoot = filepath.Join(filepath.Dir(b), "/../..")
1212
// ContractsDir path to our contracts
1313
ContractsDir = filepath.Join(ProjectRoot, "target", "deploy")
14+
// VendorContractsDir path to vendored contract binaries
15+
VendorContractsDir = filepath.Join(ProjectRoot, "target", "vendor")
1416
)

0 commit comments

Comments
 (0)