Skip to content

Commit 01c4661

Browse files
authored
Repo structure refactor (#449)
* Repo structure refactor This change introduces major codebase layout changes in three areas: * Tilt devnet lives in tilt-devnet/ - all k8s and docker files, scripts, local testing private keys are moved to this directory. * pyth2wormhole becomes pyth-wormhole-attester and is relocated to wormhole-attester/ - This long-needed rename will hopefully eradicate most of the confusing naming around the attester. The Rust client binary becomes pyth-wormhole-attester-client. * Target-chain code lives in target-chain/ - This leaves just the attester, third_party and pythnet-specific things at top-level. Other opportunistic changes: * Fixed rebuild trigger for Dockerfile.wasm These items are a fraction of the necessary structure changes in the repo. * cosmwasm: fix contract after faulty merge * .github: remove unused dependabot config * Fix path references in .github and .pre-commit-config.yml * .github: Rename attester references to pyth-wormhole-attester * .pre-commit-config.yaml: fix paths and run all commit hooks * p2w-relay: Fix faulty merge resolution in favor of origin/main * Dockerfile.pyth_relay: Fix Ethereum path reference * Dockerfile.solana: Trip early cache with arbitrary change * Dockerfile.pyth_relay: typo * p2w-relay: fix evm build in npm script * Dockerfile.solana: Retry invalidating cache again * near -> target-chains/near * wormhole-attester: bump on/off-chain major versions due to rename Attester packages were renamed. This possibly breaks most dependees. * Dockerfile.solana: Improve decoy-crate to have a real lib target * .github/[...]/pyth-cosmwasm-contract.yml: typo * rust-toolchain: Bump rust to stable 1.63 * rust-toolchain: use christmas nightly * empty commit to trigger build * attester-image-push.yaml: keep xc-attest image name intact * multisig-wh-message-builder: remove accidental revert
1 parent 3b5c159 commit 01c4661

File tree

300 files changed

+215
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+215
-226
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/attester-image-push.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Push Attester Image
22
on:
33
push:
44
tags:
5-
- pyth-attester-v*
5+
- pyth-wormhole-attester-v*
66
workflow_dispatch:
77
inputs:
88
dispatch_description:
@@ -18,13 +18,13 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v2
2020
- name: Set image tag to version of the git tag
21-
if: ${{ startsWith(github.ref, 'refs/tags/pyth-attester-v') }}
21+
if: ${{ startsWith(github.ref, 'refs/tags/pyth-wormhole-attester-v') }}
2222
run: |
2323
PREFIX="refs/tags/pyth-attester-"
2424
VERSION="${GITHUB_REF:${#PREFIX}}"
2525
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
2626
- name: Set image tag to the git commit hash
27-
if: ${{ !startsWith(github.ref, 'refs/tags/pyth-attester-v') }}
27+
if: ${{ !startsWith(github.ref, 'refs/tags/pyth-wormhole-attester-v') }}
2828
run: |
2929
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
3030
- uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1
@@ -37,7 +37,6 @@ jobs:
3737
env:
3838
AWS_REGION: us-east-1
3939
- run: |
40-
DOCKER_BUILDKIT=1 docker build -f Dockerfile.client -t bridge-client .
4140
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f third_party/pyth/Dockerfile.p2w-attest .
4241
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
4342
env:

.github/workflows/ethereum-contract.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
on:
22
pull_request:
33
paths:
4-
- ethereum/**
4+
- target-chains/ethereum/**
55
- third_party/pyth/xc-governance-sdk-js/**
66
push:
77
branches:
88
- main
99
paths:
10-
- ethereum/**
10+
- target-chains/ethereum/**
1111
- third_party/pyth/xc-governance-sdk-js/**
1212

1313
name: Ethereum Contract
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
defaults:
2020
run:
21-
working-directory: ethereum/
21+
working-directory: target-chains/ethereum/
2222
steps:
2323
- uses: actions/checkout@v3
2424

.github/workflows/price-service-image-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
env:
3838
AWS_REGION: us-east-1
3939
- run: |
40-
DOCKER_BUILDKIT=1 docker build -f Dockerfile.wasm -o type=local,dest=. .
40+
DOCKER_BUILDKIT=1 docker build -f tilt-devnet/docker-images/Dockerfile.wasm -o type=local,dest=. .
4141
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f third_party/pyth/price-service/Dockerfile.price_service .
4242
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
4343
env:

.github/workflows/pyth-cosmwasm-contract.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Pyth CosmWasm Contract
33
on:
44
pull_request:
55
paths:
6-
- cosmwasm/**
6+
- target-chains/cosmwasm/**
77
- third_party/pyth/p2w-sdk/rust/**
88
push:
99
branches:
1010
- main
1111
paths:
12-
- cosmwasm/**
12+
- target-chains/cosmwasm/**
1313
- third_party/pyth/p2w-sdk/rust/**
1414

1515
env:
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
defaults:
2222
run:
23-
working-directory: ./cosmwasm/contracts/pyth
23+
working-directory: target-chains/cosmwasm/contracts/pyth
2424
steps:
2525
- uses: actions/checkout@v2
2626
- name: Build

.pre-commit-config.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,51 @@ repos:
2222
language: "rust"
2323
entry: cargo +nightly fmt --manifest-path ./pythnet/remote-executor/Cargo.toml --all -- --config-path rustfmt.toml
2424
pass_filenames: false
25-
files: pythnet/remote-executor/
25+
files: pythnet/remote-executor
2626
- id: cargo-clippy-remote-executor
2727
name: Cargo clippy for remote executor
2828
language: "rust"
2929
entry: cargo +nightly clippy --manifest-path ./pythnet/remote-executor/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
3030
pass_filenames: false
31-
files: pythnet/remote-executor/
31+
files: pythnet/remote-executor
3232
# Hooks for the attester
3333
- id: cargo-fmt-attester
3434
name: Cargo format for attester
3535
language: "rust"
36-
entry: cargo +nightly fmt --manifest-path ./solana/pyth2wormhole/Cargo.toml --all -- --config-path rustfmt.toml
36+
entry: cargo +nightly fmt --manifest-path ./wormhole-attester/Cargo.toml --all -- --config-path rustfmt.toml
3737
pass_filenames: false
38-
files: solana/pyth2wormhole/
38+
files: wormhole-attester
3939
- id: cargo-clippy-attester
4040
name: Cargo clippy for attester
4141
language: "rust"
4242
entry: |
4343
bash -c 'EMITTER_ADDRESS=0 BRIDGE_ADDRESS=0 cargo +nightly clippy --manifest-path \
44-
./solana/pyth2wormhole/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings'
44+
./wormhole-attester/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings'
4545
pass_filenames: false
46-
files: solana/pyth2wormhole/
46+
files: wormhole-attester
4747
# Hooks for cosmwasm contract
4848
- id: cargo-fmt-cosmwasm
4949
name: Cargo format for cosmwasm contract
5050
language: "rust"
51-
entry: cargo +nightly fmt --manifest-path ./cosmwasm/Cargo.toml --all -- --config-path rustfmt.toml
51+
entry: cargo +nightly fmt --manifest-path ./target-chains/cosmwasm/Cargo.toml --all -- --config-path rustfmt.toml
5252
pass_filenames: false
53-
files: cosmwasm/
53+
files: target-chains/cosmwasm
5454
- id: cargo-clippy-cosmwasm
5555
name: Cargo clippy for cosmwasm contract
5656
language: "rust"
57-
entry: cargo +nightly clippy --manifest-path ./cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
57+
entry: cargo +nightly clippy --manifest-path ./target-chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
5858
pass_filenames: false
59-
files: cosmwasm/
59+
files: target-chains/cosmwasm
6060
# Hooks for p2w-sdk/rust
6161
- id: cargo-fmt-p2w-sdk
6262
name: Cargo format for p2w-sdk
6363
language: "rust"
6464
entry: cargo +nightly fmt --manifest-path ./third_party/pyth/p2w-sdk/rust/Cargo.toml --all -- --config-path rustfmt.toml
6565
pass_filenames: false
66-
files: third_party/pyth/p2w-sdk/rust/
66+
files: third_party/pyth/p2w-sdk/rust
6767
- id: cargo-clippy-p2w-sdk
6868
name: Cargo clippy for p2w-sdk
6969
language: "rust"
7070
entry: cargo +nightly clippy --manifest-path ./third_party/pyth/p2w-sdk/rust/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
7171
pass_filenames: false
72-
files: third_party/pyth/p2w-sdk/rust/
72+
files: third_party/pyth/p2w-sdk/rust

Dockerfile.prometheus

Lines changed: 0 additions & 3 deletions
This file was deleted.

Tiltfile

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ def k8s_yaml_with_ns(objects):
6666

6767
local_resource(
6868
name = "wasm-gen",
69-
cmd = "tilt docker build -- -f Dockerfile.wasm -o type=local,dest=. .",
69+
cmd = "tilt docker build -- -f tilt-devnet/docker-images/Dockerfile.wasm -o type=local,dest=. .",
7070
env = {"DOCKER_BUILDKIT": "1"},
71+
deps = "./wormhole-attester",
7172
labels = ["wasm"],
7273
allow_parallel=True,
7374
trigger_mode = trigger_mode,
7475
)
7576

76-
7777
def build_node_yaml():
78-
node_yaml = read_yaml_stream("devnet/node.yaml")
78+
node_yaml = read_yaml_stream("tilt-devnet/k8s/node.yaml")
7979

8080
for obj in node_yaml:
8181
if obj["kind"] == "StatefulSet" and obj["metadata"]["name"] == "guardian":
@@ -103,7 +103,7 @@ k8s_resource(
103103
)
104104

105105
# spy
106-
k8s_yaml_with_ns("devnet/spy.yaml")
106+
k8s_yaml_with_ns("tilt-devnet/k8s/spy.yaml")
107107

108108
k8s_resource(
109109
"spy",
@@ -121,23 +121,20 @@ k8s_resource(
121121
docker_build(
122122
ref = "bridge-client",
123123
context = ".",
124-
only = ["./solana"],
125-
dockerfile = "Dockerfile.client",
126-
# Ignore target folders from local (non-container) development.
127-
ignore = ["./solana/*/target"],
124+
dockerfile = "tilt-devnet/docker-images/Dockerfile.client",
128125
)
129126

