Skip to content

Commit

Permalink
tools: Fix proto compiler (#1015)
Browse files Browse the repository at this point in the history
* Make Vec method reference absolute to fix #1014

Signed-off-by: Thane Thomson <[email protected]>

* Regenerate protos with proto-compiler

Signed-off-by: Thane Thomson <[email protected]>

* Add experimental CI job to test that generated protos compile

Signed-off-by: Thane Thomson <[email protected]>

* Try alternative approach to `uses` with `working-directory`

Signed-off-by: Thane Thomson <[email protected]>

* Add changelog entry

Signed-off-by: Thane Thomson <[email protected]>
  • Loading branch information
thanethomson authored Oct 29, 2021
1 parent 858b577 commit 60e1a0a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/unreleased/bug-fixes/1014-fix-proto-compiler.md
Original file line number Diff line number Diff line change
@@ -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))
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion proto/src/prost/tendermint.abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
}
/// nondeterministic
Expand Down
1 change: 0 additions & 1 deletion proto/src/tendermint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ pub mod p2p {
}

pub mod abci {
use crate::prelude::*;
include!("prost/tendermint.abci.rs");
}

Expand Down
2 changes: 1 addition & 1 deletion tools/proto-compiler/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 60e1a0a

Please sign in to comment.