rust-elements icon indicating copy to clipboard operation
rust-elements copied to clipboard

PSET Examples broken

Open stevenroose opened this issue 2 years ago • 9 comments

It seems that the examples are broken on master. Running this produces various compilation errors:

cargo test --features serde

stevenroose avatar Nov 21 '22 19:11 stevenroose

Can you quote the error messages? That command runs cleanly for me and it is run in CI, which has also passed recently.

apoelstra avatar Nov 22 '22 14:11 apoelstra

Hmm, came here to report this again, but probably different broken. The PSET ones are broken now. Many errors about private fields:

Some errors have detailed explanations: E0308, E0433, E0599, E0609, E0616.
For more information about an error, try `rustc --explain E0308`.
error[E0616]: field `inputs` of struct `elements::pset::PartiallySignedTransaction` is private
   --> examples/pset.rs:298:10
    |
298 |     pset.inputs[0].partial_sigs.clear();
    |          ^^^^^^ private field
    |
help: a method `inputs` also exists, call it with parentheses
    |
298 |     pset.inputs()[0].partial_sigs.clear();
    |                ++

error[E0616]: field `inputs` of struct `elements::pset::PartiallySignedTransaction` is private
   --> examples/pset.rs:299:10
    |
299 |     pset.inputs[0].final_script_witness = Some(vec![
    |          ^^^^^^ private field

stevenroose avatar Aug 02 '23 06:08 stevenroose

Hmm, this should definitely be added to the CI.

sanket1729 avatar Aug 02 '23 06:08 sanket1729

Yes, and I need to figure out how to run the examples in my local CI.

I think we want to add --all-targets to our cargo test invocations.

apoelstra avatar Aug 02 '23 13:08 apoelstra

@apoelstra I think they are run as part of test.sh ? or does your local CI not use that script

delta1 avatar Aug 02 '23 13:08 delta1

@delta1 no, my local CI uses nix so that I can reuse all the dependencies' builds across runs. cargo rebuilds the world every time.

apoelstra avatar Aug 02 '23 13:08 apoelstra

cool.. maybe a postCheck that calls run-parts ?

delta1 avatar Aug 02 '23 13:08 delta1

I guess you mean using run-parts to call the contrib scripts? No, because the contrib scripts call cargo which will rebuild the world and take 10x as long.

I think to run examples I would need https://github.com/kolloch/crate2nix/issues/284 -- it looks like there is a draft PR open so I can crib code from that.

Edit ah, you mean to run run-parts ./target/debug/examples as is done in contrib/test.sh ... lemme see if that'll work, it would be super easy and nice if it would..

apoelstra avatar Aug 02 '23 13:08 apoelstra

It looks like the target/debug/examples directory isn't created. I think I would need to modify crate2nix.

apoelstra avatar Aug 02 '23 15:08 apoelstra