Skip to content

Commit 9231cdd

Browse files
committed
Update P1 verification test to happy path
Replaces the test for timestamp out-of-window failure with a happy path test for P1 notes, verifying successful on-chain hash and timestamp validation.
1 parent 2d1f3a6 commit 9231cdd

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tests/python_sdks/test_verifier_core.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,13 @@ def fake_decode(note_b64):
204204
assert res["note_sha256"] != res["rebuilt_sha256"]
205205

206206

207-
def test_verify_tx_p1_ts_out_of_window(monkeypatch):
207+
def test_verify_tx_p1_happy_path(monkeypatch):
208208
"""
209-
P1 note with ts outside allowed skew window should fail with
210-
reason='ts_out_of_window'.
209+
P1 note with matching hash and in-window ts should verify successfully.
211210
"""
212211
fake_now = 1_700_000_000
213-
# Put ts well in the past beyond default skew
214-
ts_past = fake_now - (vmod.DEFAULT_SKEW_PAST_SEC + 10)
215-
note = _make_p1_note(ts=ts_past, with_hash=False)
212+
# Do NOT include note_sha256 here; typical on-chain note does not have it.
213+
note = _make_p1_note(ts=fake_now, with_hash=False)
216214

217215
def fake_fetch(txid, network, indexer_url=None):
218216
return {
@@ -231,6 +229,9 @@ def fake_decode(note_b64):
231229
monkeypatch.setattr(vmod.time, "time", lambda: fake_now)
232230

233231
res = verify_tx("FAKE_TX", network="testnet")
234-
assert res["verified"] is False
232+
assert res["verified"] is True
235233
assert res["mode"] == "p1"
236-
assert res["reason"] == "ts_out_of_window"
234+
assert res["reason"] is None
235+
assert res["confirmed_round"] == 321
236+
assert res["note"] == note
237+
assert res["note_sha256"] == res["rebuilt_sha256"]

0 commit comments

Comments
 (0)