Skip to content
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

bitcoin: bump 0.28.0 -> 0.29.1 #147

Merged
merged 5 commits into from Oct 4, 2022

Conversation

RCasatta
Copy link
Collaborator

bitcoin_hases: bump 0.10.1 -> 0.11.0
rand: bump 0.6.5 -> 0.8

Code changes relate to:

  • Drop default from structure since hashes has all_zeros() instead of default(), Input manually implements default to minimize changes.
  • convert arrays to Scalar type

@@ -733,7 +733,7 @@ mod tests {
// Initially secp context and rng global state
let secp = secp256k1_zkp::Secp256k1::new();
#[allow(deprecated)]
let mut rng = rand::ChaChaRng::seed_from_u64(0);
let mut rng = rand::rngs::StdRng::seed_from_u64(0);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to docs StdRng use ChaCha, I think it's equivalent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as it's deterministic anything should work here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've errors in examples in comparison against test vectors ( pset_blind_coinjoin.rs and raw_blind.rs) which I think it's because those are not equivalent...

  left: `Global { tx_data: TxData { version: 2, fallback_locktime: None, input_count: 2, output_count: 5, tx_modifiable: None }, version: 2, xpub: {}, scalars: [Tweak(a9fe9d44d70fd0efea5c2313c7235b02475b81bd243d2004b853821cee0b2047)], elements_tx_modifiable_flag: None, proprietary: {}, unknown: {} }`,
 right: `Global { tx_data: TxData { version: 2, fallback_locktime: None, input_count: 2, output_count: 5, tx_modifiable: None }, version: 2, xpub: {}, scalars: [Tweak(0f56f3a1f798b585d605591085469b0e3d0c3f46c3bdf230773056302acccdb8)], elements_tx_modifiable_flag: None, proprietary: {}, unknown: {} }`', examples/pset_blind_coinjoin.rs:274:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I can't keep rand 0.6 because it would break against secp256k1_zkp which is now 0.8

Any suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into finding an equivalent here. 0.8 rand should have some equivalent PRNG.

Copy link
Collaborator Author

@RCasatta RCasatta Sep 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a deprecation notice on rand 0.6 referring to using the rand_chacha crate (luckily wee need only as dev-dep), I tested it and it looks compatible:

  let mut rng = rand_chacha::ChaChaRng::seed_from_u64(0);
    assert_eq!(rng.next_u32(), 2180380594);

    let mut rng = rand::ChaChaRng::seed_from_u64(0);
    assert_eq!(rng.gen::<u32>(), 2180380594);

    let mut rng = rand::rngs::StdRng::seed_from_u64(0);
    assert_eq!(rng.gen::<u32>(),3384286946);

So I added c187bbb

and raw_blind.rs example works, however, pset_blind_coinjoin.rs still doesn't!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to add a commit which removes the rand_chacha dep, sticks in some custom crappy RNG, and updates the test vectors. We'd still have a commit that used rand_chacha so that readers could check that the change in tests was only due to the change in RNG, rather than anything else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that should just be a separate PR..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pset_blind_coinjoin.rs still doesn't!

FYI this was due to wrongdoing in the "fix warning" commit

@RCasatta
Copy link
Collaborator Author

I've got a test failure which I am not sure how to tackle (to check the CI the test is temporarily ignored):

---- confidential::tests::nonce_serde stdout ----
thread 'confidential::tests::nonce_serde' panicked at 'expected Token::Bytes([2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) but serialized as Tuple { len: 33, }', /home/casatta/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_test-1.0.136/src/ser.rs:240:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@RCasatta RCasatta mentioned this pull request Sep 29, 2022
RCasatta added a commit that referenced this pull request Sep 30, 2022
948416b Use crappy rng for raw_blind, update test_vector (Riccardo Casatta)
ecb2c30 Use crappy rng for pset_blind_coinjoin, update test_vector (Riccardo Casatta)
ed79cdd Move big test strings to external file (Riccardo Casatta)

Pull request description:

  As suggested in #147 (comment)

ACKs for top commit:
  apoelstra:
    ACK 948416b

Tree-SHA512: 4eecb52ca357bc531b1872ed6e2ebc764627e226d0d56ed3a76b58590b27ce19aab3d8d99cd15978e4503bae2b60ad840a74f2e8a7a0f6caa85e94dde274658c
@RCasatta RCasatta force-pushed the bump_bitcoin branch 2 times, most recently from 56f4512 to ac20e2f Compare September 30, 2022 07:38
@RCasatta
Copy link
Collaborator Author

Rebased over master,
I still have to figure out #147 (comment)

bitcoin_hases: bump 0.10.1 -> 0.11.0
rand: bump 0.6.5 -> 0.8

Code changes relate to:
* Drop default from structure since hashes has all_zeros() instead of default(),
  Input manually implements default to minimize changes.
* convert arrays to Scalar type
@RCasatta
Copy link
Collaborator Author

The serde error is due to
rust-bitcoin/rust-secp256k1#406

So I think it's expected and I have update the test vector and mentioned in the CHANGELOG

@RCasatta RCasatta marked this pull request as ready for review September 30, 2022 08:44
@apoelstra
Copy link
Member

Can you add a commit which renames serde-feature to serde similar to how rust-bitcoin does it now? (Will also need a CHANGELOG entry)

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 7a53252

@apoelstra apoelstra mentioned this pull request Sep 30, 2022
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 6039cc4

@RCasatta
Copy link
Collaborator Author

RCasatta commented Oct 3, 2022

Do not merge yet, I've got issues in downstream lib on serde that wasn't there before the rename (suggestion appreciated, not sure what's happening)

error[E0277]: the trait bound `secp256k1_zkp::SurjectionProof: serde::Deserialize<'_>` is not satisfied
    --> /home/casatta/.cargo/git/checkouts/rust-elements-29d0ae2a32add2d1/7a53252/src/pset/map/output.rs:130:5
     |                                                                          
130  |     /// The blind asset surjection proof                                 
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::Deserialize<'_>` is not implemented for `secp256k1_zkp::SurjectionProof`
     |                                                                          
     = help: the following other types implement trait `serde::Deserialize<'de>`:
               &'a Path                                                         
               &'a [u8]                                                         
               &'a serde_json::value::RawValue                                  
               &'a str                                                          
               ()                                                               
               (T0, T1)                                                         
               (T0, T1, T2)                                                     
               (T0, T1, T2, T3)                                                 
             and 276 others                                                     
     = note: required because of the requirements on the impl of `serde::Deserialize<'_>` for `Box<secp256k1_zkp::SurjectionProof>`
     = note: 1 redundant requirement hidden                                     
     = note: required because of the requirements on the impl of `serde::Deserialize<'_>` for `std::option::Option<Box<secp256k1_zkp::SurjectionProof>>`
note: required by a bound in `next_value`                                       
    --> /home/casatta/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.145/src/de/mod.rs:1869:12
     |                                                                          
1869 |         V: Deserialize<'de>,                                             
     |            ^^^^^^^^^^^^^^^^ required by this bound in `next_value`       
                                                                                
For more information about this error, try `rustc --explain E0277`.

@apoelstra
Copy link
Member

Is there a serde feature on secp256k1-zkp that we need to enable?

@RCasatta
Copy link
Collaborator Author

RCasatta commented Oct 3, 2022

Yes, but it's there like it was before the rename.

@apoelstra
Copy link
Member

Maybe your downstream crate is using a different version of secp-zkp now, and use-serde isn't enabled on the downstream version.

BTW we missed an opportunity to rename secp-zkp/use-serde to secp-zkp/serde when we did the release last week :/

@RCasatta
Copy link
Collaborator Author

RCasatta commented Oct 3, 2022

yeah sorry, there is no issue I was just missing a cargo update ( suggested by @noib3 ) so it's mergeable to me, I am going to merge it tomorrow unless @sanket1729 has some feedback

BTW we missed an opportunity to rename secp-zkp/use-serde to secp-zkp/serde when we did the release last week :/

yes, we should have done that, opening an issue -> BlockstreamResearch/rust-secp256k1-zkp#61

Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 6039cc4

@RCasatta RCasatta merged commit 19e40ae into ElementsProject:master Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants