tilt: add aptos

This commit is contained in:
Csongor Kiss 2022-10-14 01:23:23 +00:00 committed by Csongor Kiss
parent daf689cf2a
commit 12b855f3b1
6 changed files with 136 additions and 2 deletions

View File

@ -46,3 +46,4 @@ COPY --from=const-build /scripts/.env.hex terra/tools/.env
COPY --from=const-build /scripts/.env.hex cosmwasm/tools/.env
COPY --from=const-build /scripts/.env.hex algorand/.env
COPY --from=const-build /scripts/.env.hex near/.env
COPY --from=const-build /scripts/.env.hex aptos/.env

View File

@ -39,6 +39,7 @@ config.define_string("webHost", False, "Public hostname for port forwards")
# Components
config.define_bool("near", False, "Enable Near component")
config.define_bool("aptos", False, "Enable Aptos component")
config.define_bool("algorand", False, "Enable Algorand component")
config.define_bool("evm2", False, "Enable second Eth component")
config.define_bool("solana", False, "Enable Solana component")
@ -61,6 +62,7 @@ bigTableKeyPath = cfg.get("bigTableKeyPath", "./event_database/devnet_key.json")
webHost = cfg.get("webHost", "localhost")
algorand = cfg.get("algorand", True)
near = cfg.get("near", True)
aptos = cfg.get("aptos", True)
evm2 = cfg.get("evm2", True)
solana = cfg.get("solana", True)
terra_classic = cfg.get("terra_classic", True)
@ -173,6 +175,16 @@ def build_node_yaml():
gcpProject,
]
if aptos:
container["command"] += [
"--aptosRPC",
"http://aptos:8080",
"--aptosAccount",
"de0036a9600559e295d5f6802ef6f3f802f510366e0c23912b0655d972166017",
"--aptosHandle",
"0xde0036a9600559e295d5f6802ef6f3f802f510366e0c23912b0655d972166017::state::WormholeMessageHandle",
]
if evm2:
container["command"] += [
"--bscRPC",
@ -254,6 +266,8 @@ if terra2:
guardian_resource_deps = guardian_resource_deps + ["terra2-terrad"]
if algorand:
guardian_resource_deps = guardian_resource_deps + ["algorand"]
if aptos:
guardian_resource_deps = guardian_resource_deps + ["aptos"]
k8s_resource(
"guardian",
@ -751,3 +765,25 @@ if secondWormchain:
labels = ["wormchain"],
trigger_mode = trigger_mode,
)
if aptos:
k8s_yaml_with_ns("devnet/aptos-localnet.yaml")
docker_build(
ref = "aptos-node",
context = "aptos",
dockerfile = "aptos/Dockerfile",
target = "aptos",
)
k8s_resource(
"aptos",
port_forwards = [
port_forward(8080, name = "RPC [:8080]", host = webHost),
port_forward(6181, name = "FullNode [:6181]", host = webHost),
port_forward(8081, name = "Faucet [:8081]", host = webHost),
],
resource_deps = ["const-gen"],
labels = ["aptos"],
trigger_mode = trigger_mode,
)

View File

@ -2,7 +2,10 @@
set -euxo pipefail
GUARDIAN_ADDR=0xbeFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe
DOTENV=$(dirname $0)/../.env
[[ -f "$DOTENV" ]] && . "$DOTENV"
GUARDIAN_ADDR="${INIT_SIGNERS_CSV:-0xbeFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe}"
WORMHOLE_ADDR=$(worm contract devnet aptos Core)
TOKEN_BRIDGE_ADDR=$(worm contract devnet aptos TokenBridge)
DEPLOYER_ADDR=0x277fa055b6a73c42c0662d5236c65c864ccbf2d4abd21f174a30c8b786eab84b
@ -29,3 +32,5 @@ worm aptos deploy --network devnet ../examples/core_messages --named-addresses "
# Deploy coin
#worm aptos deploy --network devnet ../wormhole --named-addresses $NAMED_ADDRS
echo "Deployments successful."

24
aptos/scripts/register_devnet Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
DOTENV=../.env
[ -f $DOTENV ] || (echo "$DOTENV does not exist." >&2; exit 1)
# 1. load variables from .env file
. $DOTENV
# 2. next we get all the token bridge registration VAAs from the environment
# if a new VAA is added, this will automatically pick it up
VAAS=$(set | grep "REGISTER_.*_TOKEN_BRIDGE_VAA" | grep -v APTOS | cut -d '=' -f1)
# TODO: this will not be needed when the sdk is published
TOKEN_BRIDGE_ADDR=$(worm contract devnet aptos TokenBridge)
# 3. use 'worm' to submit each registration VAA
for VAA in $VAAS
do
VAA=${!VAA}
worm submit $VAA --chain aptos --contract-address $TOKEN_BRIDGE_ADDR --network devnet
done
echo "Registrations successful."

View File

@ -163,7 +163,7 @@ export async function callEntryFunc(
TxnBuilderTypes.AccountAddress.fromHex(accountFrom.address()),
BigInt(sequenceNumber),
txPayload,
BigInt(20000), //max gas to be used. TODO(csongor): we could compute this from the simulation below...
BigInt(30000), //max gas to be used. TODO(csongor): we could compute this from the simulation below...
BigInt(100), //price per unit gas TODO(csongor): we should get this dynamically
BigInt(Math.floor(Date.now() / 1000) + 10),
new TxnBuilderTypes.ChainId(chainId),

View File

@ -0,0 +1,68 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: aptos
name: aptos
spec:
ports:
- name: node
port: 8080
targetPort: 8080
- name: prometheus
port: 6181
targetPort: prometheus
- name: faucet
port: 8081
targetPort: 8081
selector:
app: aptos
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: aptos
name: aptos
spec:
replicas: 1
selector:
matchLabels:
app: aptos
serviceName: aptos
template:
metadata:
labels:
app: aptos
spec:
containers:
- name: aptos-node
image: aptos-node
command:
- /bin/sh
- -c
- /tmp/start_node.sh
ports:
- containerPort: 8080
name: node
protocol: TCP
- containerPort: 6181
name: prometheus
protocol: TCP
- containerPort: 8081
name: faucet
protocol: TCP
readinessProbe:
tcpSocket:
port: 8081
- name: aptos-contracts
image: aptos-node
command: ["/bin/bash", "-c"]
args: ["cd /tmp/scripts && ./deploy && ./register_devnet && touch success && sleep infinity"]
readinessProbe:
periodSeconds: 1
failureThreshold: 300
exec:
command:
- cat
- /tmp/scripts/success