Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit b8b1f9f
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Wed Apr 5 10:46:25 2023 -0400

    Cleanups from PR reviews.

commit de52c39
Merge: cdfdfc5 72ceae8
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Wed Mar 29 20:39:58 2023 -0400

    Merge pull request #4 from nimadebi/v6-0d-wizard-genesis

    V6 0d wizard genesis

commit 72ceae8
Author: nimadepi <nakib@live.nl>
Date:   Sun Mar 19 13:05:56 2023 +0100

    clean up

commit 259cad6
Author: nimadepi <nakib@live.nl>
Date:   Sun Mar 19 12:57:40 2023 +0100

    add node files generation

commit cdfdfc5
Merge: 2363875 40e9732
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Fri Mar 10 15:13:52 2023 -0500

    Merge pull request #3 from nimadebi/v6-0d-wizard-genesis

    V6 0d wizard genesis

commit 40e9732
Author: nimadepi <nakib@live.nl>
Date:   Sun Mar 5 23:12:26 2023 +0100

    cleanup comments

commit 92001c3
Author: nimadepi <nakib@live.nl>
Date:   Sun Mar 5 22:54:33 2023 +0100

    create 0L folder when gh keys entered

commit 7fdda59
Author: nimadepi <nakib@live.nl>
Date:   Sat Mar 4 22:13:08 2023 +0100

    fixed total process

commit 04df840
Author: nimadepi <nakib@live.nl>
Date:   Sat Mar 4 19:57:14 2023 +0100

    cleanup

commit ed5a998
Author: nimadepi <nakib@live.nl>
Date:   Sat Mar 4 15:37:21 2023 +0100

    fix snapshot path

commit dcbe647
Author: nimadepi <nakib@live.nl>
Date:   Sat Mar 4 14:53:08 2023 +0100

    fix

commit f7e8887
Author: nimadepi <nakib@live.nl>
Date:   Sat Mar 4 13:48:24 2023 +0100

    fix

commit 4f656f1
Author: nimadepi <nakib@live.nl>
Date:   Sat Mar 4 13:32:10 2023 +0100

    check for existing snapshot

commit 2363875
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Fri Mar 3 10:06:13 2023 -0500

    complete all features of genesis wizard

commit b66a1d5
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 17:26:27 2023 -0500

    workflow patches

commit e15a42a
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 17:16:23 2023 -0500

    save api key

commit 4496eb8
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 16:54:28 2023 -0500

    makefile

commit b573d14
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 16:50:59 2023 -0500

    revert makefile

commit 1afc03c
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 16:39:11 2023 -0500

    cleanup

commit 7867a7d
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 16:28:35 2023 -0500

    cleanup

commit a802d14
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 17:26:27 2023 -0500

    workflow patches

commit 9483386
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 15:45:49 2023 -0500

    patch

commit b093c9b
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 15:31:05 2023 -0500

    cleanup

commit dbc6cc3
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 15:26:36 2023 -0500

    fix

commit 8375271
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 15:26:11 2023 -0500

    wizard runs genesis.

commit 78cb948
Merge: 121b95a 0a24808
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Thu Mar 2 14:47:52 2023 -0500

    Merge pull request #1 from nimadebi/v6-0d-wizard-genesis

    V6 0d wizard genesis

commit 0a24808
Author: nimadepi <nakib@live.nl>
Date:   Thu Mar 2 17:40:00 2023 +0100

    add epoch

commit e2c2709
Author: nimadepi <nakib@live.nl>
Date:   Wed Mar 1 23:27:24 2023 +0100

    add genesis pull request

commit 3070000
Author: nimadepi <nakib@live.nl>
Date:   Wed Mar 1 22:11:30 2023 +0100

    send validator config to github

commit b060fa8
Author: nimadepi <nakib@live.nl>
Date:   Wed Mar 1 18:02:43 2023 +0100

    add validator config struct

commit 121b95a
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Tue Feb 28 20:44:38 2023 -0500

    patches. uses correct git account

commit be42125
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Tue Feb 28 20:18:27 2023 -0500

    cleanup

commit 034ed5c
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Tue Feb 28 18:12:14 2023 -0500

    gross refactoring to make the github genesis work as a library

commit 1da22f6
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Tue Feb 28 14:42:13 2023 -0500

    refactoring onboard

commit a48e1a1
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Tue Feb 28 14:07:43 2023 -0500

    refactoring onboardin

commit 101d317
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Tue Feb 28 13:42:05 2023 -0500

    wip

commit 3fbe012
Author: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
Date:   Tue Feb 28 13:30:15 2023 -0500

    scaffold for genesis wizard
  • Loading branch information
