Git Product home page Git Product logo

revaultd's People

Contributors

danielabrozzoni avatar darosior avatar edouardparis avatar mariocynicys avatar rndhouse avatar vaibhavgarg237 avatar zshan0 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

revaultd's Issues

Did i already sign this ? Let the user know if they need to acknowledge / active this vault

darosior
20:07
Hmm we should have a "i already signed" state don't you think? Weird to still have to acknowledge funds on homepage after succesful signing

edouard
09:43
yes, I can check for each vault not spent if the presigned transactions are signed but If there are 6371 vaults it would take time to load
maybe once revocationtxs is done, we update a column in vault table with: revocation_txs_signed: true
and the column has a field is in the resource of the listvaults call

darosior
09:45
That's basically equivalent to having a new state

edouard
09:46
yes, do we both agree that a new vault status is too much ?
two other column in the table could do the job:
revocation_txs_signed unvault_tx_signed

darosior
09:55
Well i feel like the opposite (as usual lol), adding more columns seems overkiller than a new state. But the number of state is bloated. I'm thinking of a way to do it without DB
Let's put an issue for now

Figure out the "history" screens, different views, and generate CSV

Users will have different use-cases, and we should need to adapt to their requirements.

Typically:
"Accounting view" with receive/spend
"transaction view" as in Bitcoin transaction
"detailed view" with fees, cancel, change, etc

We also should have a tool to extract a CSV for accounting purpose.

Directories permissions on Windows

revaultd is creating a directory (the "datadir") and some files (the database, the UNIX domain socket for RPC) on the host OS. We want to setup some basic OS permissions on these files (why would another user get allowed to modify our database, or use our RPC socket?). These permissions are set up at creation time in different places:

However, they are only currently setup for UNIX systems, and Windows is special-cased to setup no particular restrictions. We need to setup some permissions also on Windows, but first we need to figure out how :)

Some guidance on this issue:

  • It seems that the equivalent of permissions under Windows is to use ACLs. Maybe the stdlib has some way of abstracting it. Please don't introduce new dependencies just for this :).
  • To decode the UNIX permissions set in the links above, we want rw only for the owner of the file for the database and the RPC and rwx (still only for the owner) for the data directory.

Reduce unwrap_or_else(|e| log(e); exit(1);) boilerplate

Since we run as a daemon, we get no backtraces for panic. Therefore i use this pattern everywhere we want to panic:

unwrap_or_else(|e| {
     log(e);
     exit(1);
});

Woudl be great to either make it a macro or setup fern to catch panics.

Support RPC password authentication

AFAICT only cookie-file based bitcoind RPC authentication is supported atm. RPC password authentication has many advantages like the use of multiple usernames and rpcwhitelists.

Fuzz testing the JSONRPC server

As it's exposed in a single server module, it think we could fuzz the mio_loop:
https://github.com/re-vault/revaultd/blob/3141908c8c1e847b2e76f9240c109734d1324599/src/daemon/jsonrpc/server.rs#L121-L125

We could use a custom MetaIoHandler that would not process the actual command but rather be used to acknowledge their reception. This would largely complement our unit tests that are only for now testing for simple situations and edge cases that we uncover as we go.

We could use the great libFuzzer integration by the rust-fuzz org.

Startup check that the coordinator got all our sigs

In the unvaulttx call (as well as in the revocationtxs call for that matter) we might crash or have a network connection error just after storing the sig in db, resulting in us having the sig but the others not being able to fetch them.

At startup we could getsigs for our sigs to make sure the coordinator got everything already.

Replace the "Secure" terminology

We denote vaults for which all revocation transactions are signed as being "Secure". That's poor terminology and we should find then use a new one..

JSONRPC server Parse Error

On my sig sharing branch, i could reliably reproduce the error @edouardparis encountered for a while now. This has likely to do with the size of the request.

cargo run --bin revault-cli -- --conf config_regtest.toml revocationtxs 99924e3d562891b6b972e268a10a4ae4321280eb7b2759d0f1f86db500e82d04:1 "cHNidP8BAF4CAAAAAQvn7DOXXnPUZqa3v7gwctBN0yNMOagHYYDl+4Wq+2O9AAAAAAASAAAAAcbVmTsAAAAAIgAgy7Co1PHzwoce0hHQR5RHMS72lSZudTF3bYrNgqLbkDYAAAAAAAEBK7A4mjsAAAAAIgAgtYkRK0YZh1BcaCEDFv1qa3z/G3bl1zNYrXV2LYjQwhMBAwSBAAAAAQX9RwFSIQJm7Qi89u6RJ80T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DUD+FV/9LvhhQx7TytiEClghIhOmp4rLxE40iu68WDFRWbj5cqP+qig/sMJV9KZRSrmR2qRTIPHfJailcIXqf1nObeNERfLzUp4isa3apFCrfSAV1plExbDv+7hUfsxciw6RhiKxsk2t2qRTEDwSFmw8jMC9oIjTvxaO5dXHly4isbJNrdqkUWNaeGHwKcz885RxsiARUuJKVNUmIrGyTVIdnVCECZEz54reP6wp1HlBQL1MKTL0LvaMCB3lgU5HnFlTdZsIhA87VXRIIvYxrQrEeKbqld3EcroMbOhKWYHxeXT7TZfScIQJiN/ZV879F/Wt6oA6RwmA9YVXxzAAeQPXkdmLZZcTHeSEDCjy8+/33Ei/n+oMDVMlW6mWV8tveIyhvA7wewMFoXKNUrwESsmgAAA=="]}YAAAAAAAEBKwDKmjsAAAAAIgAgy7Co1PHzwoce0hHQR5RHMS72lSZudTF3bYrNgqLbkDYBAwSBAAAAAQXPViECZu0IvPbukSfNExdaH9MBpHRQQ1A/hVf/S74YUMe08rYhApYISITpqeKy8RONIruvFgxUVm4+XKj/qooP7DCVfSmUIQNm0V2PSlsko5OmMsfXZKKzs8mx1UNiCdw+ubxdg1/eEyECBuQo8Ehzc4QLzLpMuacbzMQNVJgNMVcTyPOOjkEL0IwhA9cfv8Yyxztmgl0Ayb8taZKgvcvXEWVTG/WGxITDbPtqIQNrT42dBZ.
[2021-01-31][23:55:43][rpc][DEBUG] Response: {"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error"},"id":null}.

