Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECO-2725] Update localnet and deployer to use Aptos CLI v6.0.1 #533

Merged
merged 7 commits into from
Jan 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/docker/deployer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

@@ -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/
16 changes: 8 additions & 8 deletions src/docker/deployer/sh/build-publish-payloads.sh
Original file line number Diff line number Diff line change
@@ -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
@@ -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() {
6 changes: 5 additions & 1 deletion src/docker/deployer/sh/init-profile.sh
Original file line number Diff line number Diff line change
@@ -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
@@ -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
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/*