Skip to content

Commit a4f366d

Browse files
local-multi-validator tss setup
1 parent 711b88f commit a4f366d

File tree

7 files changed

+688
-176
lines changed

7 files changed

+688
-176
lines changed

e2e-tests/deploy_addresses.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"generatedAt": "2026-03-27T08:28:17Z",
2+
"generatedAt": "2026-03-27T15:09:03Z",
33
"contracts": {
44
"WPC": "0xB2cf4B3aec93F4A8F92b292d2F605591dB3e3011",
55
"Factory": "0x057931Df99f61caB5e5DbDb6224D7003E64F659e",

e2e-tests/setup.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,16 @@ step_devnet() {
665665
log_ok "Devnet is up"
666666
}
667667

668+
step_ensure_tss_key_ready() {
669+
require_cmd bash
670+
log_info "Ensuring TSS key is ready"
671+
(
672+
cd "$LOCAL_DEVNET_DIR"
673+
./devnet tss-keygen
674+
)
675+
log_ok "TSS key is ready"
676+
}
677+
668678
step_setup_environment() {
669679
if ! is_local_testing_env; then
670680
log_info "TESTING_ENV is not LOCAL, skipping setup-environment"
@@ -2048,6 +2058,7 @@ cmd_all() {
20482058
step_update_env_fund_to_address
20492059
step_stop_running_nodes
20502060
step_devnet
2061+
step_ensure_tss_key_ready
20512062
if is_local_testing_env; then
20522063
step_setup_environment
20532064
fi

local-multi-validator/devnet

Lines changed: 347 additions & 32 deletions
Large diffs are not rendered by default.

local-multi-validator/scripts/setup-universal.sh

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,17 @@ fi
338338

339339
echo "🔐 Waiting for AuthZ grants to be created by core validator..."
340340
echo "📝 Core validators create AuthZ grants after UV registration completes"
341-
echo "📋 Required grants: MsgVoteInbound, MsgVoteChainMeta, MsgVoteOutbound"
341+
echo "📋 Required grants: MsgVoteInbound, MsgVoteChainMeta, MsgVoteOutbound, MsgVoteTssKeyProcess"
342342

343343
# Get the hotkey address
344344
HOTKEY_ADDR=$($BINARY keys show "$HOTKEY_NAME" --address --keyring-backend test --home "$HOME_DIR" 2>/dev/null || echo "")
345345

346346
# Required message types (must match PushSigner validation requirements)
347-
REQUIRED_MSG_TYPES='["/uexecutor.v1.MsgVoteInbound","/uexecutor.v1.MsgVoteChainMeta","/uexecutor.v1.MsgVoteOutbound"]'
348-
REQUIRED_GRANTS=3
347+
REQUIRED_MSG_TYPES='["/uexecutor.v1.MsgVoteInbound","/uexecutor.v1.MsgVoteChainMeta","/uexecutor.v1.MsgVoteOutbound","/utss.v1.MsgVoteTssKeyProcess"]'
348+
REQUIRED_GRANTS=4
349+
350+
# Allow additional time for grant propagation during startup races.
351+
AUTHZ_GRANTS_WAIT_SECONDS=${AUTHZ_GRANTS_WAIT_SECONDS:-120}
349352

350353
# Query core-validator-1 for grants (genesis validator creates ALL grants immediately)
351354
GRANTS_QUERY_HOST="core-validator-1"
@@ -354,14 +357,14 @@ if [ -n "$HOTKEY_ADDR" ]; then
354357
echo "🔍 Checking for AuthZ grants for hotkey: $HOTKEY_ADDR"
355358
echo "📡 Querying grants from: $GRANTS_QUERY_HOST:1317"
356359

357-
# Wait for all required AuthZ grants (should be fast - genesis validator creates all grants)
358-
max_wait=20
360+
# Wait for all required AuthZ grants (genesis validator creates all grants, but propagation can lag)
361+
max_wait=$AUTHZ_GRANTS_WAIT_SECONDS
359362
wait_time=0
360363
MATCHED_GRANTS=0
361364
while [ $wait_time -lt $max_wait ]; do
362365
# Query grants and count only required message types
363366
MATCHED_GRANTS=$(curl -s "http://$GRANTS_QUERY_HOST:1317/cosmos/authz/v1beta1/grants/grantee/$HOTKEY_ADDR" 2>/dev/null | \
364-
jq -r --argjson required "$REQUIRED_MSG_TYPES" '[.grants[]? | select(.authorization.value.msg as $m | $required | index($m))] | length' 2>/dev/null || echo "0")
367+
jq -r --argjson required "$REQUIRED_MSG_TYPES" '[.grants[]? | (.authorization.msg // .authorization.value.msg // "") as $m | select($required | index($m))] | length' 2>/dev/null || echo "0")
365368

366369
if [ "$MATCHED_GRANTS" -ge "$REQUIRED_GRANTS" ] 2>/dev/null; then
367370
echo "✅ Found all $MATCHED_GRANTS/$REQUIRED_GRANTS required AuthZ grants!"
@@ -377,11 +380,12 @@ if [ -n "$HOTKEY_ADDR" ]; then
377380
done
378381

379382
if [ "$MATCHED_GRANTS" -lt "$REQUIRED_GRANTS" ] 2>/dev/null; then
380-
echo "⚠️ Only found $MATCHED_GRANTS/$REQUIRED_GRANTS required grants after ${max_wait}s"
381-
echo " The universal validator may fail startup validation if grants are missing."
383+
echo "⚠️ Only found $MATCHED_GRANTS/$REQUIRED_GRANTS required grants after ${max_wait}s"
384+
echo " Continuing startup; grants may still arrive shortly."
382385
fi
383386
else
384-
echo "⚠️ Could not get hotkey address, skipping AuthZ check"
387+
echo "❌ Could not get hotkey address, cannot verify AuthZ grants"
388+
exit 1
385389
fi
386390

387391
# ---------------------------
@@ -407,7 +411,7 @@ if [ -n "$EXPECTED_PEER_ID" ]; then
407411
reg_wait=0
408412
while [ $reg_wait -lt $max_reg_wait ]; do
409413
# Query all universal validators via REST API and look for our peer_id
410-
FOUND=$(curl -s "http://core-validator-1:1317/push/uvalidator/v1/all_universal_validators" 2>/dev/null | \
414+
FOUND=$(curl -s "http://core-validator-1:1317/uvalidator/v1/universal_validators" 2>/dev/null | \
411415
jq -r --arg pid "$EXPECTED_PEER_ID" \
412416
'.universal_validator[]? | select(.network_info.peer_id == $pid) | .network_info.peer_id' 2>/dev/null || echo "")
413417

@@ -424,10 +428,13 @@ if [ -n "$EXPECTED_PEER_ID" ]; then
424428
done
425429

426430
if [ -z "$FOUND" ]; then
427-
echo "⚠️ Validator not found on-chain after ${max_reg_wait}s, continuing anyway..."
431+
echo "❌ Validator not found on-chain after ${max_reg_wait}s"
432+
echo " Failing startup so container restarts until registration is correct."
433+
exit 1
428434
fi
429435
else
430-
echo "⚠️ Unknown UNIVERSAL_ID, skipping registration check"
436+
echo "❌ Unknown UNIVERSAL_ID, cannot validate on-chain registration"
437+
exit 1
431438
fi
432439

433440
# ---------------------------

0 commit comments

Comments
 (0)