Skip to content

Commit 240a44f

Browse files
fix(sui): use correct image for arm64 (#328)
When running locally on mac, the SUI CTF provider by default uses the AMD64 image (coded in CTF), so unit tests ran on the mac will fail/hang. This commit add logic to check if we are running in arm architecture and uses the suitable image.
1 parent 82f40ee commit 240a44f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.changeset/red-views-accept.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink-deployments-framework": patch
3+
---
4+
5+
fix(sui): use correct docker image on arm64

chain/sui/provider/ctf_provider.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"runtime"
78
"strconv"
89
"sync"
910
"testing"
@@ -169,13 +170,29 @@ func (p *CTFChainProvider) startContainer(
169170
faucetPort := ports[1]
170171

171172
image := ""
173+
platform := ""
174+
175+
// by default, if image and platform are empty, they are set to amd64 by CTF
176+
// to support running locally on macos arm64, we set the image and platform to ci-arm64 and linux/arm64 respectively
172177
if p.config.Image != nil {
173178
image = *p.config.Image
179+
} else {
180+
if runtime.GOARCH == "arm64" {
181+
image = "mysten/sui-tools:ci-arm64"
182+
}
183+
}
184+
185+
if p.config.Platform != nil {
186+
platform = *p.config.Platform
187+
} else {
188+
if runtime.GOARCH == "arm64" {
189+
platform = "linux/arm64"
190+
}
174191
}
175192

176193
input := &blockchain.Input{
177194
Image: image,
178-
ImagePlatform: p.config.Platform,
195+
ImagePlatform: &platform,
179196
Type: blockchain.TypeSui,
180197
ChainID: chainID,
181198
PublicKey: address,

0 commit comments

Comments
 (0)