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

@@ -4,7 +4,8 @@ from meshnet_contracts import LocalSolanaContracts
def test_node_stake_is_reflected_in_registry():
"""A node can submit stake and read the updated registry balance."""
"A node can submit stake and read the updated registry balance.\n\nTags: billing, contracts, settlement"
contracts = LocalSolanaContracts()
receipt = contracts.registry.submit_stake("node-wallet-a", 500)
@@ -15,7 +16,8 @@ def test_node_stake_is_reflected_in_registry():
def test_client_can_fund_api_key_with_testnet_sol():
"""A client can fund an API key account and read the available balance."""
"A client can fund an API key account and read the available balance.\n\nTags: billing, contracts, settlement"
contracts = LocalSolanaContracts()
receipt = contracts.payment.fund_api_key("api-key-a", lamports=2_000)
@@ -25,7 +27,8 @@ def test_client_can_fund_api_key_with_testnet_sol():
def test_epoch_settlement_debits_clients_and_rewards_nodes_and_validator():
"""Settlement distributes native token rewards according to recorded work."""
"Settlement distributes native token rewards according to recorded work.\n\nTags: billing, contracts, settlement"
contracts = LocalSolanaContracts(
cost_per_layer_token_lamport=2,
probationary_job_count=0,
@@ -65,7 +68,8 @@ def test_epoch_settlement_debits_clients_and_rewards_nodes_and_validator():
def test_failed_settlement_does_not_advance_probation_or_settle_attribution():
"""Settlement state is unchanged when caller balance validation fails."""
"Settlement state is unchanged when caller balance validation fails.\n\nTags: billing, contracts, settlement"
contracts = LocalSolanaContracts(starting_credit_lamports=0, probationary_job_count=1)
contracts.payment.record_attribution(
session_id="session-a",
@@ -87,7 +91,8 @@ def test_failed_settlement_does_not_advance_probation_or_settle_attribution():
def test_slash_proof_reduces_stake_increments_strikes_and_warns(capsys):
"""Submitting a slash proof updates registry state and notifies the operator."""
"Submitting a slash proof updates registry state and notifies the operator.\n\nTags: billing, contracts, settlement"
contracts = LocalSolanaContracts()
contracts.registry.submit_stake("node-wallet-a", 500)
@@ -107,7 +112,8 @@ def test_slash_proof_reduces_stake_increments_strikes_and_warns(capsys):
def test_probationary_wallet_earns_only_after_required_jobs():
"""A new wallet's first N completed jobs are counted but not rewarded."""
"A new wallet's first N completed jobs are counted but not rewarded.\n\nTags: billing, contracts, security, settlement, wallet"
contracts = LocalSolanaContracts(probationary_job_count=2)
contracts.payment.fund_api_key("api-key-a", lamports=1_000)
for job_number in range(3):
@@ -130,7 +136,8 @@ def test_probationary_wallet_earns_only_after_required_jobs():
def test_probationary_wallet_receives_no_rewards_before_threshold():
"""Settlement state verifies a wallet earns zero during probation."""
"Settlement state verifies a wallet earns zero during probation.\n\nTags: billing, contracts, security, settlement, wallet"
contracts = LocalSolanaContracts(probationary_job_count=50)
contracts.payment.fund_api_key("api-key-a", lamports=1_000)
contracts.payment.record_attribution(
@@ -151,7 +158,8 @@ def test_probationary_wallet_receives_no_rewards_before_threshold():
def test_slash_proof_at_threshold_marks_wallet_banned():
"""Registry marks a wallet banned when strikes reach the configured threshold."""
"Registry marks a wallet banned when strikes reach the configured threshold.\n\nTags: billing, contracts, security, settlement, wallet"
contracts = LocalSolanaContracts()
contracts.registry.submit_stake("node-wallet-a", 500)
contracts.registry.submit_slash_proof(