Skip to content

Commit

Permalink
sui: remove faucet and simplify tilt deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
kcsongor committed Mar 3, 2024
1 parent 5ce0fc5 commit 497fb6c
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 48 deletions.
1 change: 0 additions & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,6 @@ if sui:
"sui",
port_forwards = [
port_forward(9000, 9000, name = "RPC [:9000]", host = webHost),
port_forward(5003, name = "Faucet [:5003]", host = webHost),
port_forward(9184, name = "Prometheus [:9184]", host = webHost),
],
labels = ["sui"],
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/consts/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const OVERRIDES = {
},
DEVNET: {
sui: {
core: "0x6c0b10e14f6d9e817105765811faf144e591e9b286abde60a796775363bac14c", // wormhole module State object ID
core: "0xb49caa756546453e3145574c206a570a43506fbc2c43f0181834555f85dbe57d", // wormhole module State object ID
token_bridge:
"0x7e8558339a0605f2ea79bb4dfd20523dc5ae44af3f5c6f891305cf6fe61044bf", // token_bridge module State object ID
"0xad0fd243ad451b773ccff4707842e0eeaa8c51a8071912fe3285247220b3fdd1", // token_bridge module State object ID
},
aptos: {
token_bridge:
Expand Down
9 changes: 2 additions & 7 deletions devnet/sui-devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ spec:
- name: prometheus
port: 9184
targetPort: prometheus
- name: faucet
port: 5003
targetPort: faucet
selector:
app: sui
---
Expand Down Expand Up @@ -52,9 +49,6 @@ spec:
- containerPort: 9184
name: prometheus
protocol: TCP
- containerPort: 5003
name: faucet
protocol: TCP
readinessProbe:
tcpSocket:
port: 9000
Expand All @@ -63,9 +57,10 @@ spec:
command: ["/bin/bash", "-c"]
args:
[
"cd /tmp && ./scripts/wait_for_devnet.sh && ./scripts/airdrop_devnet.sh && worm sui setup-devnet && touch success && sleep infinity",
"cd /tmp && ./scripts/wait_for_devnet.sh && worm sui setup-devnet && touch success && sleep infinity",
]
readinessProbe:
initialDelaySeconds: 30
periodSeconds: 5
failureThreshold: 300
exec:
Expand Down
2 changes: 0 additions & 2 deletions sdk/js/src/token_bridge/__tests__/sui-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import { Payload, VAA, parse, serialiseVAA } from "../../vaa/generic";
import {
ETH_NODE_URL,
ETH_PRIVATE_KEY10,
SUI_FAUCET_URL,
SUI_NODE_URL,
TEST_ERC20,
WORMHOLE_RPC_HOSTS,
Expand All @@ -92,7 +91,6 @@ const suiAddress: string = suiKeypair.getPublicKey().toSuiAddress();
const suiProvider: JsonRpcProvider = new JsonRpcProvider(
new Connection({
fullnode: SUI_NODE_URL,
faucet: SUI_FAUCET_URL,
})
);
const suiSigner: RawSigner = new RawSigner(suiKeypair, suiProvider);
Expand Down
3 changes: 0 additions & 3 deletions sdk/js/src/token_bridge/__tests__/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,3 @@ export const APTOS_PRIVATE_KEY =
"537c1f91e56891445b491068f519b705f8c0f1a1e66111816dd5d4aa85b8113d";

export const SUI_NODE_URL = ci ? "http://sui:9000" : "http://localhost:9000";
export const SUI_FAUCET_URL = ci
? "http://sui:5003/gas"
: "http://localhost:5003/gas";
4 changes: 2 additions & 2 deletions sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,9 @@ const DEVNET = {
"0x46da3d4c569388af61f951bdd1153f4c875f90c2991f6b2d0a38e2161a40852c",
},
sui: {
core: "0x6c0b10e14f6d9e817105765811faf144e591e9b286abde60a796775363bac14c", // wormhole module State object ID
core: "0xb49caa756546453e3145574c206a570a43506fbc2c43f0181834555f85dbe57d", // wormhole module State object ID
token_bridge:
"0x7e8558339a0605f2ea79bb4dfd20523dc5ae44af3f5c6f891305cf6fe61044bf", // token_bridge module State object ID
"0xad0fd243ad451b773ccff4707842e0eeaa8c51a8071912fe3285247220b3fdd1", // token_bridge module State object ID
nft_bridge: undefined,
},
moonbeam: {
Expand Down
6 changes: 2 additions & 4 deletions sui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ FROM cli-gen AS cli-export
FROM const-gen AS const-export
FROM ghcr.io/wormhole-foundation/sui:1.19.1-mainnet@sha256:544a1b2aa5701fae25a19aed3c5e8c24e0caf7d1c9f511b6844d339a8f0b2a00 as sui

RUN sui genesis -f

# COPY sui/devnet/client.yaml /root/.sui/sui_config/
# COPY sui/devnet/sui.keystore /root/.sui/sui_config/
COPY sui/devnet/genesis_config genesis_config
RUN sui genesis -f --from-config genesis_config

WORKDIR /tmp

Expand Down
11 changes: 2 additions & 9 deletions sui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ Make sure your Cargo version is at least 1.65.0 and then follow the steps below:
Install the `Sui` CLI. This tool is used to compile the contracts and run the tests.

```sh
cargo install --locked --git https://github.com/MystenLabs/sui.git --rev 041c5f2bae2fe52079e44b70514333532d69f4e6 sui sui-faucet
cargo install --locked --git https://github.com/MystenLabs/sui.git --rev 041c5f2bae2fe52079e44b70514333532d69f4e6 sui
```

Some useful Sui CLI commands are

- `sui start` to spin up a local network
- `rpc-server` to start a server for handling rpc calls
- `sui-faucet` to start a faucet for requesting funds from active-address

Next, install the [worm](../clients/js/README.md) CLI tool by running

Expand Down Expand Up @@ -93,13 +92,7 @@ Simply run
worm start-validator sui
```

which will start a local sui validator with an RPC endpoint at `0.0.0.0:9000`
and the faucet endpoint at `0.0.0.0:5003/gas`. Note that the faucet takes a few
(~10) seconds to come up, so only proceed when you see the following:

```text
Faucet is running. Faucet endpoint: 0.0.0.0:5003/gas
```
which will start a local sui validator with an RPC endpoint at `0.0.0.0:9000`.

Once the validator is running, the contracts are ready to deploy. In the
[scripts](./scripts) directory, run
Expand Down
55 changes: 55 additions & 0 deletions sui/devnet/genesis_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
ssfn_config_info: ~
validator_config_info: ~
parameters:
chain_start_timestamp_ms: 1709486339140
protocol_version: 36
allow_insertion_of_extra_objects: true
epoch_duration_ms: 86400000
stake_subsidy_start_epoch: 0
stake_subsidy_initial_distribution_amount: 1000000000000000
stake_subsidy_period_length: 10
stake_subsidy_decrease_rate: 1000
accounts:
- address: "0x2e425dd30f43ff1d59547322839cfc4b8fbaae54d72075181ebd7388b644fdbe"
gas_amounts:
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- address: "0x8a8bb058d6c86aa175566c9e2d19278dd22ed9fecdda8fb486018f93a0629bb5"
gas_amounts:
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- address: "0xa0f33ce147ecae789f535c64634851724284dd618a529672702b991a5f7bf816"
gas_amounts:
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- address: "0xbd00a48078c0513a5f9a0d1c9352cd5c23a0e0cf3e6a82673cdae857cd00021e"
gas_amounts:
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- address: "0xfd5f84cf9285f2b206e03727224b9daffa6092661b840d92434751792010b7de"
gas_amounts:
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- address: "0xed867315e3f7c83ae82e6d5858b6a6cc57c291fd84f7509646ebc8162169cf96"
gas_amounts:
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
- 30000000000000000
12 changes: 0 additions & 12 deletions sui/scripts/airdrop_devnet.sh

This file was deleted.

4 changes: 1 addition & 3 deletions sui/scripts/start_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

set -x

sui start >/dev/null 2>&1 &
sleep 5
sui-faucet --write-ahead-log faucet.log
sui start 2>&1
3 changes: 0 additions & 3 deletions sui/scripts/wait_for_devnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ set -e

# Wait for sui to start
while [[ "$(curl -X POST -H "Content-Type: application/json" -d '{ "jsonrpc":"2.0", "method":"rpc.discover","id":1 }' -s -o /dev/null -w '%{http_code}' 0.0.0.0:9000/)" != "200" ]]; do sleep 1; done

# Wait for sui-faucet to start
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 0.0.0.0:5003/)" != "200" ]]; do sleep 1; done

0 comments on commit 497fb6c

Please sign in to comment.