--- Log opened Mon May 10 00:00:51 2021 02:48 -!- jb55 [~jb55@gateway/tor-sasl/jb55] has quit [Remote host closed the connection] 02:48 -!- jb55 [~jb55@gateway/tor-sasl/jb55] has joined ##miniscript 04:03 -!- darosior [~darosior@194.36.189.246] has quit [Ping timeout: 260 seconds] 04:23 -!- darosior [~darosior@194.36.189.246] has joined ##miniscript 10:47 < andytoshi> sgeisler: if you're using PSBT you should never be touching the raw tx 10:47 < andytoshi> what is the problem with the finalization API? 10:47 < andytoshi> i don't even know how you could use the raw tx, PSBT does not have any ability to store witness data directly in the transaction 10:48 < sgeisler> The satisfier API works on the raw tx (one input at a time) and can use a PSBT as a satisfier 10:49 < sgeisler> so at that point the PSBT is not yet finalized and to work on the raw tx I have to copy it out 10:50 < sgeisler> maybe that's wrong? but idk how else to use the descriptor satisfier API 10:50 < sgeisler> Andytoshi: After that the question is, is the tx always completely finalized by the satisfy fn? 10:51 < sgeisler> Or do I sometimes have to put it into the PSBT again and call satisfy (I don't think so, although it doesn't seem to hurt) 10:51 < sgeisler> *call finalize 10:52 < sgeisler> so essentially: is https://docs.rs/miniscript/5.1.0/miniscript/descriptor/trait.DescriptorTrait.html#method.satisfy cutting short a PSBT's lifecycle? 10:53 < andytoshi> yeah we should drop that method 10:54 < andytoshi> it's just a wrapper around get_satisfaction that does the wrong thing 10:54 < andytoshi> putting the data into a mutable txin (which again, you should not be able to get from a PSBT0, and won't even exist in PSBT2) rather than into a PSBT 10:54 < sgeisler> Uh, so instead I should put the output of get_satisfaction into the PSBT inputs? 10:54 < andytoshi> yeah 10:54 < andytoshi> sorry, i can see this is a really nonintuitive API 10:55 < andytoshi> we should maybe just add a `satisfy_psbt` method beside `satisfy` 10:55 < andytoshi> which puts the data into a (mutable) PSBT and does not take a transaction/txin at all 10:55 < andytoshi> since it should be able to get that data out of the PSBT 10:55 < sgeisler> exactly, that's sort of what I'd expect 10:56 < sgeisler> maybe give the option to optionally limit it to one input 10:56 < andytoshi> and yeah ... having this `Satisfier` trait which is a like a read-only view into transaction data is weird 10:57 < andytoshi> i guess the `psbt::finalize` method already does this 10:58 < sgeisler> I think satisfy_psbt should put the script_sig into the psbt input while finalize takes that and puts it into the raw tx iiuc? or was that extract? 10:58 < andytoshi> so, "Satisfier" is not a PSBT role 10:59 < sgeisler> yes 10:59 < andytoshi> there is a "finalizer" which takes the signatures etc and makes witnesses 10:59 < andytoshi> and an "extractor" which pulls out a raw tx 10:59 < sgeisler> oh, so our satisfier takes on the finalizer role 10:59 < andytoshi> nothing "puts data into the raw tx" except the extractor, which does so by taking everything from the PSBT and returning a non-PSBT 10:59 < andytoshi> yeah 10:59 < andytoshi> this is a terminology discrepancy between miniscript and PSBT, which honestly is inexcusable given that PSBT was here first.. 11:00 < sgeisler> Maybe this can be fixed in the next major version? 11:00 < andytoshi> but "finalize" in PSBT is essentually the same as "satisfy" in miniscript 11:01 < andytoshi> yeah... i wish sipa were here 11:01 < sgeisler> there are a few good jokes to be made about the satisfaction API though ;) 11:01 < andytoshi> but sanketcell what do you think about renaming `satisfy` to `finalize` everywhere throughout the lib? 11:01 < andytoshi> hehehe 11:01 < andytoshi> sanket1729^ 11:01 < andytoshi> is sanketcell actually used? funny that sanket is perpetually online from two places 11:02 < sgeisler> for me both show "away" 11:04 < andytoshi> ah! that would explain why my autocomplete always goes to the cell one, even though 1729 has most recently spokje 11:38 < sanket1729> Hey 11:38 < sanket1729> Sorry, I have been away for a while now. Catching up logs 11:49 < sanket1729> sgeisler: Descriptor satisfy method and psbt finalize methods are two ways of different different things. One is when you have psbt(thereby a pstbInputSatisfier) and one is when you have a custom satisfier 11:50 < sanket1729> Why are you using both of them? 11:50 < sanket1729> > I'm arguing that after calling satisfy (https://docs.rs/miniscript/5.1.0/miniscript/descri 11:50 < sanket1729> ptor/trait.DescriptorTrait.html#method.satisfy) on all inputs there is nothing left to do for the finalizer or e 11:50 < sanket1729> xtractor 11:51 < sanket1729> This is correct. 11:52 < sanket1729> But in a psbt workflow. You should deal with raw transactions. Are you looking for finalize method? https://github.com/rust-bitcoin/rust-miniscript/blob/f550b9b87a26710db9228c47e84199611ccc7aa4/src/psbt/finalizer.rs#L245 11:53 < sgeisler> So, how would that finalize method know how to satisfy inputs without the descriptor? 11:53 < sanket1729> It infers the descriptors 11:53 < sanket1729> psbt has enough information in itself so that you can do it 11:54 < sgeisler> oh, interesting! right, the script_code I guess? 11:54 < sgeisler> or how it's called in the psbt 11:55 < sanket1729> The script_pubkey, and witness_script/redeem_script etc are enough 11:56 < sanket1729> The term script code is used in signing context, in most cases it same of witness_script/redeem_script. But it's not necessary 11:56 < sgeisler> Thx a lot for clarifying. So as long as I use PSBTs I don't have to worry about the satisfyer API at all 11:56 < sanket1729> Yes 11:57 < sgeisler> Just include the necessary info (which I have to do anyway afaik for tx hashing iirc) and the finalizer will figure it out 11:58 < sanket1729> Right now, it's either finalizes all inputs or none. 11:58 < sanket1729> So, the drawback is that if you any non-miniscript finalized inputs. It does not work :( . 12:07 < sanket1729> > it's just a wrapper around get_satisfaction that does the wrong thing? 12:08 < sanket1729> What is the wrong thing here? 12:11 < sanket1729> I think we can make psbt.get_descriptor(index) https://github.com/rust-bitcoin/rust-miniscript/blob/f550b9b87a26710db9228c47e84199611ccc7aa4/src/psbt/finalizer.rs#L69 a pub method 12:11 < sanket1729> Seems useful to have 12:18 < andytoshi> sanket1729: i think directly modifying a TxIn is a niche thing to do (at best) and we shouldn't have a prominent API for it 12:19 < andytoshi> at the very least it should be called `finalize` so it's obvious that its functionality overlaps with the PSBT finalizer role 12:19 < sanket1729> +1 for removing it entirely. 12:19 < andytoshi> i think that API was designed to work for the liquid functionaries, which don't use PSBT (everyone has global knowledge of all descriptors so it has limited value) 12:20 < andytoshi> but it wouldn't hurt the liquid functionaries to just implement that method themselves using get_satisfaction 12:20 < sanket1729> Agreed 13:16 -!- jonatack [jon@gateway/vpn/airvpn/jonatack] has quit [Ping timeout: 240 seconds] 14:12 -!- jonatack [jon@gateway/vpn/airvpn/jonatack] has joined ##miniscript 14:13 -!- roconnor [~roconnor@host-23-91-186-24.dyn.295.ca] has quit [Ping timeout: 268 seconds] 14:15 -!- roconnor [~roconnor@host-23-91-186-24.dyn.295.ca] has joined ##miniscript 16:40 -!- shesek [~shesek@unaffiliated/shesek] has quit [Remote host closed the connection] 16:41 -!- shesek [~shesek@164.90.217.137] has joined ##miniscript 16:41 -!- shesek [~shesek@164.90.217.137] has quit [Changing host] 16:41 -!- shesek [~shesek@unaffiliated/shesek] has joined ##miniscript 22:16 -!- jeremyrubin [~jr@024-176-247-182.res.spectrum.com] has quit [Remote host closed the connection] 22:17 -!- jeremyrubin [~jr@024-176-247-182.res.spectrum.com] has joined ##miniscript 22:27 -!- justinmoon_ [~quassel@157.245.122.126] has quit [Quit: No Ping reply in 180 seconds.] 22:29 -!- justinmoon [~quassel@157.245.122.126] has joined ##miniscript --- Log closed Tue May 11 00:00:51 2021