Skip to content

Commit

Permalink
rename rust miner -> tower (0LNetworkCommunity#736)
Browse files Browse the repository at this point in the history
* rename rusr miner -> tower

* rename miner

* patch test runners
  • Loading branch information
0o-de-lally authored Oct 9, 2021
1 parent dc3e7c4 commit 5b240f5
Show file tree
Hide file tree
Showing 38 changed files with 78 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
toolchain: 1.52.1
override: true
components: rustfmt, clippy
- name: miner tests
run: cd ol/miner && NODE_ENV=test cargo test
- name: tower tests
run: cd ol/tower && NODE_ENV=test cargo test
- name: types tests
run: cd ol/types && NODE_ENV=test cargo test
- name: txs tests
Expand Down
106 changes: 53 additions & 53 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ members = [
# //////// 0L ////////
"ol/cli",
"ol/keys",
"ol/miner",
"ol/tower",
"ol/onboard",
"ol/txs",
"ol/types",
Expand Down
1 change: 0 additions & 1 deletion config/management/genesis/src/ol_mining.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use diem_management::{config::ConfigPath, error::Error, secure_backend::SharedBackend};
// use miner::block::Block;
use serde_json;
use std::{fs, path::PathBuf, process::exit};
use structopt::StructOpt;
Expand Down
2 changes: 1 addition & 1 deletion ol/integration-tests/test-autopay.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ swarm:
cd ${SOURCE_PATH} && cargo run -p diem-swarm -- --diem-node ${SOURCE_PATH}/target/debug/diem-node -c ${SWARM_TEMP} -n ${NUM_NODES} &> ${LOG} &

stop:
killall diem-swarm diem-node miner ol txs cli | true
killall diem-swarm diem-node tower ol txs cli | true

init:
cd ${SOURCE_PATH} && cargo r -p ol -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} init --source-path ${SOURCE_PATH}
Expand Down
4 changes: 2 additions & 2 deletions ol/integration-tests/test-mining.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ swarm:
cd ${SOURCE_PATH} && cargo run -p diem-swarm -- --diem-node ${SOURCE_PATH}/target/debug/diem-node -c ${SWARM_TEMP} -n ${NUM_NODES} &> ${LOG} &

stop:
killall diem-swarm diem-node miner ol txs cli | true
killall diem-swarm diem-node tower ol txs cli | true

echo:
@echo hi &> ${LOG} &
Expand All @@ -44,7 +44,7 @@ init:
cd ${SOURCE_PATH} && cargo r -p ol -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} init --source-path ${SOURCE_PATH}

mine:
cd ${SOURCE_PATH} && cargo r -p miner -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} start
cd ${SOURCE_PATH} && cargo r -p tower -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} start

create-stage:
cd ${SOURCE_PATH} && cargo r -p txs -- --swarm-path ${SWARM_TEMP} --swarm-persona ${PERSONA} create-validator -f ol/fixtures/account/stage.eve.account.json
Expand Down
2 changes: 1 addition & 1 deletion ol/integration-tests/test-onboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ swarm:
cd ${SOURCE_PATH} && NODE_ENV=test TEST=y cargo run -p diem-swarm -- --diem-node ${SOURCE_PATH}/target/debug/diem-node -c ${SWARM_TEMP} -n ${NUM_NODES} &> ${LOG} &

stop:
killall diem-swarm diem-node miner ol txs cli | true
killall diem-swarm diem-node tower ol txs cli | true

init:
@echo INIT
Expand Down
2 changes: 1 addition & 1 deletion ol/integration-tests/test-upgrade.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ start:
cd ${SOURCE_PATH} && cargo run -p diem-swarm -- --diem-node ${SOURCE_PATH}/target/debug/diem-node -c ${SWARM_TEMP} -n ${NUM_NODES} 2>&1 | tee ${LOG}&

stop:
killall diem-swarm diem-node miner ol txs cli | true
killall diem-swarm diem-node tower ol txs cli | true

prep:
# save makefile outside of repo, since we'll need it across branches
Expand Down
2 changes: 1 addition & 1 deletion ol/onboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ol-types = { path = "../../ol/types"}
ol-fixtures = { path = "../../ol/fixtures"}
bcs = "0.1.2"

miner = { path = "../miner" }
tower = { path = "../tower" }
zip = "0.5.12"
dialoguer = "0.8.0"

