Skip to content

Commit

Permalink
Merge pull request #15 from cosmos/rano/fix-wasm-compile
Browse files Browse the repository at this point in the history
fix: failing wasm compilation
  • Loading branch information
Carlos Rodriguez authored Mar 25, 2024
2 parents b7b0d89 + 03fd019 commit f3f2f77
Show file tree
Hide file tree
Showing 18 changed files with 84 additions and 94 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ cosmwasm-std = { version = "1.5.0", features = [
cw-storage-plus = "1.1.0"
cw2 = "1.1.1"
derive_more = "0.99.17"
ibc = { git = "https://github.com/cosmos/ibc-rs", rev = "1410bb03fdba930abd31c0941a5fd7f43d13ec96", default-features = false, features = ["schema"] } # "0.50.0"
ibc-core = { git = "https://github.com/cosmos/ibc-rs", rev = "1410bb03fdba930abd31c0941a5fd7f43d13ec96", default-features = false, features = ["schema"] } # "0.50.0"
ibc-clients = { git = "https://github.com/cosmos/ibc-rs", rev = "1410bb03fdba930abd31c0941a5fd7f43d13ec96", default-features = false, features = ["schema"] } # "0.50.0"
ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", rev = "6cbe4c7ace5a688bc98831fa9c1cc2dabf3b2976", default-features = false } # "0.42.0"
prost = "0.12.3"
schemars = "0.8.15"
Expand Down
16 changes: 8 additions & 8 deletions src/context/ctx.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use ibc::clients::tendermint::consensus_state::ConsensusState as TendermintConsensusState;
use ibc::core::client::context::ClientExecutionContext;
use ibc::core::client::types::error::ClientError;
use ibc_clients::tendermint::consensus_state::ConsensusState as TendermintConsensusState;
use ibc_core::client::context::ClientExecutionContext;
use ibc_core::client::types::error::ClientError;

use ibc::core::client::context::ClientValidationContext;
use ibc::core::client::types::Height;
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::identifiers::ClientId;
use ibc::core::primitives::Timestamp;
use ibc_core::client::context::ClientValidationContext;
use ibc_core::client::types::Height;
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::identifiers::ClientId;
use ibc_core::primitives::Timestamp;

/// Enables conversion (`TryInto` and `From`) between the consensus state type
/// used by the host and the one specific to the Rollkit light client, which
Expand Down
22 changes: 11 additions & 11 deletions src/context/custom_ctx.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use std::str::FromStr;
use core::str::FromStr;

use cosmwasm_std::{Deps, DepsMut, Env, Order, Storage};
use ibc::clients::wasm_types::client_state::ClientState as WasmClientState;
use ibc::core::client::context::client_state::ClientStateCommon;
use ibc::core::client::types::error::ClientError;
use ibc::core::client::types::Height;
use ibc::core::host::types::identifiers::ClientId;
use ibc::core::host::types::path::{
use ibc_clients::wasm_types::client_state::ClientState as WasmClientState;
use ibc_core::client::context::client_state::ClientStateCommon;
use ibc_core::client::types::error::ClientError;
use ibc_core::client::types::Height;
use ibc_core::host::types::identifiers::ClientId;
use ibc_core::host::types::path::{
iteration_key, ClientStatePath, ClientUpdateHeightPath, ClientUpdateTimePath,
ITERATE_CONSENSUS_STATE_PREFIX,
};
use ibc::core::primitives::proto::{Any, Protobuf};
use ibc_core::primitives::proto::{Any, Protobuf};

use crate::types::AnyCodec;
use crate::types::ClientType;
Expand All @@ -27,7 +27,7 @@ pub struct Context<'a, C: ClientType<'a>> {
env: Env,
client_id: ClientId,
checksum: Option<Checksum>,
client_type: std::marker::PhantomData<C>,
client_type: core::marker::PhantomData<C>,
}

impl<'a, C: ClientType<'a>> Context<'a, C> {
Expand All @@ -40,7 +40,7 @@ impl<'a, C: ClientType<'a>> Context<'a, C> {
env,
client_id,
checksum: None,
client_type: std::marker::PhantomData::<C>,
client_type: core::marker::PhantomData::<C>,
})
}

Expand All @@ -53,7 +53,7 @@ impl<'a, C: ClientType<'a>> Context<'a, C> {
env,
client_id,
checksum: None,
client_type: std::marker::PhantomData::<C>,
client_type: core::marker::PhantomData::<C>,
})
}

Expand Down
14 changes: 7 additions & 7 deletions src/context/execution_ctx.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use ibc::clients::wasm_types::consensus_state::ConsensusState as WasmConsensusState;
use ibc::core::client::context::ClientExecutionContext;
use ibc::core::client::types::Height;
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::identifiers::ClientId;
use ibc::core::host::types::path::{iteration_key, ClientConsensusStatePath, ClientStatePath};
use ibc::core::primitives::Timestamp;
use ibc_clients::wasm_types::consensus_state::ConsensusState as WasmConsensusState;
use ibc_core::client::context::ClientExecutionContext;
use ibc_core::client::types::Height;
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::identifiers::ClientId;
use ibc_core::host::types::path::{iteration_key, ClientConsensusStatePath, ClientStatePath};
use ibc_core::primitives::Timestamp;

