Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Release 5.1.3 #1125

Merged
merged 45 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e615e31
downgrade error msg to info
0o-de-lally Jun 2, 2022
6d81c53
cleanup unused prometheus log code
0o-de-lally Jun 7, 2022
92f4e64
downgrade state sync error message to info
0o-de-lally Jun 10, 2022
74440f7
makefile for set-waypoint
0o-de-lally Jun 10, 2022
decdc27
patch makefile
0o-de-lally Jun 10, 2022
1d668e9
refresh onchain state
0o-de-lally Jun 11, 2022
33492d5
genesis should assign vouches
0o-de-lally Jun 11, 2022
e7ab9fb
set layout for devnet has 4 nodes
0o-de-lally Jun 11, 2022
857e96c
init val in genesis first
0o-de-lally Jun 11, 2022
50355bf
github repo tools can put file in genesis repo
0o-de-lally Jun 13, 2022
cae4f3b
save files to genesis repo
0o-de-lally Jun 13, 2022
4d24245
reorganize testnet scripts
0o-de-lally Jun 13, 2022
6182797
cleanup
0o-de-lally Jun 13, 2022
e3aa0f0
documentation
0o-de-lally Jun 13, 2022
decf2f8
patch makefile
0o-de-lally Jun 13, 2022
60f40fd
makefile
0o-de-lally Jun 14, 2022
4fbb5f6
makefile
0o-de-lally Jun 14, 2022
65133fd
text [skip-ci]
0o-de-lally Jun 14, 2022
c70f9c9
update yaml configs so that node file uses multiple fullnode networks…
0o-de-lally Jun 15, 2022
8c8150f
patch [skip ci]
0o-de-lally Jun 15, 2022
1b946af
patch ports [skip ci]
0o-de-lally Jun 15, 2022
acba74d
validator init on genesis and ol init, will use seed peers
0o-de-lally Jun 16, 2022
8160dce
trim whitespace on genesis_waypoint.txt
0o-de-lally Jun 16, 2022
ba50ece
makefile
0o-de-lally Jun 16, 2022
8c8d9f3
reverse state-sync default params
0o-de-lally Jun 18, 2022
222b963
add helper in init to reset safety data
0o-de-lally Jun 18, 2022
6f31a60
bump version
0o-de-lally Jun 18, 2022
7f8fddc
ol restore has --boundary-only or -b which will not attempt to restor…
0o-de-lally Jun 18, 2022
21c6942
ol restore defaults to only fetch the epoch boundary. --highest-versi…
0o-de-lally Jun 19, 2022
c61e4cb
ol serve: deprecating the --run-checks or -c option. We now assume th…
0o-de-lally Jun 19, 2022
5f7945f
improve error messages on safety rules initialize
0o-de-lally Jun 20, 2022
2603123
validator should panic on trying to startup safety rules
0o-de-lally Jun 20, 2022
a64464d
patch
0o-de-lally Jun 20, 2022
d6f393a
makefile
0o-de-lally Jun 20, 2022
0dca4b0
make testnet start with alice, bob, carol only
0o-de-lally Jul 12, 2022
3fc0ba3
add execution.genesis_file_location to fullnode yaml
0o-de-lally Jul 12, 2022
74fe43d
set layout to have 5 addresses for testnet genesis
0o-de-lally Jul 12, 2022
b3deb52
alway use cargo release mode even in testnet
0o-de-lally Jul 12, 2022
cd215ba
undo
0o-de-lally Jul 12, 2022
3cecb9e
update fixture files with ip addresses for reference.
0o-de-lally Jul 12, 2022
faa81ac
patch validator yaml file generation
0o-de-lally Jul 23, 2022
4b5d7ad
ol start doesn't need to swtich between validator and fullnode mode w…
0o-de-lally Jul 23, 2022
0c05a65
make pubnet config use onchain discovery
0o-de-lally Jul 25, 2022
772206d
remove setting for fullnode identity in validator file
0o-de-lally Jul 25, 2022
dfd0229
rename ol restore option highest_version -> latest_version
0o-de-lally Jul 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Cargo.lock

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

121 changes: 58 additions & 63 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif
# Registration params
REMOTE = 'backend=github;repository_owner=${GITHUB_USER};repository=${REPO_NAME};token=${DATA_PATH}/github_token.txt;namespace=${ACC}'

