test descriptions

This commit is contained in:
Dobromir Popov
2026-07-11 22:25:30 +03:00
parent 7d259d7c9b
commit 7cf8d9bcf3
43 changed files with 876 additions and 265 deletions

View File

@@ -52,6 +52,7 @@ def _reference_output(reference_url: str) -> str:
def test_divergence_forfeits_pending_and_strikes(reference_node):
"Divergence forfeits pending and strikes\n\nTags: billing, security"
contracts = LocalSolanaContracts()
contracts.registry.submit_stake("wallet-bad", 500)
ledger = BillingLedger(starting_credit=10.0, default_price_per_1k=0.02)
@@ -79,6 +80,7 @@ def test_divergence_forfeits_pending_and_strikes(reference_node):
def test_matching_output_forfeits_nothing(reference_node):
"Matching output forfeits nothing\n\nTags: billing, security"
contracts = LocalSolanaContracts()
contracts.registry.submit_stake("wallet-good", 500)
ledger = BillingLedger(starting_credit=10.0, default_price_per_1k=0.02)
@@ -101,11 +103,8 @@ def test_matching_output_forfeits_nothing(reference_node):
def test_three_strikes_bans_and_bad_node_loses_everything(reference_node):
"""Deliberately-bad node: every job is fraudulent, checks always sample.
"Deliberately-bad node: every job is fraudulent, checks always sample.\n\nTags: billing, security"
Earn → caught → forfeit, three times over; the third strike bans the
wallet, and the tracker rejects its registration.
"""
contracts = LocalSolanaContracts()
contracts.registry.submit_stake("wallet-bad", 500)
ledger = BillingLedger(starting_credit=10.0, default_price_per_1k=0.02)
@@ -153,6 +152,7 @@ def test_three_strikes_bans_and_bad_node_loses_everything(reference_node):
def test_forfeit_endpoint_requires_auth_and_forfeits():
"Forfeit endpoint requires auth and forfeits\n\nTags: auth, billing, security"
contracts = LocalSolanaContracts()
ledger = BillingLedger(starting_credit=10.0, default_price_per_1k=0.02)
ledger.charge_request("client", MODEL, 1000, [("wallet-x", 12)])
@@ -188,7 +188,8 @@ def test_forfeit_endpoint_requires_auth_and_forfeits():
def test_probation_earns_nothing_then_earning_begins():
"""First N jobs accrue no pending balance; job N+1 earns (issue 08)."""
"First N jobs accrue no pending balance; job N+1 earns (issue 08).\n\nTags: billing, security"
contracts = LocalSolanaContracts(probationary_job_count=2)
ledger = BillingLedger(starting_credit=10.0, default_price_per_1k=0.02)
@@ -330,15 +331,8 @@ def _record_two_hop_event(
def test_60_request_stream_bans_intermittent_first_hop_cheater_not_last_hop():
"""Integration (AH-010): a 60-request stream through a two-hop route where
the *first* hop (not the last) cheats on 3 of the jobs. TOPLOC bisection
(issue 07) must blame wallet-hop0 specifically -- the old last-hop-only
heuristic would have blamed the innocent wallet-hop1 instead. Each catch
forfeits wallet-hop0's pending balance and strikes it in the same
validation cycle; the third strike bans it within the 60-request stream,
and the settlement loop's payables() then excludes only the banned wallet
while the honest downstream hop keeps earning (ADR-0015/ADR-0018).
"""
"Integration (AH-010): a 60-request stream through a two-hop route where the *first* hop (not the last) cheats on 3 of the jobs.\n\nTags: billing, security, streaming"
config = ToplocAuditConfig(topk=2, decode_batching_size=16)
backend = _FakeToploc()
reference_hop0 = [[1.0, 2.0], [3.0, 4.0]]