use super::Context;
use crate::types::AnyCodec;
Expand Down
20 changes: 10 additions & 10 deletions src/context/validation_ctx.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use ibc::clients::tendermint::context::{ConsensusStateConverter, ValidationContext};
use ibc::clients::wasm_types::client_state::ClientState as WasmClientState;
use ibc::clients::wasm_types::consensus_state::ConsensusState as WasmConsensusState;
use ibc::core::client::context::ClientValidationContext;
use ibc::core::client::types::{error::ClientError, Height};
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::identifiers::ClientId;
use ibc::core::host::types::path::{ClientConsensusStatePath, ClientStatePath};
use ibc::core::primitives::proto::{Any, Protobuf};
use ibc::core::primitives::Timestamp;
use ibc_clients::tendermint::context::{ConsensusStateConverter, ValidationContext};
use ibc_clients::wasm_types::client_state::ClientState as WasmClientState;
use ibc_clients::wasm_types::consensus_state::ConsensusState as WasmConsensusState;
use ibc_core::client::context::ClientValidationContext;
use ibc_core::client::types::{error::ClientError, Height};
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::identifiers::ClientId;
use ibc_core::host::types::path::{ClientConsensusStatePath, ClientStatePath};
use ibc_core::primitives::proto::{Any, Protobuf};
use ibc_core::primitives::Timestamp;

use super::Context;
use crate::helpers::HeightTravel;
Expand Down
11 changes: 5 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use alloc::string::String;
use std::error::Error as StdError;

use cosmwasm_std::StdError as CwError;
use derive_more::{Display, From};
use ibc::core::client::types::error::ClientError;
use ibc::core::commitment_types::error::CommitmentError;
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::error::IdentifierError;
use ibc::core::host::types::path::PathError;
use ibc_core::client::types::error::ClientError;
use ibc_core::commitment_types::error::CommitmentError;
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::error::IdentifierError;
use ibc_core::host::types::path::PathError;

use crate::types::Error;

Expand Down
9 changes: 3 additions & 6 deletions src/handlers.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use cosmwasm_std::{to_json_binary, Binary};
use ibc::core::client::context::client_state::{
ClientStateCommon, ClientStateExecution, ClientStateValidation,
};
use ibc::core::client::context::prelude::*;
use ibc::core::host::types::path::ClientConsensusStatePath;
use ibc::primitives::proto::Any;
use ibc_core::client::context::prelude::*;
use ibc_core::host::types::path::ClientConsensusStatePath;
use ibc_core::primitives::proto::Any;
use prost::Message;

use crate::context::Context;
Expand Down
6 changes: 3 additions & 3 deletions src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ibc::core::client::types::error::ClientError;
use ibc::core::client::types::Height;
use ibc_core::client::types::error::ClientError;
use ibc_core::client::types::Height;

