Skip to content

Commit

Permalink
chore: review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: aeryz <[email protected]>
  • Loading branch information
aeryz committed Jan 8, 2025
1 parent d8b1693 commit 588e8bf
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 131 deletions.
4 changes: 2 additions & 2 deletions cosmwasm/ibc-union/core/light-client-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pub mod msg;
pub mod state;

// These are only used for `key` calculation. We don't want this crate to depend on `ibc-union`.
const CLIENT_STATES: Map<u32, Binary> = Map::new("client_states");
const CLIENT_CONSENSUS_STATES: Map<(u32, u64), Binary> = Map::new("client_consensus_states");
pub const CLIENT_STATES: Map<u32, Binary> = Map::new("client_states");
pub const CLIENT_CONSENSUS_STATES: Map<(u32, u64), Binary> = Map::new("client_consensus_states");
const CLIENT_IMPLS: Map<u32, Addr> = Map::new("client_impls");
const QUERY_STORE: Item<Binary> = Item::new("query_store");

Expand Down
5 changes: 2 additions & 3 deletions cosmwasm/ibc-union/light-clients/ethereum/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ use cosmwasm_std::{
from_json, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response,
StdResult, SubMsg,
};
use ethereum_light_client_types::{ClientState, ConsensusState};
use ethereum_light_client_types::ClientState;
use ibc_union_light_client::{
msg::{InstantiateMsg, QueryMsg},
read_consensus_state,
state::IBC_HOST,
IbcClientError, CLIENT_CONSENSUS_STATES, CLIENT_STATES,
IbcClientError, CLIENT_STATES,
};
use ibc_union_msg::module::IbcUnionMsg;
use serde::{Deserialize, Serialize};
use unionlabs::{
encoding::{Bincode, EncodeAs, EthAbi},
Expand Down
6 changes: 1 addition & 5 deletions lib/cometbls-light-client-types/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ pub struct ClientState {

#[cfg(feature = "proto")]
pub mod proto {
use std::array::TryFromSliceError;

use unionlabs::{
errors::{InvalidLength, MissingField},
impl_proto_via_try_from_into,
Expand All @@ -54,14 +52,12 @@ pub mod proto {
}
}

#[derive(Debug, Clone, thiserror::Error)]
#[derive(Debug, PartialEq, Clone, thiserror::Error)]
pub enum Error {
#[error(transparent)]
MissingField(#[from] MissingField),
#[error("invalid chain_id")]
ChainId(#[from] InvalidLength),
#[error("invalid contract address")]
ContractAddress(#[source] TryFromSliceError),
}

impl TryFrom<protos::union::ibc::lightclients::cometbls::v1::ClientState> for ClientState {
Expand Down
2 changes: 1 addition & 1 deletion lib/tendermint-light-client-types/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub mod proto {
.collect::<Result<Vec<_>, _>>()
.map_err(Error::ProofSpecs)?,
upgrade_path: value.upgrade_path,
// // FIXME: we need to define the tm proto ourself and regenerate
// contract address is not needed for native impl which uses proto
contract_address: H256::default(),
})
}
Expand Down
3 changes: 0 additions & 3 deletions lib/unionlabs/src/ibc/lightclients/evm_in_cosmos.rs

This file was deleted.

53 changes: 0 additions & 53 deletions lib/unionlabs/src/ibc/lightclients/evm_in_cosmos/client_state.rs

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion lib/unionlabs/src/ibc/lightclients/evm_in_cosmos/header.rs

This file was deleted.

17 changes: 5 additions & 12 deletions voyager/modules/client/state-lens/evm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,9 @@ impl ClientModule for Module {
async fn new(_: Self::Config, info: ClientModuleInfo) -> Result<Self, BoxDynError> {
info.ensure_client_type(ClientType::STATE_LENS_EVM)?;
info.ensure_consensus_type(ConsensusType::ETHEREUM)?;
// TODO(aeryz): impl a nice combinator
if info
.ensure_ibc_interface(IbcInterface::IBC_SOLIDITY)
.is_err()
&& info
.ensure_ibc_interface(IbcInterface::IBC_COSMWASM)
.is_err()
{
panic!("no no no")
}
info.ensure_ibc_interface(IbcInterface::IBC_SOLIDITY)
.or(info.ensure_ibc_interface(IbcInterface::IBC_COSMWASM))?;

Ok(Self {
ibc_interface: SupportedIbcInterface::try_from(info.ibc_interface.to_string())?,
})
Expand Down Expand Up @@ -279,9 +272,9 @@ impl ClientModuleServer for Module {
None::<()>,
)
})?;
// TODO: extract to unionlabs? this is MPT proofs encoding for EVM
// the solidity MPT verifier expects the proof RLP nodes to be serialized in sequence
match self.ibc_interface {
// TODO: extract to unionlabs? this is MPT proofs encoding for EVM
// the solidity MPT verifier expects the proof RLP nodes to be serialized in sequence
SupportedIbcInterface::IbcSolidity => Ok(proof.proof.into_iter().flatten().collect()),
SupportedIbcInterface::IbcCosmwasm => Ok(proof.encode_as::<Bincode>().into()),
}
Expand Down

0 comments on commit 588e8bf

Please sign in to comment.