From 797eabfb762ae2f5e0819066d11d1783640b11ce Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Thu, 23 Mar 2023 21:13:56 +0100 Subject: [PATCH 01/14] doc: README --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..841f7f16 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# Rust bindings and server for Tenderdash ABCI++ protocol + +## Introduction + +![example workflow](https://github.com/dashpay/rs-tenderdash-abci/actions/workflows/test.yml/badge.svg?branch=master) + +This repository contains Rust bindings for Tenderdash. It includes: + +* data types, requests and responses required on [Tenderdash] +* ABCI++ protocol server, supporting **Unix sockets** and **TCP** connections + +## Structure + +The repository contains the following crates: + +* [tenderdash-abci](./abci/) - main crate, including ABCI++ server implementation, `Application` trait and re-exporting `tenderdash-proto` crate +* [tenderdash-proto](./proto/) - ABCI++ messages and data types definitions, generated based on Tenderdash protobuf specifications +* [tenderdash-proto-compiler](./proto-compiler/) - an internal tool that fetches tenderdash repository and converts protobuf files to Rust + +## Versioning + +The major and Minor version of this library matches the major and minor version of [Tenderdash]. For example, for `Tenderdash 1.2.34`, use `rs-tenderdash-abci 1.2.*`. + +You should also check the protocol version in `init_chain()`. + +## Quick start + +1. Install dependencies. You can find a current list of dependencies in the [Dockerfile](Dockerfile). +2. Add tenderdash-abci crate to your project: + + ```bash + cargo add --git https://github.com/dashpay/rs-tenderdash-abci tenderdash-abci + ``` + +3. Implement the [Application](abci/src/application.rs) trait with your custom logic. You can check [kvstore](abci/tests/kvstore.rs) as a minimal example. + +## Credits + +This project is a partial fork of [tendermint-rs] project. + +## License + +[MIT](LICENSE.md) + +[Tenderdash]: https://github.com/dashpay/tenderdash +[tendermint-rs]: https://github.com/informalsystems/tendermint-rs From 0cc2a9d4ba43a8b99112a25a3442a3b4e24c4507 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:17:17 +0100 Subject: [PATCH 02/14] build(github): deploy docs to github pages --- .github/workflows/rust.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 79f8314a..4451cfc7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,12 +30,30 @@ jobs: run: cargo fmt --all -- --check docs: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: ./.github/actions/deps - - name: Check documentation generation + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Generate documentation shell: bash env: RUSTDOCFLAGS: "--cfg docsrs" run: cargo doc --no-deps --all-features + + - name: Upload docs + uses: actions/upload-pages-artifact@v1 + with: + # Upload entire repository + path: "target/doc" + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 From b89fc1cce7f54bc7f5734c76dbfea5a562e0a93a Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:22:22 +0100 Subject: [PATCH 03/14] build(github-pages): only deploy from master branch --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4451cfc7..ed0ea524 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,3 +57,4 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v1 + if: github.ref_name == 'master' From b2c1c24710ee84c0b88f9b95c2d2ddb160cb3770 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:24:59 +0100 Subject: [PATCH 04/14] chore: trying to get github-pages working --- .github/workflows/rust.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ed0ea524..7a3e6010 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -53,8 +53,9 @@ jobs: with: # Upload entire repository path: "target/doc" + if: ${{ github.ref_name == 'master' }} - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v1 - if: github.ref_name == 'master' + if: ${{ github.ref_name == 'master' }} From 3f5d8f8ab1c20201d671c60f30a723cb73a4e24b Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:29:18 +0100 Subject: [PATCH 05/14] build(github-pages): copy README.md as pages index --- .github/workflows/rust.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7a3e6010..3d5b0919 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,9 +30,10 @@ jobs: run: cargo fmt --all -- --check docs: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + # TODO: we need permissions to enable github-pages env + # environment: + # name: github-pages + # url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -48,6 +49,10 @@ jobs: RUSTDOCFLAGS: "--cfg docsrs" run: cargo doc --no-deps --all-features + - name: Generate index page + shell: bash + run: cp README.md target/doc/ + - name: Upload docs uses: actions/upload-pages-artifact@v1 with: From 0d3f15467995e82621900f2f46f97296ca9534b1 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:38:54 +0100 Subject: [PATCH 06/14] build(github-pages): separate workflow for github pages --- .github/workflows/github-pages.yml | 49 ++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 22 +------------- 2 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/github-pages.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 00000000..8f645ee1 --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -0,0 +1,49 @@ +--- +name: Github Pages + +on: + pull_request: + push: + branches: + - master + - "v*.*.*" +jobs: + cleanup-runs: + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" + + docs: + # environment: + # name: github-pages + # url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: ./.github/actions/deps + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Generate documentation + shell: bash + env: + RUSTDOCFLAGS: "--cfg docsrs" + run: cargo doc --no-deps --all-features + + - name: Generate index page + shell: bash + run: cp README.md target/doc/ + + - name: Upload docs + uses: actions/upload-pages-artifact@v1 + with: + path: "target/doc" + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3d5b0919..364d2931 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,30 +37,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: ./.github/actions/deps - - name: Setup Pages - uses: actions/configure-pages@v3 - - - name: Generate documentation + - name: Check documentation generation shell: bash env: RUSTDOCFLAGS: "--cfg docsrs" run: cargo doc --no-deps --all-features - - - name: Generate index page - shell: bash - run: cp README.md target/doc/ - - - name: Upload docs - uses: actions/upload-pages-artifact@v1 - with: - # Upload entire repository - path: "target/doc" - if: ${{ github.ref_name == 'master' }} - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 - if: ${{ github.ref_name == 'master' }} From efdb1544c817d114b401ddb3e3dc88e51ecba970 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:39:46 +0100 Subject: [PATCH 07/14] chore: code cleanup --- .github/workflows/rust.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 364d2931..79f8314a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,15 +30,10 @@ jobs: run: cargo fmt --all -- --check docs: - # TODO: we need permissions to enable github-pages env - # environment: - # name: github-pages - # url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ./.github/actions/deps - - name: Check documentation generation shell: bash env: From 438283bf68a469cb974adf52d9640dd4652bf8fd Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 18:41:58 +0100 Subject: [PATCH 08/14] build(github-pages): add permissions --- .github/workflows/github-pages.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 8f645ee1..74127323 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -20,6 +20,10 @@ jobs: # environment: # name: github-pages # url: ${{ steps.deployment.outputs.page_url }} + permissions: + contents: read + pages: write + id-token: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 9aac3960847a3f922d8ce0c4521735388e9e6ed4 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 19:00:29 +0100 Subject: [PATCH 09/14] chore(github-pages): set tenderdash_abci as default page --- .github/workflows/github-pages.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 74127323..b8642b7c 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -41,7 +41,12 @@ jobs: - name: Generate index page shell: bash - run: cp README.md target/doc/ + run: | + cat > target/doc/index.html << EOF +
+ Click here + + EOF - name: Upload docs uses: actions/upload-pages-artifact@v1 From 425c26e87567aa2467dabc9fc5dc57bcfe76c3d6 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 19:06:35 +0100 Subject: [PATCH 10/14] chore: add docs url in cargo.toml --- abci/Cargo.toml | 4 +++- proto/Cargo.toml | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/abci/Cargo.toml b/abci/Cargo.toml index 124a92e7..6d4b1606 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -5,8 +5,10 @@ edition = "2021" license = "Apache-2.0" readme = "README.md" categories = ["cryptography::cryptocurrencies", "network-programming"] -keywords = ["abci", "blockchain", "bft", "consensus", "tendermint"] +keywords = ["abci", "blockchain", "bft", "consensus", "tendermint", "dash"] repository = "https://github.com/dashpay/rs-tenderdash-abci/tree/main/abci" +documentation = "https://dashpay.github.io/rs-tenderdash-abci/tenderdash_abci/" + description = """tenderdash-abci provides a simple framework with which to build\ low-level applications on top of Tenderdash.""" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index a12d799d..fdf6120f 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -4,8 +4,15 @@ version = "0.12.0-dev.1" edition = "2021" license = "Apache-2.0" repository = "https://github.com/dashpay/rs-tenderdash-abci/tree/main/proto" +documentation = "https://dashpay.github.io/rs-tenderdash-abci/tenderdash_proto/" readme = "README.md" -categories = ["cryptography", "cryptography::cryptocurrencies", "database"] +categories = [ + "cryptography", + "cryptography::cryptocurrencies", + "database", + "dash", + "tenderdash", +] keywords = ["blockchain", "tenderdash", "proto"] description = """ From 7adcdf9fb24da7eed2e733d855e9fbc12f13d4e4 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 24 Mar 2023 19:13:55 +0100 Subject: [PATCH 11/14] build(github-pages): exclude tenderdash-proto-compiler --- .github/workflows/github-pages.yml | 2 +- proto-compiler/src/lib.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index b8642b7c..c813fb77 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -37,7 +37,7 @@ jobs: shell: bash env: RUSTDOCFLAGS: "--cfg docsrs" - run: cargo doc --no-deps --all-features + run: cargo doc --no-deps --all-features --workspace --exclude tenderdash-proto-compiler - name: Generate index page shell: bash diff --git a/proto-compiler/src/lib.rs b/proto-compiler/src/lib.rs index cedd6d27..1d6ad542 100644 --- a/proto-compiler/src/lib.rs +++ b/proto-compiler/src/lib.rs @@ -1,3 +1,6 @@ +//! Convert Tenderdash ABCI++ protocol buffers (protobuf3) definitions to Rust. +//! +//! This tool is for internal use. Used by tenderdash-proto/build.rs. use std::{ env::{self, var}, path::PathBuf, @@ -14,7 +17,7 @@ use functions::{ mod constants; use constants::{CUSTOM_FIELD_ATTRIBUTES, CUSTOM_TYPE_ATTRIBUTES, TENDERDASH_REPO}; -/// Import and compile protobuf definitions for Tenderdash. +/// Internal tool to download and compile protobuf definitions for Tenderdash. /// /// Checkouts tenderdash repository to ../target/tenderdash and generates /// Rust protobuf definitions in ../proto/src/prost/ and From 8ec6ff798562c3b3557183636f06e4603996026c Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:50:10 +0100 Subject: [PATCH 12/14] chore: move github pages GHA code to separate pr --- .github/workflows/github-pages.yml | 58 ------------------------------ 1 file changed, 58 deletions(-) delete mode 100644 .github/workflows/github-pages.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml deleted file mode 100644 index c813fb77..00000000 --- a/.github/workflows/github-pages.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -name: Github Pages - -on: - pull_request: - push: - branches: - - master - - "v*.*.*" -jobs: - cleanup-runs: - runs-on: ubuntu-latest - steps: - - uses: rokroskar/workflow-run-cleanup-action@master - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" - - docs: - # environment: - # name: github-pages - # url: ${{ steps.deployment.outputs.page_url }} - permissions: - contents: read - pages: write - id-token: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: ./.github/actions/deps - - - name: Setup Pages - uses: actions/configure-pages@v3 - - - name: Generate documentation - shell: bash - env: - RUSTDOCFLAGS: "--cfg docsrs" - run: cargo doc --no-deps --all-features --workspace --exclude tenderdash-proto-compiler - - - name: Generate index page - shell: bash - run: | - cat > target/doc/index.html << EOF - - Click here - - EOF - - - name: Upload docs - uses: actions/upload-pages-artifact@v1 - with: - path: "target/doc" - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 From 48c70811faf030f1f4fb5e04f483ffbf178f2af0 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:54:50 +0100 Subject: [PATCH 13/14] Squashed commit of the following: commit 17ed6e7e18a28602afa40622688a421389adcc89 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Fri Mar 15 17:56:00 2024 +0100 fix: release.sh platform deps update broken (#57) commit af64c65d94ef233053be8616e4c92f571fb5aae0 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Fri Mar 15 17:29:40 2024 +0100 fix(proto-compiler): existence of unzipped tenderdash sources not verified correctly (#56) * fix(proto-compiler): better detection of missing protobuf files * build: release 0.14.0-dev.9 commit 86ba24b8f6d92e6eb24c7d6aff39f9f733d307ba Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Wed Mar 13 15:46:59 2024 +0100 build: release v0.14.0-dev.8 for tenderdash 0.14.0-dev.4 (#55) commit 672f8bafcf2e6e2b5b7e16192bbbfbcf1b03cbb6 Author: lklimek <842586+lklimek@users.noreply.github.com> Date: Tue Mar 12 06:34:13 2024 +0100 feat(proto)!: grpc server and client support (#50) * feat(proto): grpc server and client support * chore: make ServerRuntime public * test(proto): test grpc server with tenderdash in docker * chore(proto): fix imports * chore: build issues * chore: abci grpc-server feature * chore: imports and features * chore: grpc test * chore: re-export tonic * chore: fix missing serde serialization * chore(proto): fix feature flags * chore(proto): fix warn * fix: wrong json serialization of ConsensusParams * fix: wrong json serialization of ConsensusParams * chore: fix build * chore: simplify features * chore: self review, simplify features * chore: comments * test(abci): grpc test uses latest tenderdash tag * chore: bump version to 0.14.0-dev.7 for tenderdash v0.14.0-dev.3, abci 0.26.0 * chore: fix missing serde serialization * fix: wrong json serialization of ConsensusParams * build(deps): update chrono and replace deprecated fn calls --------- Co-authored-by: Ivan Shumkov