/// Travel is an enum to represent the direction of travel in the context of
/// height.
Expand All @@ -11,7 +11,7 @@ pub enum HeightTravel {
/// Decodes a `Height` from a UTF-8 encoded byte array.
pub fn parse_height(encoded_height: Vec<u8>) -> Result<Height, ClientError> {
let height_str =
alloc::str::from_utf8(encoded_height.as_slice()).map_err(|e| ClientError::Other {
core::str::from_utf8(encoded_height.as_slice()).map_err(|e| ClientError::Other {
description: e.to_string(),
})?;

Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
)]
#![forbid(unsafe_code)]

extern crate alloc;

pub mod context;
pub mod contract;
mod error;
Expand Down
19 changes: 9 additions & 10 deletions src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
//! Contains the definition of the messages that can be sent to the CosmWasm contract.
use alloc::vec::Vec;
use std::str::FromStr;
use core::str::FromStr;

use base64::prelude::BASE64_STANDARD;
use base64::Engine;
use cosmwasm_schema::cw_serde;
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

//use ibc::clients::wasm_types::client_message::ClientMessage;
//use ibc_clients::wasm_types::client_message::ClientMessage;

use ibc::core::client::types::error::ClientError;
use ibc::core::client::types::proto::v1::Height as RawHeight;
use ibc::core::client::types::Height;
use ibc::core::commitment_types::commitment::{CommitmentPrefix, CommitmentProofBytes};
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::path::Path;
use ibc::core::primitives::proto::Any;
use ibc_core::client::types::error::ClientError;
use ibc_core::client::types::proto::v1::Height as RawHeight;
use ibc_core::client::types::Height;
use ibc_core::commitment_types::commitment::{CommitmentPrefix, CommitmentProofBytes};
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::path::Path;
use ibc_core::primitives::proto::Any;
use prost::Message;

use crate::error::ContractError;
Expand Down
5 changes: 1 addition & 4 deletions src/response.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use alloc::string::String;
use alloc::vec::Vec;

use cosmwasm_schema::cw_serde;
use ibc::core::client::types::Height;
use ibc_core::client::types::Height;

#[cw_serde]
pub struct GenesisMetadata {
Expand Down
6 changes: 3 additions & 3 deletions src/types/client_message.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ibc::clients::tendermint::types::Misbehaviour;
use ibc::clients::tendermint::types::TENDERMINT_MISBEHAVIOUR_TYPE_URL;
use ibc::core::primitives::proto::{Any, Protobuf};
use ibc_clients::tendermint::types::Misbehaviour;
use ibc_clients::tendermint::types::TENDERMINT_MISBEHAVIOUR_TYPE_URL;
use ibc_core::primitives::proto::{Any, Protobuf};
use prost::Message;

use crate::types::{Error, Header, ROLLKIT_HEADER_TYPE_URL};
Expand Down
10 changes: 5 additions & 5 deletions src/types/client_type.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use ibc::clients::tendermint::client_state::ClientState as TendermintClientState;
use ibc::core::client::context::client_state::ClientStateExecution;
use ibc::core::client::context::consensus_state::ConsensusState as ConsensusStateTrait;
use ibc::core::client::types::error::ClientError;
use ibc::core::primitives::proto::Any;
use ibc_clients::tendermint::client_state::ClientState as TendermintClientState;
use ibc_core::client::context::client_state::ClientStateExecution;
use ibc_core::client::context::consensus_state::ConsensusState as ConsensusStateTrait;
use ibc_core::client::types::error::ClientError;
use ibc_core::primitives::proto::Any;

use crate::context::Context;
use crate::types::AnyConsensusState;
Expand Down
3 changes: 2 additions & 1 deletion src/types/codec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ibc::{core::client::types::error::ClientError, primitives::proto::Any};
use ibc_core::client::types::error::ClientError;
use ibc_core::primitives::proto::Any;
use prost::Message;

pub trait AnyCodec {
Expand Down
10 changes: 5 additions & 5 deletions src/types/consensus_state.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use ibc::clients::tendermint::consensus_state::ConsensusState as TendermintConsensusState;
use ibc::clients::tendermint::types::{ConsensusState, TENDERMINT_CONSENSUS_STATE_TYPE_URL};
use ibc::core::client::types::error::ClientError;
use ibc::core::primitives::proto::Any;
use ibc::derive::ConsensusState as ConsensusStateDerive;
use ibc_clients::tendermint::consensus_state::ConsensusState as TendermintConsensusState;
use ibc_clients::tendermint::types::{ConsensusState, TENDERMINT_CONSENSUS_STATE_TYPE_URL};
use ibc_core::client::types::error::ClientError;
use ibc_core::derive::ConsensusState as ConsensusStateDerive;
use ibc_core::primitives::proto::Any;

#[derive(Clone, Debug, ConsensusStateDerive)]
pub enum AnyConsensusState {
Expand Down
6 changes: 3 additions & 3 deletions src/types/da_data.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use base64::engine::general_purpose;
use base64::Engine;
use core::fmt::{Debug, Display, Error as FmtError, Formatter};
use std::str::FromStr;
use core::str::FromStr;

use ibc::core::host::types::identifiers::ClientId;
use ibc::core::primitives::proto::Protobuf;
use ibc_core::host::types::identifiers::ClientId;
use ibc_core::primitives::proto::Protobuf;
use ibc_proto::ibc::lightclients::rollkit::v1::DaData as RawDaData;

use crate::types::Error;
Expand Down
8 changes: 3 additions & 5 deletions src/types/error.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use alloc::string::{String, ToString};

use ibc::core::client::types::error::ClientError;
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::error::IdentifierError;
use ibc_core::client::types::error::ClientError;
use ibc_core::handler::types::error::ContextError;
use ibc_core::host::types::error::IdentifierError;
use tendermint_light_client_verifier::Verdict;

/// Defines the error type for Rollkit light client.
Expand Down
8 changes: 4 additions & 4 deletions src/types/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
use core::fmt::{Debug, Display, Error as FmtError, Formatter};

use ibc::clients::tendermint::types::Header as TendermintHeader;
use ibc::core::client::types::Height;
use ibc::core::primitives::proto::{Any, Protobuf};
use ibc::core::primitives::Timestamp;
use ibc_clients::tendermint::types::Header as TendermintHeader;
use ibc_core::client::types::Height;
use ibc_core::primitives::proto::{Any, Protobuf};
use ibc_core::primitives::Timestamp;
use ibc_proto::ibc::lightclients::rollkit::v1::Header as RawRollkitHeader;

use crate::types::DaData;
Expand Down

0 comments on commit f3f2f77

Please sign in to comment.