Skip to content

Commit 7d6ab85

Browse files
committed
add propose and execute for object upgrade
1 parent 503e15f commit 7d6ab85

2 files changed

Lines changed: 102 additions & 0 deletions

File tree

examples/execute_object_upgrade.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# #!/bin/sh
2+
3+
# Execute a hash-only multisig proposal for object_code_deployment::upgrade. Rebuild must match propose_object_upgrade.sh
4+
# (same oft_fa, named-addresses, package, and jq transform) or the hash will not match.
5+
#
6+
# Requires: jq (brew install jq)
7+
#
8+
set -e
9+
set -u
10+
set -o pipefail
11+
12+
if ! command -v jq >/dev/null 2>&1; then
13+
echo "jq is required (e.g. brew install jq)" >&2
14+
exit 1
15+
fi
16+
17+
multisig_address="0x98ebb7985c84a89972022edf391bdaa7d95f061d9742efb3703de368413431e1"
18+
oft_fa="0x3dfe1ac4574c7dbbe6f1c5ba862de88fc3e7d3cf8eba95ef1abf32b582889e6d"
19+
20+
source ./set_move_env.sh
21+
set_move_env movement mainnet oft-aptos-move
22+
23+
base_payload="$(mktemp /tmp/oft_object_upgrade_base.XXXXXX.json)"
24+
payload_file="$(mktemp /tmp/oft_object_upgrade_payload.XXXXXX.json)"
25+
26+
cleanup() {
27+
rm -f "$base_payload" "$payload_file"
28+
}
29+
trap cleanup EXIT
30+
31+
movement move build-publish-payload \
32+
--package-dir oft-aptos-move \
33+
--named-addresses oft="$oft_fa",oft_admin="$multisig_address" \
34+
--json-output-file "$base_payload" \
35+
--assume-yes
36+
37+
jq --arg obj "$oft_fa" \
38+
'.function_id = "0x1::object_code_deployment::upgrade" | .args += [{"type": "address", "value": $obj}]' \
39+
"$base_payload" >"$payload_file"
40+
41+
# Simulate first: append --local. Remove --assume-yes to review gas prompts interactively.
42+
movement multisig execute-with-payload \
43+
--multisig-address "$multisig_address" \
44+
--json-file "$payload_file" \
45+
--assume-yes \
46+
--profile eoa
47+
48+
# movement multisig verify-proposal \
49+
# --multisig-address "$multisig_address" \
50+
# --sequence-number <N> \
51+
# --json-file "$payload_file" \
52+
# --profile ops

examples/propose_object_upgrade.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# #!/bin/sh
2+
3+
# Multisig proposal for upgrading a package deployed with 0x1::object_code_deployment (object holds PackageRegistry).
4+
#
5+
# Movement CLI only has `build-publish-payload`, which targets 0x1::code::publish_package_txn. The first two
6+
# arguments (package metadata + module bytecode) are the same as for object_code_deployment::upgrade; we
7+
# rewrite the JSON to call 0x1::object_code_deployment::upgrade and append the code-object address.
8+
#
9+
# Requires: jq (brew install jq)
10+
#
11+
set -e
12+
set -u
13+
set -o pipefail
14+
15+
if ! command -v jq >/dev/null 2>&1; then
16+
echo "jq is required (e.g. brew install jq)" >&2
17+
exit 1
18+
fi
19+
20+
multisig_address="0x98ebb7985c84a89972022edf391bdaa7d95f061d9742efb3703de368413431e1"
21+
# Must match propose.sh: @oft and the code object arg to object_code_deployment::upgrade.
22+
oft_fa="0x3dfe1ac4574c7dbbe6f1c5ba862de88fc3e7d3cf8eba95ef1abf32b582889e6d"
23+
24+
source ./set_move_env.sh
25+
set_move_env movement mainnet oft-aptos-move
26+
27+
base_payload="$(mktemp /tmp/oft_object_upgrade_base.XXXXXX.json)"
28+
payload_file="$(mktemp /tmp/oft_object_upgrade_payload.XXXXXX.json)"
29+
30+
cleanup() {
31+
rm -f "$base_payload" "$payload_file"
32+
}
33+
trap cleanup EXIT
34+
35+
movement move build-publish-payload \
36+
--package-dir oft-aptos-move \
37+
--named-addresses oft="$oft_fa",oft_admin="$multisig_address" \
38+
--json-output-file "$base_payload" \
39+
--assume-yes
40+
41+
jq --arg obj "$oft_fa" \
42+
'.function_id = "0x1::object_code_deployment::upgrade" | .args += [{"type": "address", "value": $obj}]' \
43+
"$base_payload" >"$payload_file"
44+
45+
movement multisig create-transaction \
46+
--multisig-address "$multisig_address" \
47+
--json-file "$payload_file" \
48+
--store-hash-only \
49+
--local \
50+
--profile ops

0 commit comments

Comments
 (0)