Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Sep 25, 2024
1 parent 89d6416 commit e8a4e8c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
54 changes: 29 additions & 25 deletions charts/deploy.just
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ init tool *ARGS:
run-smoke type *ARGS:
@just run-smoke-{{type}} {{ARGS}}

load-image image:
kind load docker-image {{image}} --name astria-dev-cluster
load-image image_name tag=default_docker_tag repo=default_repo_name:
kind load docker-image {{repo}}/{{image_name}}:{{tag}} --name astria-dev-cluster

deploy-all: deploy-cluster deploy-ingress-controller wait-for-ingress-controller deploy-astria-local wait-for-sequencer (deploy-chart "sequencer-faucet") deploy-rollup
delete-all: clean clean-persisted-data
Expand Down Expand Up @@ -207,7 +207,8 @@ sequencer_rpc_url := "http://rpc.sequencer.localdev.me"
sequencer_bridge_address := "astria13ahqz4pjqfmynk9ylrqv4fwe4957x2p0h5782u"
sequencer_bridge_pkey := "dfa7108e38ab71f89f356c72afc38600d5758f11a8c337164713e4471411d2e0"
sequencer_chain_id := "sequencer-test-chain-0"
init-rollup-bridge rollupName=defaultRollupName evmDestinationAddress=evm_destination_address transferAmount=sequencer_transfer_amount:
cli_image := "ghcr.io/astriaorg/astria-cli"
init-rollup-bridge tag=defaultTag rollupName=defaultRollupName evmDestinationAddress=evm_destination_address transferAmount=sequencer_transfer_amount:
#!/usr/bin/env bash
set -e
Expand All @@ -216,13 +217,15 @@ init-rollup-bridge rollupName=defaultRollupName evmDestinationAddress=evm_destin
FEE_ASSET="nria"
TRANSFER_AMOUNT=$(echo "{{transferAmount}} * {{sequencer_base_amount}}" | bc)

astria-cli sequencer init-bridge-account \
IMAGE="{{cli_image}}{{ if tag != '' { replace(':#', '#', tag) } else { '' } }}"

docker run --rm --network host $IMAGE sequencer init-bridge-account \
--rollup-name {{rollupName}} \
--private-key {{sequencer_bridge_pkey}} \
--sequencer.chain-id {{sequencer_chain_id}} \
--sequencer-url {{sequencer_rpc_url}} \
--fee-asset=$FEE_ASSET --asset=$ASSET || exit 1
astria-cli sequencer bridge-lock {{sequencer_bridge_address}} \
docker run --rm --network host $IMAGE sequencer bridge-lock {{sequencer_bridge_address}} \
--amount $TRANSFER_AMOUNT \
--destination-chain-address {{evmDestinationAddress}} \
--private-key $SEQUENCER_FUNDS_PKEY \
Expand All @@ -231,8 +234,8 @@ init-rollup-bridge rollupName=defaultRollupName evmDestinationAddress=evm_destin
--fee-asset=$FEE_ASSET --asset=$ASSET


init-ibc-bridge privateKey asset feeAsset rollupName=defaultRollupName:
astria-cli sequencer init-bridge-account \
init-ibc-bridge privateKey asset feeAsset tag=defaultTag rollupName=defaultRollupName:
docker run --rm --network host {{cli_image}}{{ if tag != '' { replace(':#', '#', tag) } else { '' } }} sequencer init-bridge-account \
--rollup-name {{ rollupName }} \
--private-key {{ privateKey }} \
--sequencer.chain-id {{ sequencer_chain_id }} \
Expand All @@ -244,10 +247,10 @@ eth_rpc_url := "http://executor.astria.localdev.me/"
eth_ws_url := "ws://ws-executor.astria.localdev.me/"
bridge_tx_bytes := "0xf8f280843c54e7f182898594a58639fb5458e65e4fa917ff951c390292c24a15880de0b6b3a7640000b884bab916d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002d617374726961313777306164656736346b7930646178776432756779756e65656c6c6d6a676e786c333935303400000000000000000000000000000000000000820a96a086b85348c9816f6d34533669db3d3626cf55eecea6a380d4d072efb1839df443a04b8b60c8b91dd30add1ca4a96097238d73bab29b0a958322d9a51755d5a5f287"
bridge_tx_hash := "0x67db5b0825e8f60b926234e209d54e0336cd94defe6720e7acadf871e0377150"
run-smoke-test:
run-smoke-test tag=defaultTag:
#!/usr/bin/env bash
set -e
ASTRIA_CLI_IMAGE="{{cli_image}}{{ if tag != '' { replace(':#', '#', tag) } else { '' } }}"
MAX_CHECKS=30
# Checking starting balance
Expand All @@ -258,7 +261,7 @@ run-smoke-test:
fi

echo "Testing Bridge In..."
just init rollup-bridge
just init rollup-bridge {{tag}}
CHECKS=0
EXPECTED_BALANCE=$(echo "{{sequencer_transfer_amount}} * {{sequencer_base_amount}} * {{rollup_multiplier}}" | bc)
while (( $CHECKS < $MAX_CHECKS )); do
Expand Down Expand Up @@ -301,7 +304,7 @@ run-smoke-test:
EXPECTED_BALANCE=$(echo "1 * {{sequencer_base_amount}}" | bc)
while (( $CHECKS < $MAX_CHECKS )); do
CHECKS=$((CHECKS+1))
BALANCE=$(astria-cli sequencer account balance astria17w0adeg64ky0daxwd2ugyuneellmjgnxl39504 --sequencer-url {{sequencer_rpc_url}} | awk '/nria/{print $(NF-1)}')
BALANCE=$(docker run --rm --network host $ASTRIA_CLI_IMAGE sequencer account balance astria17w0adeg64ky0daxwd2ugyuneellmjgnxl39504 --sequencer-url {{sequencer_rpc_url}} | awk '/nria/{print $(NF-1)}')
echo "Check $CHECKS, Balance: $BALANCE, Expected: $EXPECTED_BALANCE"
if [ "$BALANCE" == "$EXPECTED_BALANCE" ]; then
echo "Bridge Out Sequencer success"
Expand Down Expand Up @@ -343,10 +346,11 @@ delete-smoke-test:
just delete rollup