Expand Down
2 changes: 1 addition & 1 deletion ol/onboard/src/commands/wizard_fork_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl Runnable for ForkCmd {

if !self.skip_mining {
// Mine Block
miner::block::write_genesis(&app_config);
tower::block::write_genesis(&app_config);
status_ok!(
"\nGenesis proof complete",
"\n...........................\n"
Expand Down
2 changes: 1 addition & 1 deletion ol/onboard/src/commands/wizard_user_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use ol_keys::wallet;
use ol_types::block::Block;
use miner::{delay, block::write_genesis};
use tower::{delay, block::write_genesis};
use ol_types::config::AppCfg;
use abscissa_core::{Command, Options, Runnable};
use std::{path::PathBuf};
Expand Down
2 changes: 1 addition & 1 deletion ol/onboard/src/commands/wizard_val_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl Runnable for ValWizardCmd {

if !self.skip_mining {
// Mine Block
miner::block::write_genesis(&app_config);
tower::block::write_genesis(&app_config);
status_ok!(
"\nGenesis proof complete",
"\n...........................\n"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ol/miner/Cargo.toml → ol/tower/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "miner"
name = "tower"
version = "0.1.0"
edition = "2018"
authors = ["0L contributors"]
description = "0L miner"
description = "0L tower"
repository = "https://github.com/OLSF/libra"
homepage = "https://github.com/olsf/"

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ol/miner/benches/bench.rs → ol/tower/benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Benchmarks
use criterion::{criterion_group, criterion_main, Criterion};
use miner::delay;
use tower::delay;

// exammple code
// fn fibonacci(n: u64) -> u64 {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![deny(warnings, missing_docs, trivial_casts, unused_qualifications)]
#![forbid(unsafe_code)]

use miner::application::APPLICATION;
use tower::application::APPLICATION;

/// Boot MinerApp
fn main() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions ol/miner/tests/config.rs → ol/tower/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#[test]
fn test_genesis_preimage() {
let configs = miner::block::test_make_configs_fixture();
let configs = tower::block::test_make_configs_fixture();

let first_preimage = miner::block::genesis_preimage(&configs);
let first_preimage = tower::block::genesis_preimage(&configs);
let encoded = hex::encode(&first_preimage);
println!("proof:\n{:?}", encoded);

Expand Down
2 changes: 1 addition & 1 deletion ol/miner/tests/delay.rs → ol/tower/tests/delay.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Functional test for delay module
#![forbid(unsafe_code)]
use miner::delay;
use tower::delay;

#[test]
fn test_do_delay() {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub fn integration_submit_tx() {
blocks_dir.push(&config.workspace.block_dir);


let (current_block_number, _current_block_path) = miner::block::parse_block_height(&blocks_dir);
let (current_block_number, _current_block_path) = tower::block::parse_block_height(&blocks_dir);
let block_number_before_block = current_block_number.unwrap();


Expand Down Expand Up @@ -134,7 +134,7 @@ pub fn integration_submit_tx() {
let test_timeout = Duration::from_secs(240); // To let the timeout happen and continue mining.
thread::sleep(test_timeout);

let (current_block_number, _current_block_path) = miner::block::parse_block_height(&blocks_dir);
let (current_block_number, _current_block_path) = tower::block::parse_block_height(&blocks_dir);
let block_number_after_unblock = current_block_number.unwrap();

// Miner should have continued mining. +1 to consider atleast 2 blocks mined.
Expand Down Expand Up @@ -204,13 +204,13 @@ fn get_node_port() -> u16 {
}

fn check_node_sync(tx_params: &TxParams, config: &AppCfg) -> Result<(), Error> {
let remote_state = miner::backlog::get_remote_state(&tx_params).unwrap();
let remote_state = tower::backlog::get_remote_state(&tx_params).unwrap();
let remote_height = remote_state.verified_tower_height;
println!("Remote tower height: {}", remote_height);

let mut blocks_dir = config.workspace.node_home.clone();
blocks_dir.push(&config.workspace.block_dir);
let (current_block_number, _current_block_path) = miner::block::parse_block_height(&blocks_dir);
let (current_block_number, _current_block_path) = tower::block::parse_block_height(&blocks_dir);
let current_block_number = current_block_number.unwrap();
println!("Local tower height: {}", current_block_number);

Expand Down
4 changes: 2 additions & 2 deletions testsuite/cli/src/client_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ impl ClientProxy {
"Invalid number of arguments to create user. Did you pass your account and the file path?"
);

//TODO: Parsing json should use Serde to deserialize from the miner::accounts::ValConfigs obj, but importing miner causes a circular dependency. Refactor...
//TODO: Parsing json should use Serde to deserialize from the tower::accounts::ValConfigs obj, but importing miner causes a circular dependency. Refactor...

let file = fs::File::open(space_delim_strings[2])
.expect("file should open read only");
Expand Down Expand Up @@ -631,7 +631,7 @@ impl ClientProxy {
"Invalid number of arguments to create user. Did you pass your account and the file path?"
);

//TODO: Parsing json should use Serde to deserialize from the miner::accounts::ValConfigs obj, but importing miner causes a circular dependency. Refactor...
//TODO: Parsing json should use Serde to deserialize from the tower::accounts::ValConfigs obj, but importing miner causes a circular dependency. Refactor...

let file = fs::File::open(space_delim_strings[2])
.expect("file should open read only");
Expand Down

0 comments on commit 5b240f5

Please sign in to comment.