Skip to content

Commit 83a460a

Browse files
Tracks ibc-rs changes up to v0.48.1 (#144)
* chore: tracks ibc-rs pr 970 * chore: track changes in ibc-rs pr 975 * deps: update ibc-rs rev * deps: bump ibc-re rev * deps: update ibc-rs rev * deps: bump ibc-rs rev * deps: bump ibc-rs rev * deps: bump ibc-rs to v0.48.0 * chore: update ibc-rs rev * deps: bump ibc-rs rev * chore: set ibc-rs version to v0.48.1
1 parent dc4f039 commit 83a460a

File tree

16 files changed

+704
-454
lines changed

16 files changed

+704
-454
lines changed

Cargo.lock

Lines changed: 591 additions & 349 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ base64 = { version = "0.21", default-features = false, features = ["alloc"] }
1212
displaydoc = { version = "0.2", default-features = false }
1313
derive_more = { version = "0.99.17", default-features = false, features = ["from", "into", "display"] }
1414
ed25519 = { version = "2.1.0", default-features = false }
15-
ibc = "0.47.0"
16-
ibc-query = "0.47.0"
15+
ibc = { version = "0.48.1", default-features = false }
16+
ibc-query = { version = "0.48.1", default-features = false }
1717
ibc-proto = { version = "0.38.0", default-features = false }
1818
ics23 = { version = "0.11", default-features = false }
1919
prost = { version = "0.12", default-features = false }
@@ -25,7 +25,3 @@ tendermint-abci = "0.34"
2525
tendermint-proto = "0.34"
2626
tendermint-rpc = "0.34"
2727
tracing = "0.1.26"
28-
29-
[patch.crates-io]
30-
ibc = { git = "https://github.com/cosmos/ibc-rs" , rev = "527bb14" }
31-
ibc-query = { git = "https://github.com/cosmos/ibc-rs" , rev = "527bb14" }

crates/app/src/abci/v0_37/impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use basecoin_store::utils::SharedRwExt;
99
use cosmrs::tx::SignerInfo;
1010
use cosmrs::tx::SignerPublicKey;
1111
use cosmrs::Tx;
12-
use ibc::proto::Any;
12+
use ibc::primitives::proto::Any;
1313
use prost::Message;
1414
use serde_json::Value;
1515
use std::fmt::{Debug, Write};

crates/app/src/modules/gov/impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use basecoin_store::impls::SharedStore;
1212
use basecoin_store::types::{Height, Path, ProtobufStore, TypedStore};
1313
use basecoin_store::utils::{SharedRw, SharedRwExt};
1414

15-
use ibc::hosts::tendermint::upgrade_proposal::upgrade_client_proposal_handler;
16-
use ibc::hosts::tendermint::upgrade_proposal::UpgradeProposal;
15+
use ibc::cosmos_host::upgrade_proposal::upgrade_client_proposal_handler;
16+
use ibc::cosmos_host::upgrade_proposal::UpgradeProposal;
1717
use ibc_proto::cosmos::gov::v1beta1::query_server::QueryServer;
1818
use ibc_proto::google::protobuf::Any;
1919
use ibc_proto::Protobuf;

crates/app/src/modules/ibc/client_contexts.rs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ use super::impls::{AnyConsensusState, IbcContext};
33
use basecoin_store::context::Store;
44
use basecoin_store::types::Height;
55

6-
use ibc::clients::ics07_tendermint::client_state::ClientState as TmClientState;
7-
use ibc::clients::ics07_tendermint::consensus_state::ConsensusState as TmConsensusState;
8-
use ibc::clients::ics07_tendermint::{CommonContext, ValidationContext as TmValidationContext};
9-
use ibc::core::ics02_client::error::ClientError;
10-
use ibc::core::ics02_client::{ClientExecutionContext, ClientValidationContext};
11-
use ibc::core::ics24_host::identifier::ClientId;
12-
use ibc::core::ics24_host::path::{ClientConsensusStatePath, ClientStatePath, Path};
13-
use ibc::core::timestamp::Timestamp;
14-
use ibc::core::{ContextError, ValidationContext};
15-
use ibc::Height as IbcHeight;
6+
use ibc::clients::tendermint::client_state::ClientState as TmClientState;
7+
use ibc::clients::tendermint::consensus_state::ConsensusState as TmConsensusState;
8+
use ibc::clients::tendermint::context::{CommonContext, ValidationContext as TmValidationContext};
9+
use ibc::core::client::context::{ClientExecutionContext, ClientValidationContext};
10+
use ibc::core::client::types::error::ClientError;
11+
use ibc::core::client::types::Height as IbcHeight;
12+
use ibc::core::handler::types::error::ContextError;
13+
use ibc::core::host::types::identifiers::ClientId;
14+
use ibc::core::host::types::path::{ClientConsensusStatePath, ClientStatePath, Path};
15+
use ibc::core::host::ValidationContext;
16+
use ibc::primitives::Timestamp;
1617

1718
use std::fmt::Debug;
1819

@@ -198,7 +199,10 @@ where
198199
}
199200
})
200201
.map(|consensus_path| {
201-
let height = IbcHeight::new(consensus_path.epoch, consensus_path.height)?;
202+
let height = IbcHeight::new(
203+
consensus_path.revision_number,
204+
consensus_path.revision_height,
205+
)?;
202206
Ok(height)
203207
})
204208
.collect()
@@ -212,7 +216,7 @@ where
212216
fn next_consensus_state(
213217
&self,
214218
client_id: &ClientId,
215-
height: &ibc::Height,
219+
height: &IbcHeight,
216220
) -> Result<Option<Self::AnyConsensusState>, ContextError> {
217221
let path = format!("clients/{client_id}/consensusStates")
218222
.try_into()
@@ -221,7 +225,7 @@ where
221225
let keys = self.store.get_keys(&path);
222226
let found_path = keys.into_iter().find_map(|path| {
223227
if let Ok(Path::ClientConsensusState(path)) = Path::try_from(path) {
224-
if height > &ibc::Height::new(path.epoch, path.height).unwrap() {
228+
if height > &IbcHeight::new(path.revision_number, path.revision_height).unwrap() {
225229
return Some(path);
226230
}
227231
}
@@ -246,7 +250,7 @@ where
246250
fn prev_consensus_state(
247251
&self,
248252
client_id: &ClientId,
249-
height: &ibc::Height,
253+
height: &IbcHeight,
250254
) -> Result<Option<Self::AnyConsensusState>, ContextError> {
251255
let path = format!("clients/{client_id}/consensusStates")
252256
.try_into()
@@ -255,7 +259,7 @@ where
255259
let keys = self.store.get_keys(&path);
256260
let pos = keys.iter().position(|path| {
257261
if let Ok(Path::ClientConsensusState(path)) = Path::try_from(path.clone()) {
258-
height >= &ibc::Height::new(path.epoch, path.height).unwrap()
262+
height >= &IbcHeight::new(path.revision_number, path.revision_height).unwrap()
259263
} else {
260264
false
261265
}

crates/app/src/modules/ibc/error.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
use ibc::core::handler::types::error::ContextError;
2+
13
pub use crate::types::error::Error as AppError;
2-
use ibc::core::RouterError;
34

4-
pub type Error = RouterError;
5+
pub type Error = ContextError;
56

67
impl From<Error> for AppError {
78
fn from(e: Error) -> Self {

crates/app/src/modules/ibc/impls.rs

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,45 @@ use basecoin_store::{
1515
};
1616
use cosmrs::AccountId;
1717
use derive_more::{From, TryInto};
18+
use ibc::apps::transfer::handler::send_transfer;
19+
use ibc::clients::tendermint::client_state::ClientState as TmClientState;
20+
use ibc::clients::tendermint::consensus_state::ConsensusState as TmConsensusState;
21+
use ibc::clients::tendermint::types::ConsensusState as ConsensusStateType;
22+
use ibc::core::client::context::consensus_state::ConsensusState;
23+
use ibc::core::client::types::Height as IbcHeight;
24+
use ibc::core::commitment_types::commitment::{CommitmentPrefix, CommitmentRoot};
25+
use ibc::core::entrypoint::dispatch;
26+
use ibc::core::handler::types::error::ContextError;
27+
use ibc::core::handler::types::events::IbcEvent;
28+
use ibc::core::handler::types::msgs::MsgEnvelope;
29+
use ibc::core::host::types::identifiers::Sequence;
30+
use ibc::core::host::{ExecutionContext, ValidationContext};
31+
use ibc::cosmos_host::IBC_QUERY_PATH;
32+
use ibc::primitives::{Signer, Timestamp};
1833
use ibc::{
19-
applications::transfer::{msgs::transfer::MsgTransfer, send_transfer},
20-
clients::ics07_tendermint::{
21-
client_state::ClientState as TmClientState,
22-
consensus_state::ConsensusState as TmConsensusState,
23-
},
34+
apps::transfer::types::msgs::transfer::MsgTransfer,
2435
core::{
25-
dispatch,
26-
events::IbcEvent,
27-
ics02_client::{consensus_state::ConsensusState, error::ClientError},
28-
ics03_connection::{
29-
connection::{ConnectionEnd, IdentifiedConnectionEnd},
30-
error::ConnectionError,
31-
version::Version as ConnectionVersion,
32-
},
33-
ics04_channel::{
36+
channel::types::{
3437
channel::{ChannelEnd, IdentifiedChannelEnd},
3538
commitment::{AcknowledgementCommitment, PacketCommitment},
3639
error::{ChannelError, PacketError},
37-
packet::{PacketState, Receipt, Sequence},
40+
packet::{PacketState, Receipt},
41+
},
42+
client::types::error::ClientError,
43+
connection::types::{
44+
error::ConnectionError,
45+
version::Version as ConnectionVersion,
46+
{ConnectionEnd, IdentifiedConnectionEnd},
3847
},
39-
ics23_commitment::commitment::{CommitmentPrefix, CommitmentRoot},
40-
ics24_host::{
41-
identifier::{ClientId, ConnectionId},
48+
host::types::{
49+
identifiers::{ClientId, ConnectionId},
4250
path::{
4351
AckPath, ChannelEndPath, ClientConnectionPath, ClientConsensusStatePath,
4452
ClientStatePath, CommitmentPath, ConnectionPath, Path as IbcPath, ReceiptPath,
4553
SeqAckPath, SeqRecvPath, SeqSendPath,
4654
},
4755
},
48-
timestamp::Timestamp,
49-
ContextError, ExecutionContext, MsgEnvelope, ValidationContext,
5056
},
51-
hosts::tendermint::IBC_QUERY_PATH,
52-
Height as IbcHeight, Signer,
5357
};
5458
use ibc_proto::{
5559
google::protobuf::Any,
@@ -260,7 +264,7 @@ where
260264
}
261265

262266
fn begin_block(&mut self, header: &Header) -> Vec<Event> {
263-
let consensus_state = TmConsensusState::new(
267+
let consensus_state = ConsensusStateType::new(
264268
CommitmentRoot::from_bytes(header.app_hash.as_ref()),
265269
header.time,
266270
header.next_validators_hash,
@@ -270,7 +274,7 @@ where
270274
.consensus_states
271275
.write()
272276
.expect("lock is poisoined")
273-
.insert(header.height.value(), consensus_state);
277+
.insert(header.height.value(), consensus_state.into());
274278

275279
vec![]
276280
}
@@ -405,8 +409,11 @@ where
405409
&self,
406410
client_cons_state_path: &ClientConsensusStatePath,
407411
) -> Result<Self::AnyConsensusState, ContextError> {
408-
let height = IbcHeight::new(client_cons_state_path.epoch, client_cons_state_path.height)
409-
.map_err(|_| ClientError::InvalidHeight)?;
412+
let height = IbcHeight::new(
413+
client_cons_state_path.revision_number,
414+
client_cons_state_path.revision_height,
415+
)
416+
.map_err(|_| ClientError::InvalidHeight)?;
410417
let consensus_state = self
411418
.consensus_state_store
412419
.get(Height::Pending, client_cons_state_path)
@@ -668,7 +675,10 @@ where
668675
}
669676
})
670677
.map(|consensus_path| {
671-
let height = IbcHeight::new(consensus_path.epoch, consensus_path.height)?;
678+
let height = IbcHeight::new(
679+
consensus_path.revision_number,
680+
consensus_path.revision_height,
681+
)?;
672682
let client_state = self
673683
.consensus_state_store
674684
.get(Height::Pending, &consensus_path)
@@ -704,7 +714,12 @@ where
704714
None
705715
}
706716
})
707-
.map(|consensus_path| Ok(IbcHeight::new(consensus_path.epoch, consensus_path.height)?))
717+
.map(|consensus_path| {
718+
Ok(IbcHeight::new(
719+
consensus_path.revision_number,
720+
consensus_path.revision_height,
721+
)?)
722+
})
708723
.collect::<Result<Vec<_>, _>>()
709724
}
710725

crates/app/src/modules/ibc/router.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ use crate::modules::bank::impls::BankBalanceKeeper;
22
use crate::modules::ibc::transfer::IbcTransferModule;
33

44
use basecoin_store::context::Store;
5-
use ibc::applications::transfer::MODULE_ID_STR as IBC_TRANSFER_MODULE_ID;
6-
use ibc::core::ics24_host::identifier::PortId;
7-
use ibc::core::router::{Module as IbcModule, ModuleId, Router};
8-
use ibc::core::RouterError;
5+
use ibc::apps::transfer::types::MODULE_ID_STR as IBC_TRANSFER_MODULE_ID;
6+
use ibc::core::router::module::Module as IbcModule;
7+
use ibc::core::router::router::Router;
8+
use ibc::core::router::types::error::RouterError;
9+
use ibc::core::{host::types::identifiers::PortId, router::types::module::ModuleId};
910

1011
use std::{borrow::Borrow, collections::BTreeMap, fmt::Debug};
1112

crates/app/src/modules/ibc/transfer.rs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,30 @@ use crate::modules::auth::account::ACCOUNT_PREFIX;
22
use crate::modules::bank::context::BankKeeper;
33
use crate::modules::bank::util::{Coin, Denom};
44

5-
use ibc::applications::transfer::context::cosmos_adr028_escrow_address;
6-
use ibc::applications::transfer::context::TokenTransferExecutionContext;
7-
use ibc::applications::transfer::context::TokenTransferValidationContext;
8-
use ibc::applications::transfer::context::{
5+
use ibc::apps::transfer::context::TokenTransferExecutionContext;
6+
use ibc::apps::transfer::context::TokenTransferValidationContext;
7+
use ibc::apps::transfer::module::{
98
on_acknowledgement_packet_validate, on_chan_open_ack_validate, on_chan_open_confirm_validate,
109
on_chan_open_init_execute, on_chan_open_init_validate, on_chan_open_try_execute,
1110
on_chan_open_try_validate, on_recv_packet_execute, on_timeout_packet_execute,
1211
on_timeout_packet_validate,
1312
};
14-
use ibc::applications::transfer::error::TokenTransferError;
15-
use ibc::applications::transfer::PrefixedCoin;
16-
use ibc::applications::transfer::VERSION;
17-
use ibc::core::events::IbcEvent;
18-
use ibc::core::ics04_channel::acknowledgement::Acknowledgement;
19-
use ibc::core::ics04_channel::channel::Counterparty;
20-
use ibc::core::ics04_channel::channel::Order;
21-
use ibc::core::ics04_channel::error::ChannelError;
22-
use ibc::core::ics04_channel::error::PacketError;
23-
use ibc::core::ics04_channel::packet::Packet;
24-
use ibc::core::ics04_channel::Version as ChannelVersion;
25-
use ibc::core::ics24_host::identifier::ChannelId;
26-
use ibc::core::ics24_host::identifier::ConnectionId;
27-
use ibc::core::ics24_host::identifier::PortId;
28-
use ibc::core::router::Module as IbcModule;
29-
use ibc::core::router::ModuleExtras;
30-
use ibc::Signer;
13+
use ibc::apps::transfer::types::error::TokenTransferError;
14+
use ibc::apps::transfer::types::{PrefixedCoin, VERSION};
15+
use ibc::core::channel::types::acknowledgement::Acknowledgement;
16+
use ibc::core::channel::types::channel::{Counterparty, Order};
17+
use ibc::core::channel::types::error::ChannelError;
18+
use ibc::core::channel::types::error::PacketError;
19+
use ibc::core::channel::types::packet::Packet;
20+
use ibc::core::channel::types::Version as ChannelVersion;
21+
use ibc::core::handler::types::events::IbcEvent;
22+
use ibc::core::host::types::identifiers::ChannelId;
23+
use ibc::core::host::types::identifiers::ConnectionId;
24+
use ibc::core::host::types::identifiers::PortId;
25+
use ibc::core::router::module::Module as IbcModule;
26+
use ibc::core::router::types::module::ModuleExtras;
27+
use ibc::cosmos_host::utils::cosmos_adr028_escrow_address;
28+
use ibc::primitives::Signer;
3129

3230
use core::fmt::Debug;
3331
use cosmrs::AccountId;

crates/app/src/modules/upgrade/impls.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
use ibc::core::client::types::error::UpgradeClientError;
2+
use ibc::core::commitment_types::commitment::CommitmentRoot;
3+
use ibc::core::host::types::path::UpgradeClientPath;
4+
use ibc::cosmos_host::SDK_UPGRADE_QUERY_PATH;
15
use prost::Message;
26
use std::fmt::Debug;
37
use tracing::debug;
@@ -12,16 +16,12 @@ use cosmrs::AccountId;
1216
use ibc_proto::cosmos::upgrade::v1beta1::query_server::QueryServer;
1317
use ibc_proto::google::protobuf::Any;
1418

15-
use ibc::clients::ics07_tendermint::{
16-
client_state::ClientState as TmClientState, consensus_state::ConsensusState as TmConsensusState,
17-
};
18-
use ibc::core::ics02_client::error::UpgradeClientError;
19-
use ibc::core::ics23_commitment::commitment::CommitmentRoot;
20-
use ibc::core::ics24_host::path::UpgradeClientPath;
21-
use ibc::hosts::tendermint::upgrade_proposal::UpgradeExecutionContext;
22-
use ibc::hosts::tendermint::upgrade_proposal::UpgradeValidationContext;
23-
use ibc::hosts::tendermint::upgrade_proposal::{Plan, UpgradeChain};
24-
use ibc::hosts::tendermint::SDK_UPGRADE_QUERY_PATH;
19+
use ibc::clients::tendermint::client_state::ClientState as TmClientState;
20+
use ibc::clients::tendermint::consensus_state::ConsensusState as TmConsensusState;
21+
use ibc::clients::tendermint::types::ConsensusState as ConsensusStateType;
22+
use ibc::cosmos_host::upgrade_proposal::UpgradeExecutionContext;
23+
use ibc::cosmos_host::upgrade_proposal::UpgradeValidationContext;
24+
use ibc::cosmos_host::upgrade_proposal::{Plan, UpgradeChain};
2525
use tendermint::abci::Event;
2626

2727
use tendermint::merkle::proof::ProofOp;
@@ -159,7 +159,7 @@ where
159159
// so that IBC clients can use the last NextValidatorsHash as a trusted kernel for verifying
160160
// headers on the next version of the chain.
161161
if host_height == plan.height.checked_sub(1).unwrap() {
162-
let upgraded_consensus_state = TmConsensusState {
162+
let upgraded_consensus_state = ConsensusStateType {
163163
timestamp: header.time,
164164
root: CommitmentRoot::from(vec![]),
165165
next_validators_hash: header.next_validators_hash,
@@ -170,7 +170,7 @@ where
170170

171171
self.store_upgraded_consensus_state(
172172
upgraded_cons_state_path,
173-
upgraded_consensus_state.into(),
173+
TmConsensusState::from(upgraded_consensus_state).into(),
174174
)
175175
.unwrap();
176176

@@ -326,7 +326,7 @@ where
326326
fn store_upgraded_consensus_state(
327327
&mut self,
328328
upgrade_path: UpgradeClientPath,
329-
consensus_state: Self::AnyConsensusState,
329+
consensus_state: AnyConsensusState,
330330
) -> Result<(), UpgradeClientError> {
331331
let tm_consensus_state: TmConsensusState =
332332
consensus_state

crates/app/src/modules/upgrade/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use ibc::hosts::tendermint::upgrade_proposal::Plan;
1+
use ibc::cosmos_host::upgrade_proposal::Plan;
22
use ibc_proto::cosmos::upgrade::v1beta1::Plan as RawPlan;
33
use ibc_proto::Protobuf;
44
use tendermint_rpc::{Client, HttpClient};

crates/app/src/modules/upgrade/service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use basecoin_store::types::Height;
44
use basecoin_store::types::ProtobufStore;
55
use basecoin_store::types::TypedStore;
66

7-
use ibc::clients::ics07_tendermint::consensus_state::ConsensusState as TmConsensusState;
8-
use ibc::core::ics24_host::path::UpgradeClientPath;
7+
use ibc::clients::tendermint::types::ConsensusState as TmConsensusState;
8+
use ibc::core::host::types::path::UpgradeClientPath;
99

1010
use ibc_proto::cosmos::upgrade::v1beta1::query_server::Query as UpgradeQuery;
1111
use ibc_proto::cosmos::upgrade::v1beta1::QueryAppliedPlanRequest;

0 commit comments

Comments
 (0)