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

[NTRN-192] feat: add proto build #125

Merged
merged 11 commits into from
Apr 17, 2024
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["contracts/*", "packages/*"]
members = ["contracts/*", "packages/*", "proto-build"]

[profile.release]
opt-level = 3
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ check_contracts:
@cargo install cosmwasm-check
@cosmwasm-check --available-capabilities iterator,staking,stargate,neutron artifacts/*.wasm

build: schema clippy test fmt doc compile check_contracts
build: schema clippy test fmt doc compile check_contracts

build-proto:
@cargo run --bin proto-build $(revision)
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ make test
make schema
```

### Generating proto files

Neutron proto files represented as generated Rust code is a part of the Neutron SDK. In case Neutron
proto files have changed there's a command for Rust generated code rebuild. To rebuild the files,
run the following command using the respective Neutron revision (tag) as an argument, e.g.:
```sh
make build-proto revision=v3.0.3
```

### Production

For production builds, run the following:
Expand Down
2 changes: 1 addition & 1 deletion packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f6a079d67ec5c887447a8e2e2e35f2fdb58c3823
v3.0.3
39 changes: 16 additions & 23 deletions packages/neutron-sdk/src/proto_types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
pub mod neutron {
pub mod dex {
include!("neutron.dex.rs");
}

pub mod interchaintxs {
pub mod contractmanager {
include!("neutron.contractmanager.rs");
pub mod v1 {
include!("neutron.interchaintxs.v1.rs");
include!("neutron.contractmanager.v1.rs");
}
}

pub mod feeburner {
include!("neutron.feeburner.rs");
}

pub mod interchainqueries {
include!("neutron.interchainqueries.rs");
}

pub mod cron {
include!("neutron.cron.rs");
}
pub mod transfer {
include!("neutron.transfer.rs");
pub mod dex {
include!("neutron.dex.rs");
}
pub mod feeburner {
include!("neutron.feeburner.rs");
}

pub mod feerefunder {
include!("neutron.feerefunder.rs");
}

pub mod contractmanager {
include!("neutron.contractmanager.rs");
pub mod interchainqueries {
include!("neutron.interchainqueries.rs");
}
pub mod interchaintxs {
pub mod v1 {
include!("neutron.contractmanager.v1.rs");
include!("neutron.interchaintxs.v1.rs");
}
}
pub mod transfer {
include!("neutron.transfer.rs");
}
}

pub mod osmosis {
pub mod tokenfactory {
pub mod v1beta1 {
Expand Down
14 changes: 14 additions & 0 deletions proto-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "proto-build"
version = "0.1.0"
authors = ["Sergei Sotnikov <[email protected]>"]
edition = "2018"
publish = false

[dependencies]
prost = "0.12"
prost-build = "0.12"
tonic = "0.10"
tonic-build = "0.10"
regex = "1"
walkdir = "2"
8 changes: 8 additions & 0 deletions proto-build/buf.neutron.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
plugins:
- plugin: buf.build/community/neoeinstein-prost:v0.2.1
out: .
opt:
- extern_path=.cosmos=.cosmos_sdk_proto::cosmos
- extern_path=.ibc=.cosmos_sdk_proto::ibc
- extern_path=.tendermint=tendermint_proto::v0_37
4 changes: 4 additions & 0 deletions proto-build/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: v1
name: buf.build/neutron-org/neutron-sdk
deps:
- buf.build/cosmos/ibc
Loading
Loading