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

@@ -26,6 +26,7 @@ MODEL = "stub-model"
def test_clean_audit_increases_reputation_by_documented_delta():
"Clean audit increases reputation by documented delta\n\nTags: general"
contracts = LocalSolanaContracts()
contracts.registry.record_audit_outcome("wallet-a", passed=False) # 1.0 -> 0.7
before = contracts.registry.get_wallet("wallet-a").reputation
@@ -37,6 +38,7 @@ def test_clean_audit_increases_reputation_by_documented_delta():
def test_failed_audit_decreases_reputation_by_documented_delta():
"Failed audit decreases reputation by documented delta\n\nTags: general"
contracts = LocalSolanaContracts()
contracts.registry.record_audit_outcome("wallet-b", passed=False)
assert contracts.registry.get_wallet("wallet-b").reputation == pytest.approx(
@@ -45,6 +47,7 @@ def test_failed_audit_decreases_reputation_by_documented_delta():
def test_reputation_clamps_to_documented_bounds():
"Reputation clamps to documented bounds\n\nTags: general"
contracts = LocalSolanaContracts()
for _ in range(10):
contracts.registry.record_audit_outcome("wallet-c", passed=False)
@@ -56,9 +59,8 @@ def test_reputation_clamps_to_documented_bounds():
def test_reputation_uses_persisted_fields_not_a_second_schema(tmp_path):
"""Red (issue 08 test-first item 1): reputation deltas must persist and
reload through the same event log issue 05 already wired — no parallel
storage path."""
"Red (issue 08 test-first item 1): reputation deltas must persist and reload through the same event log issue 05 already wired — no parallel storage path.\n\nTags: persistence"
db = str(tmp_path / "registry.sqlite")
contracts = LocalSolanaContracts(registry_db=db)
contracts.registry.record_audit_outcome("wallet-d", passed=False)
@@ -74,6 +76,7 @@ def test_reputation_uses_persisted_fields_not_a_second_schema(tmp_path):
def test_strike_applies_graduated_routing_multiplier_not_full_penalty():
"Strike applies graduated routing multiplier not full penalty\n\nTags: general"
contracts = LocalSolanaContracts()
contracts.registry.submit_stake("wallet-e", 500)
assert contracts.registry.routing_multiplier("wallet-e") == pytest.approx(1.0)
@@ -88,6 +91,7 @@ def test_strike_applies_graduated_routing_multiplier_not_full_penalty():
def test_three_strikes_still_bans_and_probation_still_enforced():
"Three strikes still bans and probation still enforced\n\nTags: general"
contracts = LocalSolanaContracts(probationary_job_count=2)
for _ in range(3):
contracts.registry.record_strike("wallet-f")
@@ -103,6 +107,7 @@ def test_three_strikes_still_bans_and_probation_still_enforced():
def test_inactivity_decay_after_idle_days_without_completed_jobs():
"Inactivity decay after idle days without completed jobs\n\nTags: general"
contracts = LocalSolanaContracts()
contracts.registry.record_completed_jobs("wallet-h", 1, ts=0.0)
@@ -116,6 +121,7 @@ def test_inactivity_decay_after_idle_days_without_completed_jobs():
def test_inactivity_decay_skips_wallets_active_within_the_window():
"Inactivity decay skips wallets active within the window\n\nTags: security, wallet"
contracts = LocalSolanaContracts()
contracts.registry.record_completed_jobs("wallet-i", 1, ts=1000.0)
@@ -128,6 +134,7 @@ def test_inactivity_decay_skips_wallets_active_within_the_window():
def test_inactivity_decay_applies_at_most_once_per_idle_window():
"Inactivity decay applies at most once per idle window\n\nTags: general"
contracts = LocalSolanaContracts()
contracts.registry.record_completed_jobs("wallet-j", 1, ts=0.0)
idle_seconds = 30 * 86400.0
@@ -140,6 +147,7 @@ def test_inactivity_decay_applies_at_most_once_per_idle_window():
def test_inactivity_decay_skips_banned_wallets():
"Inactivity decay skips banned wallets\n\nTags: security, wallet"
contracts = LocalSolanaContracts()
contracts.registry.record_completed_jobs("wallet-k", 1, ts=0.0)
contracts.registry.ban_wallet("wallet-k")
@@ -153,6 +161,7 @@ def test_inactivity_decay_skips_banned_wallets():
def test_registry_contract_has_no_peer_rating_api():
"Registry contract has no peer rating api\n\nTags: general"
contracts = LocalSolanaContracts()
for forbidden in ("rate_peer", "submit_peer_rating", "peer_reputation"):
assert not hasattr(contracts.registry, forbidden)
@@ -191,6 +200,7 @@ def _reference_output(reference_url: str) -> str:
def test_validator_credits_clean_audit_via_persisted_reputation(reference_node):
"Validator credits clean audit via persisted reputation\n\nTags: persistence"
contracts = LocalSolanaContracts()
contracts.registry.record_audit_outcome("wallet-good", passed=False) # 1.0 -> 0.7
validator = ValidatorProcess(
@@ -206,6 +216,7 @@ def test_validator_credits_clean_audit_via_persisted_reputation(reference_node):
def test_validator_docks_reputation_on_failed_audit_without_double_striking(reference_node):
"Validator docks reputation on failed audit without double striking\n\nTags: general"
contracts = LocalSolanaContracts()
contracts.registry.submit_stake("wallet-bad", 500)
validator = ValidatorProcess(