Skip to main content

Dynamic Plasma Witness Pricing & DoS Hardening

TL;DR: In go-zenon-v1/internal/pow/plasma.go:269, GetBasePlasmaForAccountBlock currently charges 68 plasma/byte (ABByteDataPlasma) only on block.Data, charging 0 plasma for block.PublicKey and block.Signature. With 96-byte Ed25519 witnesses, that omission was harmless. With 1.5 KB – 7.9 KB post-quantum witnesses, zero-cost witness bytes allow an attacker to exhaust the 8.0 MiB MaxMomentumContentBytes cap (~1,060 blocks instead of ~27,000) and bloat Pebble v2 storage for just 21,000 base plasma. Introducing GetWitnessPlasma closes this DoS vector cleanly.


1. Quantifying the Unpriced Witness Attack Vector​

Examine GetBasePlasmaForAccountBlock in internal/pow/plasma.go:275-285:

if block.IsReceiveBlock() {
return AccountBlockBasePlasma, nil // Always 21,000 — ignores witness size!
}
if !types.IsEmbeddedAddress(block.ToAddress) {
if len(block.Data) > MaxDataLength {
return 0, ErrABDataTooBig
}
return AccountBlockBasePlasma + uint64(len(block.Data))*ABByteDataPlasma, nil
}

And examine verifyMomentumContent in internal/vm/verifier/momentum.go:385-435:

  1. A Momentum admits user blocks until totalBasePlasma <= vars.MaxBasePlasmaInMomentum (4,200,000 default, tunable up to 2,100,000,000) AND totalProtoBytes <= MaxMomentumContentBytes (8,388,608 B).
  2. Dynamic Plasma (pow.NextResourcePrice in internal/pow/dynamic_plasma.go) adjusts NextFusionPrice (P_F) and NextWorkPrice (P_W) strictly as a function of usedFused and usedWork base plasma—it has no visibility into totalProtoBytes unless witness bytes contribute to canonicalBase!
  3. If a 7,857-byte SLH-DSA-SHAKE-128s UserReceive block costs the exact same 21,000 base plasma (10 fused QSR) as a 667-byte cached FN-DSA-512 block:
    • It consumes 11.8× more wire bandwidth and disk space and 40× more verifier CPU at 0 marginal QSR/PoW cost.
    • Worse, if MaxBasePlasmaInMomentum is raised via Plasma.SetVariables, attackers can hit the hard 8 MiB MaxMomentumContentBytes wall while totalBasePlasma remains below FusedPlasmaTarget—preventing NextFusionPrice and NextWorkPrice from rising during congestion!

2. Canonical Post-Quantum Witness Plasma Formula​

When PostQuantumAccountsSpork is active and block.Version >= 2 (for non-embedded senders !types.IsEmbeddedAddress(block.Address)):

CanonicalBasePlasma(block) = LegacyBasePlasma(block) + WitnessPlasma(block)

Where WitnessPlasma(block) prices both marginal storage/bandwidth bytes above the 96-byte legacy Ed25519 baseline and non-trivial verifier CPU cost:

WitnessBytes = len(block.PublicKey) + len(block.Signature)
ExcessWitnessBytes = max(0, WitnessBytes - 96)
ABWitnessBytePlasma = 17 // 25% of ABByteDataPlasma (68), reflecting SegWit-style 4:1 witness discount!

VerifyComputePlasma(algID):
0x00 (Ed25519) -> 0
0x01 (ML-DSA-44) -> 2,100 (+1 QSR fusion unit)
0x02 (FN-DSA-512) -> 1,050 (+0.5 QSR fusion unit)
0x03 (SLH-DSA-SHAKE-128s) -> 42,000 (+20 QSR fusion units; ~1.8 ms Keccak tree verify)
0x81 (Hybrid Ed+MLDSA44) -> 3,150 (+1.5 QSR fusion units)

WitnessPlasma(block) = ExcessWitnessBytes * ABWitnessBytePlasma + VerifyComputePlasma(algID)

