cosmos / cosmos-rust Goto Github PK
View Code? Open in Web Editor NEWThe home of all shared Rust resources for the Cosmos ecosystem.
License: Apache License 2.0
The home of all shared Rust resources for the Cosmos ecosystem.
License: Apache License 2.0
In ibc-proto
we've been experiencing an error when compiling the proto files. We intend to migrate our proto crate to cosmos-rust
in the future but just as a test we've tried to reproduce the same error in cosmos-rust
and it seems to be affecting it too.
If you set the Cosmos SDK to release v0.40.0-rc5
the error below is happening. I've tried to troubleshoot it and see if I could fix but without success so far. So just reporting it here to see if you can help find a solution.
in proto-build -> src -> main.rs
I've changed this line to point to the Cosmos SDK mentioned above:
/// The Cosmos commit or tag to be cloned and used to build the proto files
const COSMOS_REV: &str = "v0.40.0-rc5";
Then running it I get an error:
$ cargo run
Compiling proto-build v0.1.0 (/home/andy/development/github.com/cosmos/cosmos-rust/proto-build)
Finished dev [unoptimized + debuginfo] target(s) in 2.62s
Running `target/debug/proto-build`
[info] Updating cosmos/cosmos-sdk submodule...
HEAD is now at 7c1da3d99 update changelog for v0.40.0-rc5 (#8156)
[info] Compiling .proto files to Rust into '/tmp/tmp-protobuf/'...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: /home/andy/development/github.com/cosmos/cosmos-rust/proto-build/../proto: warning: directory does not exist.\nibc/core/client/v1/tx.proto:8:1: warning: Import ibc/core/client/v1/client.proto is unused.\ncosmos/tx/v1beta1/service.proto:7:1: warning: Import gogoproto/gogo.proto is unused.\ncosmos/base/tendermint/v1beta1/query.proto:87:3: \"tendermint.types.BlockID\" is resolved to \"cosmos.base.tendermint.types.BlockID\", which is not defined. The innermost scope is searched first in name resolution. Consider using a leading \'.\'(i.e., \".tendermint.types.BlockID\") to start from the outermost scope.\ncosmos/base/tendermint/v1beta1/query.proto:88:3: \"tendermint.types.Block\" is resolved to \"cosmos.base.tendermint.types.Block\", which is not defined. The innermost scope is searched first in name resolution. Consider using a leading \'.\'(i.e., \".tendermint.types.Block\") to start from the outermost scope.\ncosmos/base/tendermint/v1beta1/query.proto:96:3: \"tendermint.types.BlockID\" is resolved to \"cosmos.base.tendermint.types.BlockID\", which is not defined. The innermost scope is searched first in name resolution. Consider using a leading \'.\'(i.e., \".tendermint.types.BlockID\") to start from the outermost scope.\ncosmos/base/tendermint/v1beta1/query.proto:97:3: \"tendermint.types.Block\" is resolved to \"cosmos.base.tendermint.types.Block\", which is not defined. The innermost scope is searched first in name resolution. Consider using a leading \'.\'(i.e., \".tendermint.types.Block\") to start from the outermost scope.\ncosmos/base/tendermint/v1beta1/query.proto:113:3: \"tendermint.p2p.DefaultNodeInfo\" is resolved to \"cosmos.base.tendermint.p2p.DefaultNodeInfo\", which is not defined. The innermost scope is searched first in name resolution. Consider using a leading \'.\'(i.e., \".tendermint.p2p.DefaultNodeInfo\") to start from the outermost scope.\ncosmos/base/tendermint/v1beta1/query.proto:4:1: warning: Import gogoproto/gogo.proto is unused.\ncosmos/base/tendermint/v1beta1/query.proto:6:1: warning: Import google/api/annotations.proto is unused.\ncosmos/base/tendermint/v1beta1/query.proto:9:1: warning: Import tendermint/types/types.proto is unused.\ncosmos/base/tendermint/v1beta1/query.proto:8:1: warning: Import tendermint/types/block.proto is unused.\ncosmos/base/tendermint/v1beta1/query.proto:7:1: warning: Import tendermint/p2p/types.proto is unused.\n" }', proto-build/src/main.rs:127:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Seems something broken regarding the external reference to tendermint protos. I've tried to play with different the config.extern_path(".tendermint", "::tendermint_proto");
line but no lucky. The prost (and tonic) docs are not very straightforward about this function.
We had this issue also in ibc-rs
when trying to compile some IBC core services.
For example, with this addition:
diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs
index 9d9591c..aeeb30d 100644
--- a/proto-build/src/main.rs
+++ b/proto-build/src/main.rs
@@ -161,6 +161,7 @@ fn compile_proto_services(out_dir: impl AsRef<Path>) {
sdk_dir.join("proto/cosmos/bank/v1beta1/query.proto"),
sdk_dir.join("proto/cosmos/tx/v1beta1/service.proto"),
sdk_dir.join("proto/cosmos/tx/v1beta1/tx.proto"),
+ sdk_dir.join("proto/ibc/core/channel/v1/query.proto"),
];
// List available paths for dependencies
and after cargo run
some of the structures are missing from ../cosmos-sdk-proto/src/prost/ibc.core.channel.v1.rs
(all Msg..
structs, GenesisState
).
In ibc-rs
we fixed this by doing the proto and service compilation with tonic see here
cosmos-rust
as well as tendermint-rs
rely on prost
and prost-types
0.7. The prost-types
crate has a reported security advisory RUSTSEC-2021-0073. An upgrade to prost
and prost-types
0.8 would address the advisory.
This issue upstream in prost 0.8 is preventing a clean upgrade to 0.8, but once it is addressed or a workaround is taken, this ticket can track the upgrade in cosmos-rust. Thanks.
The current prost-types
dependency version doesn't support proper Duration error propagation, which should be fixed when tokio-rs/prost#625 is included in a release.
Once that is done, we can also expose PeriodicAllowance
, similarly to how we did in #250 for MsgGrantAllowance
, MsgRevokeAllowance
, BasicAllowance
and
AllowedMsgAllowance
It seems like the version of proto
shipped with the crate is out of sync with what's expected. I'm seeing various errors like below, for example:
error[E0433]: failed to resolve: could not find `v1` in `wasm`
--> /Users/max/.cargo/registry/src/github.com-1ecc6299db9ec823/cosmrs-0.4.0/src/cosmwasm.rs:354:36
|
354 | proto::cosmwasm::wasm::v1::MsgClearAdmin::from(&msg)
| ^^^^^^^^^^^^^ not found in `proto::cosmwasm::wasm::v1`
|
help: consider importing one of these items
|
6 | use cosmos_sdk_proto::cosmwasm::wasm::v1beta1::MsgClearAdmin;
|
6 | use crate::proto::cosmwasm::wasm::v1beta1::MsgClearAdmin;
For example, is the plan to implement all the modules of the Cosmos SDK and interact with the underlying Tendermint modules via ABCI++, so that developers can use Rust to develop blockchain applications.
According to this recent PR of ibc-rs
, should we also use Google's Protobuf well-known types definitions instead of prost_types
to derive Serialize
and Deserialize
? Thanks.
https://grpc.bd.evmos.org:9090
), I encountered with the following error.connection error: hyper::Error(Http2, Error { kind: GoAway(b"", FRAME_SIZE_ERROR, Library) })
export NODE=grpc.bd.evmos.org:9090
grpcurl -d '{"'address'": "'$EVMOS_ADDR_3'"}' $NODE cosmos.bank.v1beta1.Query/AllBalances
{
"balances": [
{
"denom": "aevmos",
"amount": "19254711178107386863"
},
{
"denom": "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518",
"amount": "63743"
}
],
"pagination": {
"total": "2"
}
}
/Users/sigridjin.eth/Documents/github/ParachuteDrop-LightClient/target/debug/parachutedrop-rust-server
[2022-12-26T03:01:44Z INFO actix_server::builder] Starting 10 workers
[2022-12-26T03:01:44Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
[2022-12-26T03:01:51Z DEBUG hyper::client::connect::dns] resolving host="grpc.bd.evmos.org"
[2022-12-26T03:01:51Z DEBUG hyper::client::connect::http] connecting to 18.211.85.17:9090
[2022-12-26T03:01:51Z DEBUG hyper::client::connect::http] connected to 18.211.85.17:9090
[2022-12-26T03:01:51Z DEBUG h2::client] binding client connection
[2022-12-26T03:01:51Z DEBUG h2::client] client connection bound
[2022-12-26T03:01:51Z DEBUG h2::codec::framed_write] send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
[2022-12-26T03:01:51Z DEBUG h2::proto::connection] Connection; peer=Client
[2022-12-26T03:01:51Z DEBUG h2::codec::framed_write] send frame=WindowUpdate { stream_id: StreamId(0), size_increment: 5177345 }
[2022-12-26T03:01:59Z DEBUG tower::buffer::worker] service.ready=true message=processing request
[2022-12-26T03:01:59Z DEBUG h2::codec::framed_write] send frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
[2022-12-26T03:01:59Z DEBUG h2::codec::framed_write] send frame=Data { stream_id: StreamId(1) }
[2022-12-26T03:01:59Z DEBUG h2::codec::framed_write] send frame=Data { stream_id: StreamId(1), flags: (0x1: END_STREAM) }
[2022-12-26T03:02:03Z DEBUG h2::proto::connection] Connection::poll; connection error error=GoAway(b"", FRAME_SIZE_ERROR, Library)
[2022-12-26T03:02:03Z DEBUG h2::codec::framed_write] send frame=GoAway { error_code: FRAME_SIZE_ERROR, last_stream_id: StreamId(0) }
[2022-12-26T03:02:03Z DEBUG h2::proto::connection] Connection::poll; connection error error=GoAway(b"", FRAME_SIZE_ERROR, Library)
[2022-12-26T03:02:03Z DEBUG hyper::proto::h2::client] connection error: broken pipe
[2022-12-26T03:02:03Z DEBUG hyper::client::service] connection error: hyper::Error(Http2, Error { kind: GoAway(b"", FRAME_SIZE_ERROR, Library) })
[2022-12-26T03:02:03Z DEBUG hyper::proto::h2::client] client response error: connection error detected: frame with invalid size
#[get("/evmos")]
pub async fn evmos_health() -> Result<HttpResponse, HTTPError> {
// grpcurl -d '{"'address'": "'$EVMOS_ADDR_3'"}' $NODE cosmos.bank.v1beta1.Query/AllBalances
let endpoint = tonic::transport::Endpoint::new("https://grpc.bd.evmos.org:9090"
.parse::<tonic::transport::Uri>().unwrap())
.unwrap();
let channel = endpoint.connect().await;
let mut connected_client = QueryClient::new(channel.unwrap());
let request = QueryAllBalancesRequest {
address: "evmos1f57x5pm9wpvlu4qldy864j0hdnq025287r65z2".to_string(),
pagination: Option::from(PageRequest {
key: Vec::from("".to_string()),
offset: 0,
limit: 0,
count_total: false,
reverse: false
}),
};
let response = connected_client.all_balances(request).await;
// let response = connected_client.all_balances(request).await;
// response.unwrap();
Ok(HttpResponse::Ok().json(HealthResponse {
status: StatusCode::OK.as_u16(),
message: "OK".to_string(),
data: None,
}))
}
My cosmos-sdk-proto
fork is using prost-wkt-build
to support Any::{try_pack, try_unpack}
via Serde (de)serialization.
prost-wkt
still has some issues. But I manually fixed them all.
If prost-wkt
looks alright, I would be happy to create a PR with my fork.
Line 189 in d674c6e
This should be rewrited.
I could be a little off base here as my understanding of this is pretty shallow at best. Ledgers expect a specific version of "SignDoc" that must have all json objects sorted by key. you can see the spec here. It seems to me that that would requires a different form for Raw, as the current implementation separates "auth_info" and "body". When these are passed to the ledger, they must first be sorted. The sorted version is signed, and then transforming back into Raw causes a jumble, and invalidates the signature. Is my understanding of this problem correct?
Hello,
Can you assist me to fix a panic ?
cargo run
Blocking waiting for file lock on build directory
Finished dev [unoptimized + debuginfo] target(s) in 3.83s
Running `target/debug/proto-build`
[info] Updating cosmos/cosmos-sdk submodule...
fatal: cannot change to '../cosmos-sdk-go': No such file or directory
thread 'main' panicked at 'git exited with error code: Some(128)', proto-build/src/main.rs:134:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
proto-build/src/main.rs:134:9
if !exit_status.success() {
panic!("git exited with error code: {:?}", exit_status.code());
}
rustc 1.56.0 (09c42c458 2021-10-18)
This gRPC client in particular disappeared in the v0.12 release. It was present in the v0.11 release:
Other gRPC clients, e.g. authz
, are still present:
https://docs.rs/cosmos-sdk-proto/0.12.0/cosmos_sdk_proto/?search=QueryClient
This is probably related to the prost
v0.10 and tonic
v0.7 upgrade, which was the only major change in this release.
Running into compatibility issues using cosmrs
together with the upcoming k256
Taproot feature. Is there an official policy on how and when to keep up with the relatively frequent breaking changes in RustCrypto libraries? E.g., would combined PRs to tendermint-rs/cosmos-rust have a chance of being merged + released?
Hello,
thank you so much for working on this awesome repository.
How much effort would it be to add Osmosis and Terra?
I tried running the build, but something fails. I was able to manually add some Osmosis related messages.
If it is easy to archive by adding it to the main.rs file maybe I do not need to implement it manually.
Thank you in advance.
Best regards,
Philipp
I've pushed up a branch containing the files changed when I run proto-build
locally:
https://github.com/cosmos/cosmos-rust/pull/16/files
It appears to be mostly whitespace changes. I'm not sure what the cause would be.
This change to cosmos.base.abci.v1beta1.rs
in particular (edit: actually a few files) looks pretty strange:
- pub header: ::std::option::Option<tendermint_proto::types::Header>,
+ pub header: ::std::option::Option<super::super::super::tendermint::types::Header>,
For whatever reason it's outputting super::super::super::tendermint
instead of tendermint_proto
.
I hope it supports general query such as GetBalance
, GetUnclaimedReward
and more.
I've had a few people ask me about the rust transaction builder and I've pointed them to this repo, however if the readme for that project said a little more about what's currently supported/unsupported and maturity I think that may help newbies.
Hello,
I was able to build repo successfully.
Can you assist me to fix a panic ?
cargo run
Blocking waiting for file lock on build directory
Finished dev [unoptimized + debuginfo] target(s) in 3.83s
Running `target/debug/proto-build`
[info] Updating cosmos/cosmos-sdk submodule...
fatal: cannot change to '../cosmos-sdk-go': No such file or directory
thread 'main' panicked at 'git exited with error code: Some(128)', proto-build/src/main.rs:134:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
proto-build/src/main.rs:134:9
if !exit_status.success() {
panic!("git exited with error code: {:?}", exit_status.code());
}
rustc 1.56.0 (09c42c458 2021-10-18)
[user@development proto-build]$ cargo run
Updating crates.io index
Downloaded serde v1.0.144
Downloaded axum v0.5.15
Downloaded prettyplease v0.1.18
Downloaded 3 crates (236.5 KB) in 2.21s
Compiling [...]
Running `/home/user/Documents/trash-bin/cosmos-rust/target/debug/proto-build`
[info] Updating cosmos/cosmos-sdk submodule...
Submodule 'cosmos-sdk' (https://github.com/cosmos/cosmos-sdk.git) registered for path '../cosmos-sdk-go'
Submodule 'ibc-go' (https://github.com/cosmos/ibc-go) registered for path '../ibc-go'
Submodule 'wasmd' (https://github.com/CosmWasm/wasmd.git) registered for path '../wasmd'
Cloning into '/home/user/Documents/trash-bin/cosmos-rust/cosmos-sdk-go'...
Cloning into '/home/user/Documents/trash-bin/cosmos-rust/ibc-go'...
Cloning into '/home/user/Documents/trash-bin/cosmos-rust/wasmd'...
Submodule path '../cosmos-sdk-go': checked out 'ad9e5620fb3445c716e9de45cfcdb56e8f1745bf'
Submodule path '../ibc-go': checked out '46e020640e66f9043c14c53a4d215a5b457d6703'
Submodule path '../wasmd': checked out '891b4061a63fe9f5802e11d9e0482f9605dd4bdc'
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 8 (delta 3), reused 6 (delta 3), pack-reused 0
Unpacking objects: 100% (8/8), 3.07 KiB | 629.00 KiB/s, done.
From https://github.com/cosmos/cosmos-sdk
aaab34e7b..a49b1fce9 julien/flaky-query-by-sig -> origin/julien/flaky-query-by-sig
HEAD is now at ad9e5620f chore: release notes++
[info] Updating cosmos/ibc-go submodule...
HEAD is now at 46e02064 fixes for the documentation about handling ack for SDK <= 0.45 (#1122) (#1129)
[info] Updating wasmd submodule...
HEAD is now at 891b406 Update changelog (#737)
[info] Compiling cosmos-sdk .proto files to Rust into '/tmp/tmp-protobuf/cosmos-sdk'...
[info] Compiling proto definitions and clients for GRPC services!
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/auth/v1beta1/auth.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/auth/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/auth/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/authz/v1beta1/authz.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/authz/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/authz/v1beta1/event.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/authz/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/authz/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/bank/v1beta1/authz.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/bank/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/bank/v1beta1/bank.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/bank/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/bank/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/snapshots/v1beta1/snapshot.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/tendermint/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/query/v1beta1/pagination.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/kv/v1beta1/kv.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/store/v1beta1/commit_info.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/store/v1beta1/listening.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/v1beta1/coin.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/reflection/v2alpha1/reflection.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/reflection/v1beta1/reflection.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/abci/v1beta1/abci.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/base/tendermint/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/capability/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/capability/v1beta1/capability.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/crisis/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/crisis/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/crypto/ed25519/keys.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/crypto/multisig/keys.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/crypto/multisig/v1beta1/multisig.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/crypto/secp256k1/keys.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/crypto/secp256r1/keys.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/distribution.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/evidence.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/feegrant.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/genutil/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/gov/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/gov/v1beta1/gov.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/gov/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/gov/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/mint/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/mint/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/mint/v1beta1/mint.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/params/v1beta1/params.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/params/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/slashing.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/staking/v1beta1/authz.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/staking/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/staking/v1beta1/staking.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/staking/v1beta1/genesis.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/staking/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/tx/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/tx/v1beta1/service.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/tx/signing/v1beta1/signing.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/upgrade/v1beta1/upgrade.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/upgrade/v1beta1/query.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/vesting/v1beta1/tx.proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto/cosmos/vesting/v1beta1/vesting.proto
cargo:rerun-if-changed=/home/user/Documents/trash-bin/cosmos-rust/proto-build/../proto
cargo:rerun-if-changed=../cosmos-sdk-go/proto
cargo:rerun-if-changed=../cosmos-sdk-go/third_party/proto
ignoring /home/user/Documents/trash-bin/cosmos-rust/proto-build/../proto since it does not exist.
Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/tmp/prost-buildQe0gjb/prost-descriptor-set" "-I" "../cosmos-sdk-go/proto" "-I" "../cosmos-sdk-go/third_party/proto" "../cosmos-sdk-go/proto/cosmos/auth/v1beta1/auth.proto" "../cosmos-sdk-go/proto/cosmos/auth/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/auth/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/authz/v1beta1/authz.proto" "../cosmos-sdk-go/proto/cosmos/authz/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/authz/v1beta1/event.proto" "../cosmos-sdk-go/proto/cosmos/authz/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/authz/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/bank/v1beta1/authz.proto" "../cosmos-sdk-go/proto/cosmos/bank/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/bank/v1beta1/bank.proto" "../cosmos-sdk-go/proto/cosmos/bank/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/bank/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/base/snapshots/v1beta1/snapshot.proto" "../cosmos-sdk-go/proto/cosmos/base/tendermint/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/base/query/v1beta1/pagination.proto" "../cosmos-sdk-go/proto/cosmos/base/kv/v1beta1/kv.proto" "../cosmos-sdk-go/proto/cosmos/base/store/v1beta1/commit_info.proto" "../cosmos-sdk-go/proto/cosmos/base/store/v1beta1/listening.proto" "../cosmos-sdk-go/proto/cosmos/base/v1beta1/coin.proto" "../cosmos-sdk-go/proto/cosmos/base/reflection/v2alpha1/reflection.proto" "../cosmos-sdk-go/proto/cosmos/base/reflection/v1beta1/reflection.proto" "../cosmos-sdk-go/proto/cosmos/base/abci/v1beta1/abci.proto" "../cosmos-sdk-go/proto/cosmos/base/tendermint/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/capability/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/capability/v1beta1/capability.proto" "../cosmos-sdk-go/proto/cosmos/crisis/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/crisis/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/crypto/ed25519/keys.proto" "../cosmos-sdk-go/proto/cosmos/crypto/multisig/keys.proto" "../cosmos-sdk-go/proto/cosmos/crypto/multisig/v1beta1/multisig.proto" "../cosmos-sdk-go/proto/cosmos/crypto/secp256k1/keys.proto" "../cosmos-sdk-go/proto/cosmos/crypto/secp256r1/keys.proto" "../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/distribution.proto" "../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/distribution/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/evidence/v1beta1/evidence.proto" "../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/feegrant.proto" "../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/feegrant/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/genutil/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/gov/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/gov/v1beta1/gov.proto" "../cosmos-sdk-go/proto/cosmos/gov/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/gov/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/mint/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/mint/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/mint/v1beta1/mint.proto" "../cosmos-sdk-go/proto/cosmos/params/v1beta1/params.proto" "../cosmos-sdk-go/proto/cosmos/params/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/slashing.proto" "../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/slashing/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/staking/v1beta1/authz.proto" "../cosmos-sdk-go/proto/cosmos/staking/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/staking/v1beta1/staking.proto" "../cosmos-sdk-go/proto/cosmos/staking/v1beta1/genesis.proto" "../cosmos-sdk-go/proto/cosmos/staking/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/tx/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/tx/v1beta1/service.proto" "../cosmos-sdk-go/proto/cosmos/tx/signing/v1beta1/signing.proto" "../cosmos-sdk-go/proto/cosmos/upgrade/v1beta1/upgrade.proto" "../cosmos-sdk-go/proto/cosmos/upgrade/v1beta1/query.proto" "../cosmos-sdk-go/proto/cosmos/vesting/v1beta1/tx.proto" "../cosmos-sdk-go/proto/cosmos/vesting/v1beta1/vesting.proto"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: google/protobuf/descriptor.proto: File not found.\ncosmos_proto/cosmos.proto:4:1: Import \"google/protobuf/descriptor.proto\" was not found or had errors.\ncosmos_proto/cosmos.proto:8:8: \"google.protobuf.MessageOptions\" is not defined.\ncosmos_proto/cosmos.proto: \"google.protobuf.MessageOptions\" is not defined.\ncosmos_proto/cosmos.proto:14:8: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto:32:1: Import \"google/protobuf/descriptor.proto\" was not found or had errors.\ngogoproto/gogo.proto:38:8: \"google.protobuf.EnumOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.EnumOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.EnumOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.EnumOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.EnumOptions\" is not defined.\ngogoproto/gogo.proto:46:8: \"google.protobuf.EnumValueOptions\" is not defined.\ngogoproto/gogo.proto:50:8: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FileOptions\" is not defined.\ngogoproto/gogo.proto:92:8: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.MessageOptions\" is not defined.\ngogoproto/gogo.proto:129:8: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngogoproto/gogo.proto: \"google.protobuf.FieldOptions\" is not defined.\ngoogle/protobuf/any.proto:35:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\ncosmos/auth/v1beta1/auth.proto:4:1: Import \"cosmos_proto/cosmos.proto\" was not found or had errors.\ncosmos/auth/v1beta1/auth.proto:5:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\ncosmos/auth/v1beta1/auth.proto:6:1: Import \"google/protobuf/any.proto\" was not found or had errors.\ncosmos/auth/v1beta1/auth.proto:21:3: \"google.protobuf.Any\" is not defined.\n" }', proto-build/src/main.rs:254:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Hi!
I've been trying to use this library with some partial success and I was hoping you would be able to point me in the direction of what I was doing wrong.
Basically, I was able to use the HttpClient
to query for data as well as send transactions, however, unfortunately I'm not having a lot of success with grpc query clients. All of my requests fail with:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Status { code: Unknown, message: "h2 protocol error: protocol error: frame with invalid size" }'
I've tried it against a local validator using cosmos-sdk v0.42.5
as well as a remote one with cosmos-sdk on v0.40.1
The sample code I've used:
#[tokio::main]
async fn main() {
let validator = "https://testnet-finney-validator.nymtech.net";
let http_client = HttpClient::new(validator).unwrap();
// this works perfectly!
let latest_block = http_client.latest_block().await.unwrap();
println!(
"Current block height: {:?}",
latest_block.block.header.height
);
let mut query_client =
cosmos_sdk_proto::cosmos::auth::v1beta1::query_client::QueryClient::connect(validator)
.await
.unwrap();
let address = "hal1qwevrpcje6yllakkpp54fn4w054jcyf34j820y";
let req = QueryAccountRequest {
address: address.to_string(),
};
let response = query_client.account(req).await.unwrap().into_inner();
// doesn't get here : (
let base_account: BaseAccount =
prost::Message::decode(response.account.unwrap().value.as_ref()).unwrap();
println!("{:?}", base_account);
}
Thank you for any suggestions!
Currently there is no way to access tonic::transport::channel::endpoint::Endpoint
.
For example one might want to use tls_config() or other timeout related methods.
let mut endpoint = Endpoint::new("url".parse().unwrap()).unwrap();
endpoint = endpoint.tls_config();
// expected would be that something like the following works:
// MsgClient::connect(endpoint).await;
// MsgClient::new(endpoint.connect().await?);
Relevant Code Example:
inner: tonic::client::Grpc<T>,
}
#[cfg(feature = "grpc-transport")]
#[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
impl MsgClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
Please let me know if I am missing something.
Hi again!
While browsing through the code I encountered this comment in the FromStr
implementation for Denom
:
cosmos-rust/cosmrs/src/base.rs
Lines 178 to 189 in ed05f69
I think the validation might actually be incorrect. My argument for that is that I sent a QueryTotalSupplyRequest
request, thus receiving the corresponding QueryTotalSupplyResponse
. To remind, it looks as following:
/// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC
/// method
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryTotalSupplyResponse {
/// supply is the supply of the coins
#[prost(message, repeated, tag = "1")]
pub supply: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
/// pagination defines the pagination in the response.
#[prost(message, optional, tag = "2")]
pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
}
As you can see, the response contains proto representation of a cosmos Coin
. Logically I attempted to parse it into cosmrs::Coin
type, which failed as the denom was incorrect. It makes perfect sense given the existing validation. Now, as for the value returned from the query:
QueryTotalSupplyResponse {
supply: [
Coin {
denom: "ibc/9F53D255F5320A4BE124FF20C29D46406E126CE8A09B00CA8D3CFF7905119728",
amount: "1500",
},
Coin {
denom: "unymt",
amount: "1000000000000000",
},
Coin {
denom: "unyxt",
amount: "999999996000000",
},
],
pagination: None,
}
The denom established via the IBC channel, i.e. ibc/9F53D255F5320A4BE124FF20C29D46406E126CE8A09B00CA8D3CFF7905119728
failed to get parsed. Now, the "possibly" part of the title of the issue comes from the fact that I'm unsure whether this is expected Cosmos' behaviour or not, i.e. whether IBC denoms are "valid" in this context. But I thought I might let you know of this : )
Hi, I found the field amount
in MsgUndelete is type of Option<Coin>
(different in MsgDelegate). Could it be assigned to None? And why? Thanks.
https://github.com/cosmos/cosmos-rust/blob/main/cosmrs/src/staking.rs#L83
Paraphrasing @ethanfrey:
If Orga supported the Cosmos-SDK's
Bank
data structure and message interface it could get wallet support out of the box.
This represents more than a cosmos-rust issue, rather it's a question about whether frameworks ecosystem-wide can or want to standardise around a minimal set of internal representations, like bank
, such that they can expose common interfaces to client applications.
This may be relevant to projects like Agoric, Kepler, CosmosSwift, and other frameworks that could benefit from cosmjs, alan dart, or other client library support, as well as direct integrations with wallets, block explorers, etc.
cc: @mappum @keppel @blinky3713 @michaelfig @ratranqu @aaronc @webmaster128 @okwme @RiccardoM
We're building an app that needs to decode a tx::Tx
that contains a bank::MsgSend
message, and when we supply an invalid from_address
or to_address
the error produced is simply:
bad encoding
This comes from the subtle-encoding
crate over here (it took us a while to realize it came from here specifically).
It'd be super helpful to have more descriptive errors when decoding these data structures and converting them into their domain types.
Unneeded type parameter in SigningKey::derive_from_path
causes build error:
--> src/account.rs:22:13
|
22 | SigningKey::derive_from_path(seed, &path).expect("private key derivation failed");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `S` declared on the associated function `derive_from_path`
messages in the tx are encoded with protobuf,
need to know class first to decode by typeurl
if those messages can be parsed into serde_json, it would be easy to display
how about adding serde json support in compiling rust files from proto files?
(in prost)
This is a tracking issue for a breakage in automated codegen.
Currently the generated code contains two different types named Validators
:
$ cargo test
Compiling cosmos-sdk-proto v0.8.0
error[E0428]: the name `Validators` is defined multiple times
--> cosmos-sdk-proto/src/prost/cosmos.staking.v1beta1.rs:1115:5
|
1109 | pub struct Validators {
| --------------------- previous definition of the type `Validators` here
...
1115 | pub enum Validators {
| ^^^^^^^^^^^^^^^^^^^ `Validators` redefined here
|
= note: `Validators` must be defined only once in the type namespace of this module
The interim solution is to hand-edit the generated code to be:
pub struct StakeAuthorizationValidators
pub enum IsStakeAuthorizationValidators
Ideally this would get resolved in the upstream cosmos-sdk protos so the names don't clash in the generated code.
If that isn't going to happen, we might need to look into something like auto-applying a patch to the generated code to handle renaming the files.
To call gRPC methods from browsers with grpc-web
using webassembly, we need to disable transport
feature of tonic
which is not currently exposed in cosmos-sdk-proto
.
MsgTransfer
impl-s MessageExt
, the function from_any
of which requires impl of TypeUrl
.
Not sure if this is on purpose, right now with 0.14.0, I cannot do MsgTransfer::from_any
.
I'm testing running a program to extract data from cosmos hub and got an error when parsing a transaction;
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: invalid type URL for public key: /cosmos.crypto.multisig.LegacyAminoPubKey
Caused by:
cryptographic error
Location:
/home/andy/.cargo/registry/src/github.com-1ecc6299db9ec823/cosmrs-0.2.1/src/crypto/public_key.rs:118:22', src/main.rs:46:79
This can be reproduced running this repo https://github.com/andynog/cosmrs-tx-example
The transaction causing the issue is https://www.mintscan.io/cosmos/txs/E4AD2D2B27CB57AA2B273F4E872B3BC83D9E189B670AAEFDB50A790974D18FE1
and the information about the tx from the RPC endpoint is: (the tx base64 encoded is at the end)
{
"jsonrpc": "2.0",
"id": -1,
"result": {
"hash": "E4AD2D2B27CB57AA2B273F4E872B3BC83D9E189B670AAEFDB50A790974D18FE1",
"height": "5258498",
"index": 0,
"tx_result": {
"code": 0,
"data": "CgYKBHNlbmQ=",
"log": "[{\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"send\"},{\"key\":\"sender\",\"value\":\"cosmos16plylpsgxechajltx9yeseqexzdzut9g8vla4k\"},{\"key\":\"module\",\"value\":\"bank\"}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"cosmos13pmeycgs4snkpyplwz3t8vfaupj2sya62z6k49\"},{\"key\":\"sender\",\"value\":\"cosmos16plylpsgxechajltx9yeseqexzdzut9g8vla4k\"},{\"key\":\"amount\",\"value\":\"1900000000uatom\"}]}]}]",
"info": "",
"gas_wanted": "200000",
"gas_used": "102272",
"events": [
{
"type": "transfer",
"attributes": [
{
"key": "cmVjaXBpZW50",
"value": "Y29zbW9zMTd4cGZ2YWttMmFtZzk2MnlsczZmODR6M2tlbGw4YzVsc2VycXRh",
"index": true
},
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
},
{
"key": "YW1vdW50",
"value": "MjUwMDB1YXRvbQ==",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "YWN0aW9u",
"value": "c2VuZA==",
"index": true
}
]
},
{
"type": "transfer",
"attributes": [
{
"key": "cmVjaXBpZW50",
"value": "Y29zbW9zMTNwbWV5Y2dzNHNua3B5cGx3ejN0OHZmYXVwajJzeWE2Mno2azQ5",
"index": true
},
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
},
{
"key": "YW1vdW50",
"value": "MTkwMDAwMDAwMHVhdG9t",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "bW9kdWxl",
"value": "YmFuaw==",
"index": true
}
]
}
],
"codespace": ""
},
"tx": "CpYBCpMBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnMKLWNvc21vczE2cGx5bHBzZ3hlY2hhamx0eDl5ZXNlcWV4emR6dXQ5Zzh2bGE0axItY29zbW9zMTNwbWV5Y2dzNHNua3B5cGx3ejN0OHZmYXVwajJzeWE2Mno2azQ5GhMKBXVhdG9tEgoxOTAwMDAwMDAwEtMDCroDCpgDCikvY29zbW9zLmNyeXB0by5tdWx0aXNpZy5MZWdhY3lBbWlub1B1YktleRLqAggDEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohAxbrmb4nOS4lje2D3BN45Qes8btyb6QHFn5wlGGzpjHLEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA2Pe6/E9MKmEDyddAZEfPgXz+1+IVU9Ssu9TTc4GsdpZEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohAy4lPPghTz1GbtKWuZGYIa5mgYBskbPCBjpFqLhc5+EVEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohAyb/0SvRFfJgo3Hy8JvykobkyWgce8EJ9GBMgu2C1tIyEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA0OjtIUCFJM3AobJ9HJTWKP9RZV2+WPcwVjLgsAidrZ/EhsSGQoFCAUSAcgSBAoCCH8SBAoCCH8SBAoCCH8YCxIUCg4KBXVhdG9tEgUyNTAwMBDAmgwaxgEKQI0PpGe+CH/OOwB88URkLXUzmyPVx6pNSGsn6uU3JhvKayaX20ptWCk/eCkPI/mTqaAcCCsmOR0wfOKK2SCSkvAKQFUwlZFWm9RAH4LEFNxIvROpmuWLi2mxGr3qfAVFHxPuVUAAzujseJEM63+3oJwzA4K1hOJezJVfdyPJsY3ASVYKQDVh/powvND7m4/I75SyuNVFfZaR/PMfcD/5xqXXe+DaNCV+Er4K8+sZoOuH8stVKt8w/sLFmRn0SYu0xdQljBE="
}
}
Upgrade to cosmos v0.3
, and now when trying to parse a tx
I'm getting a signature error
This line is where the error is thrown https://github.com/andynog/cosmrs-tx-example/blob/0f25f3e00cfbff3367e451098809d9739d3c77ca/src/main.rs#L52
When running I get:
Getting messages for transactions in height 5258498
Error converting tx: Block 5258498 - Height "E4AD2D2B27CB57AA2B273F4E872B3BC83D9E189B670AAEFDB50A790974D18FE1" - Error: signature error
Location:
/rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/result.rs:1915:27
the TxResponse
has a tx
property that is an Option<Any>
, so I try to get the value as bytes
let tx_result = Tx::from_bytes(tx.value.as_slice());
So it is most likely failing to decode the bytes into the Tx proto in the code below ?
impl TryFrom<&[u8]> for Tx {
type Error = ErrorReport;
fn try_from(bytes: &[u8]) -> Result<Tx> {
proto::cosmos::tx::v1beta1::Tx::decode(bytes)?.try_into()
}
}
Here's the transactions details (with bytes at the end):
{
"jsonrpc": "2.0",
"id": -1,
"result": {
"hash": "E4AD2D2B27CB57AA2B273F4E872B3BC83D9E189B670AAEFDB50A790974D18FE1",
"height": "5258498",
"index": 0,
"tx_result": {
"code": 0,
"data": "CgYKBHNlbmQ=",
"log": "[{\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"send\"},{\"key\":\"sender\",\"value\":\"cosmos16plylpsgxechajltx9yeseqexzdzut9g8vla4k\"},{\"key\":\"module\",\"value\":\"bank\"}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"cosmos13pmeycgs4snkpyplwz3t8vfaupj2sya62z6k49\"},{\"key\":\"sender\",\"value\":\"cosmos16plylpsgxechajltx9yeseqexzdzut9g8vla4k\"},{\"key\":\"amount\",\"value\":\"1900000000uatom\"}]}]}]",
"info": "",
"gas_wanted": "200000",
"gas_used": "102272",
"events": [
{
"type": "transfer",
"attributes": [
{
"key": "cmVjaXBpZW50",
"value": "Y29zbW9zMTd4cGZ2YWttMmFtZzk2MnlsczZmODR6M2tlbGw4YzVsc2VycXRh",
"index": true
},
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
},
{
"key": "YW1vdW50",
"value": "MjUwMDB1YXRvbQ==",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "YWN0aW9u",
"value": "c2VuZA==",
"index": true
}
]
},
{
"type": "transfer",
"attributes": [
{
"key": "cmVjaXBpZW50",
"value": "Y29zbW9zMTNwbWV5Y2dzNHNua3B5cGx3ejN0OHZmYXVwajJzeWE2Mno2azQ5",
"index": true
},
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
},
{
"key": "YW1vdW50",
"value": "MTkwMDAwMDAwMHVhdG9t",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "c2VuZGVy",
"value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
"index": true
}
]
},
{
"type": "message",
"attributes": [
{
"key": "bW9kdWxl",
"value": "YmFuaw==",
"index": true
}
]
}
],
"codespace": ""
},
"tx": "CpYBCpMBChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnMKLWNvc21vczE2cGx5bHBzZ3hlY2hhamx0eDl5ZXNlcWV4emR6dXQ5Zzh2bGE0axItY29zbW9zMTNwbWV5Y2dzNHNua3B5cGx3ejN0OHZmYXVwajJzeWE2Mno2azQ5GhMKBXVhdG9tEgoxOTAwMDAwMDAwEtMDCroDCpgDCikvY29zbW9zLmNyeXB0by5tdWx0aXNpZy5MZWdhY3lBbWlub1B1YktleRLqAggDEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohAxbrmb4nOS4lje2D3BN45Qes8btyb6QHFn5wlGGzpjHLEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA2Pe6/E9MKmEDyddAZEfPgXz+1+IVU9Ssu9TTc4GsdpZEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohAy4lPPghTz1GbtKWuZGYIa5mgYBskbPCBjpFqLhc5+EVEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohAyb/0SvRFfJgo3Hy8JvykobkyWgce8EJ9GBMgu2C1tIyEkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA0OjtIUCFJM3AobJ9HJTWKP9RZV2+WPcwVjLgsAidrZ/EhsSGQoFCAUSAcgSBAoCCH8SBAoCCH8SBAoCCH8YCxIUCg4KBXVhdG9tEgUyNTAwMBDAmgwaxgEKQI0PpGe+CH/OOwB88URkLXUzmyPVx6pNSGsn6uU3JhvKayaX20ptWCk/eCkPI/mTqaAcCCsmOR0wfOKK2SCSkvAKQFUwlZFWm9RAH4LEFNxIvROpmuWLi2mxGr3qfAVFHxPuVUAAzujseJEM63+3oJwzA4K1hOJezJVfdyPJsY3ASVYKQDVh/powvND7m4/I75SyuNVFfZaR/PMfcD/5xqXXe+DaNCV+Er4K8+sZoOuH8stVKt8w/sLFmRn0SYu0xdQljBE="
}
}
Hi,
Would it be possible to strip out the core logic so people can compile this to be used within a cosmwasm contract?
The use case is so that people can use the cosmos stargate protobuf messages.
I could also do it if someone could tell me how it can be done.
Summary, can we please get a release target for wasm32-unknown-unknown of just a vanilla repo without the network dependencies
I found that we can add some tags on generated struct during compilation.
Why don't we add attributes at build time like below?
let mut config = prost_build::Config::new();
config.type_attribute(".", "#[derive(Serialize)]");
config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]");
By default, we're only building client-side gRPC files:
cosmos-rust/proto-build/src/main.rs
Lines 212 to 213 in 388b18b
Towards providing support for both client-side and server-side implementations, shall we consider adding a cmd-line argument to enable compilation of server-side files?
This feature is needed in a mock chain implementation by @CharlyCst, comment below:
I was about to open an issue for a feature request, but it seems that it would be more appropriate to post it here:
I'm building a mock node for testing purpose and I rely on ibc-proto
for proto definitions, however proto-compiler
only builds client-related definitions (see this line). For now I simply forked the crate but I would very much appreciate having all the definitions in a single place.
I'm not very familiar with ibc-proto
and the needs of the cosmos ecosystem in general, but if someone is willing to provide some guidance I can help on moving thins forward.
Originally posted by @CharlyCst in https://github.com/informalsystems/ibc-rs/issues/425#issuecomment-735920505
It would be good to be able to pre-calculate txhash
from TxRaw
.
Alternatively.. if smbd can guide on how to do that based on Block.data
iteration that contains individual trxs in the form of Vec<u8>
- would be grateful.
It took me some time to figure out what was missing, since the rust error complains about a file/directory.
thread 'main' panicked at 'exit status missing: Os { code: 2, kind: NotFound, message: "No such file or directory" }', proto-build/src/main.rs:134:10
I am on linux so I installed buf via npm and updated main.rs to run "npx buf" instead of "buf".
npm install @bufbuild/buf
run_cmd(
"npx",
vec![
"buf",
"generate",
"--template",
"buf.wasmd.gen.yaml",
"--include-imports",
"-o",
&out_dir.display().to_string(),
&proto_path.display().to_string(),
],
);
For convenience it would be great to have a README.md that mentions the requirements.
Otherwise good work!
Best regards,
Philipp-Sc
As it stands there is very little documentation surrounding the SigningKey trait and the way you are supposed to use it with Bip32. I think a very common use case would be generating this from a mnemonic string, and as it stands there is no obvious way to go about that. An example of doing that would likely be very helpful for many.
After we got the cosmos_sdk
crate, I was somewhat disappointed to discover that it's locked into using an underscore, which is somewhat annoying given it doesn't match cosmos-sdk-proto
.
Additionally, the cosmos-sdk-rs
branding isn't great in many ways: it implements a minute amount of functionality of the actual Go cosmos-sdk
. Given that I think it inevitably sets a user up for disappointment when they're looking for a full-blown analog of the upstream Go library.
I've been wondering if a pithier name for a "Cosmos Rust Support Library" might be appropriate. The name I've been batting around in my head is "cosmrs", as in cosmos + rs. I think it also pairs nicely with CosmWasm.
WDYT?
Hej frens, I'm currently bootstrapping a rust crate for Osmosis very much in the same fashion of this crate, done so for Terra over the last months but that might be less relevant now. I'm finding myself recreating the infrastructure for proto generation, prost extensions and mapping of domain types to proto types.
Wanted to pose an open-ended question as to what could potentially extracted/shared from this repo to be used across app chain crates?
The cosmos-sdk repo since v0.46.0 no longer includes a third_party/proto
folder. Instead, it uses a buf.yml
config file to define dependencies. However, proto-build does not support this; executing cargo run
now results in the following error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: gogoproto/gogo.proto: File not found.\ngoogle/protobuf/any.proto:35:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\ngoogle/api/annotations.proto: File not found.\ncosmos_proto/cosmos.proto: File not found.\ncosmos/auth/v1beta1/auth.proto:4:1: Import \"cosmos_proto/cosmos.proto\" was not found or had errors.\ncosmos/auth/v1beta1/auth.proto:5:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\ncosmos/auth/v1beta1/auth.proto:6:1: Import \"google/protobuf/any.proto\" was not found or had errors.\ncosmos/auth/v1beta1/auth.proto:21:3: \"google.protobuf.Any\" is not defined.\ncosmos/auth/v1beta1/query.proto:5:1: Import \"gogoproto/gogo.proto\" was not found or had errors.\ncosmos/auth/v1beta1/query.proto:6:1: Import \"google/protobuf/any.proto\" was not found or had errors.\ncosmos/auth/v1beta1/query.proto:7:1: Import \"google/api/annotations.proto\" was not found or had errors.\ncosmos/auth/v1beta1/query.proto:8:1: Import \"cosmos/auth/v1beta1/auth.proto\" was not found or had errors.\ncosmos/auth/v1beta1/query.proto:9:1: Import \"cosmos_proto/cosmos.proto\" was not found or had errors.\ncosmos/auth/v1beta1/query.proto:86:12: \"google.protobuf.Any\" is not defined.\ncosmos/auth/v1beta1/query.proto:104:3: \"google.protobuf.Any\" is not defined.\ncosmos/auth/v1beta1/query.proto:113:3: \"Params\" is not defined.\ncosmos/auth/v1beta1/query.proto:125:12: \"google.protobuf.Any\" is not defined.\ncosmos/auth/v1beta1/query.proto:135:3: \"google.protobuf.Any\" is not defined.\n" }', proto-build/src/main.rs:254:10
Apparently, it cannot locate the gogoproto dependency.
I do not know a good solution to this. Any suggestion?
I think this is likely related to Proto-build fails for SDK 0.46
#318 due to the recent proto changes.
docker run fullstorydev/grpcurl osmosis-grpc.lavenderfive.com:443 cosmos.base.tendermint.v1beta1.Service/GetNodeInfo
works, but using cosmos-rust I get
status: Unknow, message: "transport error"
code:
cosmos_sdk_proto::cosmos::base::tendermint::v1beta1::service_client::ServiceClient::new(c).get_node_info(GetNodeInfoRequest{}).await
full code can be found here
I will wait until #318 is fixed, if the issue persists there is something else going on.
The authz module was added in c9ab844, however it was not added to the lib.rs so as to be able to import it. This issue should add it into the cosmos parent module (https://github.com/cosmos/cosmos-rust/blob/main/cosmos-sdk-proto/src/lib.rs#L15) similarly to:
/// Granting of arbitrary privileges from one account to another.
pub mod authz {
pub mod v1beta1 {
include!("prost/cosmos.authz.v1beta1.rs");
}
}
How's it going.
We have to make a design decision for our module to use Rust or Go. We would like to use Rust for many reasons.
Two questions:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.