From a9b2cc6244182d44266c459600f07ce31bc60925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Tue, 30 Aug 2022 15:32:18 +0200 Subject: [PATCH 1/4] docs/dev: update encoding spec generation --- documentation/dev/src/specs/encoding.md | 2 +- encoding_spec/README.md | 2 +- encoding_spec/src/main.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/dev/src/specs/encoding.md b/documentation/dev/src/specs/encoding.md index 40e4b79b3c..53ff3ad5bd 100644 --- a/documentation/dev/src/specs/encoding.md +++ b/documentation/dev/src/specs/encoding.md @@ -16,7 +16,7 @@ The encoding schemas below are described in terms of [Borsh specification](https Note that "nil" corresponds to unit (`()`) which is encoded as empty bytes (nothing is being written). - + {{#include encoding/generated-borsh-spec.md}} diff --git a/encoding_spec/README.md b/encoding_spec/README.md index 25123f6b44..92e53cc6d2 100644 --- a/encoding_spec/README.md +++ b/encoding_spec/README.md @@ -2,4 +2,4 @@ This bin crate is used to derive encoding specifications from pre-selected public types via their `BorshSchema` implementations. The `BorshSchema` provides recursive definitions of all the used types and these are also included in the generated specification. -When executed, this crate will generate `docs/src/specs/encoding/generated-borsh-spec.md` (see `OUTPUT_PATH` in the source). This page is itself included in the `docs/src/specs/encoding.md` page. +When executed, this crate will generate `documentation/dev/src/specs/encoding/generated-borsh-spec.md` (see `OUTPUT_PATH` in the source). This page is itself included in the `documentation/dev/src/specs/encoding.md` page. diff --git a/encoding_spec/src/main.rs b/encoding_spec/src/main.rs index 8877ff3e77..db65f24667 100644 --- a/encoding_spec/src/main.rs +++ b/encoding_spec/src/main.rs @@ -32,7 +32,7 @@ use namada::types::{token, transaction}; /// This generator will write output into this `docs` file. const OUTPUT_PATH: &str = - "documentation/docs/src/specs/encoding/generated-borsh-spec.md"; + "documentation/dev/src/specs/encoding/generated-borsh-spec.md"; lazy_static! { /// Borsh types may be used by declarations. These are displayed differently in the [`md_fmt_type`]. From cf78ec2f660cced629195c001a8b745c79a7550f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Tue, 30 Aug 2022 15:44:07 +0200 Subject: [PATCH 2/4] encoding_spec: rm ":" from fragment links in e.g. `ed25519::PublicKey` --- encoding_spec/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/encoding_spec/src/main.rs b/encoding_spec/src/main.rs index db65f24667..5579178210 100644 --- a/encoding_spec/src/main.rs +++ b/encoding_spec/src/main.rs @@ -394,6 +394,7 @@ fn escape_fragment_anchor(string: impl AsRef) -> String { .replace('<', "") .replace(',', "") .replace(' ', "-") + .replace(':', "") .to_ascii_lowercase() } From d991bd32111a25443ff90205b9d2d19fe5dad1b1 Mon Sep 17 00:00:00 2001 From: FatemeShirazi Date: Wed, 31 Aug 2022 10:57:53 +0200 Subject: [PATCH 3/4] I removed the limitation. Deleted "The total value transferred cannot exceed 2/3 of the total stake." It should any way be 1/3+1, but we agreed to take it now here since we will have protection in UI for this attack. --- documentation/specs/src/economics/proof-of-stake.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/specs/src/economics/proof-of-stake.md b/documentation/specs/src/economics/proof-of-stake.md index 7160872da5..808f02e585 100644 --- a/documentation/specs/src/economics/proof-of-stake.md +++ b/documentation/specs/src/economics/proof-of-stake.md @@ -29,4 +29,4 @@ with the intent of carrying out attacks. Many PoS blockcains rely on the 1/3 Byz In blockchain systems we do not rely on altruistic behavior but rather economic security. We expect the validators to execute the protocol correctly. They get rewarded for doing so and punished otherwise. Each validator has some self-stake and some stake that is delegated to it by other token holders. The validator and delegators share the reward and risk of slashing impact with each other. -The total stake behind consensus should be taken into account when value is transferred via a transaction. The total value transferred cannot exceed 2/3 of the total stake. For example, if we have 1 billion tokens, we aim that 300 Million of these tokens is backing validators. This means that users should not transfer more than 200 million of this token within a block. \ No newline at end of file +The total stake behind consensus should be taken into account when value is transferred via a transaction. For example, if we have 1 billion tokens, we aim that 300 Million of these tokens is backing validators. This means that users should not transfer more than 200 million of this token within a block. From d19e7ecf0dce2952b31c15bd8a63011c0b71e811 Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli <> Date: Wed, 31 Aug 2022 17:31:45 +0200 Subject: [PATCH 4/4] [ci] added dev documentation build, added rust doc build --- .github/workflows/docs.yml | 75 +++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c24084a771..3f5e5e5159 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -47,6 +47,12 @@ jobs: command: cd documentation/docs && mdbook build cache_subkey: docs cache_version: v1 + - name: Build development docs + folder: documentation/dev + bucket: namada-dev-static-website + command: cargo run --bin namada_encoding_spec && cd documentation/dev && mdbook build + cache_subkey: dev + cache_version: v1 env: CARGO_INCREMENTAL: 0 @@ -64,7 +70,6 @@ jobs: # See comment in build-and-test.yml with: ref: ${{ github.event.pull_request.head.sha }} - - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -121,3 +126,71 @@ jobs: - name: Stop sccache server if: always() run: sccache --stop-server || true + + rust-docs: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + + env: + CARGO_INCREMENTAL: 0 + RUSTC_WRAPPER: sccache + SCCACHE_CACHE_SIZE: 100G + SCCACHE_BUCKET: namada-sccache-master + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + if: ${{ github.event_name != 'pull_request_target' }} + - name: Checkout PR + uses: actions/checkout@v3 + if: ${{ github.event_name == 'pull_request_target' }} + # See comment in build-and-test.yml + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master + aws-region: eu-west-1 + - name: Install sccache (ubuntu-latest) + if: matrix.os == 'ubuntu-latest' + env: + LINK: https://github.com/mozilla/sccache/releases/download + SCCACHE_VERSION: v0.3.0 + run: | + SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl + mkdir -p $HOME/.local/bin + curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz + mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache + chmod +x $HOME/.local/bin/sccache + echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Install sccache (macos-latest) + if: matrix.os == 'macos-latest' + run: | + brew update + brew install sccache + - name: Setup rust toolchain + uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 + with: + profile: default + override: true + - name: Setup rust nightly + uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 + with: + toolchain: ${{ matrix.nightly_version }} + profile: default + - name: Show rust toolchain info + run: rustup show + - name: Start sccache server + run: sccache --start-server + - name: Build rust-docs + run: make build-doc + - name: Print sccache stats + if: always() + run: sccache --show-stats + - name: Stop sccache server + if: always() + run: sccache --stop-server || true