osmosis-labs / osmosis-rust

Rust libraries for osmosis
Apache License 2.0
59 stars 52 forks source link

proto-build add the GRPC services? #74

Closed Philipp-Sc closed 1 year ago

Philipp-Sc commented 1 year ago

Hi,

I am in the process of migrating my custom (outdated) proto-build code to the official pipeline here. I noticed the proto-build here does not compile any GRPC services.

Do you have an idea how to add the GRPC services?

here a code excerpt of how I did it previously:


fn compile_osmosisd_proto_services(out_dir: &Path) {
    let sdk_dir = Path::new(OSMOSISD_DIR);
    let wasmd_sdk_dir = Path::new(WASMD_DIR);

    let proto_includes_paths = [
        format!("{}/proto", sdk_dir.display()),
        format!("{}/proto", wasmd_sdk_dir.display()),
        format!("{}/third_party/proto", wasmd_sdk_dir.display()),
    ];

    // List available paths for dependencies
    let includes: Vec<PathBuf> = proto_includes_paths.iter().map(PathBuf::from).collect();

    let proto_services_path = [
        PathBuf::from(sdk_dir).join("proto/osmosis/gamm/v1beta1/query.proto"),
        PathBuf::from(sdk_dir).join("proto/osmosis/gamm/v1beta1/tx.proto"),
        PathBuf::from(sdk_dir).join("proto/osmosis/gamm/pool-models/balancer/tx.proto"),
    ];

    // List available paths for dependencies
    let services = proto_services_path
        .iter()
        .map(|p| p.as_os_str().to_os_string())
        .collect::<Vec<_>>();

    // Compile all proto client for GRPC services
    info!("Compiling osmosisd proto clients for GRPC services!");
    tonic_build::configure()
        .build_client(true)
        .build_server(false)
        .out_dir(out_dir)
        .compile(&services, &includes)
        .unwrap();

    info!("=> Done!");
}

(full code is here )

I tried to build the rust proto definitions first via the osmosis-rust proto build package and then run the compile_osmosisd_proto_services method but I get the following error:

"protoc failed: gogoproto/gogo.proto: File not found.\ncosmos/base/v1beta1/coin.proto: File not found.\nosmosis/poolmanager/v1beta1/swap_route.proto:4:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/tx.proto:4:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/tx.proto:5:1: Import \"cosmos/base/v1beta1/coin.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/tx.proto:6:1: Import \"osmosis/poolmanager/v1beta1/swap_route.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/tx.proto:37:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:49:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:65:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:72:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:81:12: \"osmosis.poolmanager.v1beta1.SwapAmountInRoute\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:83:3: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:104:12: \"osmosis.poolmanager.v1beta1.SwapAmountOutRoute\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:111:3: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:130:3: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/tx.proto:209:3: \"cosmos.base.v1beta1.Coin\" is not defined.\ncosmos/base/query/v1beta1/pagination.proto: File not found.\ngoogle/api/annotations.proto: File not found.\ncosmos_proto/cosmos.proto: File not found.\nosmosis/gamm/v1beta1/query.proto:4:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/query.proto:5:1: Import \"osmosis/gamm/v1beta1/tx.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/query.proto:6:1: Import \"osmosis/poolmanager/v1beta1/swap_route.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/query.proto:8:1: Import \"cosmos/base/v1beta1/coin.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/query.proto:9:1: Import \"cosmos/base/query/v1beta1/pagination.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/query.proto:10:1: Import \"google/api/annotations.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/query.proto:12:1: Import \"cosmos_proto/cosmos.proto\" was not found or had errors.\nosmosis/gamm/v1beta1/query.proto:124:3: \"cosmos.base.query.v1beta1.PageRequest\" is not defined.\nosmosis/gamm/v1beta1/query.proto:131:3: \"cosmos.base.query.v1beta1.PageResponse\" is not defined.\nosmosis/gamm/v1beta1/query.proto:152:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/query.proto:163:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/query.proto:178:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/query.proto:196:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/query.proto:208:3: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/query.proto:216:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/query.proto:222:12: \"cosmos.base.v1beta1.Coin\" is not defined.\nosmosis/gamm/v1beta1/query.proto:252:3: \"cosmos.base.query.v1beta1.PageRequest\" is not defined.\nosmosis/gamm/v1beta1/query.proto:259:3: \"cosmos.base.query.v1beta1.PageResponse\" is not defined.\nosmosis/gamm/v1beta1/query.proto:276:12: \"osmosis.poolmanager.v1beta1.SwapAmountInRoute\" is not defined.\nosmosis/gamm/v1beta1/query.proto:296:12: \"osmosis.poolmanager.v1beta1.SwapAmountOutRoute\" is not defined.\nosmosis/gamm/v1beta1/query.proto:315:12: \"cosmos.base.v1beta1.Coin\" is not defined.\n" }', proto-build/osmosis/src/osmosis/mod.rs:172:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Any help is appreciated.

Best regards, Philipp-Sc

Philipp-Sc commented 1 year ago

I am closing this, because this issue is no longer relevant.