Skip to content

Commit

Permalink
Merge branch 'bat/feat/new-genesis' (#2088)
Browse files Browse the repository at this point in the history
* origin/bat/feat/new-genesis:
  wallet: don't crash when no wallet
  make: separate integration tests from units coverage
  genesis: rm dbg!s
  fix integration tests shell initialization
  deps: remove now unused file-serve
  allow to join-network with archive in a dir
  genesis: fix import warn
  test+bench: use `defaults::validator_keypair` for genesis validator-0
  rename `HexString::to_bytes` to `parse` and remove other unused methods
  bench: fix txs benches by writing a chain genesis config to FS
  make: skip pos_state_machine_test in unit tests
  genesis: use the default addresses for tests and benches
  bench: fix voting epochs to correspond to PoS params
  apps/genesis: change root dir detection
  remove the rest of the "dev" feature usages
  [fix]: Fixed benchmarks, e2e test ci scripts, masp conversion persistence issue, and formatting
  [fix]: Formatting
  [fix]: Fixed signer decoding for ibc
  [fix]: Linting
  [fix] Regenerated MASP integration test proofs
  merging in upstream changes from feature branch
  fix `make check-crates`
  [fix]: Compiling now. Tests need fixing
  Namada 0.24.1
  test: remove dead multitoken_tests
  changelog: add #2047
  apps: turn off rocksdb jemalloc on windows
  remove vp/tx cache at startup
  improve sdk
  added changelog
  wasm server download via env
  [ci skip] specifiy aws region
  [fix]: Fix integration tests
  fix fmt
  fix `make check-crates`
  More fixes
  [fix]: Fixed unit tests
  [fix]: Compiling now. Tests need fixing
  fixup! [feat] Re-implementing new genesis flow in v0.24
  [feat] Re-implementing new genesis flow in v0.24
  More fixes
  [fix]: Fixed unit tests
  [fix]: Compiling now. Tests need fixing
  fixup! [feat] Re-implementing new genesis flow in v0.24
  [feat] Re-implementing new genesis flow in v0.24
  • Loading branch information
cwgoes committed Nov 5, 2023
2 parents 927e807 + 6ef52c1 commit e1badc1
Show file tree
Hide file tree
Showing 143 changed files with 9,054 additions and 5,636 deletions.
48 changes: 12 additions & 36 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ eyre = "0.6.5"
fd-lock = "3.0.12"
ferveo = {git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"}
ferveo-common = {git = "https://github.com/anoma/ferveo", rev = "e5abd0acc938da90140351a65a26472eb495ce4d"}
file-serve = "0.2.0"
flate2 = "1.0.22"
fs_extra = "1.2.0"
futures = "0.3"
Expand Down
33 changes: 19 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ build-test:
$(cargo) +$(nightly) build --tests $(jobs)

build-release:
NAMADA_DEV=false $(cargo) build $(jobs) --release --timings --package namada_apps --manifest-path Cargo.toml
$(cargo) build $(jobs) --release --timings --package namada_apps --manifest-path Cargo.toml

build-debug:
NAMADA_DEV=false $(cargo) build --package namada_apps --manifest-path Cargo.toml
$(cargo) build --package namada_apps --manifest-path Cargo.toml

install-release:
NAMADA_DEV=false $(cargo) install --path ./apps --locked
$(cargo) install --path ./apps --locked

check-release:
NAMADA_DEV=false $(cargo) check --release --package namada_apps
$(cargo) check --release --package namada_apps

package: build-release
scripts/make-package.sh
Expand All @@ -88,7 +88,7 @@ check-crates:
clippy-wasm = $(cargo) +$(nightly) clippy --manifest-path $(wasm)/Cargo.toml --all-targets -- -D warnings

clippy:
NAMADA_DEV=false $(cargo) +$(nightly) clippy $(jobs) --all-targets -- -D warnings && \
$(cargo) +$(nightly) clippy $(jobs) --all-targets -- -D warnings && \
make -C $(wasms) clippy && \
make -C $(wasms_for_tests) clippy && \
$(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true
Expand All @@ -103,7 +103,7 @@ tendermint:
./scripts/get_tendermint.sh

install: cometbft
NAMADA_DEV=false $(cargo) install --path ./apps --locked
$(cargo) install --path ./apps --locked

cometbft:
./scripts/get_cometbft.sh
Expand All @@ -126,14 +126,19 @@ audit:
test: test-unit test-e2e test-wasm test-benches

test-coverage:
# Run integration tests with pre-built MASP proofs
NAMADA_MASP_TEST_SEED=$(NAMADA_MASP_TEST_SEED) \
NAMADA_MASP_TEST_PROOFS=load \
# Run integration tests separately because they require `integration`
# feature (and without coverage) and run them with pre-built MASP proofs
$(cargo) +$(nightly) llvm-cov --output-dir target \
--features namada/testing \
--html \
-- --skip e2e --skip pos_state_machine_test \
-Z unstable-options --report-time
-- --skip e2e --skip pos_state_machine_test --skip integration \
-Z unstable-options --report-time && \
NAMADA_MASP_TEST_SEED=$(NAMADA_MASP_TEST_SEED) \
NAMADA_MASP_TEST_PROOFS=load \
$(cargo) +$(nightly) test integration:: --output-dir target \
--features integration \
--html \
-- -Z unstable-options --report-time

# NOTE: `TEST_FILTER` is prepended with `e2e::`. Since filters in `cargo test`
# work with a substring search, TEST_FILTER only works if it contains a string
Expand Down Expand Up @@ -167,7 +172,7 @@ test-integration-save-proofs:
# Run integration tests without specifiying any pre-built MASP proofs option
test-integration-slow:
RUST_BACKTRACE=$(RUST_BACKTRACE) \
$(cargo) +$(nightly) test integration::$(TEST_FILTER) \
$(cargo) +$(nightly) test integration::$(TEST_FILTER) --features integration \
-Z unstable-options \
-- \
-Z unstable-options --report-time
Expand All @@ -176,7 +181,7 @@ test-unit:
$(cargo) +$(nightly) test \
$(TEST_FILTER) \
$(jobs) \
-- --skip e2e --skip integration \
-- --skip e2e --skip integration --skip pos_state_machine_test \
-Z unstable-options --report-time

test-unit-mainnet:
Expand All @@ -191,7 +196,7 @@ test-unit-debug:
$(debug-cargo) +$(nightly) test \
$(jobs) \
$(TEST_FILTER) \
-- --skip e2e --skip integration \
-- --skip e2e --skip integration --skip pos_state_machine_test \
--nocapture \
-Z unstable-options --report-time

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ Guide.
```shell
# Build the provided validity predicate and transaction wasm modules
make build-wasm-scripts-docker

# Development (debug) build Namada, which includes a validator and some default
# accounts, whose keys and addresses are available in the wallet
NAMADA_DEV=true make
```

### Before submitting a PR, pls make sure to run the following
Expand Down
7 changes: 4 additions & 3 deletions apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ default = ["std", "abciplus"]
mainnet = [
"namada/mainnet",
]
dev = ["namada/dev"]
std = ["ed25519-consensus/std", "rand/std", "rand_core/std", "namada/std", "namada_sdk/std"]
# for integration tests and test utilies
testing = ["dev", "namada_test_utils"]

testing = ["namada_test_utils"]
benches = ["testing", "namada_test_utils"]
integration = []
abciplus = [
"namada/abciplus",
"namada/tendermint-rpc",
Expand Down Expand Up @@ -111,6 +111,7 @@ num-rational.workspace = true
num-traits.workspace = true
once_cell.workspace = true
orion.workspace = true
pretty_assertions.workspace = true
prost-types.workspace = true
prost.workspace = true
rand_core.workspace = true
Expand Down
9 changes: 0 additions & 9 deletions apps/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,4 @@ fn main() {

// Tell Cargo that if the given file changes, to rerun this build script.
println!("cargo:rerun-if-changed={}", PROTO_SRC);

// Tell Cargo to build when the `NAMADA_DEV` env var changes
println!("cargo:rerun-if-env-changed=NAMADA_DEV");
// Enable "dev" feature if `NAMADA_DEV` is trueish
if let Ok(dev) = env::var("NAMADA_DEV") {
if dev.to_ascii_lowercase().trim() == "true" {
println!("cargo:rustc-cfg=feature=\"dev\"");
}
}
}
Empty file removed apps/src/bin/namada-client/cli.rs
Empty file.
33 changes: 19 additions & 14 deletions apps/src/bin/namada-node/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,31 @@ pub fn main() -> Result<()> {
match cmd {
cmds::NamadaNode::Ledger(sub) => match sub {
cmds::Ledger::Run(cmds::LedgerRun(args)) => {
let wasm_dir = ctx.wasm_dir();
let chain_ctx = ctx.take_chain_or_exit();
let wasm_dir = chain_ctx.wasm_dir();
sleep_until(args.start_time);
ledger::run(ctx.config.ledger, wasm_dir);
ledger::run(chain_ctx.config.ledger, wasm_dir);
}
cmds::Ledger::RunUntil(cmds::LedgerRunUntil(args)) => {
let wasm_dir = ctx.wasm_dir();
let mut chain_ctx = ctx.take_chain_or_exit();
let wasm_dir = chain_ctx.wasm_dir();
sleep_until(args.time);
ctx.config.ledger.shell.action_at_height =
chain_ctx.config.ledger.shell.action_at_height =
Some(args.action_at_height);
ledger::run(ctx.config.ledger, wasm_dir);
ledger::run(chain_ctx.config.ledger, wasm_dir);
}
cmds::Ledger::Reset(_) => {
ledger::reset(ctx.config.ledger)
let chain_ctx = ctx.take_chain_or_exit();
ledger::reset(chain_ctx.config.ledger)
.wrap_err("Failed to reset Namada node")?;
}
cmds::Ledger::DumpDb(cmds::LedgerDumpDb(args)) => {
ledger::dump_db(ctx.config.ledger, args);
let chain_ctx = ctx.take_chain_or_exit();
ledger::dump_db(chain_ctx.config.ledger, args);
}
cmds::Ledger::RollBack(_) => {
ledger::rollback(ctx.config.ledger)
let chain_ctx = ctx.take_chain_or_exit();
ledger::rollback(chain_ctx.config.ledger)
.wrap_err("Failed to rollback the Namada node")?;
}
},
Expand All @@ -39,18 +44,18 @@ pub fn main() -> Result<()> {
// In here, we just need to overwrite the default chain ID, in
// case it's been already set to a different value
if let Some(chain_id) = ctx.global_args.chain_id.as_ref() {
ctx.global_config.default_chain_id = chain_id.clone();
ctx.global_config.default_chain_id = Some(chain_id.clone());
ctx.global_config
.write(&ctx.global_args.base_dir)
.unwrap_or_else(|err| {
eprintln!("Error writing global config: {}", err);
eprintln!("Error writing global config: {err}");
cli::safe_exit(1)
});
tracing::debug!(
"Generated config and set default chain ID to \
{chain_id}"
);
}
tracing::debug!(
"Generated config and set default chain ID to {}",
&ctx.global_config.default_chain_id
);
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion apps/src/bin/namada/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn handle_command(cmd: cli::cmds::Namada, raw_sub_cmd: String) -> Result<()> {
fn handle_subcommand(program: &str, mut sub_args: Vec<String>) -> Result<()> {
let env_vars = env::vars_os();

let cmd_name = if cfg!(feature = "dev") && env::var("CARGO").is_ok() {
let cmd_name = if env::var("CARGO").is_ok() {
// When the command is ran from inside `cargo run`, we also want to
// call the sub-command via `cargo run` to rebuild if necessary.
// We do this by prepending the arguments with `cargo run` arguments.
Expand Down
Loading

0 comments on commit e1badc1

Please sign in to comment.