Skip to content

Commit ec7ffa0

Browse files
feat: configurable faucet port for Sui (#2048)
The inability for us to provide a different port for the SUI faucet port when running the SUI container means that there is a chance that the port is already being used by other process. JIRA: https://smartcontract-it.atlassian.net/browse/CLD-510
1 parent 71cd719 commit ec7ffa0

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

framework/.changeset/v0.10.15.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add configurable faucet port for Sui blockchain component

framework/components/blockchain/blockchain.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ type Input struct {
5555
ContainerResources *framework.ContainerResources `toml:"resources"`
5656
CustomPorts []string `toml:"custom_ports"`
5757

58+
// Sui specific: faucet port for funding accounts
59+
FaucetPort string `toml:"faucet_port"`
60+
5861
// GAPv2 specific params
5962
HostNetworkMode bool `toml:"host_network_mode"`
6063
CertificatesPath string `toml:"certificates_path"`

framework/components/blockchain/sui.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ func defaultSui(in *Input) {
8585
if in.Port == "" {
8686
in.Port = DefaultSuiNodePort
8787
}
88+
if in.FaucetPort == "" {
89+
in.FaucetPort = DefaultFaucetPortNum
90+
}
8891
}
8992

9093
func newSui(in *Input) (*Output, error) {
@@ -127,7 +130,7 @@ func newSui(in *Input) (*Output, error) {
127130
nat.Port(DefaultFaucetPort): []nat.PortBinding{
128131
{
129132
HostIP: "0.0.0.0",
130-
HostPort: DefaultFaucetPortNum,
133+
HostPort: in.FaucetPort,
131134
},
132135
},
133136
}
@@ -168,7 +171,7 @@ func newSui(in *Input) (*Output, error) {
168171
if err != nil {
169172
return nil, err
170173
}
171-
if err := fundAccount(fmt.Sprintf("http://%s:%s", "127.0.0.1", DefaultFaucetPortNum), suiAccount.SuiAddress); err != nil {
174+
if err := fundAccount(fmt.Sprintf("http://%s:%s", "127.0.0.1", in.FaucetPort), suiAccount.SuiAddress); err != nil {
172175
return nil, err
173176
}
174177
return &Output{

0 commit comments

Comments
 (0)