You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Review finding: P2MR runtime stack counts items, not bytes #257
A P2MR input can expand a small initial witness into a much larger runtime stack.
Observed
The P2MR runtime limit checks the number of stack items (1,000), not their total bytes (src/script/interpreter.cpp:1388). OP_DUP copies a whole value, so a 16 KiB initial item duplicated to 1,000 items is ~16 MiB. A 2 MB block can carry ~110 such inputs; with -par workers this is a ~336 MiB memory spike during block connection. Mempool admission gets the same per-transaction pressure.
Impact
Small-memory nodes can be pushed into memory pressure while connecting a valid block.
Suggested fix
Add a byte cap on stack + altstack after each op (1 MiB is a safe compatibility choice), or charge validation weight for bytes copied by P2MR stack ops. Add a test for the OP_DUP/OP_DROP leaf.
Evidence
src/script/interpreter.cpp:37-47,916-926,1388. Scratch test p2mr_stack_dup_runtime_bytes_amplification passes; single-input RSS rose from ~20.5 MiB to ~35.6 MiB.
Activity
policy: bound P2MR runtime stack bytes
script: give the P2MR stack-byte policy limit its own error
test: model the P2MR stack-byte policy limit in the v1 oracle
doc: classify the P2MR stack-byte limit in the v1 profile
policy: bound P2MR runtime stack bytes (#263)
doc: add the release-gate fixes to the v1.0.1 release notes
djh58 commentedon Nov 2, 2026
Fixed by #263 (merged into 1.x.x).
doc: add the release-gate fixes to the v1.0.1 release notes
doc: add the release-gate fixes to the v1.0.1 release notes
doc: add the release-gate fixes to the v1.0.1 release notes
doc: add the release-gate fixes to the v1.0.1 release notes
release: prepare v1.0.1 (#181)
policy: bound P2MR runtime stack bytes (#263)
release: prepare v1.0.1 (#181)