130127
# solana smart contract
131128

132129
docker_build(
133130
ref = "solana-contract",
134131
context = ".",
135-
dockerfile = "Dockerfile.solana",
132+
dockerfile = "tilt-devnet/docker-images/Dockerfile.solana",
136133
)
137134

138135
# solana local devnet
139136

140-
k8s_yaml_with_ns("devnet/solana-devnet.yaml")
137+
k8s_yaml_with_ns("tilt-devnet/k8s/solana-devnet.yaml")
141138

142139
k8s_resource(
143140
"solana-devnet",
@@ -155,10 +152,7 @@ k8s_resource(
155152
docker_build(
156153
ref = "eth-node",
157154
context = "./",
158-
dockerfile = "./Dockerfile.ethereum",
159-
160-
# ignore local node_modules (in case they're present)
161-
ignore = ["./ethereum/node_modules", "./third_party/pyth/xc-governance-sdk-js/node_modules"],
155+
dockerfile = "tilt-devnet/docker-images/Dockerfile.ethereum",
162156

163157
# sync external scripts for incremental development
164158
# (everything else needs to be restarted from scratch for determinism)
@@ -176,7 +170,7 @@ docker_build(
176170
context = ".",
177171
dockerfile = "third_party/pyth/Dockerfile.pyth",
178172
)
179-
k8s_yaml_with_ns("./devnet/pyth.yaml")
173+
k8s_yaml_with_ns("./tilt-devnet/k8s/pyth.yaml")
180174

181175
k8s_resource(
182176
"pyth",
@@ -189,12 +183,10 @@ k8s_resource(
189183
docker_build(
190184
ref = "p2w-attest",
191185
context = ".",
192-
only = ["./solana", "./third_party", "./pythnet"],
193186
dockerfile = "./third_party/pyth/Dockerfile.p2w-attest",
194-
ignore = ["./solana/*/target"],
195187
)
196188

197-
k8s_yaml_with_ns("devnet/p2w-attest.yaml")
189+
k8s_yaml_with_ns("tilt-devnet/k8s/p2w-attest.yaml")
198190
k8s_resource(
199191
"p2w-attest",
200192
resource_deps = ["solana-devnet", "pyth", "guardian"],
@@ -211,7 +203,7 @@ docker_build(
211203
dockerfile = "./third_party/pyth/Dockerfile.check-attestations",
212204
)
213205

214-
k8s_yaml_with_ns("devnet/check-attestations.yaml")
206+
k8s_yaml_with_ns("tilt-devnet/k8s/check-attestations.yaml")
215207
k8s_resource(
216208
"check-attestations",
217209
resource_deps = ["pyth-price-service", "pyth", "p2w-attest"],
@@ -225,7 +217,7 @@ docker_build(
225217
context = ".",
226218
dockerfile = "third_party/pyth/p2w-relay/Dockerfile.pyth_relay",
227219
)
228-
k8s_yaml_with_ns("devnet/p2w-terra-relay.yaml")
220+
k8s_yaml_with_ns("tilt-devnet/k8s/p2w-terra-relay.yaml")
229221
k8s_resource(
230222
"p2w-terra-relay",
231223
resource_deps = ["pyth", "p2w-attest", "spy", "terra-terrad", "wasm-gen"],
@@ -235,7 +227,7 @@ k8s_resource(
235227
labels = ["pyth"]
236228
)
237229

238-
k8s_yaml_with_ns("devnet/p2w-evm-relay.yaml")
230+
k8s_yaml_with_ns("tilt-devnet/k8s/p2w-evm-relay.yaml")
239231
k8s_resource(
240232
"p2w-evm-relay",
241233
resource_deps = ["pyth", "p2w-attest", "spy", "eth-devnet", "wasm-gen"],
@@ -251,7 +243,7 @@ docker_build(
251243
context = ".",
252244
dockerfile = "third_party/pyth/price-service/Dockerfile.price_service",
253245
)
254-
k8s_yaml_with_ns("devnet/pyth-price-service.yaml")
246+
k8s_yaml_with_ns("tilt-devnet/k8s/pyth-price-service.yaml")
255247
k8s_resource(
256248
"pyth-price-service",
257249
resource_deps = ["pyth", "p2w-attest", "spy", "eth-devnet", "wasm-gen"],
@@ -268,15 +260,15 @@ docker_build(
268260
context = "third_party/pyth/evm-watcher/",
269261
dockerfile = "third_party/pyth/evm-watcher/Dockerfile",
270262
)
271-
k8s_yaml_with_ns("devnet/pyth-evm-watcher.yaml")
263+
k8s_yaml_with_ns("tilt-devnet/k8s/pyth-evm-watcher.yaml")
272264
k8s_resource(
273265
"pyth-evm-watcher",
274266
resource_deps = ["eth-devnet"],
275267
labels = ["pyth"]
276268
)
277269

278270

279-
k8s_yaml_with_ns("devnet/eth-devnet.yaml")
271+
k8s_yaml_with_ns("tilt-devnet/k8s/eth-devnet.yaml")
280272

281273
k8s_resource(
282274
"eth-devnet",
@@ -301,17 +293,17 @@ k8s_resource(
301293

302294
docker_build(
303295
ref = "terra-image",
304-
context = "./cosmwasm/devnet",
305-
dockerfile = "cosmwasm/devnet/Dockerfile",
296+
context = "./target-chains/cosmwasm/devnet",
297+
dockerfile = "./target-chains/cosmwasm/devnet/Dockerfile",
306298
)
307299

308300
docker_build(
309301
ref = "cosmwasm-contracts",
310302
context = ".",
311-
dockerfile = "Dockerfile.cosmwasm",
303+
dockerfile = "tilt-devnet/docker-images/Dockerfile.cosmwasm",
312304
)
313305

314-
k8s_yaml_with_ns("devnet/terra-devnet.yaml")
306+
k8s_yaml_with_ns("tilt-devnet/k8s/terra-devnet.yaml")
315307

316308
k8s_resource(
317309
"terra-terrad",
@@ -340,10 +332,10 @@ k8s_resource(
340332
docker_build(
341333
ref = "prometheus",
342334
context = ".",
343-
dockerfile = "Dockerfile.prometheus",
335+
dockerfile = "tilt-devnet/docker-images/Dockerfile.prometheus",
344336
)
345337

346-
k8s_yaml_with_ns("devnet/prometheus.yaml")
338+
k8s_yaml_with_ns("tilt-devnet/k8s/prometheus.yaml")
347339

348340
k8s_resource(
349341
"prometheus",
@@ -355,10 +347,10 @@ k8s_resource(
355347
docker_build(
356348
ref = "multisig",
357349
context = ".",
358-
dockerfile = "Dockerfile.multisig",
350+
dockerfile = "tilt-devnet/docker-images/Dockerfile.multisig",
359351
)
360352

361-
k8s_yaml_with_ns("devnet/multisig.yaml")
353+
k8s_yaml_with_ns("tilt-devnet/k8s/multisig.yaml")
362354

363355
k8s_resource(
364356
"multisig",

ethereum/devnet_mnemonic.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

solana/pyth2wormhole/rust-toolchain renamed to rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# ci/rust-version.sh in the branch of the solana repo that corresponds
33
# with the version we're using.
44
[toolchain]
5-
channel = "nightly-2022-02-24"
5+
channel = "nightly-2022-12-24"
66
profile = "minimal"

0 commit comments

Comments
 (0)