Project
compiler
Describe the feature
Currently, none of the data provided as witnesses to Simplicity is committed to in sig_all_hash. The signature used is part of the witness data, so we cannot just hash all of it.
I suggest we add a new built-in function witness_filtered_hash(prefix) -> u256, where prefix is a string. The compiler generates code similar to (assume prefix == "PARAM"):
let ctx1 = jet::sha_256_ctx_8_init();
let ctx2 = jet::sha_256_ctx_8_add_32(ctx2, witness::PARAM1);
let ctx3 = jet::sha_256_ctx_8_add_32(ctx3, witness::PARAM2);
... Continue for each witness declared....
let hash = jet::sha_256_ctx_8_finalize(ctx3);
This would allow us to create a std-lib function that hashes the witness values prefixed with "PARAM" with the other data used in sig_all_hash before passing it to the bip_0340_verify jet.
Project
compiler
Describe the feature
Currently, none of the data provided as witnesses to Simplicity is committed to in
sig_all_hash. The signature used is part of the witness data, so we cannot just hash all of it.I suggest we add a new built-in function
witness_filtered_hash(prefix) -> u256, where prefix is a string. The compiler generates code similar to (assumeprefix == "PARAM"):This would allow us to create a std-lib function that hashes the witness values prefixed with "PARAM" with the other data used in
sig_all_hashbefore passing it to thebip_0340_verifyjet.