Update cosmwasm crates to v2 & fix Rust 1.79 build (#76)
Co-authored-by: hu55a1n1 <sufialhussaini@gmail.com>
This commit is contained in:
parent
83441e5089
commit
fe06f244ad
17 changed files with 957 additions and 974 deletions
611
Cargo.lock
generated
611
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
34
Cargo.toml
34
Cargo.toml
|
@ -1,17 +1,19 @@
|
|||
[workspace]
|
||||
resolver = "2"
|
||||
members = [ "apps/mtcs/enclave",
|
||||
members = [
|
||||
"apps/mtcs/enclave",
|
||||
"apps/transfers/enclave",
|
||||
"core/light-client-proofs/*",
|
||||
"core/quartz",
|
||||
"cosmwasm/packages/*",
|
||||
"utils/*",
|
||||
]
|
||||
exclude = ["apps/mtcs/contracts/cw-tee-mtcs", "apps/mtcs/enclave", "apps/transfers", "apps/transfers/enclave"]
|
||||
exclude = ["apps/mtcs/contracts/cw-tee-mtcs", "apps/transfers/contracts"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.71.1"
|
||||
rust-version = "1.74.1"
|
||||
license = ""
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/informalsystems/cycles-quartz"
|
||||
|
@ -19,6 +21,7 @@ authors = ["Informal Systems <hello@informal.systems>"]
|
|||
|
||||
[workspace.dependencies]
|
||||
# external
|
||||
anyhow = { version = "1.0.86", default-features = false }
|
||||
async-trait = { version = "0.1.79", default-features = false }
|
||||
bip32 = { version = "0.5.1", default-features = false, features = ["alloc", "secp256k1", "bip39"] }
|
||||
clap = { version = "4.1.8", default-features = false, features = ["derive", "std"] }
|
||||
|
@ -32,17 +35,17 @@ hex-literal = { version = "0.4.1", default-features = false }
|
|||
k256 = { version = "0.13.2", default-features = false, features = ["ecdsa", "alloc"] }
|
||||
num-bigint = { version = "0.4.4", default-features = false }
|
||||
prost = { version = "0.12.3", default-features = false }
|
||||
rand = { version = "0.8.5", default-features = false }
|
||||
rand = { version = "0.8.5", default-features = false, features = ["getrandom"] }
|
||||
rand_core = { version = "0.6", default-features = false, features = ["std"] }
|
||||
reqwest = { version = "0.12.2", default-features = false, features = ["json", "rustls-tls"] }
|
||||
serde = { version = "1.0.189", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
|
||||
serde_json = { version = "1.0.94", default-features = false }
|
||||
serde_with = { version = "3.4.0", default-features = false, features = ["hex", "macros"] }
|
||||
sha2 = { version = "0.10.8", default-features = false }
|
||||
subtle-encoding = { version = "0.5.1", default-features = false, features = ["bech32-preview"] }
|
||||
tempfile = { version = "3", default-features = false }
|
||||
thiserror = { version = "1.0.49", default-features = false }
|
||||
tokio = { version = "1.0", default-features = false, features = ["macros", "rt-multi-thread"] }
|
||||
tokio = { version = "1.38.0", default-features = false, features = ["macros", "rt-multi-thread"] }
|
||||
tonic = { version = "0.11", default-features = false, features = ["codegen", "prost", "transport"] }
|
||||
tonic-build = { version = "0.11", default-features = false, features = ["prost", "transport"] }
|
||||
tracing = { version = "0.1.39", default-features = false }
|
||||
|
@ -55,9 +58,9 @@ zeroize = { version = "1.7.0", default-features = false }
|
|||
# cosmos
|
||||
cosmos-sdk-proto = { version = "0.21.1" }
|
||||
cosmrs = { version = "=0.16.0", default-features = false }
|
||||
cosmwasm-schema = { version = "1.4.0", default-features = false }
|
||||
cosmwasm-std = { version = "1.5.2", default-features = false }
|
||||
cw-storage-plus = { version = "1.1.0", default-features = false }
|
||||
cosmwasm-schema = { version = "2.0.0", default-features = false }
|
||||
cosmwasm-std = { version = "2.0.0", default-features = false, features = ["std"] }
|
||||
cw-storage-plus = { version = "2.0.0", default-features = false }
|
||||
ics23 = { version = "0.11.0", default-features = false, features = ["host-functions"] }
|
||||
tendermint = { version = "=0.36.0", default-features = false }
|
||||
tendermint-light-client = { version = "=0.36.0", default-features = false, features = ["rust-crypto"] }
|
||||
|
@ -76,7 +79,20 @@ cw-tee-mtcs = { path = "apps/mtcs/contracts/cw-tee-mtcs", default-features = fal
|
|||
cycles-sync = { path = "utils/cycles-sync", default-features = false }
|
||||
mtcs = { git = "ssh://git@github.com/informalsystems/mtcs.git", default-features = false }
|
||||
quartz-cw = { path = "cosmwasm/packages/quartz-cw", default-features = false }
|
||||
quartz-enclave = { path = "core/quartz", default-features = false }
|
||||
quartz-proto = { path = "core/quartz-proto", default-features = false }
|
||||
quartz-relayer = { path = "relayer", default-features = false }
|
||||
quartz-tee-ra = { path = "cosmwasm/packages/quartz-tee-ra", default-features = false }
|
||||
tm-stateless-verifier = { path = "core/light-client-proofs/tm-stateless-verifier", default-features = false }
|
||||
transfers-contract = { path = "apps/transfers/contracts", default-features = false }
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
rpath = false
|
||||
lto = true
|
||||
debug-assertions = false
|
||||
codegen-units = 1
|
||||
panic = 'abort'
|
||||
incremental = false
|
||||
overflow-checks = true
|
||||
|
|
78
apps/mtcs/contracts/cw-tee-mtcs/Cargo.lock
generated
78
apps/mtcs/contracts/cw-tee-mtcs/Cargo.lock
generated
|
@ -88,6 +88,12 @@ version = "0.9.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445"
|
||||
|
||||
[[package]]
|
||||
name = "bech32"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.5.0"
|
||||
|
@ -114,9 +120,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bnum"
|
||||
version = "0.8.1"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab9008b6bb9fc80b5277f2fe481c09e828743d9151203e804583eb4c9e15b31d"
|
||||
checksum = "56953345e39537a3e18bdaeba4cb0c58a78c1f61f361dc0fa7c5c7340ae87c5f"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
|
@ -156,12 +162,11 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-crypto"
|
||||
version = "1.5.2"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ed6aa9f904de106fa16443ad14ec2abe75e94ba003bb61c681c0e43d4c58d2a"
|
||||
checksum = "c7a339f6b59ff7ad4ae05a70512a4f3c19bf8fcc845d46bfef90f4ec0810f72c"
|
||||
dependencies = [
|
||||
"digest 0.10.7",
|
||||
"ecdsa",
|
||||
"ed25519-zebra",
|
||||
"k256",
|
||||
"rand_core 0.6.4",
|
||||
|
@ -170,18 +175,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-derive"
|
||||
version = "1.5.5"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "242e98e7a231c122e08f300d9db3262d1007b51758a8732cd6210b3e9faa4f3a"
|
||||
checksum = "7d3bfea6af94a83880fb05478135ed0c256d9a2fcde58c595a10d64dcb9c925d"
|
||||
dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmwasm-schema"
|
||||
version = "1.5.5"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7879036156092ad1c22fe0d7316efc5a5eceec2bc3906462a2560215f2a2f929"
|
||||
checksum = "101d0739564bd34cba9b84bf73665f0822487ae3b29b2dd59930608ed3aafd43"
|
||||
dependencies = [
|
||||
"cosmwasm-schema-derive",
|
||||
"schemars",
|
||||
|
@ -192,9 +197,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-schema-derive"
|
||||
version = "1.5.5"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bb57855fbfc83327f8445ae0d413b1a05ac0d68c396ab4d122b2abd7bb82cb6"
|
||||
checksum = "cf4be75f60158478da2c5d319ed59295bca1687ad50c18215a0485aa91a995ea"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -203,12 +208,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-std"
|
||||
version = "1.5.2"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad011ae7447188e26e4a7dbca2fcd0fc186aa21ae5c86df0503ea44c78f9e469"
|
||||
checksum = "ded932165de44cd0717979c34fc3b84d8e8066b8dde4f5bd78f96a643b090f90"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bech32",
|
||||
"bech32 0.9.1",
|
||||
"bnum",
|
||||
"cosmwasm-crypto",
|
||||
"cosmwasm-derive",
|
||||
|
@ -269,16 +274,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw-multi-test"
|
||||
version = "0.17.0"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d818f5323c80ed4890db7f89d65eda3f0261fe21878e628c27ea2d8de4b7ba4"
|
||||
checksum = "e403ad6ec62c8bcbcb75f7f4940712d0142b6103310da2a9375252b942358caa"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bech32 0.11.0",
|
||||
"cosmwasm-std",
|
||||
"cw-storage-plus",
|
||||
"cw-utils",
|
||||
"derivative",
|
||||
"itertools 0.11.0",
|
||||
"itertools",
|
||||
"prost",
|
||||
"schemars",
|
||||
"serde",
|
||||
|
@ -288,9 +294,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw-storage-plus"
|
||||
version = "1.2.0"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c"
|
||||
checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1"
|
||||
dependencies = [
|
||||
"cosmwasm-std",
|
||||
"schemars",
|
||||
|
@ -313,7 +319,6 @@ dependencies = [
|
|||
"k256",
|
||||
"quartz-cw",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.10.8",
|
||||
"thiserror",
|
||||
|
@ -321,24 +326,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw-utils"
|
||||
version = "1.0.3"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c4a657e5caacc3a0d00ee96ca8618745d050b8f757c709babafb81208d4239c"
|
||||
checksum = "07dfee7f12f802431a856984a32bce1cb7da1e6c006b5409e3981035ce562dec"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw2",
|
||||
"schemars",
|
||||
"semver",
|
||||
"serde",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw2"
|
||||
version = "1.1.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6c120b24fbbf5c3bedebb97f2cc85fbfa1c3287e09223428e7e597b5293c1fa"
|
||||
checksum = "b04852cd38f044c0751259d5f78255d07590d136b8a86d4e09efdd7666bd6d27"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
|
@ -351,9 +354,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw20"
|
||||
version = "1.1.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "526e39bb20534e25a1cd0386727f0038f4da294e5e535729ba3ef54055246abd"
|
||||
checksum = "a42212b6bf29bbdda693743697c621894723f35d3db0d5df930be22903d0e27c"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
|
@ -364,9 +367,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw20-base"
|
||||
version = "1.1.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17ad79e86ea3707229bf78df94e08732e8f713207b4a77b2699755596725e7d9"
|
||||
checksum = "d6de8c32e100f1fca306972d86b617234a5e6b00594ea2b48716fd6804d4d95d"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
|
@ -672,15 +675,6 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.12.1"
|
||||
|
@ -963,7 +957,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"itertools 0.12.1",
|
||||
"itertools",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
|
@ -1126,9 +1120,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde-json-wasm"
|
||||
version = "0.5.2"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e9213a07d53faa0b8dd81e767a54a8188a242fdb9be99ab75ec576a774bfdd7"
|
||||
checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "cw-tee-mtcs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
authors = ["Informal Systems <hello@informal.systems>"]
|
||||
exclude = ["contract.wasm", "hash.txt"]
|
||||
|
||||
[lib]
|
||||
|
@ -19,31 +19,29 @@ panic = 'abort'
|
|||
incremental = false
|
||||
overflow-checks = true
|
||||
|
||||
[features]
|
||||
backtraces = ["cosmwasm-std/backtraces"]
|
||||
|
||||
[dependencies]
|
||||
# external
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
hex = { version = "0.4.3", default-features = false }
|
||||
k256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] }
|
||||
schemars = "0.8.15"
|
||||
serde = { version = "1.0.189", default-features = false, features = ["derive"] }
|
||||
sha2 = "0.10.8"
|
||||
serde_json = "1.0.117"
|
||||
thiserror = { version = "1.0.49" }
|
||||
|
||||
# cosmwasm
|
||||
cosmwasm-schema = "1.5.0"
|
||||
cosmwasm-std = { version = "1.5.0", features = ["cosmwasm_1_3"] }
|
||||
cw-storage-plus = "1.1.0"
|
||||
cw20-base = { version = "1.1.1", features = ["library"] }
|
||||
cw20 = "1.1.1"
|
||||
cw2 = "1.1.1"
|
||||
cosmwasm-schema = { version = "2.0.0", default-features = false }
|
||||
cosmwasm-std = { version = "2.0.0", default-features = false, features = ["std"] }
|
||||
cw-storage-plus = { version = "2.0.0", default-features = false }
|
||||
cw20-base = { version = "2.0.0", features = ["library"] }
|
||||
cw20 = "2.0.0"
|
||||
cw2 = "2.0.0"
|
||||
|
||||
# quartz
|
||||
quartz-cw = { path = "../../../../cosmwasm/packages/quartz-cw" }
|
||||
|
||||
# patch indirect deps
|
||||
getrandom = { version = "0.2.15", features = ["js"] }
|
||||
|
||||
[dev-dependencies]
|
||||
cw-multi-test = "0.17.0"
|
||||
cw-multi-test = "2.0.0"
|
||||
serde_json = "1.0.113"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use cosmwasm_std::{
|
||||
entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult,
|
||||
Uint128,
|
||||
Uint128, Uint64,
|
||||
};
|
||||
use cw2::set_contract_version;
|
||||
use cw20_base::{
|
||||
|
@ -44,12 +44,13 @@ pub fn instantiate(
|
|||
set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
|
||||
STATE.save(deps.storage, &state)?;
|
||||
|
||||
EPOCH_COUNTER.save(deps.storage, &1)?;
|
||||
let epoch_counter = Uint64::new(1);
|
||||
EPOCH_COUNTER.save(deps.storage, &epoch_counter)?;
|
||||
|
||||
ObligationsItem::new(¤t_epoch_key(OBLIGATIONS_KEY, deps.storage)?)
|
||||
ObligationsItem::new_dyn(current_epoch_key(OBLIGATIONS_KEY, deps.storage)?)
|
||||
.save(deps.storage, &Default::default())?;
|
||||
|
||||
LiquiditySourcesItem::new(¤t_epoch_key(LIQUIDITY_SOURCES_KEY, deps.storage)?)
|
||||
LiquiditySourcesItem::new_dyn(current_epoch_key(LIQUIDITY_SOURCES_KEY, deps.storage)?)
|
||||
.save(deps.storage, &Default::default())?;
|
||||
|
||||
// store token info using cw20-base format
|
||||
|
@ -116,7 +117,7 @@ pub fn execute(
|
|||
pub mod execute {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use cosmwasm_std::{DepsMut, Env, HexBinary, MessageInfo, Response, StdResult};
|
||||
use cosmwasm_std::{DepsMut, Env, HexBinary, MessageInfo, Response, StdResult, Uint64};
|
||||
use cw20_base::contract::{execute_burn, execute_mint};
|
||||
use k256::ecdsa::VerifyingKey;
|
||||
use quartz_cw::state::{Hash, EPOCH_COUNTER};
|
||||
|
@ -159,7 +160,7 @@ pub mod execute {
|
|||
let _: Hash = digest.to_array()?;
|
||||
|
||||
// store the `(digest, ciphertext)` tuple
|
||||
ObligationsItem::new(¤t_epoch_key(OBLIGATIONS_KEY, deps.storage)?).update(
|
||||
ObligationsItem::new_dyn(current_epoch_key(OBLIGATIONS_KEY, deps.storage)?).update(
|
||||
deps.storage,
|
||||
|mut obligations| {
|
||||
if let Some(_duplicate) = obligations.insert(digest.clone(), ciphertext.clone()) {
|
||||
|
@ -185,7 +186,7 @@ pub mod execute {
|
|||
.try_for_each(|ls| VerifyingKey::from_sec1_bytes(ls).map(|_| ()))?;
|
||||
|
||||
// store the liquidity sources
|
||||
LiquiditySourcesItem::new(¤t_epoch_key(LIQUIDITY_SOURCES_KEY, deps.storage)?)
|
||||
LiquiditySourcesItem::new_dyn(current_epoch_key(LIQUIDITY_SOURCES_KEY, deps.storage)?)
|
||||
.update(deps.storage, |mut ls| {
|
||||
ls.clear();
|
||||
ls.extend(liquidity_sources);
|
||||
|
@ -201,7 +202,7 @@ pub mod execute {
|
|||
setoffs_enc: BTreeMap<RawHash, SettleOff>,
|
||||
) -> Result<Response, ContractError> {
|
||||
// store the `BTreeMap<RawHash, RawCipherText>`
|
||||
SetoffsItem::new(&previous_epoch_key(SETOFFS_KEY, deps.storage)?)
|
||||
SetoffsItem::new_dyn(previous_epoch_key(SETOFFS_KEY, deps.storage)?)
|
||||
.save(deps.storage, &setoffs_enc)?;
|
||||
|
||||
for (_, so) in setoffs_enc {
|
||||
|
@ -234,7 +235,7 @@ pub mod execute {
|
|||
|
||||
pub fn init_clearing(deps: DepsMut) -> Result<Response, ContractError> {
|
||||
EPOCH_COUNTER.update(deps.storage, |mut counter| -> StdResult<_> {
|
||||
counter += 1;
|
||||
counter = counter.saturating_add(Uint64::from(1u64));
|
||||
Ok(counter)
|
||||
})?;
|
||||
Ok(Response::new().add_attribute("action", "init_clearing"))
|
||||
|
@ -253,7 +254,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
|
|||
}
|
||||
|
||||
pub mod query {
|
||||
use cosmwasm_std::{Deps, StdResult};
|
||||
use cosmwasm_std::{Deps, StdResult, Uint64};
|
||||
|
||||
use crate::{
|
||||
msg::{GetAllSetoffsResponse, GetLiquiditySourcesResponse},
|
||||
|
@ -264,7 +265,7 @@ pub mod query {
|
|||
};
|
||||
|
||||
pub fn get_all_setoffs(deps: Deps) -> StdResult<GetAllSetoffsResponse> {
|
||||
let setoffs = SetoffsItem::new(&previous_epoch_key(SETOFFS_KEY, deps.storage)?)
|
||||
let setoffs = SetoffsItem::new_dyn(previous_epoch_key(SETOFFS_KEY, deps.storage)?)
|
||||
.load(deps.storage)?
|
||||
.into_iter()
|
||||
.collect();
|
||||
|
@ -273,14 +274,14 @@ pub mod query {
|
|||
|
||||
pub fn get_liquidity_sources(
|
||||
deps: Deps,
|
||||
epoch: Option<usize>,
|
||||
epoch: Option<Uint64>,
|
||||
) -> StdResult<GetLiquiditySourcesResponse> {
|
||||
let epoch_key = match epoch {
|
||||
None => current_epoch_key(LIQUIDITY_SOURCES_KEY, deps.storage)?,
|
||||
Some(e) => epoch_key(LIQUIDITY_SOURCES_KEY, e)?,
|
||||
};
|
||||
|
||||
let liquidity_sources = LiquiditySourcesItem::new(&epoch_key)
|
||||
let liquidity_sources = LiquiditySourcesItem::new_dyn(epoch_key)
|
||||
.load(deps.storage)?
|
||||
.into_iter()
|
||||
.collect();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use cosmwasm_schema::{cw_serde, QueryResponses};
|
||||
use cosmwasm_std::HexBinary;
|
||||
use cosmwasm_std::{HexBinary, Uint64};
|
||||
use quartz_cw::{
|
||||
msg::execute::attested::{RawAttested, RawAttestedMsgSansHandler, RawEpidAttestation},
|
||||
prelude::*,
|
||||
|
@ -96,7 +96,7 @@ pub enum QueryMsg {
|
|||
#[returns(GetAllSetoffsResponse)]
|
||||
GetAllSetoffs,
|
||||
#[returns(GetLiquiditySourcesResponse)]
|
||||
GetLiquiditySources { epoch: Option<usize> }, // `None` means latest
|
||||
GetLiquiditySources { epoch: Option<Uint64> }, // `None` means latest
|
||||
#[returns(cw20::BalanceResponse)]
|
||||
Balance { address: String },
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use cosmwasm_schema::cw_serde;
|
||||
use cosmwasm_std::{HexBinary, StdError, Storage};
|
||||
use cosmwasm_std::{HexBinary, StdError, Storage, Uint64};
|
||||
use cw_storage_plus::Item;
|
||||
use quartz_cw::state::EPOCH_COUNTER;
|
||||
|
||||
pub type RawHash = HexBinary;
|
||||
pub type RawCipherText = HexBinary;
|
||||
|
||||
pub type ObligationsItem<'a> = Item<'a, BTreeMap<RawHash, RawCipherText>>;
|
||||
pub type SetoffsItem<'a> = Item<'a, BTreeMap<RawHash, SettleOff>>;
|
||||
pub type LiquiditySourcesItem<'a> = Item<'a, BTreeSet<HexBinary>>;
|
||||
pub type ObligationsItem = Item<BTreeMap<RawHash, RawCipherText>>;
|
||||
pub type SetoffsItem = Item<BTreeMap<RawHash, SettleOff>>;
|
||||
pub type LiquiditySourcesItem = Item<BTreeSet<HexBinary>>;
|
||||
|
||||
#[cw_serde]
|
||||
pub struct State {
|
||||
|
@ -37,13 +37,20 @@ pub const SETOFFS_KEY: &str = "setoffs";
|
|||
pub const LIQUIDITY_SOURCES_KEY: &str = "liquidity_sources";
|
||||
|
||||
pub fn current_epoch_key(key: &str, storage: &dyn Storage) -> Result<String, StdError> {
|
||||
epoch_key(key, EPOCH_COUNTER.load(storage)?)
|
||||
let epoch = EPOCH_COUNTER.load(storage)?;
|
||||
epoch_key(key, epoch.into())
|
||||
}
|
||||
|
||||
pub fn previous_epoch_key(key: &str, storage: &dyn Storage) -> Result<String, StdError> {
|
||||
epoch_key(key, EPOCH_COUNTER.load(storage)? - 1)
|
||||
let epoch = EPOCH_COUNTER.load(storage)?;
|
||||
if epoch == Uint64::zero() {
|
||||
return Err(StdError::generic_err(
|
||||
"Cannot get previous epoch for epoch 0",
|
||||
));
|
||||
}
|
||||
epoch_key(key, epoch - Uint64::new(1))
|
||||
}
|
||||
|
||||
pub fn epoch_key(key: &str, epoch: usize) -> Result<String, StdError> {
|
||||
Ok(format!("{}/{key}", epoch))
|
||||
pub fn epoch_key(key: &str, epoch: Uint64) -> Result<String, StdError> {
|
||||
Ok(format!("{}/{}", epoch, key))
|
||||
}
|
||||
|
|
|
@ -1,52 +1,36 @@
|
|||
[package]
|
||||
name = "enclave"
|
||||
name = "quartz-app-mtcs-enclave"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
rpath = false
|
||||
lto = true
|
||||
debug-assertions = false
|
||||
codegen-units = 1
|
||||
panic = 'abort'
|
||||
incremental = false
|
||||
overflow-checks = true
|
||||
authors = ["Informal Systems <hello@informal.systems>"]
|
||||
|
||||
[dependencies]
|
||||
# external
|
||||
hex = { version = "0.4.3", default-features = false }
|
||||
k256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] }
|
||||
schemars = "0.8.15"
|
||||
serde = { version = "1.0.189", default-features = false, features = ["derive"] }
|
||||
thiserror = { version = "1.0.49" }
|
||||
tonic = { version = "0.11.0"}
|
||||
tonic-build = "0.11.0"
|
||||
cosmrs = { version = "0.16.0"}
|
||||
cosmwasm-std = { version = "1.5.2", default-features = false }
|
||||
serde_json = { version = "1.0.94", default-features = false }
|
||||
ecies = { version = "0.2.3", default-features = false, features = ["pure"] }
|
||||
clap = { version = "4.1.8", default-features = false, features = ["derive", "std"] }
|
||||
tokio = { version = "1.0", default-features = false, features = ["macros", "rt-multi-thread"] }
|
||||
tendermint = { version = "=0.36.0", default-features = false }
|
||||
tendermint-light-client = { version = "=0.36.0", default-features = false, features = ["rust-crypto"] }
|
||||
color-eyre = { version = "0.6.2", default-features = false }
|
||||
prost = { version = "0.12.3", default-features = false }
|
||||
clap.workspace = true
|
||||
color-eyre.workspace = true
|
||||
ecies.workspace = true
|
||||
hex.workspace = true
|
||||
k256.workspace = true
|
||||
prost.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
tokio.workspace = true
|
||||
tonic.workspace = true
|
||||
|
||||
# local
|
||||
# cosmos
|
||||
cosmrs.workspace = true
|
||||
cosmwasm-std.workspace = true
|
||||
tendermint.workspace = true
|
||||
tendermint-light-client.workspace = true
|
||||
|
||||
# quartz
|
||||
cw-tee-mtcs.workspace = true
|
||||
cycles-sync.workspace = true
|
||||
mtcs.workspace = true
|
||||
|
||||
# quartz
|
||||
quartz-cw = { path = "../../../cosmwasm/packages/quartz-cw" }
|
||||
quartz-proto = { path = "../../../core/quartz-proto" }
|
||||
quartz-enclave = { path = "../../../core/quartz"}
|
||||
|
||||
[dev-dependencies]
|
||||
cw-multi-test = "0.17.0"
|
||||
serde_json = "1.0.113"
|
||||
quartz-cw.workspace = true
|
||||
quartz-proto.workspace = true
|
||||
quartz-enclave.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build.workspace = true
|
|
@ -2,4 +2,3 @@
|
|||
wasm = "build --target wasm32-unknown-unknown --release --lib"
|
||||
wasm-debug = "build --target wasm32-unknown-unknown --lib"
|
||||
schema = "run schema"
|
||||
|
227
apps/transfers/contracts/Cargo.lock
generated
227
apps/transfers/contracts/Cargo.lock
generated
|
@ -37,7 +37,7 @@ checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -49,7 +49,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -84,9 +84,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445"
|
|||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.5.0"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
||||
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
|
@ -108,9 +108,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bnum"
|
||||
version = "0.8.1"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab9008b6bb9fc80b5277f2fe481c09e828743d9151203e804583eb4c9e15b31d"
|
||||
checksum = "56953345e39537a3e18bdaeba4cb0c58a78c1f61f361dc0fa7c5c7340ae87c5f"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
|
@ -138,12 +144,11 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-crypto"
|
||||
version = "1.5.2"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ed6aa9f904de106fa16443ad14ec2abe75e94ba003bb61c681c0e43d4c58d2a"
|
||||
checksum = "c7a339f6b59ff7ad4ae05a70512a4f3c19bf8fcc845d46bfef90f4ec0810f72c"
|
||||
dependencies = [
|
||||
"digest 0.10.7",
|
||||
"ecdsa",
|
||||
"ed25519-zebra",
|
||||
"k256",
|
||||
"rand_core 0.6.4",
|
||||
|
@ -152,18 +157,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-derive"
|
||||
version = "1.5.5"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "242e98e7a231c122e08f300d9db3262d1007b51758a8732cd6210b3e9faa4f3a"
|
||||
checksum = "7d3bfea6af94a83880fb05478135ed0c256d9a2fcde58c595a10d64dcb9c925d"
|
||||
dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cosmwasm-schema"
|
||||
version = "1.5.5"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7879036156092ad1c22fe0d7316efc5a5eceec2bc3906462a2560215f2a2f929"
|
||||
checksum = "101d0739564bd34cba9b84bf73665f0822487ae3b29b2dd59930608ed3aafd43"
|
||||
dependencies = [
|
||||
"cosmwasm-schema-derive",
|
||||
"schemars",
|
||||
|
@ -174,9 +179,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-schema-derive"
|
||||
version = "1.5.5"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bb57855fbfc83327f8445ae0d413b1a05ac0d68c396ab4d122b2abd7bb82cb6"
|
||||
checksum = "cf4be75f60158478da2c5d319ed59295bca1687ad50c18215a0485aa91a995ea"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -185,9 +190,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cosmwasm-std"
|
||||
version = "1.5.2"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad011ae7447188e26e4a7dbca2fcd0fc186aa21ae5c86df0503ea44c78f9e469"
|
||||
checksum = "ded932165de44cd0717979c34fc3b84d8e8066b8dde4f5bd78f96a643b090f90"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bech32",
|
||||
|
@ -251,9 +256,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw-storage-plus"
|
||||
version = "1.2.0"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c"
|
||||
checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1"
|
||||
dependencies = [
|
||||
"cosmwasm-std",
|
||||
"schemars",
|
||||
|
@ -262,24 +267,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw-utils"
|
||||
version = "1.0.3"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c4a657e5caacc3a0d00ee96ca8618745d050b8f757c709babafb81208d4239c"
|
||||
checksum = "07dfee7f12f802431a856984a32bce1cb7da1e6c006b5409e3981035ce562dec"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
"cw2",
|
||||
"schemars",
|
||||
"semver",
|
||||
"serde",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cw2"
|
||||
version = "1.1.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6c120b24fbbf5c3bedebb97f2cc85fbfa1c3287e09223428e7e597b5293c1fa"
|
||||
checksum = "b04852cd38f044c0751259d5f78255d07590d136b8a86d4e09efdd7666bd6d27"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
|
@ -292,9 +295,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw20"
|
||||
version = "1.1.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "526e39bb20534e25a1cd0386727f0038f4da294e5e535729ba3ef54055246abd"
|
||||
checksum = "a42212b6bf29bbdda693743697c621894723f35d3db0d5df930be22903d0e27c"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
|
@ -305,9 +308,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cw20-base"
|
||||
version = "1.1.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17ad79e86ea3707229bf78df94e08732e8f713207b4a77b2699755596725e7d9"
|
||||
checksum = "d6de8c32e100f1fca306972d86b617234a5e6b00594ea2b48716fd6804d4d95d"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
"cosmwasm-std",
|
||||
|
@ -341,7 +344,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -352,7 +355,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178"
|
|||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -396,7 +399,7 @@ checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -442,13 +445,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "displaydoc"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
|
||||
checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -551,8 +554,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -611,6 +616,15 @@ version = "1.0.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "k256"
|
||||
version = "0.13.3"
|
||||
|
@ -637,6 +651,12 @@ version = "0.2.155"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "mc-attestation-verifier"
|
||||
version = "0.4.3"
|
||||
|
@ -738,9 +758,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7"
|
||||
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
|
@ -839,9 +859,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.85"
|
||||
version = "1.0.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
|
||||
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -969,7 +989,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote",
|
||||
"serde_derive_internals",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1003,9 +1023,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde-json-wasm"
|
||||
version = "0.5.2"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e9213a07d53faa0b8dd81e767a54a8188a242fdb9be99ab75ec576a774bfdd7"
|
||||
checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -1018,7 +1038,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1029,14 +1049,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.117"
|
||||
version = "1.0.120"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
|
||||
checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -1045,9 +1065,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.8.1"
|
||||
version = "3.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20"
|
||||
checksum = "e73139bc5ec2d45e6c5fd85be5a46949c1c39a4c18e56915f5eb4c12f975e377"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
|
@ -1056,14 +1076,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.8.1"
|
||||
version = "3.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2"
|
||||
checksum = "b80d3d6b56b64335c0180e5ffde23b3c5e08c14c585b51a15bd0e95393f46703"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1130,9 +1150,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.5.0"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
||||
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
|
@ -1147,9 +1167,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.66"
|
||||
version = "2.0.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
|
||||
checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1164,7 +1184,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1184,7 +1204,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.66",
|
||||
"syn 2.0.68",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1219,7 +1239,7 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "transfers_contracts"
|
||||
name = "transfers-contract"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cosmwasm-schema",
|
||||
|
@ -1228,6 +1248,7 @@ dependencies = [
|
|||
"cw-utils",
|
||||
"cw2",
|
||||
"cw20-base",
|
||||
"getrandom",
|
||||
"quartz-cw",
|
||||
"serde_json",
|
||||
"sha2 0.10.8",
|
||||
|
@ -1264,6 +1285,60 @@ version = "0.11.0+wasi-snapshot-preview1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.68",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.68",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
|
@ -1275,9 +1350,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
|
@ -1291,51 +1366,51 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "x509-cert"
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
[package]
|
||||
name = "transfers_contracts"
|
||||
name = "transfers-contract"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
authors = ["Informal Systems <hello@informal.systems>"]
|
||||
exclude = ["contract.wasm", "hash.txt"]
|
||||
|
||||
[[bin]]
|
||||
name = "schema"
|
||||
path = "bin/schema.rs"
|
||||
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
|
@ -24,9 +23,6 @@ panic = 'abort'
|
|||
incremental = false
|
||||
overflow-checks = true
|
||||
|
||||
[features]
|
||||
backtraces = ["cosmwasm-std/backtraces"]
|
||||
|
||||
[dependencies]
|
||||
# external
|
||||
sha2 = "0.10.8"
|
||||
|
@ -34,12 +30,15 @@ serde_json = "1.0.117"
|
|||
thiserror = { version = "1.0.49" }
|
||||
|
||||
# cosmwasm
|
||||
cosmwasm-schema = "1.5.0"
|
||||
cosmwasm-std = { version = "1.5.0", features = ["cosmwasm_1_3"] }
|
||||
cw-storage-plus = "1.1.0"
|
||||
cw-utils = "1.0.3"
|
||||
cw2 = "1.1.1"
|
||||
cw20-base = { version = "1.1.1", features = ["library"] }
|
||||
cosmwasm-schema = { version = "2.0.0", default-features = false }
|
||||
cosmwasm-std = { version = "2.0.0", default-features = false, features = ["std"] }
|
||||
cw-storage-plus = { version = "2.0.0", default-features = false }
|
||||
cw-utils = "2.0.0"
|
||||
cw20-base = { version = "2.0.0", features = ["library"] }
|
||||
cw2 = "2.0.0"
|
||||
|
||||
# quartz
|
||||
quartz-cw = { path = "../../../cosmwasm/packages/quartz-cw" }
|
||||
|
||||
# patch indirect deps
|
||||
getrandom = { version = "0.2.15", features = ["js"] }
|
||||
|
|
723
apps/transfers/enclave/Cargo.lock
generated
723
apps/transfers/enclave/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,56 +1,41 @@
|
|||
[package]
|
||||
name = "enclave"
|
||||
name = "quartz-app-transfers-enclave"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
rpath = false
|
||||
lto = true
|
||||
debug-assertions = false
|
||||
codegen-units = 1
|
||||
panic = 'abort'
|
||||
incremental = false
|
||||
overflow-checks = true
|
||||
authors = ["Informal Systems <hello@informal.systems>"]
|
||||
autobins = false
|
||||
|
||||
[[bin]]
|
||||
name = "encrypt"
|
||||
path = "bin/encrypt.rs"
|
||||
|
||||
|
||||
[dependencies]
|
||||
# external
|
||||
hex = { version = "0.4.3", default-features = false }
|
||||
k256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] }
|
||||
schemars = "0.8.15"
|
||||
serde = { version = "1.0.189", default-features = false, features = ["derive"] }
|
||||
thiserror = { version = "1.0.49" }
|
||||
tonic = { version = "0.11.0"}
|
||||
cosmrs = { version = "0.16.0"}
|
||||
cosmwasm-std = { version = "1.5.2", default-features = false }
|
||||
serde_json = { version = "1.0.94", default-features = false }
|
||||
ecies = { version = "0.2.3", default-features = false, features = ["pure"] }
|
||||
clap = { version = "4.1.8", default-features = false, features = ["derive", "std"] }
|
||||
tokio = { version = "1.0", default-features = false, features = ["macros", "rt-multi-thread"] }
|
||||
tendermint = { version = "=0.36.0", default-features = false }
|
||||
tendermint-light-client = { version = "=0.36.0", default-features = false, features = ["rust-crypto"] }
|
||||
color-eyre = { version = "0.6.2", default-features = false }
|
||||
prost = { version = "0.12.3", default-features = false }
|
||||
anyhow ={ version = "*" }
|
||||
sha2 = "0.10.8"
|
||||
anyhow.workspace = true
|
||||
clap.workspace = true
|
||||
color-eyre.workspace = true
|
||||
ecies.workspace = true
|
||||
hex.workspace = true
|
||||
k256.workspace = true
|
||||
prost.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
tokio.workspace = true
|
||||
tonic.workspace = true
|
||||
|
||||
# local
|
||||
transfers_contracts = { path = "../contracts" }
|
||||
# cosmos
|
||||
cosmrs.workspace = true
|
||||
cosmwasm-std.workspace = true
|
||||
tendermint.workspace = true
|
||||
tendermint-light-client.workspace = true
|
||||
|
||||
# quartz
|
||||
quartz-cw = { path = "../../../cosmwasm/packages/quartz-cw" }
|
||||
quartz-proto = { path = "../../../core/quartz-proto" }
|
||||
quartz-enclave = { path = "../../../core/quartz"}
|
||||
|
||||
[dev-dependencies]
|
||||
cw-multi-test = "0.17.0"
|
||||
serde_json = "1.0.113"
|
||||
cycles-sync.workspace = true
|
||||
quartz-cw.workspace = true
|
||||
quartz-proto.workspace = true
|
||||
quartz-enclave.workspace = true
|
||||
transfers-contract.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = "0.11.0"
|
||||
tonic-build.workspace = true
|
||||
|
|
|
@ -8,7 +8,7 @@ use k256::{
|
|||
pkcs8::DecodePublicKey,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use transfers_contracts::msg::execute::ClearTextTransferRequestMsg;
|
||||
use transfers_contract::msg::execute::ClearTextTransferRequestMsg;
|
||||
|
||||
pub type RawCipherText = HexBinary;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ where
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use cosmwasm_std::{
|
||||
testing::{mock_dependencies, mock_env, mock_info},
|
||||
testing::{message_info, mock_dependencies, mock_env},
|
||||
DepsMut,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
@ -63,7 +63,11 @@ mod tests {
|
|||
R::DomainType: Handler,
|
||||
{
|
||||
let msg = parse_msg::<R>(msg_str);
|
||||
let info = mock_info("creator", &[]);
|
||||
let creator = deps
|
||||
.api
|
||||
.addr_validate("creator")
|
||||
.expect("Hardcoded creator");
|
||||
let info = message_info(&creator, &[]);
|
||||
let env = mock_env();
|
||||
let res = msg
|
||||
.handle(deps.branch(), &env, &info)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
|
||||
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response, Uint64};
|
||||
use quartz_tee_ra::Error as RaVerificationError;
|
||||
|
||||
use crate::{
|
||||
|
@ -31,8 +31,11 @@ impl Handler for CoreInstantiate {
|
|||
CONFIG
|
||||
.save(deps.storage, &RawConfig::from(self.config().clone()))
|
||||
.map_err(Error::Std)?;
|
||||
let epoch_counter = Uint64::new(1);
|
||||
|
||||
EPOCH_COUNTER.save(deps.storage, &1).map_err(Error::Std)?;
|
||||
EPOCH_COUNTER
|
||||
.save(deps.storage, &epoch_counter)
|
||||
.map_err(Error::Std)?;
|
||||
|
||||
Ok(Response::new().add_attribute("action", "instantiate"))
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use core::time::Duration;
|
||||
|
||||
use cosmwasm_schema::cw_serde;
|
||||
use cosmwasm_std::{HexBinary, StdError};
|
||||
use cosmwasm_std::{HexBinary, StdError, Uint64};
|
||||
use cw_storage_plus::Item;
|
||||
use k256::ecdsa::VerifyingKey;
|
||||
|
||||
|
@ -225,6 +225,6 @@ impl Session {
|
|||
}
|
||||
}
|
||||
|
||||
pub const CONFIG: Item<'_, RawConfig> = Item::new("quartz_config");
|
||||
pub const SESSION: Item<'_, Session> = Item::new("quartz_session");
|
||||
pub const EPOCH_COUNTER: Item<'_, usize> = Item::new("epoch_counter");
|
||||
pub const CONFIG: Item<RawConfig> = Item::new("quartz_config");
|
||||
pub const SESSION: Item<Session> = Item::new("quartz_session");
|
||||
pub const EPOCH_COUNTER: Item<Uint64> = Item::new("epoch_counter");
|
||||
|
|
Loading…
Reference in a new issue