bitjson / bch-vm-limits

Retargets limits to make Bitcoin Cash contracts more useful and reduce compute requirements for nodes.
4 stars 4 forks source link

Stack memory usage limit should count size of both the primary and "alt" stack #12

Closed cculianu closed 1 month ago

cculianu commented 5 months ago

Note that there are two stacks in the VM -- the primary stack and the "alt" stack (accessed by e.g. OP_FROMALTSTACK and OP_TOALTSTACK).

The current stack depth limit of 1000 applies to the depth of both stacks summed together.

Proposal: You should update the spec to specify that the 130,000 byte limit should apply to both altstack and the primary stack summed together.

In this way, this mirrors current logic for the stack depth limit.

Added comment to bitcoincashresearch thread here: https://bitcoincashresearch.org/t/chip-2021-05-targeted-virtual-machine-limits/437/42?u=cculianu

bitjson commented 1 month ago

Resolved by https://github.com/bitjson/bch-vm-limits/commit/4eba48ea4648a5ad39f40ff11bfebbe3459fca83 🚀