evm_contract_address := "0xA58639fB5458e65E4fA917FF951C390292C24A15"
run-smoke-cli:
run-smoke-cli tag=defaultTag:
#!/usr/bin/env bash
set -e
ASTRIA_CLI_IMAGE="{{cli_image}}{{ if tag != '' { replace(':#', '#', tag) } else { '' } }}"
MAX_CHECKS=30

# Checking starting balance
Expand All @@ -357,7 +361,7 @@ run-smoke-cli:
fi

echo "Testing Bridge In..."
just init rollup-bridge
just init rollup-bridge {{tag}}
CHECKS=0
EXPECTED_BALANCE=$(echo "{{sequencer_transfer_amount}} * {{sequencer_base_amount}} * {{rollup_multiplier}}" | bc)
while (( $CHECKS < $MAX_CHECKS )); do
Expand Down Expand Up @@ -400,32 +404,32 @@ run-smoke-cli:
CURRENT_BLOCK_HEX=$(just evm-get-block-by-number latest | jq -r '.number')
CURRENT_BLOCK=$(just hex-to-dec $CURRENT_BLOCK_HEX)

withdrawals_dst="$(mktemp)"
# uncomment this line if you want to inspect `withdrawals_dst`
trap "rm -f ${withdrawals_dst@Q}" EXIT

echo "passing ${withdrawals_dst} to astria-cli"

astria-cli bridge collect-withdrawals \
# Using a docker volume to handle both passing in a private key & the output file
docker volume create cli-test-withdrawals
docker run --rm -v cli-test-withdrawals:/data alpine sh -c "echo '{{sequencer_bridge_pkey}}' > /data/key"
docker run --rm -v cli-test-withdrawals:/astria --network host $ASTRIA_CLI_IMAGE bridge collect-withdrawals \
--rollup-endpoint {{eth_ws_url}} \
--contract-address {{evm_contract_address}} \
--from-rollup-height 1 \
--to-rollup-height $CURRENT_BLOCK \
--sequencer-asset-to-withdraw nria \
--bridge-address {{sequencer_bridge_address}} \
--output "${withdrawals_dst}" \
--output "/astria/tempfile" \
--force
astria-cli bridge submit-withdrawals \
--signing-key <(printf "%s" "{{sequencer_bridge_pkey}}") \
docker run --rm -v cli-test-withdrawals:/astria --network host $ASTRIA_CLI_IMAGE bridge submit-withdrawals \
--signing-key "/astria/key" \
--sequencer-chain-id {{sequencer_chain_id}} \
--sequencer-url {{sequencer_rpc_url}} \
--input "${withdrawals_dst}"
--input "/astria/tempfile"

# Can inspect the file by removing and looking in volume
docker volume remove cli-test-withdrawals

CHECKS=0
EXPECTED_BALANCE=$(echo "1 * {{sequencer_base_amount}}" | bc)
while (( $CHECKS < $MAX_CHECKS )); do
CHECKS=$((CHECKS+1))
BALANCE=$(astria-cli sequencer account balance astria17w0adeg64ky0daxwd2ugyuneellmjgnxl39504 --sequencer-url {{sequencer_rpc_url}} | awk '/nria/{print $(NF-1)}')
BALANCE=$(docker run --rm --network host $ASTRIA_CLI_IMAGE sequencer account balance astria17w0adeg64ky0daxwd2ugyuneellmjgnxl39504 --sequencer-url {{sequencer_rpc_url}} | awk '/nria/{print $(NF-1)}')
echo "Check $CHECKS, Balance: $BALANCE, Expected: $EXPECTED_BALANCE"
if [ "$BALANCE" == "$EXPECTED_BALANCE" ]; then
echo "Bridge Out Sequencer success"
Expand Down
8 changes: 4 additions & 4 deletions charts/ibc-test.just
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ delete:
kubectl wait -n astria-dev-cluster deployment hermes-local-chart --for=condition=Available=True --timeout=300s

[no-cd]
run:
run tag=defaultTag:
#!/usr/bin/env bash
set -e
initial_balance=$(just evm-get-balance {{evm_destination_address}})
initial_celestia_balance=$(just ibc-test get-celestia-balance)

# Create a bridge account on the sequencer
just init-ibc-bridge {{sequencer_tia_bridge_pkey}} transfer/channel-0/utia nria
just init-ibc-bridge {{sequencer_tia_bridge_pkey}} transfer/channel-0/utia nria {{tag}}

# Execute the transfer from Celestia to the Rollup
just ibc-test _do-ibc-transfer
Expand Down Expand Up @@ -223,5 +223,5 @@ cb address=celestia_dev_account_address namespace=defaultNamespace:
'celestia-appd query bank balances {{address}}'

# init sequencer bridge account
init-bridge-acct:
just init-ibc-bridge {{sequencer_tia_bridge_pkey}} transfer/channel-0/utia nria
init-bridge-acct tag=defaultTag:
just init-ibc-bridge {{sequencer_tia_bridge_pkey}} transfer/channel-0/utia nria {{tag}}

0 comments on commit e8a4e8c

Please sign in to comment.