Make VerifyWitnessProgram use a Span stack#18388
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
utACK c7b0131 wondering if there's some short-hand we could do to "split" the |
|
@instagibbs No reason why a |
|
@sipa took the words right out of my mouth :) I think the latter is perfect for our use-case |
c7b0131 to
ef540f7
Compare
|
@instagibbs Done. |
|
utACK ef540f7 |
elichai
left a comment
There was a problem hiding this comment.
tACK ef540f796adef1f128584bd073076062585f0bd9
Read the code, couldn't spot any logic change.
ran unit tests+functional tests
This allows for very cheap transformations on the range of elements that are to be passed to ExecuteWitnessScript.
ef540f7 to
2b0fcff
Compare
|
ReACK on the diff 2b0fcff |
|
ACK 2b0fcff |
|
re-ACK 2b0fcff |
|
re-ACK 2b0fcff |
| constexpr C* data() const noexcept { return m_data; } | ||
| constexpr C* begin() const noexcept { return m_data; } | ||
| constexpr C* end() const noexcept { return m_data + m_size; } | ||
| constexpr C& front() const noexcept { return m_data[0]; } |
There was a problem hiding this comment.
Note for reviewers: these functions front() and back() are no longer used in this PR, but are used in the taproot implementation, so there's no harm in including them here.
|
ACK 2b0fcff |
Summary: 2b0fcff7f26d59fed4bcafd1602325122a206c67 Make VerifyWitnessProgram use a Span stack (Pieter Wuille) Pull request description: Here is a follow-up to #18002, again with the goal of simplifying (potential) BIP341 code. Instead of passing a begin and end iterator of the initial stack to `ExecuteWitnessScript`, they are turned into a `Span<const valtype>`, representing a span of `valtype`s in memory. This allows `VerifyWitnessProgram` to operate on that span directly, instead of juggling iterators around (which would be exacerbated by #17977 if trying to avoid copying the stack). --- Ignored the SegWit stuff but brought in the Span functionality, might be used in the future also less merge conflicts Backport of Core [[bitcoin/bitcoin#18388 | PR18388]] Test Plan: ninja Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D8495
Here is a follow-up to #18002, again with the goal of simplifying (potential) BIP341 code.
Instead of passing a begin and end iterator of the initial stack to
ExecuteWitnessScript, they are turned into aSpan<const valtype>, representing a span ofvaltypes in memory. This allowsVerifyWitnessProgramto operate on that span directly, instead of juggling iterators around (which would be exacerbated by #17977 if trying to avoid copying the stack).