GENESIS_REMOTE = 'backend=github;repository_owner=${REPO_ORG};repository=${REPO_NAME};token=${DATA_PATH}/github_token.txt;namespace=${ACC}'
GENESIS_REMOTE = 'backend=github;repository_owner=${REPO_ORG};repository=${REPO_NAME};token=${DATA_PATH}/github_token.txt;namespace=${ACC};branch=master'

LOCAL = 'backend=disk;path=${DATA_PATH}/key_store.json;namespace=${ACC}'

Expand Down Expand Up @@ -290,7 +290,7 @@ verify-gen:
--validator-backend ${LOCAL} \
--genesis-path ${DATA_PATH}/genesis.blob

genesis:
genesis: stdlib
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- files \
--chain-id ${CHAIN_ID} \
--validator-backend ${LOCAL} \
Expand All @@ -309,10 +309,6 @@ start:
# run in foreground. Only for testing, use a daemon for net.
RUST_LOG=error cargo run -p diem-node -- --config ${DATA_PATH}/validator.node.yaml

# Start a fullnode instead of a validator node
start-full:
cargo run -p diem-node -- --config ${DATA_PATH}/fullnode.node.yaml

daemon:
mkdir -p ~/.config/systemd/user/
cp ./ol/util/diem-node.service ~/.config/systemd/user/
Expand Down Expand Up @@ -401,18 +397,16 @@ ifdef TEST
cp ./ol/devnet/set_layout_test.toml ${DATA_PATH}/set_layout.toml
endif

fix-genesis:
cp ./ol/devnet/genesis/${V}/genesis.blob ${DATA_PATH}/
cp ./ol/devnet/genesis/${V}/genesis_waypoint ${DATA_PATH}/


#### HELPERS ####
set-waypoint:
@if test -f ${DATA_PATH}/key_store.json; then \
jq -r '. | with_entries(select(.key|match("-oper/waypoint";"i")))[].value' ${DATA_PATH}/key_store.json > ${DATA_PATH}/client_waypoint; \
jq -r '. | with_entries(select(.key|match("-oper/genesis-waypoint";"i")))[].value' ${DATA_PATH}/key_store.json > ${DATA_PATH}/genesis_waypoint; \
jq -r '. | with_entries(select(.key|match("-oper/genesis-waypoint";"i")))[].value' ${DATA_PATH}/key_store.json > ${DATA_PATH}/genesis_waypoint.txt; \
fi

cargo r -p ol -- init --update-waypoint --waypoint $(shell cat ${DATA_PATH}/client_waypoint)

@echo client_waypoint:
@cat ${DATA_PATH}/client_waypoint

Expand Down Expand Up @@ -450,71 +444,65 @@ debug:
make smoke-onboard <<< $$'${MNEM}'


##### DEVNET TESTS #####
#### TESTNET #####
# The testnet is started using the same tools as genesis to have a faithful reproduction of a network from a clean slate.

devnet: clear fix dev-wizard dev-genesis start
# runs a smoke test from fixtures.
# Uses genesis blob from fixtures, assumes 3 validators, and test settings.
# This will work for validator nodes alice, bob, carol, and any fullnodes; 'eve'
# 1. The first thing necessary is initializing testnet genesis validators. All genesis nodes need to set up environment variables for their namespace/personas e.g. NS=alice. Also the TEST=y mode must be set, as well as a chain environment e.g. NODE_ENV=test. These settings must be done manually, preferably in .bashrc

dev-join: clear fix fix-genesis dev-wizard
# REQUIRES MOCK GIT INFRASTRUCTURE: OLSF/dev-genesis OLSF/dev-epoch-archive
# see `devnet-archive` below
# We want to simulate the onboarding/new validator fetching genesis files from the mock archive: dev-genesis-archive
# 2. Next those validators will register config data to a github repo OLSD/dev-genesis. Note: there could be github http errors, if validators attempt to write the same resource simultaneously

# mock restore backups from dev-epoch-archive
rm -rf ~/.0L/restore
# restore from MOCK archive OLSF/dev-epoch-archive
cargo r -p ol -- restore
# start a node with fullnode.node.yaml configs
make start-full
# THESE STEPS ARE ACHIEVED WITH `make testnet-register`

