Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tonic plugin to provenance buf config so grpc client/servers are generated - guarded by grpc and grpc-transport features #158

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/proto-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ prost-types = { workspace = true }
quote = "1.0.26"
regex = "1"
syn = { version = "1.0.109", features = ["full", "parsing", "extra-traits"] }
tonic = "0.7"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we leverage buf for generation, these deps aren't needed

tonic-build = "0.7"
walkdir = "2"
walkdir = "2"
8 changes: 7 additions & 1 deletion packages/proto-build/provenance.buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ plugins:
opt:
- extern_path=.google.protobuf.Timestamp=crate::shim::Timestamp
- extern_path=.google.protobuf.Duration=crate::shim::Duration
- extern_path=.google.protobuf.Any=crate::shim::Any
- extern_path=.google.protobuf.Any=crate::shim::Any
- plugin: buf.build/community/neoeinstein-tonic
out: .
opt:
- extern_path=.google.protobuf.Timestamp=crate::shim::Timestamp
- extern_path=.google.protobuf.Duration=crate::shim::Duration
- extern_path=.google.protobuf.Any=crate::shim::Any
8 changes: 6 additions & 2 deletions packages/proto-build/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ use crate::transformers;
const EXCLUDED_PROTO_PACKAGES: &[&str] = &["amino", "cosmos_proto", "gogoproto", "google"];

/// These structures are excluded from the final module
/// matched against using String::contains(...)
const EXCLUDED_STRUCTURES: &[&str] = &[
"provenance::msgfees::v1::CalculateTxFeesRequest",
"provenance::msgfees::v1::CalculateTxFeesResponse",
"::tonic::",
];

pub fn copy_and_transform_all(from_dir: &Path, to_dir: &Path, descriptor: &FileDescriptorSet) {
Expand Down Expand Up @@ -153,8 +155,10 @@ fn transform_items(
_ => s.ident.to_string(),
};

if EXCLUDED_STRUCTURES.contains(&full_path.as_str()) {
return None;
for exclude in EXCLUDED_STRUCTURES {
if full_path.contains(exclude) {
return None;
}
}
let s = transformers::add_derive_eq_struct(&s);
let s = transformers::append_attrs_struct(src, &s, descriptor);
Expand Down
2 changes: 1 addition & 1 deletion packages/provwasm-std/src/types/cosmos/app/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod runtime;
pub mod module;
pub mod v1alpha1;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use provwasm_proc_macro::{CosmwasmExt, SerdeEnumAsInt};
/// Module is the config object of the authz module.
/// Module is the module config object for the cosmos.app v1 app module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
Expand All @@ -11,5 +11,5 @@ use provwasm_proc_macro::{CosmwasmExt, SerdeEnumAsInt};
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.authz.module.v1.Module")]
#[proto_message(type_url = "/cosmos.app.module.v1alpha1.Module")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwtalley there's many changes like this that I wasn't expecting as it seems like this change is going backwards? Were there manual changes to these files or were they last generated with a different version of cosmos or something?

pub struct Module {}
80 changes: 0 additions & 80 deletions packages/provwasm-std/src/types/cosmos/app/runtime/v1alpha1.rs

This file was deleted.

33 changes: 1 addition & 32 deletions packages/provwasm-std/src/types/cosmos/app/v1alpha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct PackageReference {
///
/// When a new version of a module is released and items are added to existing
/// .proto files, these definitions should contain comments of the form
/// "Since: Revision N" where N is an integer revision.
/// "Since Revision N" where N is an integer revision.
///
/// When the module runtime starts up, it will check the pinned proto
/// image and panic if there are runtime protobuf definitions that are not
Expand Down Expand Up @@ -132,11 +132,6 @@ pub struct Config {
/// modules are the module configurations for the app.
#[prost(message, repeated, tag = "1")]
pub modules: ::prost::alloc::vec::Vec<ModuleConfig>,
/// golang_bindings specifies explicit interface to implementation type bindings which
/// depinject uses to resolve interface inputs to provider functions. The scope of this
/// field's configuration is global (not module specific).
#[prost(message, repeated, tag = "2")]
pub golang_bindings: ::prost::alloc::vec::Vec<GolangBinding>,
}
/// ModuleConfig is a module configuration for an app.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -168,32 +163,6 @@ pub struct ModuleConfig {
/// define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension.
#[prost(message, optional, tag = "2")]
pub config: ::core::option::Option<crate::shim::Any>,
/// golang_bindings specifies explicit interface to implementation type bindings which
/// depinject uses to resolve interface inputs to provider functions. The scope of this
/// field's configuration is module specific.
#[prost(message, repeated, tag = "3")]
pub golang_bindings: ::prost::alloc::vec::Vec<GolangBinding>,
}
/// GolangBinding is an explicit interface type to implementing type binding for dependency injection.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/cosmos.app.v1alpha1.GolangBinding")]
pub struct GolangBinding {
/// interface_type is the interface type which will be bound to a specific implementation type
#[prost(string, tag = "1")]
pub interface_type: ::prost::alloc::string::String,
/// implementation is the implementing type which will be supplied when an input of type interface is requested
#[prost(string, tag = "2")]
pub implementation: ::prost::alloc::string::String,
}
/// QueryConfigRequest is the Query/Config request type.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
1 change: 0 additions & 1 deletion packages/provwasm-std/src/types/cosmos/auth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod module;
pub mod v1beta1;
47 changes: 0 additions & 47 deletions packages/provwasm-std/src/types/cosmos/auth/module/v1.rs

This file was deleted.

Loading
Loading