Dynamic Plasma Witness Pricing & DoS Hardening
TL;DR: In
go-zenon-v1/internal/pow/plasma.go:269,GetBasePlasmaForAccountBlockcurrently charges68plasma/byte (ABByteDataPlasma) only onblock.Data, charging0plasma forblock.PublicKeyandblock.Signature. With 96-byteEd25519witnesses, that omission was harmless. With1.5 KB – 7.9 KBpost-quantum witnesses, zero-cost witness bytes allow an attacker to exhaust the8.0 MiBMaxMomentumContentBytescap (~1,060blocks instead of~27,000) and bloat Pebble v2 storage for just21,000base plasma. IntroducingGetWitnessPlasmacloses 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:
- A Momentum admits user blocks until
totalBasePlasma <= vars.MaxBasePlasmaInMomentum(4,200,000default, tunable up to2,100,000,000) ANDtotalProtoBytes <= MaxMomentumContentBytes(8,388,608 B). - Dynamic Plasma (
pow.NextResourcePriceininternal/pow/dynamic_plasma.go) adjustsNextFusionPrice(P_F) andNextWorkPrice(P_W) strictly as a function ofusedFusedandusedWorkbase plasma—it has no visibility intototalProtoBytesunless witness bytes contribute tocanonicalBase! - If a
7,857-byteSLH-DSA-SHAKE-128sUserReceiveblock costs the exact same21,000base plasma (10fused QSR) as a667-bytecachedFN-DSA-512block:- It consumes 11.8× more wire bandwidth and disk space and 40× more verifier CPU at
0marginal QSR/PoW cost. - Worse, if
MaxBasePlasmaInMomentumis raised viaPlasma.SetVariables, attackers can hit the hard8 MiBMaxMomentumContentByteswall whiletotalBasePlasmaremains belowFusedPlasmaTarget—preventingNextFusionPriceandNextWorkPricefrom rising during congestion!
- It consumes 11.8× more wire bandwidth and disk space and 40× more verifier CPU at
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(68plasma/byte) is hashed insideComputeHash(), unpacked by the VM ABI decoder, and often persisted in embedded contract key-value state (Pebblestate trie).- Witness bytes (
PublicKey+Signature) are never parsed by embedded contracts, excluded fromComputeHash(), and prunable after finality—matching Bitcoin SegWit's exact1:4witness-to-calldata weight discount (68 / 4 = 17plasma/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 & Scheme | WitnessBytes | LegacyBase | WitnessPlasma | Total CanonicalBase | Equivalent Fused QSR (at 1.0× Price) |
|---|---|---|---|---|---|
Ed25519 Send / Receive (v1 baseline) | 96 B | 21,000 | 0 | 21,000 | 10.0 QSR |
FN-DSA-512 (PK Cached, H > 1) | 667 B | 21,000 | 10,757 | 31,757 | ~15.2 QSR |
FN-DSA-512 (1st Tx w/ PK, H = 1) | 1,565 B | 21,000 | 26,023 | 47,023 | ~22.4 QSR |
ML-DSA-44 (PK Cached, H > 1) | 2,421 B | 21,000 | 41,625 | 62,625 | ~29.9 QSR |
ML-DSA-44 (1st Tx w/ PK, H = 1) | 3,734 B | 21,000 | 63,946 | 84,946 | ~40.5 QSR |
ML-DSA-44 Pillar.Delegate() (Cached) | 2,421 B | 52,500 | 41,625 | 94,125 | ~44.9 QSR |
SLH-DSA-SHAKE-128s Vault Tx | 7,857 B | 21,000 | 173,937 | 194,937 | ~92.9 QSR |
4. Consensus Invariants Preserved by This Formula
- 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 firstML-DSA-44(84,946plasma) orSLH-DSA-128s(194,937plasma) transaction can generate client PoW (difficulty = plasma * 1,500, ~0.15s–0.35s on modern desktop/mobile cores)! - Strong Economic Incentive to Cache Public Keys:
Omitting
PublicKeyafterHeight = 1saves22,321plasma (~10.6 QSR) on everyML-DSA-44block and15,266plasma (~7.3 QSR) on everyFN-DSA-512block. - Dynamic Plasma Controller Remains Saturation-Proof:
At
DefaultMaxBasePlasmaInMomentum = 4,200,000:- Max
SLH-DSA-128sblocks per Momentum =floor(4,200,000 / 194,937) = 21blocks (~170 KBwire size,~38 msverify time on 1 core /~5 mson 8 cores). - Max cached
ML-DSA-44blocks per Momentum =floor(4,200,000 / 62,625) = 67blocks (or raiseDefaultMaxBasePlasmaInMomentumviaPlasma.SetVariablesfrom4,200,000→12,600,000on Spork activation to preserve the exact 200 cachedML-DSA-44user blocks/Momentum throughput target while staying at just6.5%ofMaxMomentumContentBytes!).
- Max
GetBasePlasmaForAccountBlockNotice 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!