GithubHelp home page GithubHelp logo

revault / revault_tx Goto Github PK

View Code? Open in Web Editor NEW
15.0 5.0 9.0 662 KB

Script descriptors and transaction creation routines for Revault

License: BSD 3-Clause "New" or "Revised" License

Rust 99.36% Shell 0.64%
bitcoin vault revault miniscript rust

revault_tx's Introduction

Revault

Revault is a Bitcoin vault architecture for multi-party situations.

This library defines the Miniscript descriptors and handles PSBT management of Revault-specific transactions.

Minimum Supported Rust Version

This library should always compile with any combination of features on Rust 1.48.

Contributing

Contributions are very welcome. For general guidelines, see CONTRIBUTING.md.

Discussions happen either here in issues or at #revault on Libera.

Licence

Released under the BSD 3-Clause Licence. See the LICENCE file.

revault_tx's People

Contributors

danielabrozzoni avatar darosior avatar edouardparis avatar jswambo avatar justinmoon avatar rndhouse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

revault_tx's Issues

Deserialization tests

We should do some tests at deserialization time. The same as at creation time actually.

Get rid of `SpendTxOut`

It doesn't serve much purpose and prevents roundtrips.

TODO:

  • roundtrip twice in the fuzz targets: once for the encoded PSBTs, once for the transaction data structures

Move the inner-exposing functions out of the RevaultTransaction trait

After #55 , we have a set of assumptions for a RevaultTransaction that hold in pretty much all cases. It would be nice to get rid of that "pretty much" by preventing the user of the interface to at all access the inner PSBT as mutable. Namely to remove inner_tx_mut.

Then, we could also move inner_tx to be a private interface and have public wrappers for accessing the inner PSBT info.

Fetch CSV from UnvaultDescriptor

The API is currently polluted by requiring the Unvault CSV in order to apply it to the Spend inputs' sequence. We should be able to fetch it through the Unvault descriptor, required in all the same places

fuzz: fix run.sh script and some warnings in fuzz_targets

It's not clear to know where to use run.sh, ./fuzz/run.sh or cd fuzz & ./run.sh ?

cd corpus && git clone https://github.com/revault/revault_tx_corpus

cargo install --force cargo-fuzz
for target in $(ls fuzz/fuzz_targets);do
    cargo +nightly fuzz run "${target%.*}" -- -runs=0
done

corpus is in fuzz directory and for target in $(ls fuzz/fuzz_targets) means we are in revault_tx root directory


When running some warnings are often:

warning: unused `Result` that must be used
  --> fuzz_targets/parse_unvault.rs:45:9
   |
45 |         tx.verify_input(0);
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default
   = note: this `Result` may be an `Err` variant, which should be handled

warning: unused `Result` that must be used
  --> fuzz_targets/parse_unvault.rs:51:9
   |
51 |         tx.finalize(&secp);
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = note: this `Result` may be an `Err` variant, which should be handled

More test coverage

Some trivial error paths are not tested yet (you can use the script in contrib/gen_test_coverage.sh to find them).

Integration of mutation testing

revault_tx is a pretty good target for mutation testing, as any mutation in the transaction/script creation routines i can think of should result in a sanity check failure.

Adaptable insane fee sanity check

The point of the insane fee sanity check is to be a belt-and-suspender in case our feerate computation is wrong.

However, 0.2BTC of fees may be reasonable for, say, a hundred-inputs Spend transaction (w/ many outputs too). Maybe we could have a check depending on the amount spent? As a sweet pot between straightforwardness of the check and adaptability to many transaction.

Commit to a MSRV

1.43 looks reasonable (1.48 in Debian bullseye), need to dig more into rustc's release notes.

Exhaustive parsing checks

Right now, we only sanity-check the PSBTs in from_psbt_serialized() are sane with regard to our internal assumptions (unwrap()s basically). This may be enough, but we may also want complete parsing checks to be sure that whether a transaction is parsed or created with the constructor it will hold to our requirements (eg, no dust amounts, sane feerate, etc..). This is quite some more hairy code though..

Serde for Revault transactions

(Moved from #20)

If you naively put features = ["use-serde"] in the cargo.toml for bitcoin, will serde's #[derive(Serialize, Deserialize)] work for the ravault tx types?

@darosior : No, it's a newtype: i need to make it a trivial implem (not using #derive).

Optimize our Script tests

It was Ok to be dumb until now, but they start getting slow. There are pretty easy fix such as not creating a secp context a thousand times, removing redundant loops, etc..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.