diff --git a/.changelog/unreleased/bug-fixes/1014-fix-proto-compiler.md b/.changelog/unreleased/bug-fixes/1014-fix-proto-compiler.md new file mode 100644 index 000000000..bdc81af91 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1014-fix-proto-compiler.md @@ -0,0 +1,3 @@ +- `[tools/proto-compiler]` Fixed our proto-compiler, which was producing + protos that did not compile due to an incorrect Prost field annotation + ([#1014](https://github.com/informalsystems/tendermint-rs/issues/1014)) \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6864adb89..4b22d53fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,3 +56,20 @@ jobs: - uses: actions-rs/cargo@v1 with: command: build-tools + + # As per https://github.com/informalsystems/tendermint-rs/issues/1014 + generated-protos-compile: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Regenerate proto definitions + working-directory: ./tools/proto-compiler/ + run: cargo run + - name: Ensure that generated proto definitions compile + uses: actions-rs/cargo@v1 + with: + command: build-all diff --git a/proto/src/prost/tendermint.abci.rs b/proto/src/prost/tendermint.abci.rs index c34e6d1b8..4e5142286 100644 --- a/proto/src/prost/tendermint.abci.rs +++ b/proto/src/prost/tendermint.abci.rs @@ -236,7 +236,7 @@ pub struct ResponseInfo { #[serde(with = "crate::serializers::from_str")] pub last_block_height: i64, #[prost(bytes="vec", tag="5")] - #[serde(skip_serializing_if = "Vec::is_empty", with = "serde_bytes")] + #[serde(skip_serializing_if = "::prost::alloc::vec::Vec::is_empty", with = "serde_bytes")] pub last_block_app_hash: ::prost::alloc::vec::Vec, } /// nondeterministic diff --git a/proto/src/tendermint.rs b/proto/src/tendermint.rs index dbfda20a7..335cb2877 100644 --- a/proto/src/tendermint.rs +++ b/proto/src/tendermint.rs @@ -53,7 +53,6 @@ pub mod p2p { } pub mod abci { - use crate::prelude::*; include!("prost/tendermint.abci.rs"); } diff --git a/tools/proto-compiler/src/constants.rs b/tools/proto-compiler/src/constants.rs index 7d9c61421..6a0fa439c 100644 --- a/tools/proto-compiler/src/constants.rs +++ b/tools/proto-compiler/src/constants.rs @@ -21,7 +21,7 @@ const BASE64STRING: &str = r#"#[serde(with = "crate::serializers::bytes::base64s const VEC_BASE64STRING: &str = r#"#[serde(with = "crate::serializers::bytes::vec_base64string")]"#; const OPTIONAL: &str = r#"#[serde(with = "crate::serializers::optional")]"#; const VEC_SKIP_IF_EMPTY: &str = - r#"#[serde(skip_serializing_if = "Vec::is_empty", with = "serde_bytes")]"#; + r#"#[serde(skip_serializing_if = "::prost::alloc::vec::Vec::is_empty", with = "serde_bytes")]"#; const NULLABLEVECARRAY: &str = r#"#[serde(with = "crate::serializers::txs")]"#; const NULLABLE: &str = r#"#[serde(with = "crate::serializers::nullable")]"#; const ALIAS_POWER_QUOTED: &str =