Skip to content

Commit

Permalink
happy
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Nov 28, 2023
1 parent 184f7d7 commit af65aab
Show file tree
Hide file tree
Showing 12 changed files with 348 additions and 715 deletions.
506 changes: 98 additions & 408 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ xcm = { version = "^5.0.0", default-features = false, package = "staging-xcm" }
cw-utils = { version = "^1.0.3", default-features = false }
cw2 = { version = "^1.1.2", default-features = false }
ibc-apps-more= { git = "https://github.com/ComposableFi/ibc-apps-more-rs.git", branch = "main", default-features = false }
ibc-apps = { git = "https://github.com/dzmitry-lahoda-forks/ibc-rs.git", branch = "dz/13", default-features = false, features = ["serde"] }
ibc-core = { git = "https://github.com/dzmitry-lahoda-forks/ibc-rs.git", branch = "dz/13", default-features = false, features = ["serde"] }
ibc-primitives = { git = "https://github.com/dzmitry-lahoda-forks/ibc-rs.git", branch = "dz/13", default-features = false, features = ["serde"] }
ibc-apps = { git = "https://github.com/dzmitry-lahoda-forks/ibc-rs.git", branch = "dz/14", default-features = false, features = ["serde"] }
ibc-core = { git = "https://github.com/dzmitry-lahoda-forks/ibc-rs.git", branch = "dz/14", default-features = false, features = ["serde"] }
ibc-primitives = { git = "https://github.com/dzmitry-lahoda-forks/ibc-rs.git", branch = "dz/14", default-features = false, features = ["serde"] }
primitive-types = { git= "https://github.com/dzmitry-lahoda-forks/parity-common.git", branch = "dz/3", default-features = false, features = ["serde_no_std"] }
4 changes: 2 additions & 2 deletions contracts/cosmwasm/executor/src/bin/interpreter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(feature = "json-schema")]
#[cfg(all(feature = "json-schema", not(target_arch = "wasm32")))]
#[allow(clippy::disallowed_methods)]
fn main() {
use cosmwasm_schema::write_api;
Expand All @@ -23,5 +23,5 @@ fn main() {
write(&path, serde_json_wasm::to_string(&events).unwrap()).unwrap();
}

#[cfg(not(feature = "json-schema"))]
#[cfg(not(all(feature = "json-schema", not(target_arch = "wasm32"))))]
fn main() {}
2 changes: 1 addition & 1 deletion contracts/cosmwasm/gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bech32 = { workspace = true, features = ["strict"] }
cosmwasm-std = { workspace = true, features = [
"ibc3",
"stargate",
"cosmwasm_1_3",
"cosmwasm_1_2",
] }
cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
Expand Down
4 changes: 1 addition & 3 deletions contracts/cosmwasm/gateway/src/contract/ibc/ics27.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! ics27 integration to do txes
use std::str::FromStr;

use crate::{
auth,
contract::ReplyId,
Expand All @@ -18,7 +16,7 @@ use cosmwasm_std::{
IbcChannelOpenResponse, IbcMsg, IbcOrder, IbcPacketAckMsg, IbcPacketReceiveMsg,
IbcPacketTimeoutMsg, IbcReceiveResponse, MessageInfo, Response, SubMsg,
};
use ibc::core::host::types::identifiers::{ChannelId, ConnectionId};
use ibc_core::host::types::identifiers::{ChannelId, ConnectionId};
use cvm_runtime::{
proto::Isomorphism, shared::XcPacket, transport::ibc::ChannelInfo, CallOrigin, XCVMAck,
};
Expand Down
4 changes: 2 additions & 2 deletions contracts/cosmwasm/gateway/src/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use cosmwasm_std::{DepsMut, Env, MessageInfo, Reply, Response, SubMsgResponse, S
use cw2::set_contract_version;
use cw2::ensure_from_older_version;
use cvm_runtime::{
transport::ibc::{TransportTrackerId},
transport::ibc::TransportTrackerId,
XCVMAck,
};
use ::ibc::apps::transfer::types::proto::transfer::v1::MsgTransferResponse;
use ibc_apps::transfer::types::proto::transfer::v1::MsgTransferResponse;

use self::ibc::make_ibc_failure_event;

Expand Down
4 changes: 2 additions & 2 deletions contracts/cosmwasm/gateway/src/contract/sudo.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{error::ContractError, state};
use cosmwasm_std::{entry_point, wasm_execute, Coin, DepsMut, Env, Event, Response};
use ibc::core::host::types::identifiers::ChannelId;
use ibc_core::host::types::identifiers::ChannelId;
use ibc_apps_more::hook::{IBCLifecycleComplete, SudoMsg};

#[cfg_attr(not(feature = "library"), entry_point)]
Expand Down Expand Up @@ -28,7 +28,7 @@ pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> crate::error::Result {
fn handle_transport_failure(
deps: DepsMut,
_env: Env,
channel: ChannelId,
channel: ibc_core::host::types::identifiers::ChannelId,
sequence: u64,
reason: String,
) -> Result<cosmwasm_std::Response, ContractError> {
Expand Down
2 changes: 1 addition & 1 deletion contracts/cosmwasm/gateway/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_std::{IbcOrder, Response, StdError};
use ibc::core::host::types::error::IdentifierError;
use ibc_core::host::types::error::IdentifierError;
use thiserror::Error;
use cvm_runtime::{AssetId, NetworkId};

Expand Down
2 changes: 1 addition & 1 deletion contracts/cosmwasm/gateway/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
pub use alloc::format;
pub use cosmwasm_std::{Addr};
pub use cw_storage_plus::Map;
pub use ibc::core::host::types::identifiers::{ChannelId};
pub use ibc_core::host::types::identifiers::{ChannelId};
pub use serde::{Deserialize, Serialize};
pub use cvm_runtime::{gateway::config::*, shared::Displayed};
207 changes: 107 additions & 100 deletions contracts/evm/flake-module.nix
Original file line number Diff line number Diff line change
@@ -1,113 +1,120 @@
{ self, ... }: {
perSystem =
{ config, self', inputs', pkgs, system, crane, systemCommonRust, ... }:
let nix = " --offline --out $out/lib ";
in {

packages = rec {
openzeppelin-contracts = pkgs.stdenv.mkDerivation {
name = "openzeppelin-contracts";
src = pkgs.fetchgit {
url = "https://github.com/OpenZeppelin/openzeppelin-contracts.git";
rev = "fd81a96f01cc42ef1c9a5399364968d0e07e9e90";
sha256 = "sha256-ggdq/9VgvxeFez8ouJpjRtBwOtJFgmVgOqTkzCb83oc=";
fetchSubmodules = true;
};
phases = [ "installPhase" ];
installPhase = ''
cp --recursive --force $src/ $out
'';
{self, ...}: {
perSystem = {
config,
self',
inputs',
pkgs,
system,
crane,
systemCommonRust,
...
}: let
nix = " --offline --out $out/lib ";
in {
packages = rec {
openzeppelin-contracts = pkgs.stdenv.mkDerivation {
name = "openzeppelin-contracts";
src = pkgs.fetchgit {
url = "https://github.com/OpenZeppelin/openzeppelin-contracts.git";
rev = "fd81a96f01cc42ef1c9a5399364968d0e07e9e90";
sha256 = "sha256-ggdq/9VgvxeFez8ouJpjRtBwOtJFgmVgOqTkzCb83oc=";
fetchSubmodules = true;
};
forge-std = pkgs.stdenv.mkDerivation {
name = "forge-std";
src = pkgs.fetchgit {
url = "https://github.com/foundry-rs/forge-std.git";
rev = "1d9650e951204a0ddce9ff89c32f1997984cef4d";
sha256 = "sha256-KJU6k0w8ZCE8WXgwySBpatPzgf6jydB3cbKAiJIwWQY=";
fetchSubmodules = true;
};
phases = [ "installPhase" ];
installPhase = ''
cp --recursive --force $src/ $out
'';
phases = ["installPhase"];
installPhase = ''
cp --recursive --force $src/ $out
'';
};
forge-std = pkgs.stdenv.mkDerivation {
name = "forge-std";
src = pkgs.fetchgit {
url = "https://github.com/foundry-rs/forge-std.git";
rev = "1d9650e951204a0ddce9ff89c32f1997984cef4d";
sha256 = "sha256-KJU6k0w8ZCE8WXgwySBpatPzgf6jydB3cbKAiJIwWQY=";
fetchSubmodules = true;
};
phases = ["installPhase"];
installPhase = ''
cp --recursive --force $src/ $out
'';
};

protobuf3-solidity-lib = pkgs.stdenv.mkDerivation {
name = "protobuf3-solidity-lib";
src = pkgs.fetchgit {
url = "https://github.com/lazyledger/protobuf3-solidity-lib.git";
rev = "bc4e75a0bf6e365e820929eb293ef9b6d6d69678";
sha256 = "sha256-+HHUYhWDNRgA7x7p3Z0l0lS1e6pkJh4ZOSCCS4jQZQk=";
fetchSubmodules = true;
};
phases = [ "installPhase" ];
installPhase = ''
cp --recursive --force $src/ $out
'';
protobuf3-solidity-lib = pkgs.stdenv.mkDerivation {
name = "protobuf3-solidity-lib";
src = pkgs.fetchgit {
url = "https://github.com/lazyledger/protobuf3-solidity-lib.git";
rev = "bc4e75a0bf6e365e820929eb293ef9b6d6d69678";
sha256 = "sha256-+HHUYhWDNRgA7x7p3Z0l0lS1e6pkJh4ZOSCCS4jQZQk=";
fetchSubmodules = true;
};
phases = ["installPhase"];
installPhase = ''
cp --recursive --force $src/ $out
'';
};

yui-ibc-solidity = pkgs.stdenv.mkDerivation {
name = "yui-ibc-solidity";
src = pkgs.fetchgit {
url = "https://github.com/hyperledger-labs/yui-ibc-solidity";
rev = "d9a90cadaab7c06ddbcf0c7d73ab0c0777cef5a1";
sha256 = "sha256-X82CvEbvyv/YPT+psnT3cu7n8HxQ8eW0CDIrTC922AA=";
fetchSubmodules = true;
};
phases = [ "installPhase" ];
installPhase = ''
cp --recursive --force $src/ $out
'';
yui-ibc-solidity = pkgs.stdenv.mkDerivation {
name = "yui-ibc-solidity";
src = pkgs.fetchgit {
url = "https://github.com/hyperledger-labs/yui-ibc-solidity";
rev = "d9a90cadaab7c06ddbcf0c7d73ab0c0777cef5a1";
sha256 = "sha256-X82CvEbvyv/YPT+psnT3cu7n8HxQ8eW0CDIrTC922AA=";
fetchSubmodules = true;
};
phases = ["installPhase"];
installPhase = ''
cp --recursive --force $src/ $out
'';
};

solidity-bytes-utils = pkgs.stdenv.mkDerivation {
name = "solidity-bytes-utils";
src = pkgs.fetchgit {
url = "https://github.com/GNSPS/solidity-bytes-utils.git";
rev = "6458fb2780a3092bc756e737f246be1de6d3d362";
sha256 = "sha256-sJWoYag6hTIoS4Jr1XdqBKfrJaFQ1iMPy+UI5vVb7Lw=";
fetchSubmodules = true;
};
phases = [ "installPhase" ];
installPhase = ''
cp --recursive --force $src/ $out
'';
solidity-bytes-utils = pkgs.stdenv.mkDerivation {
name = "solidity-bytes-utils";
src = pkgs.fetchgit {
url = "https://github.com/GNSPS/solidity-bytes-utils.git";
rev = "6458fb2780a3092bc756e737f246be1de6d3d362";
sha256 = "sha256-sJWoYag6hTIoS4Jr1XdqBKfrJaFQ1iMPy+UI5vVb7Lw=";
fetchSubmodules = true;
};
phases = ["installPhase"];
installPhase = ''
cp --recursive --force $src/ $out
'';
};

evm-cvm-src = pkgs.stdenv.mkDerivation {
name = "evm-cvm-src";
src = ./.;
phases = [ "installPhase" ];
installPhase = ''
mkdir --parents $out
cp --no-preserve=mode,ownership --dereference --recursive --force $src/* $out
rm --recursive --force $out/lib
mkdir --parents $out/lib
function cpf {
cp --no-preserve=mode,ownership --dereference --recursive --force $@
}
cpf "${forge-std}/" $out/lib/forge-std
cpf "${protobuf3-solidity-lib}/" $out/lib/protobuf3-solidity-lib
cpf "${openzeppelin-contracts}/" $out/lib/openzeppelin-contracts
cpf "${yui-ibc-solidity}/" $out/lib/yui-ibc-solidity
cpf "${solidity-bytes-utils}/" $out/lib/solidity-bytes-utils
'';
};
evm-cvm-src = pkgs.stdenv.mkDerivation {
name = "evm-cvm-src";
src = ./.;
phases = ["installPhase"];
installPhase = ''
mkdir --parents $out
cp --no-preserve=mode,ownership --dereference --recursive --force $src/* $out
rm --recursive --force $out/lib
mkdir --parents $out/lib
function cpf {
cp --no-preserve=mode,ownership --dereference --recursive --force $@
}
cpf "${forge-std}/" $out/lib/forge-std
cpf "${protobuf3-solidity-lib}/" $out/lib/protobuf3-solidity-lib
cpf "${openzeppelin-contracts}/" $out/lib/openzeppelin-contracts
cpf "${yui-ibc-solidity}/" $out/lib/yui-ibc-solidity
cpf "${solidity-bytes-utils}/" $out/lib/solidity-bytes-utils
'';
};

evm-cvm-gateway = pkgs.stdenv.mkDerivation rec {
name = "evm-cvm-gateway";
FOUNDRY_SOLC = "${pkgs.solc}/bin/solc";
nativeBuildInputs = [ self'.packages.forge pkgs.solc ];
src = evm-cvm-src;
patchPhase = "true";
buildPhase = "true";
installPhase = ''
mkdir --parents $out/lib
forge build ${nix}
'';
dontFixup = true;
dontStrip = true;
};
evm-cvm-gateway = pkgs.stdenv.mkDerivation rec {
name = "evm-cvm-gateway";
FOUNDRY_SOLC = "${pkgs.solc}/bin/solc";
nativeBuildInputs = [self'.packages.forge pkgs.solc];
src = evm-cvm-src;
patchPhase = "true";
buildPhase = "true";
installPhase = ''
mkdir --parents $out/lib
forge build ${nix}
'';
dontFixup = true;
dontStrip = true;
};
};
};
}
Loading

0 comments on commit af65aab

Please sign in to comment.