Adds bitcoin clarity builtins#7179
Conversation
1b522a1 to
3dd9da4
Compare
Coverage Report for CI Build 25279731464Warning No base build found for commit Coverage: 62.459%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
Also check script pubkey length to ensure it doesn't exceed 1024.
45b50a0 to
19d5b12
Compare
|
With this change, we can basically revert #7168, but let's do that in a separate PR. |
18855df to
7b3ffe9
Compare
|
@rob-stacks has volunteered to do the benchmarking to fill in real values for the new cost functions. That can happen in a separate PR built off of this one, so this one is ready for review. |
|
With this new design, we can remove the p2wsh output DBs and related work from PR #7168. I'll do that in a separate PR as well. |
|
@brice-stacks can you share how you've found test fixtures and/or real data for the merkle proof validation stuff? Ie how to get the arguments you need for a given txid/block? |
The real data just came from real bitcoin transactions (genesis, pizza tx, BIP141 SegWit announcement). I also generated some merkle proofs for the EDIT: just realized maybe that's not what you were asking. I got the transactions from public APIs: curl https://mempool.space/api/tx/a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d/hex > pizza.hexcurl https://blockstream.info/api/tx/a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d/merkle-proof |
|
Benchmark results are here: #7179 (comment) Based on the last iteration (done for secp256r1-verify):
|
Showed the merkle proofs for the same 3 transactions used for the output examples, which show off 3 unique scenarios, and then also added lots of comments to make it clear how to get the data needed.
|
@hstove-stacks check out 58b86c0, I added tests for those same 3 transactions and clear comments about where the values come from. |
|
Thanks @rob-stacks! Added in b871e0c. |
|
@rob-stacks I was just looking at this again. Shouldn't at least |
|
@brice-stacks it should, but the size limit of 1024 bytes for the transaction body makes the difference mostly irrelevant at the cpu side (and we are already charging for the size of the transaction in terms of read) |
The 1024 byte-limit is just for the requested output. The total size of the tx body is only limited by the Clarity value size limit, so 1MB. Did the benchmark include transactions that are ~1 MB? |
|
Damn, my bad I just noticed that the argument limit is BUFFER_MAX and not BUFFER_1024. I will send you the updated numbers asap |
|
@brice-stacks ok, the load almost linearly scales every 1K, I would suggest 125 units every 1024 bytes of transaction. |
Got it, thanks Roberto. I'll make that change. |
Updated based on latest benchmark data, including a linear cost based on the transaction size.
|
@brice-stacks LGTM but do you think you can add a prop-test scrambling outputs and their numbers/amounts ? |
|
Added proptests in ea51c49 |
aaronb-stacks
left a comment
There was a problem hiding this comment.
Just had a few comments, otherwise looks good to me.
Built on top of #7173. Adds new
get-bitcoin-tx-output?andverify-merkle-proofClarity builtins.