dev-wizard:
# REQUIRES there is a genesis.blob in the fixtures/genesis/<version> you are testing
MNEM='${MNEM}' cargo run -p onboard -- val --prebuilt-genesis ${DATA_PATH}/genesis.blob --skip-mining --chain-id 1 --genesis-ceremony
# 3. Wait. All genesis nodes need to complete registration. Otherwise buidling a genesis.blob (the first block), will fail.
# 4. Each genesis node builds the genesis file locally, and submits to the github repo. (this remote genesis file is what subsequent non-genesis validators will use to bootstrap their db).
# 5. Genesis validators can start their nodes.

#### DEVNET RESTART ####
# usually do this on Alice, which has the dev-epoch-archive repo, and dev-genesis
# THESE STEPS ARE ACHIEVED WITH `make testnet`

# Do the ceremony: and also save the genesis fixtures, needs to happen before fix.
dev-register: clear fix dev-wizard gen-register
# Do a dev genesis on each node after EVERY NODE COMPLETED registration.
dev-genesis: genesis dev-save-genesis fix-genesis

#### DEVNET INFRA ####
# To make reproducible devnet files.
# 6. Assuming there is progress in the block production, subsequent validators can join.

# Save the files to mock infrastructure i.e. devnet github
dev-infra: dev-backup-archive dev-commit
# THIS IS ACHIEVED WITH: testnet-onboard

dev-save-genesis: set-waypoint
rsync -a ${DATA_PATH}/genesis* ${SOURCE}/ol/devnet/genesis/${V}/
git add ${SOURCE}/ol/devnet/genesis/${V}/

dev-backup-archive:
cd ${HOME}/dev-epoch-archive && make devnet-backup
#### 1. TESTNET SETUP ####

dev-commit:
git commit -a -m "save genesis fixtures to ${V}" | true
git push | true
testnet-init: clear fix
# REQUIRES there is a genesis.blob in the fixtures/genesis/<version> you are testing
MNEM='${MNEM}' cargo run -p onboard -- val --skip-mining --chain-id 1 --genesis-ceremony

# Do the genesis ceremony registration, this includes the step testnet-validator-init-wizard
testnet-register: testnet-init gen-register
# Do a dev genesis on each node after EVERY NODE COMPLETED registration.

# Makes the gensis file on each genesis validator, AND SAVES TO GITHUB so that other validators can be onboarded after genesis.
testnet-genesis: genesis set-waypoint
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- create-repo \
--publish-genesis ${DATA_PATH}/genesis.blob \
--shared-backend ${GENESIS_REMOTE}

cargo run -p diem-genesis-tool ${CARGO_ARGS} -- create-repo \
--publish-genesis ${DATA_PATH}/genesis_waypoint.txt \
--shared-backend ${GENESIS_REMOTE}

#### 2. TESTNET START ####

# Do this to restart the network with new code. Assumes a registration has been completed, and the genesis validators are unchanged. If new IP addresses or number of genesis nodes changed, you must RERUN SETUP below.
# - builds stdlib from source
# - clears many of the home files
# - adds fixtures
# - initializes node configs
# - rebuids genesis files and shares to github genesis repo
# - starts node in validator mode
testnet: clear fix testnet-init testnet-genesis start

# For subsequent validators joining the testnet. This will fetch the genesis information saved
testnet-onboard: clear fix
MNEM='${MNEM}' cargo run -p onboard -- val --github-org OLSF --repo dev-genesis --chain-id 1
# start a node with fullnode.node.yaml configs
cargo r -p diem-node -- -f ~/.0L/fullnode.node.yaml

TAG=$(shell git tag -l "previous")
clean-tags:
git push origin --delete ${TAG}
git tag -d ${TAG}

nuke-testnet:
@echo WIPING EVERYTHING but keeping: github_token.txt, autopay_batch.json, set_layout.toml, /vdf_proofs/proof_0.json

@if test -d ${DATA_PATH}; then \
cd ${DATA_PATH} && cp github_token.txt autopay_batch.json set_layout.toml vdf_proofs/proof_0.json ~/; \
cd ${DATA_PATH} && rm -rf *; \
cd ~ && cp github_token.txt autopay_batch.json set_layout.toml ${DATA_PATH}; \
cd ${DATA_PATH} && mkdir vdf_proofs;\
cd ~ && cp proof_0.json ${DATA_PATH}/vdf_proofs/; \
fi


####### SWARM ########

Expand Down Expand Up @@ -566,6 +554,13 @@ fork-config:
cargo run -p onboard -- fork -u http://167.172.248.37 --prebuilt-genesis ${DATA_PATH}/genesis_from_snapshot.blob