Why ABWitnessBytePlasma = 17 (4:1 SegWit Witness Ratio) Is Economically Ideal​

  • block.Data (68 plasma/byte) is hashed inside ComputeHash(), unpacked by the VM ABI decoder, and often persisted in embedded contract key-value state (Pebble state trie).
  • Witness bytes (PublicKey + Signature) are never parsed by embedded contracts, excluded from ComputeHash(), and prunable after finality—matching Bitcoin SegWit's exact 1:4 witness-to-calldata weight discount (68 / 4 = 17 plasma/byte)!

3. Resulting Plasma & QSR Fusion Schedule Across Schemes​

Recall PlasmaPerFusionUnit = 2,100 (1 fused QSR = 2,100 plasma; minimum account fusion FuseMinAmount = 10 QSR = 21,000 plasma) and PoWDifficultyPerPlasma = 1,500:

Transaction Type & SchemeWitnessBytesLegacyBaseWitnessPlasmaTotal CanonicalBaseEquivalent Fused QSR (at 1.0× Price)
Ed25519 Send / Receive (v1 baseline)96 B21,000021,00010.0 QSR
FN-DSA-512 (PK Cached, H > 1)667 B21,00010,75731,757~15.2 QSR
FN-DSA-512 (1st Tx w/ PK, H = 1)1,565 B21,00026,02347,023~22.4 QSR
ML-DSA-44 (PK Cached, H > 1)2,421 B21,00041,62562,625~29.9 QSR
ML-DSA-44 (1st Tx w/ PK, H = 1)3,734 B21,00063,94684,946~40.5 QSR
ML-DSA-44 Pillar.Delegate() (Cached)2,421 B52,50041,62594,125~44.9 QSR
SLH-DSA-SHAKE-128s Vault Tx7,857 B21,000173,937194,937~92.9 QSR

4. Consensus Invariants Preserved by This Formula​

  1. Client PoW FallbackStill Works Without QSR: Post-DynamicPlasmaSpork, PostDPMaxPoWPlasmaForAccountBlock = 210,000,000,000 (internal/pow/plasma.go:39). Even a zero-QSR user onboarding their very first ML-DSA-44 (84,946 plasma) or SLH-DSA-128s (194,937 plasma) transaction can generate client PoW (difficulty = plasma * 1,500, ~0.15s–0.35s on modern desktop/mobile cores)!
  2. Strong Economic Incentive to Cache Public Keys: Omitting PublicKey after Height = 1 saves 22,321 plasma (~10.6 QSR) on every ML-DSA-44 block and 15,266 plasma (~7.3 QSR) on every FN-DSA-512 block.
  3. Dynamic Plasma Controller Remains Saturation-Proof: At DefaultMaxBasePlasmaInMomentum = 4,200,000:
    • Max SLH-DSA-128s blocks per Momentum = floor(4,200,000 / 194,937) = 21 blocks (~170 KB wire size, ~38 ms verify time on 1 core / ~5 ms on 8 cores).
    • Max cached ML-DSA-44 blocks per Momentum = floor(4,200,000 / 62,625) = 67 blocks (or raise DefaultMaxBasePlasmaInMomentum via Plasma.SetVariables from 4,200,000 → 12,600,000 on Spork activation to preserve the exact 200 cached ML-DSA-44 user blocks/Momentum throughput target while staying at just 6.5% of MaxMomentumContentBytes!).
Determinism Rule for GetBasePlasmaForAccountBlock

Notice that GetBasePlasmaForAccountBlock(blk, mask) (internal/pow/plasma.go:269) is a pure stateless function of blk and sporkMask—called both in mempool admission and in verifyMomentumContent (internal/vm/verifier/momentum.go:419). Because blk.Signature[0] always carries algID (len(blk.Signature) >= 1 for user blocks) and len(blk.PublicKey) + len(blk.Signature) are right on blk, WitnessPlasma(blk) remains 100% stateless with zero DB reads!