0o-de-lally committed Apr 11, 2023
1 parent 2b21aa4 commit 3f413f1
Show file tree
Hide file tree
Showing 39 changed files with 1,418 additions and 1,157 deletions.
133 changes: 121 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#### VARIABLES ####
SHELL=/usr/bin/env bash
DATA_PATH = ${HOME}/.0L
Expand Down Expand Up @@ -456,7 +457,7 @@ extract-waypoint:
--extract \
--chain-id ${CHAIN_ID} \
--shared-backend ${REMOTE} \
| awk -F 'Waypoint: ' '{print $$2}' > ${DATA_PATH}/genesis_waypoint.txt
| awk -F 'Waypoint: ' '{print $$2}' > ${DATA_PATH}/genesis_waypoint.txt\

set-waypoint:
make extract-waypoint && cargo r -p ol -- init --update-waypoint --waypoint $(shell cat ${DATA_PATH}/genesis_waypoint.txt)
Expand Down
3 changes: 2 additions & 1 deletion config/management/genesis/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ impl Genesis {
//////// 0L ////////
pub fn just_the_vals(shared_backend: Storage) -> Result<Vec<Validator>, Error>{

let g = GenesisBuilder::new(shared_backend);
let g = GenesisBuilder::new(shared_backend);

g.validators()
.map_err(|e| Error::UnexpectedError(e.to_string()))
}
Expand Down
60 changes: 49 additions & 11 deletions config/management/genesis/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ use diem_global_constants::{GENESIS_WAYPOINT, OPERATOR_ACCOUNT, OWNER_ACCOUNT, W
use diem_management::{
config::ConfigPath,
error::Error,
secure_backend::{SecureBackend, SharedBackend},
secure_backend::{SharedBackend, ValidatorBackend},
};
use std::{convert::TryFrom, path::PathBuf, str::FromStr};
use std::{ path::PathBuf, str::FromStr};
use diem_secure_storage::{
CryptoStorage, OnDiskStorage, KVStorage
};
use diem_types::{waypoint::Waypoint, account_address::AccountAddress};
use structopt::StructOpt;

diem_management::secure_backend!(
ValidatorBackend,
validator_backend,
"validator configuration",
"path-to-key"
);
// diem_management::secure_backend!(
// ValidatorBackend,
// validator_backend,
// "validator configuration",
// "path-to-key"
// );

#[derive(Debug, StructOpt)]
struct Key {
pub struct Key {
#[structopt(flatten)]
config: ConfigPath,
#[structopt(flatten)]
Expand All @@ -36,6 +36,44 @@ struct Key {
}

impl Key {
pub fn new(validator_backend: &ValidatorBackend, shared_backend: &SharedBackend) -> Self {
Self {
config: ConfigPath { config: None },
shared_backend: shared_backend.to_owned(),
validator_backend: validator_backend.to_owned(),
path_to_key: None,
}
}
pub fn shared_backend(namespace: String, github_org: String, repo_name: String, data_path: PathBuf) -> anyhow::Result<SharedBackend> {

// BLACK MAGIC with MACROS
// ... AND STRING FORMATTING
// I curse your first born.

let storage_cfg = format!(
"backend=github;repository_owner={github_org};repository={repo_name};token={data_path}/github_token.txt;namespace={namespace}",
namespace = namespace,
github_org = github_org,
repo_name = repo_name,
data_path = data_path.to_str().unwrap(),
);

Ok(SharedBackend::from_str(storage_cfg.as_str())?)

}

pub fn validator_backend(namespace: String, data_path: PathBuf) -> anyhow::Result<ValidatorBackend> {

let storage_cfg = format!(
"backend=disk;path={data_path}key_store.json;namespace={namespace}",
namespace = namespace,
data_path = data_path.to_str().unwrap(),
);

Ok(ValidatorBackend::from_str(storage_cfg.as_str())?)

}

fn submit_key(
&self,
key_name: &'static str,
Expand Down Expand Up @@ -136,7 +174,7 @@ impl DiemRootKey {
#[derive(Debug, StructOpt)]
pub struct OperatorKey {
#[structopt(flatten)]
key: Key,
pub key: Key, ///////// 0L ////////
}

impl OperatorKey {
Expand All @@ -151,7 +189,7 @@ impl OperatorKey {
#[derive(Debug, StructOpt)]
pub struct OwnerKey {
#[structopt(flatten)]
key: Key,
pub key: Key, //////// 0L ////////
}

impl OwnerKey {
Expand Down
Loading

0 comments on commit 3f413f1

Please sign in to comment.