bitjson / bch-vm-limits

Re-targets virtual machine (VM) limits to enable more advanced Bitcoin Cash contracts, reduce transaction sizes, and reduce full node compute requirements.

Repository from Github https://github.combitjson/bch-vm-limitsRepository from Github https://github.combitjson/bch-vm-limits

Clarify costing of signing serialization hashing

bitjson opened this issue · comments

Just creating an issue to reference in the changelog – the BCHN implementation was not costing hash digest iterations of cached signing serializations, fixed in 252b7036. I'm also adding a clarification to the CHIP text:

Note that the hash digest iteration count is incremented each time the signature check count (A.K.A. SigChecks) is incremented, even if a previous signature check used the same signing serialization. See Rationale: Stateless Costing of Signing Serialization Hashing.

And further rationale:

Stateless Costing of Signing Serialization Hashing

This proposal accounts for the cost of hashing all signing serializations by incrementing the spending transaction input's cumulative hash digest iteration count prior to incrementing the signature check count (A.K.A. SigChecks), regardless of whether a previous signature check used the same signing serialization. This avoids creating a requirement for all implementations to track previously-used signing serializations across signature checks; while some implementations may cache and reuse signing serialization digests, other implementations may reasonably re-hash all signing serializations.