Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
chore: update basecoin rev + deny unused_variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhad-Shabani committed Apr 17, 2024
1 parent 57b2cca commit 1392187
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 3 additions & 4 deletions clients/sov-celestia/cw-contract/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------

Expand All @@ -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 -------------------

Expand Down
2 changes: 1 addition & 1 deletion clients/sov-celestia/src/client_state/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<V>(self.inner(), substitute_client_state)
}
}
Expand Down
12 changes: 7 additions & 5 deletions modules/sov-ibc-transfer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<'ws, S: Spec> IbcTransferContext<'ws, S> {
port_id: &PortId,
channel_id: &ChannelId,
) -> Result<TokenId, 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(),
}
Expand All @@ -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());
Expand Down Expand Up @@ -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(())
}
Expand Down Expand Up @@ -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(),
}
Expand Down Expand Up @@ -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(),
}
Expand Down
2 changes: 1 addition & 1 deletion modules/sov-ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sov-state = { workspace = true }
sov-rollup-interface = { workspace = true }

[features]
default = []
default = ["native"]
serde = ["serde_json"]
native = [
"serde",
Expand Down
6 changes: 3 additions & 3 deletions modules/sov-ibc/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(())
}
}
Expand Down Expand Up @@ -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(())
}
}
2 changes: 1 addition & 1 deletion modules/sov-ibc/src/rpc/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ where
Ok(consensus_states)
}

fn consensus_state_heights(&self, client_id: &ClientId) -> Result<Vec<Height>, ContextError> {
fn consensus_state_heights(&self, _client_id: &ClientId) -> Result<Vec<Height>, ContextError> {
let heights: Vec<Height> = self
.ibc
.client_update_heights_vec
Expand Down
18 changes: 14 additions & 4 deletions modules/sov-ibc/src/rpc/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -536,7 +536,17 @@ impl<S: Spec> Ibc<S> {
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")]
Expand Down

0 comments on commit 1392187

Please sign in to comment.