-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blinding API cleanups #143
Conversation
648e22e
to
0584ed1
Compare
05c8446
to
0584ed1
Compare
Should I review this? I have been holding off because of the sea of red in CI. |
The downstream options project is stable enough. I can rewive this PR today. |
c082ee9
to
157e4ef
Compare
Cherry-picked the MSRV commit here. This might not be an easy review, but I would really like this to go into the next release. |
157e4ef
to
49d1ec2
Compare
Will need rebase after #147 (and then I think we'll no longer need the MSRV bump, though we will need a CHANGELOG update). But I'll review this as-is. |
src/pset/map/input.rs
Outdated
AssetId::generate_asset_entropy(prevout, contract_hash) | ||
} else { | ||
// re-issuance | ||
sha256::Midstate::from_inner(self.issuance_asset_entropy.unwrap_or([0u8; 32])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 8b41c13:
Should use unwrap_or_default
here like above (or change both to unwrap_or([8; 32])
; having two ways to write the same thing makes it look like these do different things, which is confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still present in 04ad35f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in fa753b4
.collect::<Vec<_>>(); | ||
|
||
Ok((inp_secrets, blind_out_indices)) | ||
} | ||
|
||
/// Obtains the surjection inputs for this pset. This servers as the domain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 8b41c13:
Typo servers
should be serves
.
I also wonder if you should define "domain" ... e.g. write domain (set of assets on the "input side")
since this term isn't really used elsewhere, and it isn't obvious unless you're pretty familiar with the word "surjection".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still present in 04ad35f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in fa753b4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 49d1ec2
All my comments are nits which could be addressed with additional commits or even in another PR. Also, can you add a commit which runs |
@apoelstra, do you mean on the entire codebase |
@sanket1729 let's say, just on blind.rs and psbt/mod.rs which are otherwise heavily modified in this PR (and there are a couple format nits I didn't want to write out in those files). |
@apoelstra, any interest in reviving #80? We have enforced |
49d1ec2
to
64eea2a
Compare
Addressed the comments. Will rebase after we have #147 in |
64eea2a
to
552368f
Compare
Also added a test to test tx verification with partially blinded transactions |
552368f
to
073e720
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 073e720
This required the user to explicitly maintain whether the current TxIn has issuance or not whereas it can directly be calculated from assetIssuance field
073e720
to
b53e51b
Compare
Now the blinding APIs are separated into smaller chunks. This allows 1) Blinding only the values or the assets but not both 2) Not relying on rng to set asset/value blinding factors 3) Bunch of API cleanups with better input parameters
Issuances are still not blinded in pset. We can add another parameter to Pset::blind_last and Pset::blind_non_last, but it is add another parameter to the API. We can implement this in future if required.
This was only used in issuance blinding nonce, so was never really tested
Should be 0x0a not 0x10 :)
While the positions of inputs and outputs don't usually matter, they do matter in covenant constructions. This allows easier construction rather than creating a new vec or swapping things around
b53e51b
to
582325e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 582325e
has issuance or not whereas it can directly be calculated from
assetIssuance field
The blinding APIs are separated into smaller chunks. This allows
- Blinding only the values or the assets but not both
- Not relying on rng to set asset/value blinding factors
- Better input parameters
Note I had to edit the test vectors the order in which they were sampled from rng had changed.