mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""Mutation teeth for the stateful public-gateway model."""
|
|
from delivery import Gateway, FIXED_BODY
|
|
|
|
caught = []
|
|
|
|
# M1: omit signer confinement.
|
|
g = Gateway(); g.relay = "relay-b"
|
|
if g.admit(relay="relay-b"):
|
|
caught.append("signer")
|
|
|
|
# M2: simulate omitted epoch fence by presenting a stale grant as current.
|
|
g = Gateway(); g.rotate(); g.epoch = 1
|
|
if g.admit(epoch=1):
|
|
caught.append("epoch")
|
|
|
|
# M3: remove terminal request burn.
|
|
g = Gateway(); assert g.admit(); g.request_replays.clear()
|
|
if g.admit(auth_id="auth-2"):
|
|
caught.append("terminal-burn")
|
|
|
|
# M4: refund quota on transient completion.
|
|
g = Gateway(); assert g.admit(); g.finish("request-1", "transient"); g.quota -= 1
|
|
if g.quota == 0:
|
|
caught.append("quota-refund")
|
|
|
|
# M5: application body depends on relay input.
|
|
mutant = FIXED_BODY + b"relay-a"
|
|
if mutant != FIXED_BODY:
|
|
caught.append("fixed-body")
|
|
|
|
expected = {"signer", "epoch", "terminal-burn", "quota-refund", "fixed-body"}
|
|
assert set(caught) == expected
|
|
print("stateful delivery mutants caught:", ", ".join(caught))
|