Skip to content

Commit

Permalink
[ECO-2725] Update localnet and deployer to use Aptos CLI v6.0.1 (
Browse files Browse the repository at this point in the history
  • Loading branch information
xbtmatt authored Jan 30, 2025
1 parent ab48705 commit 944b5ff
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
5 changes: 4 additions & 1 deletion src/docker/deployer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# the `yq` releases on apt are outdated and technically deprecated.
FROM mikefarah/yq:4.44.3 AS yq

FROM econialabs/aptos-cli:4.4.0
FROM econialabs/aptos-cli:6.0.1

COPY --from=yq /usr/bin/yq /usr/bin/yq

Expand All @@ -15,6 +15,9 @@ ENV PUBLISHER_PRIVATE_KEY=${PUBLISHER_PRIVATE_KEY}
# Ensure the publisher private key is set.
RUN test -n "${PUBLISHER_PRIVATE_KEY}"

RUN apt-get update && apt-get install --no-install-recommends -y bc=1.07* \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY src/move/emojicoin_dot_fun/sources/* move/emojicoin_dot_fun/sources/
Expand Down
16 changes: 8 additions & 8 deletions src/docker/deployer/sh/build-publish-payloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ aptos move build-publish-payload \
--skip-fetch-latest-git-deps \
--move-2

# aptos move build-publish-payload \
# --assume-yes \
# --named-addresses $arena_addresses \
# emojicoin_arena=$profile,integrator=$profile,emojicoin_dot_fun=$profile"
# --package-dir $move_dir/emojicoin_arena/ \
# --json-output-file $json_dir/emojicoin_arena.json \
# --skip-fetch-latest-git-deps \
# --move-2
aptos move build-publish-payload \
--assume-yes \
--named-addresses \
emojicoin_arena=$profile,integrator=$profile,emojicoin_dot_fun=$profile \
--package-dir $move_dir/emojicoin_arena/ \
--json-output-file $json_dir/emojicoin_arena.json \
--skip-fetch-latest-git-deps \
--move-2
15 changes: 15 additions & 0 deletions src/docker/deployer/sh/compare-addresses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# cspell:word obase

# Strip the leading "0x" from the address and remove all leading zeros.
function standardize_address() {
local str="${1#0x}"
echo "obase=16; $((16#$str))" | bc
}

# Compare two addresses by standardizing them first.
function compare_addresses() {
local addr1=$(standardize_address "$1")
local addr2=$(standardize_address "$2")
[[ $addr1 == $addr2 ]]
}
12 changes: 6 additions & 6 deletions src/docker/deployer/sh/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ fund_and_publish() {
--gas-unit-price $gas_unit_price \
--profile $profile

# aptos move run \
# --assume-yes \
# --json-file /app/json/emojicoin_arena.json \
# --max-gas 2000000 \
# --gas-unit-price $gas_unit_price \
# --profile $profile
aptos move run \
--assume-yes \
--json-file /app/json/emojicoin_arena.json \
--max-gas 2000000 \
--gas-unit-price $gas_unit_price \
--profile $profile
}

fund_test_accounts() {
Expand Down
6 changes: 5 additions & 1 deletion src/docker/deployer/sh/init-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fi

source /app/sh/cli-profile.sh
source /app/sh/colors.sh
source /app/sh/compare-addresses.sh

current_key=$(get_publisher_private_key)
if [ "$current_key" == "$PUBLISHER_PRIVATE_KEY" ]; then
Expand Down Expand Up @@ -43,8 +44,11 @@ if [ -n "$result" ]; then
# Only throw an error if the profile wasn't initialized with the
# correct private key, since that's all we care about.
current_key=$(get_publisher_private_key)
if [ "$current_key" != "$PUBLISHER_PRIVATE_KEY" ]; then
if ! compare_addresses "$PUBLISHER_PRIVATE_KEY" "$current_key"; then
log_error "Failed to initialize profile \"$profile\""
log_error "Publisher private keys don't match."
log_error "Env var publisher private key: $PUBLISHER_PRIVATE_KEY"
log_error "Expected private key: $current_key"
log_error $(echo $result | jq -r '.Error')
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion src/docker/localnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cspell:word localnet

FROM econialabs/aptos-cli:4.4.0
FROM econialabs/aptos-cli:6.0.1

RUN apt-get update && apt-get install --no-install-recommends -y bc=1.07* \
&& rm -rf /var/lib/apt/lists/*
Expand Down

0 comments on commit 944b5ff

Please sign in to comment.