From 1392187ffcf6b01e3140db51ba388937a715ea85 Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Wed, 17 Apr 2024 12:21:26 -0700 Subject: [PATCH] chore: update basecoin rev + deny unused_variables --- .cargo/config.toml | 2 +- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- .../sov-celestia/cw-contract/src/tests/mod.rs | 7 +++---- .../src/client_state/validation.rs | 2 +- modules/sov-ibc-transfer/src/context.rs | 12 +++++++----- modules/sov-ibc/Cargo.toml | 2 +- modules/sov-ibc/src/context.rs | 6 +++--- modules/sov-ibc/src/rpc/context.rs | 2 +- modules/sov-ibc/src/rpc/methods.rs | 18 ++++++++++++++---- 10 files changed, 36 insertions(+), 25 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 4f8a1e99..b6799ab2 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -18,7 +18,7 @@ ibc-primitives = { git = "https://github.com/cosmos/ibc-rs.git" ibc-query = { git = "https://github.com/cosmos/ibc-rs.git", rev = "d5e3887770" } ibc-testkit = { git = "https://github.com/cosmos/ibc-rs.git", rev = "d5e3887770" } -basecoin = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "ea1abe3" } +basecoin = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "bedac3f" } jmt = { git = "https://github.com/penumbra-zone/jmt.git", rev = "1d007e11cb68aa5ca13e9a5af4a12e6439d5f7b6" } sov-modules-api = { path = "vendor/sovereign-sdk/module-system/sov-modules-api" } diff --git a/Cargo.lock b/Cargo.lock index 420b657e..0821684a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -569,7 +569,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basecoin" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ea1abe3#ea1abe34e31d9f6dd4c54a7f60912c31332a3e48" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=bedac3f#bedac3ff77407ceb47c48700ad3ff39107f4ceb2" dependencies = [ "basecoin-app", "basecoin-modules", @@ -591,7 +591,7 @@ dependencies = [ [[package]] name = "basecoin-app" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ea1abe3#ea1abe34e31d9f6dd4c54a7f60912c31332a3e48" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=bedac3f#bedac3ff77407ceb47c48700ad3ff39107f4ceb2" dependencies = [ "basecoin-modules", "basecoin-store", @@ -610,7 +610,7 @@ dependencies = [ [[package]] name = "basecoin-modules" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ea1abe3#ea1abe34e31d9f6dd4c54a7f60912c31332a3e48" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=bedac3f#bedac3ff77407ceb47c48700ad3ff39107f4ceb2" dependencies = [ "base64 0.21.7", "basecoin-store", @@ -637,7 +637,7 @@ dependencies = [ [[package]] name = "basecoin-store" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ea1abe3#ea1abe34e31d9f6dd4c54a7f60912c31332a3e48" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=bedac3f#bedac3ff77407ceb47c48700ad3ff39107f4ceb2" dependencies = [ "displaydoc", "ics23", diff --git a/Cargo.toml b/Cargo.toml index 148dee86..b3f5d941 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ dead_code = "deny" rust_2018_idioms = "deny" trivial_casts = "deny" unused_import_braces = "deny" -unused_variables = "allow" +unused_variables = "deny" [workspace.lints.clippy] debug_assert_with_mut_call = "deny" diff --git a/clients/sov-celestia/cw-contract/src/tests/mod.rs b/clients/sov-celestia/cw-contract/src/tests/mod.rs index aa92f557..d2e8625e 100644 --- a/clients/sov-celestia/cw-contract/src/tests/mod.rs +++ b/clients/sov-celestia/cw-contract/src/tests/mod.rs @@ -77,7 +77,7 @@ fn happy_cw_recovery_client() { let instantiate_msg = fxt.dummy_instantiate_msg(); - let data = ctx.instantiate(instantiate_msg.clone()).unwrap(); + ctx.instantiate(instantiate_msg.clone()).unwrap(); // ------------------- Freeze subject client ------------------- @@ -87,15 +87,14 @@ fn happy_cw_recovery_client() { let mut ctx = fxt.ctx_mut(deps.as_mut()); - let data = ctx - .sudo(UpdateStateOnMisbehaviourMsgRaw { client_message }.into()) + ctx.sudo(UpdateStateOnMisbehaviourMsgRaw { client_message }.into()) .unwrap(); // ------------------- Create substitute client ------------------- ctx.set_substitute_prefix(); - let data = ctx.instantiate(instantiate_msg).unwrap(); + ctx.instantiate(instantiate_msg).unwrap(); // ------------------- Recover subject client ------------------- diff --git a/clients/sov-celestia/src/client_state/validation.rs b/clients/sov-celestia/src/client_state/validation.rs index 158f9509..8f1521d2 100644 --- a/clients/sov-celestia/src/client_state/validation.rs +++ b/clients/sov-celestia/src/client_state/validation.rs @@ -54,7 +54,7 @@ where status(self.inner(), ctx, client_id) } - fn check_substitute(&self, ctx: &V, substitute_client_state: Any) -> Result<(), ClientError> { + fn check_substitute(&self, _ctx: &V, substitute_client_state: Any) -> Result<(), ClientError> { check_substitute::(self.inner(), substitute_client_state) } } diff --git a/modules/sov-ibc-transfer/src/context.rs b/modules/sov-ibc-transfer/src/context.rs index 7cd8f78e..05c25825 100644 --- a/modules/sov-ibc-transfer/src/context.rs +++ b/modules/sov-ibc-transfer/src/context.rs @@ -92,7 +92,7 @@ impl<'ws, S: Spec> IbcTransferContext<'ws, S> { port_id: &PortId, channel_id: &ChannelId, ) -> Result { - let token_id = TokenId::from_str(&coin.denom.to_string()).map_err(|e| { + let token_id = TokenId::from_str(&coin.denom.to_string()).map_err(|_| { TokenTransferError::InvalidCoin { coin: coin.to_string(), } @@ -104,7 +104,9 @@ impl<'ws, S: Spec> IbcTransferContext<'ws, S> { .get(&token_id, *self.working_set.borrow_mut()) { let prefixed_denom = PrefixedDenom::from_str(&token_name).map_err(|e| { - TokenTransferError::Other(format!("Failed to parse token name: {token_name}")) + TokenTransferError::Other(format!( + "Failed to parse token name: {token_name} with error: {e}" + )) })?; let trace_prefix = TracePrefix::new(port_id.clone(), channel_id.clone()); @@ -357,7 +359,7 @@ where let escrow_address = self.obtain_escrow_address(port_id, channel_id); - let escrow_balance = self.validate_balance(token_id, escrow_address, coin.amount)?; + self.validate_balance(token_id, escrow_address, coin.amount)?; Ok(()) } @@ -439,7 +441,7 @@ impl<'ws, S: Spec> TokenTransferExecutionContext for IbcTransferContext<'ws, S> // The token name on the Sovereign SDK chains is not guaranteed to be // unique, and hence we must use the token ID (which is guaranteed to be // unique) as the ICS-20 denom to ensure uniqueness. - let token_id = TokenId::from_str(&coin.denom.to_string()).map_err(|e| { + let token_id = TokenId::from_str(&coin.denom.to_string()).map_err(|_| { TokenTransferError::InvalidCoin { coin: coin.to_string(), } @@ -468,7 +470,7 @@ impl<'ws, S: Spec> TokenTransferExecutionContext for IbcTransferContext<'ws, S> channel_id: &ChannelId, coin: &PrefixedCoin, ) -> Result<(), TokenTransferError> { - let token_id = TokenId::from_str(&coin.denom.to_string()).map_err(|e| { + let token_id = TokenId::from_str(&coin.denom.to_string()).map_err(|_| { TokenTransferError::InvalidCoin { coin: coin.to_string(), } diff --git a/modules/sov-ibc/Cargo.toml b/modules/sov-ibc/Cargo.toml index 959e4587..b50d811e 100644 --- a/modules/sov-ibc/Cargo.toml +++ b/modules/sov-ibc/Cargo.toml @@ -47,7 +47,7 @@ sov-state = { workspace = true } sov-rollup-interface = { workspace = true } [features] -default = [] +default = ["native"] serde = ["serde_json"] native = [ "serde", diff --git a/modules/sov-ibc/src/context.rs b/modules/sov-ibc/src/context.rs index d54f6814..7c445fde 100644 --- a/modules/sov-ibc/src/context.rs +++ b/modules/sov-ibc/src/context.rs @@ -179,7 +179,7 @@ where fn validate_self_client( &self, - client_state_of_host_on_counterparty: Self::HostClientState, + _client_state_of_host_on_counterparty: Self::HostClientState, ) -> Result<(), ContextError> { // Note: We can optionally implement this. // It would require having a Protobuf definition of the chain's `ClientState` that other chains would use. @@ -327,7 +327,7 @@ where Duration::ZERO } - fn validate_message_signer(&self, signer: &Signer) -> Result<(), ContextError> { + fn validate_message_signer(&self, _signer: &Signer) -> Result<(), ContextError> { Ok(()) } } @@ -581,7 +581,7 @@ where /// FIXME: To implement this method there should be a way for IBC module to /// insert logs into the transaction receipts upon execution - fn log_message(&mut self, message: String) -> Result<(), ContextError> { + fn log_message(&mut self, _message: String) -> Result<(), ContextError> { Ok(()) } } diff --git a/modules/sov-ibc/src/rpc/context.rs b/modules/sov-ibc/src/rpc/context.rs index 8d802662..d7ecec88 100644 --- a/modules/sov-ibc/src/rpc/context.rs +++ b/modules/sov-ibc/src/rpc/context.rs @@ -383,7 +383,7 @@ where Ok(consensus_states) } - fn consensus_state_heights(&self, client_id: &ClientId) -> Result, ContextError> { + fn consensus_state_heights(&self, _client_id: &ClientId) -> Result, ContextError> { let heights: Vec = self .ibc .client_update_heights_vec diff --git a/modules/sov-ibc/src/rpc/methods.rs b/modules/sov-ibc/src/rpc/methods.rs index 5fe6ea11..f2249836 100644 --- a/modules/sov-ibc/src/rpc/methods.rs +++ b/modules/sov-ibc/src/rpc/methods.rs @@ -5,9 +5,9 @@ use std::rc::Rc; use ibc_core::client::context::client_state::ClientStateCommon; use ibc_core::host::ValidationContext; use ibc_query::core::channel::{ - query_channel_consensus_state, query_channels, query_connection_channels, - query_packet_acknowledgements, query_packet_commitments, query_unreceived_acks, - query_unreceived_packets, QueryChannelClientStateRequest, QueryChannelClientStateResponse, + query_channels, query_connection_channels, query_packet_acknowledgements, + query_packet_commitments, query_unreceived_acks, query_unreceived_packets, + QueryChannelClientStateRequest, QueryChannelClientStateResponse, QueryChannelConsensusStateRequest, QueryChannelConsensusStateResponse, QueryChannelRequest, QueryChannelResponse, QueryChannelsRequest, QueryChannelsResponse, QueryConnectionChannelsRequest, QueryConnectionChannelsResponse, @@ -536,7 +536,17 @@ impl Ibc { client_latest_height.revision_height(), )?; - query_channel_consensus_state(&ibc_ctx, &request).map_err(to_jsonrpsee_error) + Ok(QueryChannelConsensusStateResponse::new( + consensus_state + .ok_or(to_jsonrpsee_error(format!( + "Consensus state not found for channel {:?}", + request.channel_id + )))? + .into(), + connection_end.client_id().clone(), + proof, + proof_height, + )) } #[rpc_method(name = "packetCommitment")]