Skip to content

Commit 05523d9

Browse files
decofe0xrusowsky
andauthored
fix: use TIP-1011 authorizeKey ABI on T3+ hardforks (#386)
* fix: use TIP-1011 authorizeKey ABI on T3+ hardforks The AccountKeychain precompile changed the authorizeKey signature in TIP-1011 to accept a KeyRestrictions struct instead of flat params. Post-T3, the legacy selector is rejected. Branch the cast send call in tempo-check.sh so pre-T3 uses the legacy ABI and T3+ uses the new KeyRestrictions tuple. Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> * fix: drop T1 check, only branch on T2 Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> * docs: update authorizeKey comment with T3 fields Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> --------- Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>
1 parent a1b5756 commit 05523d9

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/scripts/tempo-check.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,20 @@ printf "Access key address: %s\n" "$ACCESS_KEY_ADDR"
164164

165165
# Authorize the access key on-chain first (required for gas estimation)
166166
# Account Keychain precompile: 0xAAAAAAAA00000000000000000000000000000000
167-
# SignatureType: 0 = Secp256k1, Expiry: 1893456000 (year 2030), enforceLimits: false, limits: []
168-
cast send --rpc-url "$ETH_RPC_URL" 0xAAAAAAAA00000000000000000000000000000000 \
169-
'authorizeKey(address,uint8,uint64,bool,(address,uint256)[])' \
170-
"$ACCESS_KEY_ADDR" 0 1893456000 false "[]" \
171-
--private-key "$PK"
167+
# SignatureType: 0 = Secp256k1, Expiry: 1893456000 (year 2030), enforceLimits: false, limits: [], allowAnyCalls: true
168+
if [[ "$HARDFORK" == "T2" ]]; then
169+
# Legacy: authorizeKey with flat params (pre-T3)
170+
cast send --rpc-url "$ETH_RPC_URL" 0xAAAAAAAA00000000000000000000000000000000 \
171+
'authorizeKey(address,uint8,uint64,bool,(address,uint256)[])' \
172+
"$ACCESS_KEY_ADDR" 0 1893456000 false "[]" \
173+
--private-key "$PK"
174+
else
175+
# TIP-1011 (T3+): authorizeKey takes a KeyRestrictions struct
176+
cast send --rpc-url "$ETH_RPC_URL" 0xAAAAAAAA00000000000000000000000000000000 \
177+
'authorizeKey(address,uint8,(uint64,bool,(address,uint256)[],bool,(address,bytes4)[]))' \
178+
"$ACCESS_KEY_ADDR" 0 "(1893456000,false,[],true,[])" \
179+
--private-key "$PK"
180+
fi
172181

173182
# Fund the access key address (needed for gas)
174183
fund_and_wait "$ACCESS_KEY_ADDR"

0 commit comments

Comments
 (0)