Skip to content

Commit bd3b7c0

Browse files
committed
fix: F8 — wait for agent A's funded note to sync through its module before task stages (testnet lag starved the async pay worker, so neither the gate nor the payment ever executed), poll pending_approvals instead of snapshotting, widen B's receive window
1 parent 4afe9d7 commit bd3b7c0

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

tests/demo-f8-testnet.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ printf "%s\n" "$PW" | $W config set sequencer_addr "$TESTNET" >/dev/null 2>&1
7676
TXA=$(printf "%s\n" "$PW" | RISC0_DEV_MODE=0 $W auth-transfer send --from "$GEN" --to-npk "$ANPK" --to-vpk "$AVPK" --amount 100 2>&1 | grep -oiE "hash is [0-9a-f]{64}" | awk '{print $3}')
7777
say "fund A tx: ${TXA:-FAILED}"
7878

79+
st "STAGE 3.5: wait until agent A SEES its balance through its module (testnet note sync lags)"
80+
ABAL=0
81+
for i in $(seq 1 60); do
82+
"$LC" --config-dir ~/cfgA call lez_wallet_module sync_private >/dev/null 2>&1
83+
ABAL=$("$LC" --config-dir ~/cfgA call lez_wallet_module balance 2>/dev/null | grep -oE '"result":"[0-9]+"' | grep -oE '[0-9]+' | head -1)
84+
[ -n "$ABAL" ] && [ "$ABAL" != "0" ] && break
85+
sleep 6
86+
done
87+
say "agent A balance through its module: ${ABAL:-0}"
88+
[ "${ABAL:-0}" != "0" ] || say "STAGE3.5_WARN: A note not synced — pay/gate stages will likely stall"
89+
7990
st "STAGE 4: set agent A per_tx_limit=50 (so a 5 LEZ pay is autonomous, an 80 is held)"
8091
"$LC" --config-dir ~/cfgA call agent_module meta_configure per_tx_limit 50 >/dev/null 2>&1
8192
"$LC" --config-dir ~/cfgA call agent_module meta_configure agent_npk "$ANPK" >/dev/null 2>&1
@@ -108,11 +119,15 @@ say "agent A peer_count=$PC"
108119
st "STAGE 7: over-limit task is HELD (F5) — card priced 80 > limit 50"
109120
GATECARD="{\"name\":\"agentB\",\"skills\":[{\"name\":\"compute.run\",\"lez_price\":\"80\"}],\"x-lez-identity\":{\"npk\":\"$BNPK\",\"vpk\":\"$BVPK\"}}"
110121
"$LC" --config-dir ~/cfgA call agent_module agent_task "$GATECARD" compute.run '{"q":"x"}' >/dev/null 2>&1
111-
"$LC" --config-dir ~/cfgA call agent_module meta_status >~/msA.json 2>/dev/null
112-
PA=$(python3 -c "import json;t=open('$HOME/msA.json').read();
122+
PA=0
123+
for i in $(seq 1 20); do
124+
"$LC" --config-dir ~/cfgA call agent_module meta_status >~/msA.json 2>/dev/null
125+
PA=$(python3 -c "import json;t=open('$HOME/msA.json').read();
113126
try:
114127
r=json.loads(json.loads([l for l in t.splitlines() if l.strip().startswith('{')][-1])['result'])['result']; print(len(r.get('pending_approvals',[])))
115128
except: print(0)" 2>/dev/null)
129+
[ "${PA:-0}" -ge 1 ] 2>/dev/null && break; sleep 6
130+
done
116131
say "pending_approvals after over-limit task: $PA"
117132

118133
st "STAGE 8: under-limit — agent A pays agent B 5 LEZ autonomously (ONE real proof, testnet)"
@@ -125,7 +140,7 @@ sleep 8; head -4 ~/paytask.log >>"$R" 2>/dev/null
125140

126141
st "STAGE 9: confirm agent B received (poll balance through B's module)"
127142
BBAL=0
128-
for i in $(seq 1 40); do
143+
for i in $(seq 1 80); do
129144
"$LC" --config-dir ~/cfgB call lez_wallet_module sync_private >/dev/null 2>&1
130145
BBAL=$("$LC" --config-dir ~/cfgB call lez_wallet_module balance 2>/dev/null | grep -oE '"result":"[0-9]+"' | grep -oE '[0-9]+' | head -1)
131146
[ -n "$BBAL" ] && [ "$BBAL" != "0" ] && break

0 commit comments

Comments
 (0)