Will push a patch shortly

Full windows support for JSONRPC server

#78 further increased disrepancies between Windows and non-Windows support. It looks like the latest version of mio included the Windows support for UDSs and we could get rid of the Windows-only code.

Chdir to our datadir

When daemonizing we currently stay in the directory we were started in. It's fine for development but eventually we should chdir to ~/.revaultd (or whatever our datadir is) as if it is unmounted we should die anyways.

Configuration and Miniscript descriptors

Right now, we take the descriptors parameters from the config (xpubs, unvault csv) in order to create a Miniscript descriptor on first startup.
This is kind of a bridge between the pre-Miniscript era where users were used to just put xpubs and It Works ™️ and the Miniscript era as if it's not first start we'll refuse to start with a config that does not correspond to the Miniscript descriptor stored in DB.

Is it the right approach ? At the end of the reflexion i believe this is a question of how modular we would like to be. It's just that we could store the Miniscript descriptor in the config directly as they are expected to be generated in advance (during the ceremony).
It would also be less regular-user friendly, redundant with the database, and we can't just change the descriptors and get everything to work immediately..

So the question(s) to answer here is:

  • Do we want to keep a configuration with a list of xpubs and parameters (such as the Unvault CSV value), or should we move to store the Miniscript descriptors right in the config ?

Startup sanity checks

Maybe store the bestblockhash in the db and rescan listunspent if it's not anymore part of the chain

Set the descriptors from backup

We could allow to set the miniscript descriptor from the configuration. We would in this case disregard all other configuration values (apart from our_pubkey) and just store the descriptor in DB. This should trigger a rescan too.

We should also add a getdescriptors RPC call. So the process would be:

  • During setup, call getdescriptors and backup your descriptors
  • If anything goes south you can re-import your backup descriptor by stuffing them in your config.

Organisation: a new `control` module

control.rs is getting large and we could separate "domains" of control better (eg signature sharing / checking, bitcoind interface, db interface, ..)

RPC server parsing error

@edouardparis reported the following on MM:

[2020-12-11][12:10:23][mio::poll][TRACE] registering event source with poller: token=Token(4), interests=READABLE
[2020-12-11][12:10:23][rpc][TRACE] Request: {"method":"getinfo","params":null,"id":172306,"jsonrpc":"2.0"}.
[2020-12-11][12:10:23][revaultd][TRACE] Got getinfo from RPC thread
[2020-12-11][12:10:23][rpc][DEBUG] Response: {"jsonrpc":"2.0","result":{"blockheight":222,"network":"regtest","sync":1.0,"version":"0.0.2"},"id":172306}.
[2020-12-11][12:10:23][mio::poll][TRACE] reregistering event source with poller: token=Token(4), interests=READABLE | WRITABLE
[2020-12-11][12:10:23][revaultd::jsonrpc][TRACE] Writing response '"{\"jsonrpc\":\"2.0\",\"result\":{\"blockheight\":222,\"network\":\"regtest\",\"sync\":1.0,\"version\":\"0.0.2\"},\"id\":172306}"' for Token(4)
[2020-12-11][12:10:23][revaultd::jsonrpc][TRACE] Dropping connection for Token(4)
[2020-12-11][12:10:23][mio::poll][TRACE] registering event source with poller: token=Token(5), interests=READABLE
[2020-12-11][12:10:23][rpc][TRACE] Request: {"method":"getinfo","params.
[2020-12-11][12:10:23][rpc][DEBUG] Response: {"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error"},"id":null}.
[2020-12-11][12:10:23][mio::poll][TRACE] reregistering event source with poller: token=Token(5), interests=READABLE | WRITABLE
[2020-12-11][12:10:23][rpc][TRACE] Request: ":null,"id":172306,"jsonrpc":"2.0"}.
[2020-12-11][12:10:23][rpc][DEBUG] Response: {"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error"},"id":null}.
[2020-12-11][12:10:23][mio::poll][TRACE] reregistering event source with poller: token=Token(5), interests=READABLE | WRITABLE
[2020-12-11][12:10:23][revaultd::jsonrpc][TRACE] Writing response '"{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32700,\"message\":\"Parse error\"},\"id\":null}"' for Token(5)
[2020-12-11][12:10:23][revaultd::jsonrpc][TRACE] Writing response '"{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32700,\"message\":\"Parse error\"},\"id\":null}"' for Token(5)
[2020-12-11][12:10:23][revaultd::jsonrpc][TRACE] Dropping connection for Token(5)
[2020-12-11][12:10:25][revaultd::bitcoind::interface][TRACE] Sending to bitcoind: Request {

I can't manage to reproduce, so let's keep it around

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.