Skip to content

Commit

Permalink
ci: switch from ganache to anvil
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Apr 4, 2024
1 parent 06cfa0b commit 81164db
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 81 deletions.
22 changes: 17 additions & 5 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Launch the devnet:

tilt up

By default this runs a network consisting of one guardian, two ganache (Eth) chains, a Solana test validator, an Algorand sandbox, and LocalTerra for both Terra Classic and Terra 2. If you want to work on non-consensus parts of the code, running with a single guardian is easiest since you won't have to wait for k8s to restart all pods. See the usage guide below for arguments to customize the tilt network.
By default this runs a network consisting of one guardian, two anvil (Eth) chains, a Solana test validator, an Algorand sandbox, and LocalTerra for both Terra Classic and Terra 2. If you want to work on non-consensus parts of the code, running with a single guardian is easiest since you won't have to wait for k8s to restart all pods. See the usage guide below for arguments to customize the tilt network.

## Usage

Expand Down Expand Up @@ -140,28 +140,40 @@ To re-generate these files run `rm -rf node/pkg/proto && docker build --target g

### Call gRPC services

<!-- cspell:disable-next-line -->
<!-- cspell:disable -->

tools/bin/grpcurl -protoset <(tools/bin/buf build -o -) -plaintext localhost:7072 spy.v1.SpyRPCService/SubscribeSignedVAA

<!-- cspell:enable -->

With parameters (using proto json encoding):

<!-- cspell:disable-next-line -->
<!-- cspell:disable -->

tools/bin/grpcurl -protoset <(tools/bin/buf build -o -) \
-d '{"filters": [{"emitter_filter": {"emitter_address": "574108aed69daf7e625a361864b1f74d13702f2ca56de9660e566d1d8691848d", "chain_id": "CHAIN_ID_SOLANA"}}]}' \
-plaintext localhost:7072 spy.v1.SpyRPCService/SubscribeSignedVAA

<!-- cspell:enable -->

### Post messages

To Solana:

<!-- cspell:disable-next-line -->
<!-- cspell:disable -->

kubectl exec solana-devnet-0 -c setup -- client post-message Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o 1 confirmed ffff

<!-- cspell:enable -->

To Solana as CPI instruction:

<!-- cspell:disable-next-line -->
<!-- cspell:disable -->

kubectl exec solana-devnet-0 -c setup -- client post-message --proxy CP1co2QMMoDPbsmV7PGcUTLFwyhgCgTXt25gLQ5LewE1 Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o 1 confirmed ffff

<!-- cspell:enable -->

### Observation Requests

kubectl exec -it guardian-0 -- /guardiand admin send-observation-request --socket /tmp/admin.sock 1 4636d8f7593c78a5092bed13dec765cc705752653db5eb1498168c92345cd389
Expand Down
4 changes: 2 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ k8s_yaml_with_ns("devnet/eth-devnet.yaml")
k8s_resource(
"eth-devnet",
port_forwards = [
port_forward(8545, name = "Ganache RPC [:8545]", host = webHost),
port_forward(8545, name = "Anvil RPC [:8545]", host = webHost),
],
labels = ["evm"],
trigger_mode = trigger_mode,
Expand All @@ -546,7 +546,7 @@ if evm2:
k8s_resource(
"eth-devnet2",
port_forwards = [
port_forward(8546, name = "Ganache RPC [:8546]", host = webHost),
port_forward(8546, 8545, name = "Anvil RPC [:8546]", host = webHost),
],
labels = ["evm"],
trigger_mode = trigger_mode,
Expand Down
23 changes: 7 additions & 16 deletions devnet/eth-devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@ spec:
spec:
terminationGracePeriodSeconds: 1
containers:
- name: ganache
- name: anvil
image: eth-node
command:
- npx
- ganache-cli
- --logging.quiet
- --wallet.defaultBalance=10000
- --wallet.deterministic
- --chain.time="1970-01-01T00:00:00+00:00"
- anvil
- --silent
- --mnemonic=myth like bonus scare over problem client lizard pioneer submit female collect
- --block-time=1
- --host=0.0.0.0
- --wallet.totalAccounts=13
- --chain.chainId=1337
- --chain.asyncRequestProcessing=false
- --accounts=13
- --chain-id=1337
ports:
- containerPort: 8545
name: rpc
Expand All @@ -64,11 +61,5 @@ spec:
initialDelaySeconds: 90
tcpSocket:
port: 2000
- name: mine
image: eth-node
command:
- /bin/sh
- -c
- "cd ../../ethereum && npx truffle exec mine.js"
---

23 changes: 7 additions & 16 deletions devnet/eth-devnet2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,16 @@ spec:
spec:
terminationGracePeriodSeconds: 1
containers:
- name: ganache
- name: anvil
image: eth-node
command:
- npx
- ganache-cli
- --logging.quiet
- --wallet.defaultBalance=10000
- --wallet.deterministic
- --chain.time="1970-01-01T00:00:00+00:00"
- anvil
- --silent
- --mnemonic=myth like bonus scare over problem client lizard pioneer submit female collect
- --block-time=1
- --host=0.0.0.0
- --wallet.totalAccounts=13
- --chain.chainId=1397
- --chain.asyncRequestProcessing=false
- --accounts=13
- --chain-id=1397
ports:
- containerPort: 8545
name: rpc
Expand All @@ -65,9 +62,3 @@ spec:
initialDelaySeconds: 90
tcpSocket:
port: 2000
- name: mine
image: eth-node
command:
- /bin/sh
- -c
- "cd ../../ethereum && npx truffle exec mine.js"
1 change: 1 addition & 0 deletions ethereum/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN $HOME/.foundry/bin/foundryup
RUN ls $HOME/.foundry/bin

# Run as user, otherwise, npx explodes.
RUN mv /root/.foundry/bin/anvil /bin/anvil
RUN mv /root/.foundry/bin/forge /bin/forge
USER 1000

Expand Down
6 changes: 0 additions & 6 deletions ethereum/copy-from-container.sh

This file was deleted.

36 changes: 0 additions & 36 deletions ethereum/mine.js

This file was deleted.

0 comments on commit 81164db

Please sign in to comment.