Skip to content

Commit

Permalink
tilt: simplify solana setup
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Dec 4, 2024
1 parent 5503b8d commit cb4b447
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 48 deletions.
16 changes: 0 additions & 16 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@ local(['sed','-i','/{chainId: vaa.ChainIDEthereum, addr: "0000000000000000000000

load(".wormhole/Tiltfile", "namespace", "k8s_yaml_with_ns")

# Copied from .wormhole/Tiltfile, as this setup will extend the `solana-contract` image in order to inject the .so at startup
docker_build(
ref = "bridge-client",
context = ".wormhole/",
only = ["./proto", "./solana", "./clients"],
dockerfile = ".wormhole/solana/Dockerfile.client",
# Ignore target folders from local (non-container) development.
ignore = [".wormhole/solana/*/target"],
)
docker_build(
ref = "solana-contract",
context = ".wormhole/solana",
dockerfile = ".wormhole/solana/Dockerfile",
target = "builder",
build_args = {"BRIDGE_ADDRESS": "Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"}
)
# Solana deploy
docker_build(
ref = "ntt-solana-contract",
Expand Down
4 changes: 4 additions & 0 deletions sdk/__tests__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ async function deploySolana(ctx: Ctx): Promise<Ctx> {
const address = sender.address.toNative("Solana").unwrap();
console.log(`Using public key: ${address}`);

const signature = await connection.requestAirdrop(address, 1000000000000);
await connection.confirmTransaction(signature);
console.log(`Airdropped 1000 SOL`);

const mint = await spl.createMint(connection, keypair, address, null, 9);
console.log("Created mint", mint.toString());

Expand Down
7 changes: 1 addition & 6 deletions solana/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ RUN --mount=type=cache,target=/opt/solana/deps/target,id=build_anchor_ntt_target

RUN cp ./target/sbf-solana-solana/release/example_native_token_transfers.so /opt/solana/deps/example_native_token_transfers_2.so

COPY --from=solana-contract /opt/solana/deps/bridge.so /opt/solana/deps/bridge.so
COPY --from=solana-contract /opt/solana/deps/token_bridge.so /opt/solana/deps/token_bridge.so
COPY --from=solana-contract /opt/solana/deps/nft_bridge.so /opt/solana/deps/nft_bridge.so
COPY --from=solana-contract /opt/solana/deps/cpi_poster.so /opt/solana/deps/cpi_poster.so
COPY --from=solana-contract /opt/solana/deps/mpl_token_metadata.so /opt/solana/deps/mpl_token_metadata.so
COPY --from=solana-contract /opt/solana/deps/wormhole_migration.so /opt/solana/deps/wormhole_migration.so
COPY solana/tilt /opt/solana/deps

COPY sdk ../sdk
COPY solana/ts ts
Expand Down
35 changes: 9 additions & 26 deletions solana/solana-devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,15 @@ spec:
- --bpf-program
- Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
- /opt/solana/deps/bridge.so
- --bpf-program
- B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE
- /opt/solana/deps/token_bridge.so
- --bpf-program
- NFTWqJR8YnRVqPDvTJrYuLrQDitTG5AScqbeghi4zSA
- /opt/solana/deps/nft_bridge.so
- --bpf-program
- CP1co2QMMoDPbsmV7PGcUTLFwyhgCgTXt25gLQ5LewE1
- /opt/solana/deps/cpi_poster.so
- --bpf-program
- metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s
- /opt/solana/deps/mpl_token_metadata.so
- --bpf-program
- Ex9bCdVMSfx7EzB3pgSi2R4UHwJAXvTw18rBQm5YQ8gK
- /opt/solana/deps/wormhole_migration.so
- --account
- FKoMTctsC7vJbEqyRiiPskPnuQx2tX1kurmvWByq5uZP
- /opt/solana/deps/bridge_config.json
- --account
- GXBsgBD3LDn3vkRZF6TfY5RqgajVZ4W5bMAdiAaaUARs
- /opt/solana/deps/fee_collector.json
- --account
- 6MxkvoEwgB9EqQRLNhvYaPGhfcLtBtpBqdQugr3AZUgD
- /opt/solana/deps/guardian_set.json
- --upgradeable-program
- NTTManager111111111111111111111111111111111
- /opt/solana/deps/example_native_token_transfers.so
Expand Down Expand Up @@ -101,14 +95,3 @@ spec:
port: rpc
path: /health
periodSeconds: 1
- name: setup
image: bridge-client
command:
- /bin/bash
- -c
- "cd /usr/src/solana && ./devnet_setup.sh"
readinessProbe:
tcpSocket:
port: 2000
periodSeconds: 1
failureThreshold: 300
Binary file added solana/tilt/bridge.so
Binary file not shown.
13 changes: 13 additions & 0 deletions solana/tilt/bridge_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pubkey": "FKoMTctsC7vJbEqyRiiPskPnuQx2tX1kurmvWByq5uZP",
"account": {
"lamports": 1057920,
"data": [
"AAAAAACYDQAAAAAAgFEBAGQAAAAAAAAA",
"base64"
],
"owner": "Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o",
"executable": false,
"rentEpoch": 0
}
}
13 changes: 13 additions & 0 deletions solana/tilt/fee_collector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pubkey": "GXBsgBD3LDn3vkRZF6TfY5RqgajVZ4W5bMAdiAaaUARs",
"account": {
"lamports": 890880,
"data": [
"",
"base64"
],
"owner": "11111111111111111111111111111111",
"executable": false,
"rentEpoch": 0
}
}
13 changes: 13 additions & 0 deletions solana/tilt/guardian_set.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"pubkey": "6MxkvoEwgB9EqQRLNhvYaPGhfcLtBtpBqdQugr3AZUgD",
"account": {
"lamports": 1141440,
"data": [
"AAAAAAEAAAC++kKdV80Yt/ik2RotqatK8F0PvoX2jWIAAAAA",
"base64"
],
"owner": "Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o",
"executable": false,
"rentEpoch": 0
}
}

0 comments on commit cb4b447

Please sign in to comment.