# start node from files
fork-start:
fork-start:
rm -rf ~/.0L/db
cargo run -p libra-node -- --config ~/.0L/validator.node.yaml

##### UTIL #####
TAG=$(shell git tag -l "previous")
clean-tags:
git push origin --delete ${TAG}
git tag -d ${TAG}

2 changes: 1 addition & 1 deletion config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "diem-config"
version = "5.1.2"
version = "5.1.3"
authors = ["Diem Association <[email protected]>"]
description = "Diem diem-config"
repository = "https://github.com/diem/diem"
Expand Down
1 change: 0 additions & 1 deletion config/global-constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub const DEFAULT_VAL_PORT: u64 = 6180;
pub const DEFAULT_VFN_PORT: u64 = 6179;
pub const DEFAULT_PUB_PORT: u64 = 6178;


// TODO: make this lazy static.
/// Switch settings between production and testing
pub fn delay_difficulty() -> u64 {
Expand Down
2 changes: 1 addition & 1 deletion config/management/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "diem-management"
version = "5.1.2"
version = "5.1.3"
authors = ["Diem Association <[email protected]>"]
description = "Diem Management is a tool used to manage the configuration of a Diem Node"
repository = "https://github.com/diem/diem"
Expand Down
1 change: 1 addition & 0 deletions config/management/genesis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ serde_json = "1"
diem-github-client = { path = "../../../secure/storage/github" }
ol-types = {path = "../../../ol/types"}
serde_yaml = "0.8.17"
base64 = "0.13.0"

[dev-dependencies]
diem-config = { path = "../..", features = ["fuzzing"]}
Expand Down
33 changes: 27 additions & 6 deletions config/management/genesis/src/ol_create_repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

use diem_github_client::Client;
use diem_management::{config::ConfigPath, error::Error, secure_backend::SharedBackend};
use std::process::exit;
use std::{process::exit, path::PathBuf, fs::File};
use structopt::StructOpt;
use std::io::prelude::*;

/// Note, it is implicitly expected that the storage supports
/// a namespace but one has not been set.
Expand All @@ -17,13 +18,15 @@ pub struct CreateGenesisRepo {
#[structopt(flatten)]
pub backend: SharedBackend,
#[structopt(long)]
pub repo_owner: String,
pub repo_owner: Option<String>,
#[structopt(long)]
pub repo_name: String,
pub repo_name: Option<String>,
#[structopt(long)]
pub pull_request_user: Option<String>,
#[structopt(long)]
pub delete_repo_user: Option<String>,
#[structopt(long)]
pub publish_genesis: Option<PathBuf>,
}

impl CreateGenesisRepo {
Expand All @@ -41,12 +44,29 @@ impl CreateGenesisRepo {
let github = Client::new(
config.repository_owner.clone(),
config.repository.clone(),
config.branch.unwrap_or("main".to_string()),
config.branch.unwrap_or("master".to_string()),
config
.token
.read_token()
.expect("could not get github token"),
);

if let Some(p) = self.publish_genesis {


let mut file = File::open(&p)
.expect("cannot read file");

let mut bytes = Vec::new();
file.read_to_end(&mut bytes).expect("could not read file");
let base64_encoded = base64::encode(bytes);

let repo_file_path = format!("genesis/{}", p.file_name().unwrap().to_str().unwrap());

github.put(&repo_file_path, &base64_encoded).expect("could not put file in github repo");

return Ok(format!("published file to genesis repo at {:?}", &repo_file_path));
}
// Make a pull request of the the forked repo, back to the genesis coordination repository.
if let Some(user) = self.pull_request_user {
match github.make_genesis_pull_request(&config.repository_owner, &config.repository, &user) {
Expand All @@ -68,8 +88,8 @@ impl CreateGenesisRepo {
}
} else {
// Fork the genesis coordination repo into a personal repo
match github.fork_genesis_repo(&self.repo_owner, &self.repo_name) {
Ok(_) => Ok(format!("Created new repo {}", &self.repo_name)),
match github.fork_genesis_repo(&self.repo_owner.unwrap(), &self.repo_name.as_ref().unwrap()) {
Ok(_) => Ok(format!("Created new repo {}", &self.repo_name.unwrap())),
Err(e) => Err(Error::StorageWriteError(
"github",
"fork genesis repo",
Expand All @@ -85,3 +105,4 @@ impl CreateGenesisRepo {
}
}
}

Loading