Skip to content

Commit

Permalink
Rename enclave_cosmwasm_types to enclave_cosmwasm_v010_types
Browse files Browse the repository at this point in the history
  • Loading branch information
assafmo committed Jul 13, 2022
1 parent 5a015c1 commit df58736
Show file tree
Hide file tree
Showing 28 changed files with 38 additions and 40 deletions.
8 changes: 4 additions & 4 deletions cosmwasm/enclaves/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 cosmwasm/enclaves/shared/contract-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ enclave-ffi-types = { path = "../../ffi-types" }
cosmos_proto = { path = "../cosmos-proto" }
enclave_crypto = { path = "../crypto" }
enclave_cosmos_types = { path = "../cosmos-types" }
enclave_cosmwasm_types = { path = "../cosmwasm-types" }
enclave_cosmwasm_v010_types = { path = "../cosmwasm-v010-types" }
enclave_cosmwasm_v1_types = { path = "../cosmwasm-v1-types" }
enclave_utils = { path = "../utils" }
serde = { git = "https://github.com/mesalock-linux/serde-sgx", features = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::wasm::CosmWasmApiVersion;
use cosmos_proto::tx::signing::SignMode;
use cosmwasm_v010_types::types::CanonicalAddr;
use enclave_cosmos_types::types::{ContractCode, HandleType, SigInfo};
use enclave_cosmwasm_types as cosmwasm_v010_types;
use enclave_cosmwasm_types::encoding::Binary;
use enclave_cosmwasm_v010_types as cosmwasm_v010_types;
use enclave_cosmwasm_v010_types::encoding::Binary;
use enclave_cosmwasm_v1_types::addresses::Addr;
use enclave_cosmwasm_v1_types::results::{
DecryptedReply, Event, Reply, SubMsgResponse, SubMsgResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use enclave_cosmos_types::traits::CosmosAminoPubkey;
use enclave_cosmos_types::types::{
ContractCode, CosmWasmMsg, CosmosPubKey, SigInfo, SignDoc, StdSignDoc,
};
use enclave_cosmwasm_types::types::{CanonicalAddr, Coin, Env, HumanAddr};
use enclave_cosmwasm_v010_types::types::{CanonicalAddr, Coin, Env, HumanAddr};
use enclave_crypto::traits::VerifyingKey;
use enclave_crypto::{sha_256, AESKey, Hmac, Kdf, HASH_SIZE, KEY_MANAGER};

Expand Down
23 changes: 11 additions & 12 deletions cosmwasm/enclaves/shared/contract-engine/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ use crate::contract_validation::ReplyParams;
/// that is unique to the user and the enclave
///
use super::types::{IoNonce, SecretMessage};
use enclave_cosmwasm_types as cosmwasm_v010_types;
use enclave_cosmwasm_types::encoding::Binary;
use enclave_cosmwasm_types::types::{CanonicalAddr, Coin};
use enclave_cosmwasm_v010_types::encoding::Binary;
use enclave_cosmwasm_v010_types::types::{CanonicalAddr, Coin};
use enclave_cosmwasm_v1_types::results::{Event, Reply, ReplyOn, SubMsgResponse, SubMsgResult};

use enclave_ffi_types::EnclaveError;
Expand Down Expand Up @@ -43,7 +42,7 @@ enum RawWasmOutput {
},
OkV010 {
#[serde(rename = "Ok")]
ok: cosmwasm_v010_types::types::ContractResult,
ok: enclave_cosmwasm_v010_types::types::ContractResult,
internal_reply_enclave_sig: Option<Binary>,
internal_msg_id: Option<Binary>,
},
Expand All @@ -58,7 +57,7 @@ enum RawWasmOutput {
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
struct V010WasmOutput {
#[serde(rename = "Ok")]
pub ok: Option<cosmwasm_v010_types::types::ContractResult>,
pub ok: Option<enclave_cosmwasm_v010_types::types::ContractResult>,
#[serde(rename = "Err")]
pub err: Option<Value>,
}
Expand Down Expand Up @@ -243,7 +242,7 @@ pub fn encrypt_output(
internal_msg_id,
} => {
for msg in &mut ok.messages {
if let cosmwasm_v010_types::types::CosmosMsg::Wasm(wasm_msg) = msg {
if let enclave_cosmwasm_v010_types::types::CosmosMsg::Wasm(wasm_msg) = msg {
encrypt_v010_wasm_msg(
wasm_msg,
secret_msg.nonce,
Expand Down Expand Up @@ -496,20 +495,20 @@ pub fn encrypt_output(
}

fn encrypt_v010_wasm_msg(
wasm_msg: &mut cosmwasm_v010_types::types::WasmMsg,
wasm_msg: &mut enclave_cosmwasm_v010_types::types::WasmMsg,
nonce: IoNonce,
user_public_key: Ed25519PublicKey,
contract_addr: &CanonicalAddr,
) -> Result<(), EnclaveError> {
match wasm_msg {
cosmwasm_v010_types::types::WasmMsg::Execute {
enclave_cosmwasm_v010_types::types::WasmMsg::Execute {
msg,
callback_code_hash,
callback_sig,
send,
..
}
| cosmwasm_v010_types::types::WasmMsg::Instantiate {
| enclave_cosmwasm_v010_types::types::WasmMsg::Instantiate {
msg,
callback_code_hash,
callback_sig,
Expand Down Expand Up @@ -590,11 +589,11 @@ fn encrypt_v1_wasm_msg(
&msg_to_pass,
&funds
.iter()
.map(|coin| cosmwasm_v010_types::types::Coin {
.map(|coin| enclave_cosmwasm_v010_types::types::Coin {
denom: coin.denom.clone(),
amount: cosmwasm_v010_types::math::Uint128(coin.amount.u128()),
amount: enclave_cosmwasm_v010_types::math::Uint128(coin.amount.u128()),
})
.collect::<Vec<cosmwasm_v010_types::types::Coin>>()[..],
.collect::<Vec<enclave_cosmwasm_v010_types::types::Coin>>()[..],
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::errors::WasmEngineError;
use crate::external::{ecalls, ocalls};
use crate::types::{IoNonce, SecretMessage};

use enclave_cosmwasm_types::{
use enclave_cosmwasm_v010_types::{
encoding::Binary,
query::{QueryRequest, WasmQuery},
std_error::{StdError, StdResult},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use wasmi::{Error as InterpreterError, MemoryInstance, MemoryRef, ModuleRef, Run

use enclave_ffi_types::{Ctx, EnclaveError};

use enclave_cosmwasm_types::consts::BECH32_PREFIX_ACC_ADDR;
use enclave_cosmwasm_v010_types::consts::BECH32_PREFIX_ACC_ADDR;
use enclave_crypto::{sha_256, Ed25519PublicKey, WasmApiCryptoError};

use crate::contract_validation::ContractKey;
Expand Down
13 changes: 7 additions & 6 deletions cosmwasm/enclaves/shared/cosmos-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://gi
cosmos_proto = { path = "../cosmos-proto" }
enclave-ffi-types = { path = "../../ffi-types" }
enclave_crypto = { path = "../crypto" }
enclave_cosmwasm_types = { path = "../cosmwasm-types" }

enclave_cosmwasm_v010_types = { path = "../cosmwasm-v010-types" }
log = "0.4.14"
serde = { git = "https://github.com/mesalock-linux/serde-sgx", features = ["derive"] }
serde = { git = "https://github.com/mesalock-linux/serde-sgx", features = [
"derive"
] }
derive_more = "0.99"

protobuf = "2.25.2"
sha2 = "0.8.1"
num_enum = "0.5.7"

prost = { git = "https://github.com/mesalock-linux/prost-sgx", rev = "cd3103a6d45cf7a43b6c1c5e4223428097d1c547", default-features = false, features = ["prost-derive"] }
prost = { git = "https://github.com/mesalock-linux/prost-sgx", rev = "cd3103a6d45cf7a43b6c1c5e4223428097d1c547", default-features = false, features = [
"prost-derive"
] }
2 changes: 1 addition & 1 deletion cosmwasm/enclaves/shared/cosmos-types/src/multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cosmos_proto::crypto::multisig::multisig::MultiSignature;

use super::traits::CosmosAminoPubkey;

use enclave_cosmwasm_types::types::CanonicalAddr;
use enclave_cosmwasm_v010_types::types::CanonicalAddr;
use enclave_crypto::CryptoError;
use protobuf::Message;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use enclave_crypto::secp256k1::{Secp256k1PubKey, SECP256K1_PREFIX};
use log::warn;

use super::traits::CosmosAminoPubkey;
use enclave_cosmwasm_types::types::CanonicalAddr;
use enclave_cosmwasm_v010_types::types::CanonicalAddr;
use enclave_crypto::hash::ripemd::ripemd160;
use enclave_crypto::hash::sha::sha_256;

Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/enclaves/shared/cosmos-types/src/traits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use enclave_cosmwasm_types::types::CanonicalAddr;
use enclave_cosmwasm_v010_types::types::CanonicalAddr;

// https://github.com/tendermint/tendermint/blob/v0.33.3/crypto/crypto.go#L22
pub trait CosmosAminoPubkey: PartialEq {
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/enclaves/shared/cosmos-types/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use enclave_crypto::{

use cosmos_proto as proto;

use enclave_cosmwasm_types::{
use enclave_cosmwasm_v010_types::{
coins::Coin,
encoding::Binary,
math::Uint128,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "enclave_cosmwasm_types"
name = "enclave_cosmwasm_v010_types"
version = "1.2.4"
authors = ["Cashmaney <[email protected]>"]
edition = "2018"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ where
T: Clone + fmt::Debug + PartialEq,
{
Bank(BankMsg),
// by default we use RawMsg, but a contract can override that
// to call into more app-specific code (whatever they define)
Custom(T),
Staking(StakingMsg),
Wasm(WasmMsg),
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/enclaves/shared/cosmwasm-v1-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://gi

[dependencies]
enclave-ffi-types = { path = "../../ffi-types" }
enclave_cosmwasm_types = { path = "../cosmwasm-types" }
enclave_cosmwasm_v010_types = { path = "../cosmwasm-v010-types" }
log = "0.4.8"
serde = { git = "https://github.com/mesalock-linux/serde-sgx", features = [
"derive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fmt;
use crate::coins::Coin;
#[cfg(feature = "stargate")]
use crate::ibc::IbcMsg;
use enclave_cosmwasm_types::encoding::Binary;
use enclave_cosmwasm_v010_types::encoding::Binary;

use super::Empty;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use enclave_cosmwasm_types::types::LogAttribute;
use enclave_cosmwasm_v010_types::types::LogAttribute;
use serde::{Deserialize, Serialize};
/// A full [*Cosmos SDK* event].
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use std::fmt;

use enclave_cosmwasm_types::{encoding::Binary, types::LogAttribute};
use enclave_cosmwasm_v010_types::{encoding::Binary, types::LogAttribute};

use super::{Empty, Event, SubMsg};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use std::fmt;

use enclave_cosmwasm_types::encoding::Binary;
use enclave_cosmwasm_v010_types::encoding::Binary;

use super::{CosmosMsg, Empty, Event};

Expand Down

0 comments on commit df58736

Please sign in to comment.