Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bat/new genesis #1840

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5edec4a
refactor bech32m string encoding for address and MASP addresses
tzemanovic Nov 29, 2022
3e5393e
add bech32m string encoding for `common::PublicKey` and `DkgPublicKey`
tzemanovic Nov 30, 2022
f24631c
changelog: add #849
tzemanovic Dec 7, 2022
2e592c5
add `common::Signature` bech32m encoding
tzemanovic Dec 8, 2022
ea3882b
core/key: add a helper to gen ed25519 key in bech32m format
tzemanovic Feb 8, 2023
1868fba
test/e2e/ledger_tests: use bech32m PK format for `init-account` cmd
tzemanovic Feb 8, 2023
37c0315
wasm: update checksums
tzemanovic Jul 31, 2023
7614463
[feat]: Added pre-genesis command checks to client/wallet commands
batconjurer Aug 2, 2023
65a07be
cli/client: refactor saving of wallet of custom and transfer tx
tzemanovic Aug 3, 2023
ae82626
changelog: add #1782
tzemanovic Dec 7, 2022
ff4eb4d
[feat]: Changed pre-genesis flow. PoS tests currently not working
batconjurer Aug 25, 2023
2ff3a1e
[chore]: Linting and formatting
batconjurer Aug 25, 2023
c655944
test/PoS: add missing calls to `init_genesis_helper`
tzemanovic Aug 28, 2023
654be99
skip validator set update assertion at genesis
tzemanovic Aug 28, 2023
01b4205
PoS: fix offset for validator set swap
tzemanovic Aug 28, 2023
202e725
test/PoS/SM: use `init_genesis_helper`
tzemanovic Aug 28, 2023
09aa6b3
test/ethereum_bridge/votes: undo fixed test's changes
tzemanovic Aug 30, 2023
74cb7d8
apps/genesis/txs: rust doc fix
tzemanovic Aug 30, 2023
eee4cc4
test/e2e: almost working single validator setup with new genesis
tzemanovic Sep 1, 2023
932f8e8
update validator consensus key dir to cometBFT
tzemanovic Sep 1, 2023
dcff144
fixup! test/e2e: almost working single validator setup with new genesis
tzemanovic Sep 1, 2023
1d8e1f2
[fix]: Properly denominate and validate amounts in pre-genesis files
batconjurer Sep 11, 2023
d4dfe74
[fix]: Fixed integration tests
batconjurer Sep 20, 2023
784aa90
[fix]: Fixed many e2e tests including ibc tests
batconjurer Sep 28, 2023
40fcca4
[chore] Formatting, linting, and fixing unit tests
batconjurer Sep 28, 2023
3968fef
[chore]: Small cleanup
batconjurer Sep 28, 2023
fcc8405
[chore]: Merging in v23
batconjurer Oct 17, 2023
b81a147
[fix]: Fixed remaining e2e tests
batconjurer Oct 18, 2023
cb93b96
[fix]: Fixed remaining e2e tests
batconjurer Oct 18, 2023
a06d930
[chore]: Clippy
batconjurer Oct 18, 2023
45392e0
[feat]: Benchmarks no longer set the testing flag in default builds
batconjurer Oct 18, 2023
a4cbf0c
[chore]: Merge in v0.23.1
batconjurer Oct 19, 2023
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
7 changes: 7 additions & 0 deletions .changelog/unreleased/features/1782-pre-genesis-wallet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Added `--pre-genesis` argument to the wallet commands to allow to generate
keys, implicit addresses and shielded keys without having a chain setup. If
no chain is setup yet (i.e. there's no base-dir or it's empty), the wallet
defaults to use the pre-genesis wallet even without the `--pre-genesis`
flag. The pre-genesis wallet is located inside base-dir in
`pre-genesis/wallet.toml`.
([#1782](https://github.com/anoma/namada/pull/1782))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Added bech32m string encoding for `common::PublicKey` and `DkgPublicKey`.
([#849](https://github.com/anoma/namada/pull/849))
40 changes: 39 additions & 1 deletion .github/workflows/automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,42 @@ jobs:
if: steps.check.outputs.triggered != 'true'
run: echo "Comment \"$COMMENT\" not matched"
env:
COMMENT: ${{ matrix.make.comment }}
COMMENT: ${{ matrix.make.comment }}

tasks: # tasks with commands with no external deps
if: ${{ github.event.issue.pull_request }}
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.make.timeout }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
make:
- name: Run PoS state-machine tests
comment: pls run pos tests
command: PROPTEST_CASES=300 make test-pos-sm # PoS state machine tests
timeout: 600 # 10 hours

steps:
- uses: khan/[email protected]
id: check
with:
trigger: ${{ matrix.make.comment }}
reaction: eyes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: xt0rted/pull-request-comment-branch@v1
if: steps.check.outputs.triggered == 'true'
id: comment-branch
- uses: actions/checkout@v3
if: steps.check.outputs.triggered == 'true'
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- name: Install Protoc
uses: arduino/setup-protoc@v1
if: steps.check.outputs.triggered == 'true'
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run task ${{ matrix.make.name }}
if: steps.check.outputs.triggered == 'true'
run: ${{ matrix.make.command }}
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ jobs:
cargo-cache

run-benchmarks:
runs-on:
runs-on:
group: gians-runners
timeout-minutes: 30
needs: [build-wasm]
Expand Down
19 changes: 11 additions & 8 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,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 --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 @@ -85,7 +85,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 @@ -100,7 +100,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 Down Expand Up @@ -163,7 +163,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 Down Expand Up @@ -217,7 +217,7 @@ test-pos-sm:
RUST_BACKTRACE=1 \
PROPTEST_CASES=$(PROPTEST_CASES) \
RUSTFLAGS='-C debuginfo=2 -C debug-assertions=true -C overflow-checks=true' \
cargo test pos_state_machine_test --release
cargo test pos_state_machine_test --release

fmt-wasm = $(cargo) +$(nightly) fmt --manifest-path $(wasm)/Cargo.toml
fmt:
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,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
8 changes: 5 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"]
# for integration tests and test utilies
testing = ["dev"]

testing = []
benches = ["testing", "namada_test_utils"]
integration = []
abciplus = [
"namada/abciplus",
"namada/tendermint-rpc",
Expand All @@ -67,6 +67,7 @@ abciplus = [

[dependencies]
namada = {path = "../shared", features = ["ferveo-tpke", "masp-tx-gen", "multicore", "http-client"]}
namada_test_utils = {path = "../test_utils", optional = true}
ark-serialize.workspace = true
ark-std.workspace = true
arse-merkle-tree = { workspace = true, features = ["blake2b"] }
Expand Down Expand Up @@ -108,6 +109,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\"");
}
}
}
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