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

Feat installer #123

Merged
merged 48 commits into from
Jul 5, 2021
Merged

Feat installer #123

merged 48 commits into from
Jul 5, 2021

Conversation

edouardparis
Copy link
Member

@edouardparis edouardparis commented May 18, 2021

Add installer

Different use case:

  1. --conf is present, the app tries to run and returns error if failure.

  2. --datadir is present, the app tries to run and starts installer if config is
    not fund in datadir or datadir does not exist.

  3. no flags, the app tries to run with default datadir path, starts installer
    if config is not fund in default datadir or default datadir does not exist.

    close Build the setup wizard #106

Copy link
Collaborator

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

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

I scrolled briefly through it but I still haven't tested it. Can you add some documentation on how to start it, what it does etc?

src/revault.rs Show resolved Hide resolved
src/app/config.rs Outdated Show resolved Hide resolved
src/installer/mod.rs Outdated Show resolved Hide resolved
src/installer/mod.rs Outdated Show resolved Hide resolved
src/installer/message.rs Outdated Show resolved Hide resolved
src/installer/message.rs Outdated Show resolved Hide resolved
src/installer/message.rs Outdated Show resolved Hide resolved
src/installer/step/manager.rs Show resolved Hide resolved
Copy link
Collaborator

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

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

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PolicyCompilation(PolicyError(DuplicatePubKeys))', src/installer/step/stakeholder.rs:113:42
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    21753 segmentation fault (core dumped)  ../revault-gui/target/debug/revault-gui --datadir /tmp/fakedatadir

:(

Overall, it looks really nice! But, either here or in a following PR, we should add some checks on the user inputs. Some issues I found:

  • you can add only one stakeholder, even tho the minimum is two
  • the manager threshold can be higher than the number of the managers, so you can create a super secure 8of1 (I saw a check for this in the code though 🤔 I think you allow the user to go on even if there are warnings, maybe somewhere else as well)
  • we accept whatever in the field cosigner keys, even aaaaaa
  • same for all the fields host and noise key (watchtowers, coordinator, cosigners...), and for the cookie in bitcoind, we should check that the input is valid
  • I think we should ask for the revaultd_path as well, otherwise the installer won't start correctly the gui :(
  • As I was saying in ui: Give a fixed width to the buttons #141, I think all the buttons should have fixed width - for example, it would be nice to have the "stakeholder", "stakeholder & manager", "manager" buttons with the same widths, or the "save" and "install"
  • As I was saying in Avoid putting the whole view in a Scrollable #125, some elements of the Ui should stay outside the scroll - like the "previous" or "save" buttons

}
message::Action::Decrement => {
self.treshold_warning = false;
if self.managers_treshold > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe the threshold should start from 1?

}
message::Action::Decrement => {
self.spending_delay_warning = false;
if self.spending_delay > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, should be at least 1

src/installer/step/mod.rs Outdated Show resolved Hide resolved
src/installer/view.rs Outdated Show resolved Hide resolved
.push(col_address)
.push(col_cookie)
.push(
button::primary(&mut self.save_button, button::button_content(None, "Save"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can probably write "Install" in this button, no need to click install in the next view

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean: you write "Install" here in this button, and you actually install clicking that button, and the next view is only a "everything went good"

warning: Option<&String>,
) -> Element<Message> {
let mut col = Column::new()
.push(text::bold(text::simple("You reached the end")).size(50))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would put here "RevaultGUI is installed!" (or a better name, or a better phrasing) and the button for starting

#[derive(Debug, Clone)]
pub enum Message {
Install(installer::Message),
Run(app::Message),
Copy link
Collaborator

Choose a reason for hiding this comment

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

cargo clippy is sad :(

warning: large size difference between variants
  --> src/main.rs:69:5
   |
69 |     Run(app::Message),
   |     ^^^^^^^^^^^^^^^^^ this variant is 552 bytes
   |
note: and the second-largest variant is 48 bytes:
  --> src/main.rs:68:5
   |
68 |     Install(installer::Message),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
help: consider boxing the large fields to reduce the total size of the enum
   |
69 |     Run(Box<app::Message>),
   |         ^^^^^^^^^^^^^^^^^

src/installer/step/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

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

  • Fill private noise key -> Would be nice to have here a "your", Fill your private noise key. It would also be nice to have the validation while you write and not only when you click next, but I'm ok with merging even without this.
    As we were saying in private chat, I think we should clarify how the secret is encoded? I think (but I'm not sure) at the moment the gui is treating it as utf-8 encoded (it uses as_bytes)
  • We should validate that the emergency address is on the same network as bitcoind, otherwise revaultd won't start :(
    For doing this I think we should ask the emergency address after asking the bitcoind params

Again, I have no idea if the installation is correct as I can't start it, as the revaultd_path is not set in the revault_gui.toml

src/revaultd/config.rs Show resolved Hide resolved
src/installer/mod.rs Outdated Show resolved Hide resolved
src/installer/view.rs Outdated Show resolved Hide resolved
src/installer/view.rs Outdated Show resolved Hide resolved
@edouardparis
Copy link
Member Author

install revaultd in your .cargo/bin with cd revaultd & cargo install --path .
GUI expect that revaultd is installed

@danielabrozzoni
Copy link
Collaborator

I would prefer avoiding installing revaultd on my machine actually 😅 We'll come up with something, I guess :)

ACK 4e54d3b - I didn't review the code in deep, but I tested extensively

@darosior
Copy link
Member

darosior commented Jul 5, 2021 via email

@edouardparis
Copy link
Member Author

ACK 4e54d3b

@edouardparis edouardparis merged commit 71fdc9a into revault:master Jul 5, 2021
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.

Build the setup wizard
3 participants