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

Commit

Permalink
fix: Remove ibc-primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
code0xff committed Sep 9, 2024
1 parent c3d5fd9 commit 2be63f1
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 258 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ members = [
"template/runtime",
"template/node",
"cosmwasm/std",
"composable/primitives",
"composable/vm",
"composable/vm-wasmi",
"composable/composable-support",
Expand Down Expand Up @@ -141,7 +140,6 @@ wasmi = { version = "0.30.0", default-features = false }
wasmi-validation = { version = "0.5.0", default-features = false }

# Composable
ibc-primitives = { path = "composable/primitives", default-features = false }
pallet-cosmwasm = { path = "frame/cosmwasm", default-features = false }
cosmwasm-vm = { path = "composable/vm", default-features = false }
cosmwasm-vm-wasmi = { path = "composable/vm-wasmi", default-features = false }
Expand Down
26 changes: 0 additions & 26 deletions composable/primitives/Cargo.toml

This file was deleted.

129 changes: 0 additions & 129 deletions composable/primitives/src/lib.rs

This file was deleted.

2 changes: 0 additions & 2 deletions frame/cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ scale-info = { default-features = false, version = "2.1.1", features = [
hex = { version = "0.4", default-features = false, features = ["alloc"] }
hex-literal = { workspace = true }
ibc = { workspace = true, default-features = false }
ibc-primitives = { workspace = true, default-features = false, optional = false }
libsecp256k1 = { version = "0.7.0", default-features = false }
log = { workspace = true, default-features = false }
parity-wasm = { version = "0.45.0", default-features = false }
Expand Down Expand Up @@ -63,7 +62,6 @@ std = [
"scale-info/std",
"hex/std",
"ibc/std",
"ibc-primitives/std",
"libsecp256k1/std",
"log/std",
"parity-wasm/std",
Expand Down
98 changes: 0 additions & 98 deletions frame/cosmwasm/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,6 @@ use crate::{
types::{AccountIdOf, DefaultCosmwasmVM},
Config, Pallet,
};
use cosmwasm_vm::{
executor::{
ibc::{
IbcChannelCloseCall, IbcChannelConnectCall, IbcChannelOpenCall, IbcPacketAckCall,
IbcPacketReceiveCall, IbcPacketTimeoutCall,
},
AllocateCall, AsFunctionName, CosmwasmCallInput, CosmwasmCallWithoutInfoInput,
DeallocateCall, HasInfo, Unit,
},
input::Input,
memory::PointerOf,
vm::{VmErrorOf, VmInputOf, VmOutputOf},
};
use ibc::{
core::{
client::types::Height,
host::types::identifiers::{ChannelId, PortId},
},
primitives::Timestamp,
};
use ibc_primitives::HandlerMessage;

use crate::types::EntryPoint::{self, *};

pub struct ChannelOpenCall;
impl Input for ChannelOpenCall {
type Output = cosmwasm_vm::executor::ibc::IbcChannelOpenResult;
}
impl AsFunctionName for ChannelOpenCall {
const NAME: &'static str = "ibc_channel_open";
}
impl HasInfo for ChannelOpenCall {
const HAS_INFO: bool = false;
}

impl cosmwasm_vm::system::EventIsTyped for ChannelOpenCall {
const TYPE: cosmwasm_vm::system::SystemEventType =
cosmwasm_vm::system::SystemEventType::IbcChannelConnect;
}

impl cosmwasm_vm::system::EventHasCodeId for ChannelOpenCall {
const HAS_CODE_ID: bool = false;
}

impl<T: Config> Pallet<T> {
/// Check whether a contract export the mandatory IBC functions and is consequently IBC capable.
Expand Down Expand Up @@ -84,58 +41,3 @@ impl<T: Config> Pallet<T> {
format!("wasm.{}", Pallet::<T>::account_to_cosmwasm_addr(address))
}
}

use cosmwasm_vm::system::CosmwasmBaseVM;
pub trait CosmwasmCallVMSingle<I> = CosmwasmBaseVM
where
I: Input + HasInfo,
for<'x> Unit: TryFrom<VmOutputOf<'x, Self>, Error = VmErrorOf<Self>>,
for<'x> VmInputOf<'x, Self>: TryFrom<AllocateCall<PointerOf<Self>>, Error = VmErrorOf<Self>>
+ TryFrom<DeallocateCall<PointerOf<Self>>, Error = VmErrorOf<Self>>
+ TryFrom<CosmwasmCallInput<'x, PointerOf<Self>, I>, Error = VmErrorOf<Self>>
+ TryFrom<CosmwasmCallWithoutInfoInput<'x, PointerOf<Self>, I>, Error = VmErrorOf<Self>>;

pub trait AsEntryName {
const ENTRY: EntryPoint;
}

impl AsEntryName for IbcChannelOpenCall {
const ENTRY: EntryPoint = IbcChannelOpen;
}

impl AsEntryName for IbcPacketReceiveCall {
const ENTRY: EntryPoint = IbcPacketReceive;
}

impl AsEntryName for IbcChannelConnectCall {
const ENTRY: EntryPoint = IbcChannelConnect;
}

impl AsEntryName for IbcChannelCloseCall {
const ENTRY: EntryPoint = IbcChannelClose;
}

impl AsEntryName for IbcPacketTimeoutCall {
const ENTRY: EntryPoint = IbcPacketTimeout;
}

impl AsEntryName for IbcPacketAckCall {
const ENTRY: EntryPoint = IbcPacketAck;
}

pub struct NoRelayer<T> {
_marker: core::marker::PhantomData<T>,
}

impl<T: Config> ibc_primitives::IbcHandler<AccountIdOf<T>> for NoRelayer<T> {
fn latest_height_and_timestamp(
_port_id: &PortId,
_channel_id: &ChannelId,
) -> Result<(Height, Timestamp), ibc_primitives::Error> {
Err(ibc_primitives::Error::Other { msg: Some("not supported".to_string()) })
}

fn handle_message(_msg: HandlerMessage<AccountIdOf<T>>) -> Result<(), ibc_primitives::Error> {
Err(ibc_primitives::Error::Other { msg: Some("not supported".to_string()) })
}
}
1 change: 0 additions & 1 deletion frame/cosmwasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub mod runtimes;
pub mod types;
pub mod utils;
pub mod weights;
pub use crate::ibc::NoRelayer;
pub mod entrypoint;

const SUBSTRATE_ECDSA_SIGNATURE_LEN: usize = 65;
Expand Down

0 comments on commit 2be63f1

Please sign in to comment.