Skip to content

Commit

Permalink
patches. uses correct git account
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Mar 1, 2023
1 parent be42125 commit 121b95a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 35 deletions.
3 changes: 2 additions & 1 deletion ol/genesis-tools/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ fn main() -> Result<()> {
let mut w = wizard::GenesisWizard::default();
w.repo_name = opts.genesis_repo_name.as_ref().unwrap().clone();
w.repo_owner = opts.genesis_repo_owner.as_ref().unwrap().clone();
w.start_wizard()?
w.start_wizard()?;
return Ok(()); // exit
}

let rt = tokio::runtime::Runtime::new().unwrap();
Expand Down
74 changes: 40 additions & 34 deletions ol/genesis-tools/src/wizard.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! A simple workflow tool to organize all genesis
//! instead of using many CLI tools.



use anyhow::bail;
use dialoguer::{Confirm, Input};

Expand Down Expand Up @@ -39,7 +37,7 @@ impl Default for GenesisWizard {
/// testnet values for genesis wizard
fn default() -> Self {
let data_path = dirs::home_dir().expect("no home dir found").join(".0L/");
dbg!(&data_path);

Self {
namespace: "alice".to_string(),
repo_owner: "0l-testnet".to_string(),
Expand Down Expand Up @@ -81,36 +79,37 @@ pub fn start_wizard(&mut self) -> anyhow::Result<()>{

// check if the user has the github auth token, and that
// there is a forked repo on their account.
// Fork the repo, if it doesn't exist
self.git_setup()?;

let app_config = ol_types::config::parse_toml(self.data_path.join("0L.toml"))?;


// Run registration
// register the configs on the new forked repo, and make the pull request
self.register_configs(&app_config)?;


for _ in (0..10).progress_with_style(OLProgress::fun())
.with_message("Initializing 0L") {
thread::sleep(Duration::from_millis(100));
}



// Fork the repo, if it doesn't exist

// Run registration
// Download the snapshot from the epoch archive. Ask user which epoch to use.

// run genesis

// create the files

// empty the DB

// reset the safety rules


// verify genesis

// reset the safety rules

// remove "owner" key from key_store.json

for _ in (0..10).progress_with_style(OLProgress::fun())
.with_message("Initializing 0L") {
thread::sleep(Duration::from_millis(100));
}

Ok(())
}

Expand Down Expand Up @@ -185,7 +184,7 @@ fn git_setup(&mut self) -> anyhow::Result<()> {

let sh = Key::shared_backend(
app_cfg.format_owner_namespace().clone(),
self.repo_owner.clone(),
self.github_username.clone(), // NOTE: we need to write to the github user.
self.repo_name.clone(),
self.data_path.clone()
)?;
Expand All @@ -196,6 +195,14 @@ fn git_setup(&mut self) -> anyhow::Result<()> {

op.execute()?;

// # OPER does this
// # Submits operator key to github, and creates local OPERATOR_ACCOUNT
// oper-key:
// cargo run -p diem-genesis-tool ${CARGO_ARGS} -- operator-key \
// --validator-backend ${LOCAL} \
// --shared-backend ${REMOTE}


pb.inc(1);

let own = OwnerKey {
Expand All @@ -205,6 +212,14 @@ fn git_setup(&mut self) -> anyhow::Result<()> {
own.execute()?;
pb.inc(1);

// # OWNER does this
// # Submits operator key to github, does *NOT* create the OWNER_ACCOUNT locally
// owner-key:
// cargo run -p diem-genesis-tool ${CARGO_ARGS} -- owner-key \
// --validator-backend ${LOCAL} \
// --shared-backend ${REMOTE}


let set_oper = ValidatorOperator::new(
app_cfg.format_owner_namespace().clone(),
&sh
Expand All @@ -213,31 +228,20 @@ fn git_setup(&mut self) -> anyhow::Result<()> {
set_oper.execute()?;
pb.inc(1);

pb.finish_and_clear();

//TODO(nima) send the validator config. similar to above

// # OPER does this
// # Submits operator key to github, and creates local OPERATOR_ACCOUNT
// oper-key:
// cargo run -p diem-genesis-tool ${CARGO_ARGS} -- operator-key \
// --validator-backend ${LOCAL} \
// --shared-backend ${REMOTE}

// # OWNER does this
// # Submits operator key to github, does *NOT* create the OWNER_ACCOUNT locally
// owner-key:
// cargo run -p diem-genesis-tool ${CARGO_ARGS} -- owner-key \
// --validator-backend ${LOCAL} \
// --shared-backend ${REMOTE}

// # OWNER does this
// # Links to an operator on github, creates the OWNER_ACCOUNT locally
// assign:
// cargo run -p diem-genesis-tool ${CARGO_ARGS} -- set-operator \
// --operator-name ${OPER} \
// --shared-backend ${REMOTE}



//TODO(nima) send the validator config. similar to above




// # OPER does this
// # Submits signed validator registration transaction to github.
// reg:
Expand All @@ -249,6 +253,8 @@ fn git_setup(&mut self) -> anyhow::Result<()> {
// --validator-backend ${LOCAL} \
// --shared-backend ${REMOTE}

pb.finish_and_clear();

Ok(())
}

Expand Down

0 comments on commit 121b95a

Please sign in to comment.