--- Day changed Fri Oct 09 2020 00:30 -!- jonatack [~jon@37.171.174.75] has joined ##miniscript 00:34 -!- jonatack [~jon@37.171.174.75] has quit [Ping timeout: 256 seconds] 00:35 -!- jonatack [~jon@213.152.162.99] has joined ##miniscript 03:13 -!- shesek [~shesek@unaffiliated/shesek] has quit [Remote host closed the connection] 04:02 -!- martindale [ericfabric@gateway/shell/matrix.org/x-pbpuumytgpjwpbjr] has quit [Quit: killed] 04:10 -!- martindale [ericfabric@gateway/shell/matrix.org/x-ecyshefyldcgwglo] has joined ##miniscript 04:30 -!- jonatack [~jon@213.152.162.99] has quit [Ping timeout: 258 seconds] 04:34 -!- Netsplit *.net <-> *.split quits: jeremyrubin, sgeisler 04:34 -!- sgeisler [sid356034@gateway/web/irccloud.com/x-hufxcxkokofqrotu] has joined ##miniscript 04:40 -!- jeremyrubin [~jr@c-73-15-215-148.hsd1.ca.comcast.net] has joined ##miniscript 05:32 -!- jonatack [~jon@2a01:e0a:53c:a200:bb54:3be5:c3d0:9ce5] has joined ##miniscript 06:08 < sanket1729> andytoshi: is rust-bitcoin not already bumped? 06:11 < andytoshi> sanket1729: the msrv is bumped 06:11 < andytoshi> i want https://github.com/rust-bitcoin/rust-bitcoin/pull/491 in 06:11 < andytoshi> you're welcome to PR to just bump the MSRV of rust-miniscript (and update to rust-bitcoin 0.25 etc) 06:11 < andytoshi> if you're blocked on this 06:14 < sanket1729> I saw drorlovsky opened a PR for the bumping to 0.25 . There is also another PR by darosior that needs 1.29 06:14 < sanket1729> I will open a PR shortly 06:14 < andytoshi> oh kk lemme check the dr-orlovsky pr 06:16 < darosior> Actually it doesn't need it anymore 06:16 < darosior> (Mine) 06:17 < darosior> I refactored it and opened 2 new PRs (including one for which i have new questions..), just leaving the old one opened to not close the discussion thread with sanket1729 06:19 < sanket1729> darosior: reviewing it now 06:19 < darosior> Thanks! 06:32 < sanket1729> andytoshi, sipa: Is `0` a valid Miniscript? Do we have a condition that miniscripts must have atleast one satisfaction. For example and(pk(A),False) 06:34 < sanket1729> According to the website, it is. 06:35 < sanket1729> If that is the case, we will have to change many APIs so that they can fail 06:36 < sanket1729> max_satisfaction_wieght etc. 06:37 < sanket1729> or we can panic if the user tries to call max_satisfaction_weight on something that cannot be satisfied 06:39 < andytoshi> sanket1729: what happens now? 06:39 < sanket1729> The current code is incorrect, it assumes 0 for False 06:39 < andytoshi> ah lol 06:40 < andytoshi> yeah let's make this an Option return 06:41 < andytoshi> sanket1729: so i have something of an ugly question for you.. 06:41 < andytoshi> in Liquid, for compat reasons, it would be nice if we could encode public keys in Script as `fe` bytes instead of as full 33-byte keys 06:41 < andytoshi> i wonder if we should change the ToPublicKey type to somehow support this 06:42 < sanket1729> `fe` bytes? 06:42 < andytoshi> literally the byte `fe` rather than a push 06:42 < andytoshi> fe is an invalid opcode 06:42 < andytoshi> this is how our pre-miniscript code would encode public keys, we had a "script template" rather than a descriptor 06:43 < andytoshi> the more i think about this i think we should just do something hacky in liquid (we need this only for test infrastructure which needs to generate old-school config files which are semantically the same as the new descriptor-based ones) 06:43 < sanket1729> So, pubkeys are encoded as a single byte `fe`? 06:43 < andytoshi> yeah 06:48 < sanket1729> If we really want we can create a trait PkEncodeable or something. Change the encode method so that it accepts PkEncodable instead of ToPublicKey. and PkEncodeable has a method that outputs bytes for pk. 06:49 < sanket1729> Would not be too much of a change, but I think we should probably change the liquid end. 06:50 < darosior> "yeah let's make this an Option return" => 🎉 06:53 < andytoshi> sanket1729: yeah i think it's too invasive 06:53 < andytoshi> and it's hard for me to imagine a non-liquid use case 06:53 < andytoshi> and like, liquid already does ungodly things to descriptors to provide alternate Script encodings ... adding a bit more for templating wouldn't be that big a deal 07:23 < sanket1729> darosior: To satisfy or dissatisfy a CHECKMULTISIG you need k signatures, why do you think we need `n` signatures? 07:23 < sanket1729> `n` elements 07:23 < darosior> *elements 07:24 < darosior> Because you need to provide empty byte arrays for the signatures you don't use 07:24 < darosior> (iirc) 07:24 * darosior checks sipa's implementation 07:25 < darosior> I think he does use `n` too, but i may be wrong: https://github.com/sipa/miniscript/blob/027b422495a8ee3ea3fa7787150389bb65d1b9de/bitcoin/script/miniscript.h#L546 07:27 < sanket1729> I think the bitcoin core source tells me it's k. Maybe I am misreading it. 07:27 < sanket1729> https://github.com/sipa/miniscript/blob/027b422495a8ee3ea3fa7787150389bb65d1b9de/bitcoin/script/miniscript.h#L546 07:27 < sanket1729> https://github.com/bitcoin/bitcoin/blob/283a73d7eaea2907a6f7f800f529a0d6db53d7a6/src/script/interpreter.cpp#L1109-L1115 07:30 < darosior> I think you are, you can even check the rust-miniscript code for the satisfaction of a Multi fragment 07:31 < darosior> Ah no, i misread it 07:31 < darosior> Argh now i'm in doubt 07:32 < darosior> Ah, no ! The witness vector does have n elements https://github.com/rust-bitcoin/rust-miniscript/blob/b70042e5b29b077ad123b1af5f855a02d8a4b0f9/src/miniscript/satisfy.rs#L735-L768 07:38 < sanket1729> darosior: This is a 2 of 3 transaction 07:38 < sanket1729> https://blockstream.info/tx/78126ea4aaf1acd232711b1efa3dc15832bd45d89bd5718c1cd15ec57d802497 07:39 < sanket1729> it has only 2 sigs with dummy push(multisig bug) 07:40 < darosior> You are right 07:40 * darosior hides 07:40 < sanket1729> but it is a bug in the c++ implementation 07:40 < sanket1729> atleast we found it :) 07:42 < darosior> Not even sure, i think i misread it too ^^" 07:57 < darosior> sanket1729: i'm back to arguing that you need to push empty byte arrays for signatures you don't use to satisfy CHECKMULTISIG :) (sorry but i'm still unsure) 07:57 < darosior> So i bisected your script 07:57 < darosior> bc decodescript 00483045022100acb79a21e7e6cea47a598254e02639f87b5fa9a08c0ec8455503da0a479c19560220724014c241ac64ffc108d4457302644d5d057fbc4f2edbf33a86f24cf0b10447014730440220338862b4a13d67415fdaac35d408bd2a6d86e4c3be03b7abc92ee769b254dbe1022043ba94f304aff774fdb957af078c9b302425976370cc66f42ae05382c84ea5ea014cc9524104a97b658c114d77dc5f71736ab78fbe40 07:57 < darosior> 8ce632ed1478d7eaa106eef67c55d58a91c6449de4858faf11721e85fe09ec850c6578432eb4be9a69c76232ac593c3b4104019ef04a316792f0ecbe5ab1718c833c3964dee3626cfabe19d97745dbcaa5198919081b456e8eeea5898afa0e36d5c17ab693a80d728721128ed8c5f38cdba04104a04f29f308160e6f945b33d943304b1b471ed8f9eaceeb5412c04e60a0fab0376871d9d1108948b67cafbc703e565a18f8351fb8558fd7c7482d70 07:57 < darosior> 27eecd687c53ae 07:57 < darosior> { 07:57 < darosior> "asm": "0 3045022100acb79a21e7e6cea47a598254e02639f87b5fa9a08c0ec8455503da0a479c19560220724014c241ac64ffc108d4457302644d5d057fbc4f2edbf33a86f24cf0b1044701 30440220338862b4a13d67415fdaac35d408bd2a6d86e4c3be03b7abc92ee769b254dbe1022043ba94f304aff774fdb957af078c9b302425976370cc66f42ae05382c84ea5ea01 524104a97b658c114d77dc5f71736ab78fbe408ce632ed1478 07:57 < darosior> d7eaa106eef67c55d58a91c6449de4858faf11721e85fe09ec850c6578432eb4be9a69c76232ac593c3b4104019ef04a316792f0ecbe5ab1718c833c3964dee3626cfabe19d97745dbcaa5198919081b456e8eeea5898afa0e36d5c17ab693a80d728721128ed8c5f38cdba04104a04f29f308160e6f945b33d943304b1b471ed8f9eaceeb5412c04e60a0fab0376871d9d1108948b67cafbc703e565a18f8351fb8558fd7c7482d7027eecd687c53 07:57 < darosior> ae" 07:59 < darosior> Argh it's in scriptSig and not in witness nevermind, .... 08:05 < sanket1729> darosior: that's from the verify_tx example in rust-miniscript. 08:06 -!- jonatack [~jon@2a01:e0a:53c:a200:bb54:3be5:c3d0:9ce5] has quit [Quit: jonatack] 08:11 -!- jonatack [~jon@2a01:e0a:53c:a200:bb54:3be5:c3d0:9ce5] has joined ##miniscript 09:31 -!- roconnor [~roconnor@host-45-78-205-7.dyn.295.ca] has joined ##miniscript 09:36 -!- shesek [~shesek@164.90.217.137] has joined ##miniscript 09:36 -!- shesek [~shesek@164.90.217.137] has quit [Changing host] 09:36 -!- shesek [~shesek@unaffiliated/shesek] has joined ##miniscript 10:44 < andytoshi> i think it is n 10:46 < andytoshi> actually hmm .. so, what the code will do given blank signatures is, try every key with the first signature (until there are fewer than k keys left, at which point it'll recognize that it can't pass) 10:46 < sipa> did i miss something here? 10:46 < sipa> i saw something about a bug, but haven't read the whole backlog 10:47 < andytoshi> sipa: darosior and sanket1729 are saying that to dissatisfy a k-of-n checkmultisig, you need k blank signatures (plus a dummy push) 10:47 < andytoshi> but my recollection, and apparently the C++ code, have n blank signatures (plus dummy) 10:47 < darosior> andytoshi: Yeah that's what i argued for 10:48 < darosior> But not what was implemented in rust-miniscript for the satisfaction cost, so i asked sanket1729 10:48 < darosior> And his example is pretty convincing.. 10:49 < sipa> it should be k blank signatures 10:49 < andytoshi> yeah, ok, i see it now 10:50 < andytoshi> (and it looks like this is what's implemented in rust-miniscript's satisfaction code) 10:52 < sipa> for (size_t i = 0; i < k; ++i) nsat = std::move(nsat) + ZERO; 10:52 < sipa> so i think the C++ code is also correct 10:52 < andytoshi> sipa: above, darosior linked to https://github.com/sipa/miniscript/blob/027b422495a8ee3ea3fa7787150389bb65d1b9de/bitcoin/script/miniscript.h#L546 10:52 < andytoshi> i'm not 100% sure what that function is calculating but it looks like a cost estimate might be off 10:53 < sipa> oh! that looks wrong indeed 10:53 < andytoshi> a little surprised our compiler cross-testing didn't notice this 10:54 < sipa> indeed 11:04 -!- jonatack [~jon@2a01:e0a:53c:a200:bb54:3be5:c3d0:9ce5] has quit [Ping timeout: 240 seconds] 11:04 -!- jonatack [~jon@213.152.162.15] has joined ##miniscript 12:40 < sanket1729> sipa, andytoshi: That is not dissatisfaction cost calculation code 12:40 < sanket1729> It is stack size calculation code 12:42 < sipa> yes 12:42 < sipa> oh 12:42 < sanket1729> The compiler code is correct 12:42 < sanket1729> case NodeType::MULTI: return CostPair{1.0 + l * 73.0, 1.0 + l}; 12:42 < sipa> which does push N keys 12:42 < sanket1729> https://github.com/sipa/miniscript/blob/027b422495a8ee3ea3fa7787150389bb65d1b9de/compiler.cpp#L513 12:45 < sipa> yup 17:36 -!- meshcollider [meshcollid@gateway/shell/ircnow/x-btdjauxcaymhdeld] has quit [Ping timeout: 260 seconds] 17:36 -!- meshcollider [meshcollid@gateway/shell/ircnow/x-ymbjzimilbdxsocu] has joined ##miniscript 20:40 -!- harrigan [~harrigan@ptr-93-89-242-235.ip.airwire.ie] has quit [Read error: Connection reset by peer] 20:42 -!- harrigan [~harrigan@ptr-93-89-242-235.ip.airwire.ie] has joined ##miniscript