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

gRPC blanket implementation from ibc-rs #125

Merged
merged 57 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
dc3f021
impl ValidationContext trait
rnbguy Aug 24, 2023
a22729f
from AnyConsensus to Any
rnbguy Aug 24, 2023
5c92a49
update imports
rnbguy Aug 24, 2023
61ff653
use ibc-rs services
rnbguy Aug 24, 2023
d5a6443
disable local services
rnbguy Aug 24, 2023
b303c5c
make linter happy
rnbguy Aug 24, 2023
2a676d1
update ibc rev
rnbguy Aug 24, 2023
4ffdd22
remove false errors
rnbguy Aug 24, 2023
1c26d4b
fix failing grpc call
rnbguy Aug 24, 2023
7a28e4c
minor refactor and comment
rnbguy Aug 25, 2023
e86e5d8
resolve clippy lints
rnbguy Aug 28, 2023
6a1a3b1
cargo fmt and clippy
rnbguy Aug 28, 2023
2c2037f
add impl for ProvableContext
rnbguy Aug 29, 2023
3c9c14b
use crate constant over local constant
rnbguy Aug 29, 2023
d3cf93a
add docs
rnbguy Aug 29, 2023
537ce1d
latest rev of ibc-rs
rnbguy Aug 29, 2023
1184223
fix compilation
rnbguy Aug 29, 2023
3832f51
fix unreceived_packets
rnbguy Aug 29, 2023
4e4e11b
update packet ack query
rnbguy Sep 1, 2023
0f42bbe
update todo comments
rnbguy Sep 1, 2023
04b549e
merge changes for store crate
rnbguy Sep 1, 2023
5dca4c7
import trait
rnbguy Sep 1, 2023
4053dd2
todo for revertible store
rnbguy Sep 1, 2023
69b21d4
ignore empty commitments
rnbguy Sep 1, 2023
003ef1b
ignore empty acknowledgement commitments
rnbguy Sep 1, 2023
9902336
rm leftover files from merge
rnbguy Sep 1, 2023
4703d34
latest ibc-rs rev
rnbguy Sep 4, 2023
8e67b9a
handle empty sequence list
rnbguy Sep 4, 2023
a62c05d
update comments
rnbguy Sep 5, 2023
4b8f07b
remove redundant conversions
rnbguy Sep 5, 2023
0079cf2
remove few more conversions
rnbguy Sep 5, 2023
d44842f
latest ibc-rs rev
rnbguy Sep 5, 2023
d4715ef
polish comments
rnbguy Sep 5, 2023
5bbb140
rm old service module
rnbguy Sep 7, 2023
120c330
latest ibc-rs rev
rnbguy Sep 7, 2023
30c44be
update import paths
rnbguy Sep 7, 2023
f226faa
more grpcurl tests
rnbguy Sep 7, 2023
d0bede2
latest ibc-rs rev
rnbguy Sep 7, 2023
f5b26c1
upgrade client before grpcurl tests
rnbguy Sep 7, 2023
694d8c3
fix prefix path
rnbguy Sep 7, 2023
cdfd9df
rm removed trait method
rnbguy Sep 7, 2023
e9df0f0
polish imports
rnbguy Sep 7, 2023
dab5c1c
update trait impl
rnbguy Sep 14, 2023
f915596
latest ibc-rs rev
rnbguy Sep 14, 2023
5f00ac3
suppress client params query
rnbguy Sep 14, 2023
3464b78
cargo fmt
rnbguy Sep 14, 2023
2596b61
correct param names
rnbguy Sep 15, 2023
9d39c64
rm redundant default feature
rnbguy Sep 15, 2023
aa03b60
update import paths
rnbguy Sep 15, 2023
8976bad
latest ibc-rs rev
rnbguy Sep 15, 2023
d3fb9ee
ibc-rs rev from main
rnbguy Sep 15, 2023
8eac9d9
bump ibc-proto to satisfy deps
rnbguy Sep 15, 2023
7edb847
update ExecutionContext trait impl
rnbguy Sep 15, 2023
29ff4cf
add changelog entry
rnbguy Sep 15, 2023
fdee814
fix client_status by using Arc
rnbguy Sep 15, 2023
78a17dd
turn on ClientStatus test
rnbguy Sep 15, 2023
287f3a6
update Cargo.lock
rnbguy Sep 15, 2023
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Support gRPC services via IBC-rs trait implementation
([\#125](https://github.com/informalsystems/basecoin-rs/pull/125))
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ base64 = { version = "0.21", default-features = false, features = ["alloc"] }
displaydoc = { version = "0.2", default-features = false }
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display"] }
ed25519 = { version = "2.1.0", default-features = false }
ibc = { git = "https://github.com/cosmos/ibc-rs.git", rev= "6ffe8ce" }
ibc-proto = { version = "0.34.0", default-features = false }
ibc = { git = "https://github.com/cosmos/ibc-rs.git", rev= "c17ff9d", features = ["grpc"] }
ibc-proto = { version = "0.34.1", default-features = false }
ics23 = { version = "0.10.1", default-features = false }
prost = { version = "0.11.6", default-features = false }
serde = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ upgrade-client: create-channel
bash ~/tests/upgrade-client.sh
@echo "Client upgraded"

grpc-service: create-channel
grpc-service: upgrade-client
@echo "Testing gRPC services..."
bash ~/tests/grpc-service.sh
@echo "gRPC services working"
144 changes: 142 additions & 2 deletions ci/tests/grpc-service.sh
Original file line number Diff line number Diff line change
@@ -1,50 +1,190 @@
#!/bin/bash
set -euo pipefail

echo "Testing grpc service using grpcurl..."
echo "Testing gRPC service using grpcurl..."

# list services via gRPC reflection
echo "List Client services via gRPC reflection."
grpcurl -plaintext localhost:9093 list ibc.core.client.v1.Query
echo "List Connection services via gRPC reflection."
grpcurl -plaintext localhost:9093 list ibc.core.connection.v1.Query
echo "List Channel services via gRPC reflection."
grpcurl -plaintext localhost:9093 list ibc.core.channel.v1.Query

# client services
echo "ibc.core.client.v1.Query/ClientState"
grpcurl -plaintext -d @ localhost:9093 ibc.core.client.v1.Query/ClientState <<EOM
{
"client_id": "07-tendermint-0"
}
EOM
echo "ibc.core.client.v1.Query/ClientStates"
grpcurl -plaintext localhost:9093 ibc.core.client.v1.Query/ClientStates
grpcurl -plaintext localhost:9093 ibc.core.client.v1.Query/ConsensusStates
echo "ibc.core.client.v1.Query/ConsensusState"
grpcurl -plaintext -d @ localhost:9093 ibc.core.client.v1.Query/ConsensusState <<EOM
{
"client_id": "07-tendermint-0",
"latest_height": true
}
EOM
echo "ibc.core.client.v1.Query/ConsensusStates"
grpcurl -plaintext -d @ localhost:9093 ibc.core.client.v1.Query/ConsensusStates <<EOM
{
"client_id": "07-tendermint-0"
}
EOM
echo "ibc.core.client.v1.Query/ConsensusStateHeights"
grpcurl -plaintext -d @ localhost:9093 ibc.core.client.v1.Query/ConsensusStateHeights <<EOM
{
"client_id": "07-tendermint-0"
}
EOM
echo "ibc.core.client.v1.Query/ClientStatus"
grpcurl -plaintext -d @ localhost:9093 ibc.core.client.v1.Query/ClientStatus <<EOM
{
"client_id": "07-tendermint-0"
}
EOM
# echo "ibc.core.client.v1.Query/ClientParams"
# TODO(rano): it is unimplemented
# grpcurl -plaintext localhost:9093 ibc.core.client.v1.Query/ClientParams
echo "ibc.core.client.v1.Query/UpgradedClientState"
grpcurl -plaintext localhost:9093 ibc.core.client.v1.Query/UpgradedClientState
echo "ibc.core.client.v1.Query/UpgradedConsensusState"
grpcurl -plaintext localhost:9093 ibc.core.client.v1.Query/UpgradedConsensusState


# connection services
echo "ibc.core.connection.v1.Query/Connection"
grpcurl -plaintext -d @ localhost:9093 ibc.core.connection.v1.Query/Connection <<EOM
{
"connection_id": "connection-0"
}
EOM
echo "ibc.core.connection.v1.Query/Connections"
grpcurl -plaintext localhost:9093 ibc.core.connection.v1.Query/Connections
echo "ibc.core.connection.v1.Query/ClientConnections"
grpcurl -plaintext -d @ localhost:9093 ibc.core.connection.v1.Query/ClientConnections <<EOM
{
"client_id": "07-tendermint-0"
}
EOM
echo "ibc.core.connection.v1.Query/ConnectionClientState"
grpcurl -plaintext -d @ localhost:9093 ibc.core.connection.v1.Query/ConnectionClientState <<EOM
{
"connection_id": "connection-0"
}
EOM
# need valid revision height
# echo "ibc.core.connection.v1.Query/ConnectionConsensusState"
# grpcurl -plaintext -d @ localhost:9093 ibc.core.connection.v1.Query/ConnectionConsensusState <<EOM
# {
# "connection_id": "connection-0",
# "revision_number": 0,
# "revision_height": ?
# }
# EOM
echo "ibc.core.connection.v1.Query/ConnectionParams"
grpcurl -plaintext localhost:9093 ibc.core.connection.v1.Query/ConnectionParams

# channel services
echo "ibc.core.channel.v1.Query/Channel"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/Channel <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0"
}
EOM
echo "ibc.core.channel.v1.Query/Channels"
grpcurl -plaintext localhost:9093 ibc.core.channel.v1.Query/Channels
echo "ibc.core.channel.v1.Query/ConnectionChannels"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/ConnectionChannels <<EOM
{
"connection": "connection-0"
}
EOM
echo "ibc.core.channel.v1.Query/ChannelClientState"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/ChannelClientState <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0"
}
EOM
# need valid revision height
# echo "ibc.core.channel.v1.Query/ChannelConsensusState"
# grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/ChannelConsensusState <<EOM
# {
# "port_id": "transfer",
# "channel_id": "channel-0",
# "revision_number": 0,
# "revision_height": ?
# }
# EOM
echo "ibc.core.channel.v1.Query/PacketCommitments"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/PacketCommitments <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0"
}
EOM
# need a valid packet sequence
# echo "ibc.core.channel.v1.Query/PacketCommitment"
# grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/PacketCommitment <<EOM
# {
# "port_id": "transfer",
# "channel_id": "channel-0",
# "sequence": ?
# }
# EOM
# echo "ibc.core.channel.v1.Query/PacketReceipt"
# grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/PacketReceipt <<EOM
# {
# "port_id": "transfer",
# "channel_id": "channel-0",
# "sequence": ?
# }
# EOM
# echo "ibc.core.channel.v1.Query/PacketAcknowledgement"
# grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/PacketAcknowledgement <<EOM
# {
# "port_id": "transfer",
# "channel_id": "channel-0",
# "sequence": ?
# }
# EOM
echo "ibc.core.channel.v1.Query/PacketAcknowledgements"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/PacketAcknowledgements <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0",
"packet_commitment_sequences": []
}
EOM
echo "ibc.core.channel.v1.Query/UnreceivedPackets"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/UnreceivedPackets <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0",
"packet_commitment_sequences": []
}
EOM
echo "ibc.core.channel.v1.Query/UnreceivedAcks"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/UnreceivedAcks <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0",
"packet_ack_sequences": []
}
EOM
echo "ibc.core.channel.v1.Query/NextSequenceReceive"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/NextSequenceReceive <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0"
}
EOM
echo "ibc.core.channel.v1.Query/NextSequenceSend"
grpcurl -plaintext -d @ localhost:9093 ibc.core.channel.v1.Query/NextSequenceSend <<EOM
{
"port_id": "transfer",
"channel_id": "channel-0"
Expand Down
8 changes: 6 additions & 2 deletions crates/app/src/abci/v0_37/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use cosmrs::Tx;
use ibc::Any;
use prost::Message;
use serde_json::Value;
use std::fmt::Debug;
use std::fmt::{Debug, Write};
use tracing::{debug, info};

use tendermint_proto::v0_37::abci::response_process_proposal;
Expand Down Expand Up @@ -269,7 +269,11 @@ pub fn commit<S: Default + ProvableStore>(app: &BaseCoinApp<S>) -> ResponseCommi
info!(
"Committed height {} with hash({})",
state.current_height() - 1,
data.iter().map(|b| format!("{b:02X}")).collect::<String>()
data.iter().fold(String::new(), |mut acc, b| {
// write!-ing into a String can never fail
let _ = write!(acc, "{b:02X}");
acc
})
);
ResponseCommit {
data: data.into(),
Expand Down
Loading
Loading