Skip to content

Commit cd9993e

Browse files
author
pll
committed
update install_qa
1 parent 7688969 commit cd9993e

1 file changed

Lines changed: 55 additions & 59 deletions

File tree

install_qa.sh

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,61 @@ else
1515
fi
1616

1717
CONFIG_FILE="$MANTLE_CONFIG_DIR/cicd/services/mantle-op-$TYPE/app-$NAMESPACE.yaml"
18+
decode_calldata() {
1819

20+
CALLDATA="$1"
21+
22+
echo "== 外层 CALLDATA =="
23+
echo "$CALLDATA"
24+
echo
25+
26+
# 2) 解码外层 ProxyAdmin.upgradeAndCall(address proxy, address impl, bytes data)
27+
echo "== 解码 upgradeAndCall(address,address,bytes) =="
28+
OUTER=$(cast calldata-decode "upgradeAndCall(address,address,bytes)" "$CALLDATA")
29+
echo "$OUTER"
30+
echo
31+
32+
PROXY=$(echo "$OUTER" | sed -n '1p' | awk '{print $1}')
33+
IMPL=$(echo "$OUTER" | sed -n '2p' | awk '{print $1}')
34+
INNER=$(echo "$OUTER" | sed -n '3p' | awk '{print $1}')
35+
36+
echo "proxy = $PROXY"
37+
echo "implementation = $IMPL"
38+
echo "inner selector = ${INNER:0:10}"
39+
echo
40+
41+
# 3) 解码内层 initialize(InitParams)
42+
# struct InitParams {
43+
# address challenger; address proposer; address owner;
44+
# uint256 finalizationPeriodSeconds; uint256 l2BlockTime;
45+
# bytes32 aggregationVkey; bytes32 rangeVkeyCommitment; bytes32 rollupConfigHash;
46+
# bytes32 startingOutputRoot; uint256 startingBlockNumber; uint256 startingTimestamp;
47+
# uint256 submissionInterval; address verifier;
48+
# }
49+
INIT_SIG="initialize((address,address,address,uint256,uint256,bytes32,bytes32,bytes32,bytes32,uint256,uint256,uint256,address))"
50+
51+
echo "== 解码内层 $INIT_SIG =="
52+
DECODED=$(cast calldata-decode "$INIT_SIG" "$INNER")
53+
echo "$DECODED"
54+
echo
55+
56+
# 4) 逐字段标注
57+
FIELDS=(challenger proposer owner finalizationPeriodSeconds l2BlockTime \
58+
aggregationVkey rangeVkeyCommitment rollupConfigHash startingOutputRoot \
59+
startingBlockNumber startingTimestamp submissionInterval verifier)
60+
61+
echo "== 字段核对 =="
62+
# cast 把 tuple 输出成一行: (v0, v1, ...)。去掉外层括号后按 ", " 拆分。
63+
INNER_TUPLE="${DECODED#\(}"
64+
INNER_TUPLE="${INNER_TUPLE%\)}"
65+
IFS=',' read -ra VALS <<< "$INNER_TUPLE"
66+
for i in "${!FIELDS[@]}"; do
67+
v="${VALS[$i]}"
68+
v="${v#"${v%%[![:space:]]*}"}" # 去掉前导空格
69+
printf "%-26s = %s\n" "${FIELDS[$i]}" "$v"
70+
done
71+
72+
}
1973
read_addr() {
2074
local dec padded
2175
dec=$(yq "$1" "$CONFIG_FILE")
@@ -109,62 +163,4 @@ cast send --private-key $KEY_addrowner \
109163
"upgrade(address,address)" \
110164
$CA_L2OutputOracleProxy \
111165
$SUCCINCTIMPL \
112-
-r $L1_RPC
113-
114-
115-
116-
function decode_calldata() {
117-
118-
CALLDATA="$1"
119-
120-
echo "== 外层 CALLDATA =="
121-
echo "$CALLDATA"
122-
echo
123-
124-
# 2) 解码外层 ProxyAdmin.upgradeAndCall(address proxy, address impl, bytes data)
125-
echo "== 解码 upgradeAndCall(address,address,bytes) =="
126-
OUTER=$(cast calldata-decode "upgradeAndCall(address,address,bytes)" "$CALLDATA")
127-
echo "$OUTER"
128-
echo
129-
130-
PROXY=$(echo "$OUTER" | sed -n '1p' | awk '{print $1}')
131-
IMPL=$(echo "$OUTER" | sed -n '2p' | awk '{print $1}')
132-
INNER=$(echo "$OUTER" | sed -n '3p' | awk '{print $1}')
133-
134-
echo "proxy = $PROXY"
135-
echo "implementation = $IMPL"
136-
echo "inner selector = ${INNER:0:10}"
137-
echo
138-
139-
# 3) 解码内层 initialize(InitParams)
140-
# struct InitParams {
141-
# address challenger; address proposer; address owner;
142-
# uint256 finalizationPeriodSeconds; uint256 l2BlockTime;
143-
# bytes32 aggregationVkey; bytes32 rangeVkeyCommitment; bytes32 rollupConfigHash;
144-
# bytes32 startingOutputRoot; uint256 startingBlockNumber; uint256 startingTimestamp;
145-
# uint256 submissionInterval; address verifier;
146-
# }
147-
INIT_SIG="initialize((address,address,address,uint256,uint256,bytes32,bytes32,bytes32,bytes32,uint256,uint256,uint256,address))"
148-
149-
echo "== 解码内层 $INIT_SIG =="
150-
DECODED=$(cast calldata-decode "$INIT_SIG" "$INNER")
151-
echo "$DECODED"
152-
echo
153-
154-
# 4) 逐字段标注
155-
FIELDS=(challenger proposer owner finalizationPeriodSeconds l2BlockTime \
156-
aggregationVkey rangeVkeyCommitment rollupConfigHash startingOutputRoot \
157-
startingBlockNumber startingTimestamp submissionInterval verifier)
158-
159-
echo "== 字段核对 =="
160-
# cast 把 tuple 输出成一行: (v0, v1, ...)。去掉外层括号后按 ", " 拆分。
161-
INNER_TUPLE="${DECODED#\(}"
162-
INNER_TUPLE="${INNER_TUPLE%\)}"
163-
IFS=',' read -ra VALS <<< "$INNER_TUPLE"
164-
for i in "${!FIELDS[@]}"; do
165-
v="${VALS[$i]}"
166-
v="${v#"${v%%[![:space:]]*}"}" # 去掉前导空格
167-
printf "%-26s = %s\n" "${FIELDS[$i]}" "$v"
168-
done
169-
170-
}
166+
-r $L1_RPC

0 commit comments

Comments
 (0)