Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,418 changes: 1,149 additions & 269 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ crypto = { path = "../modules/crypto" }
keymanager = { path = "../modules/keymanager" }
remote-attestation = { path = "../modules/remote-attestation" }
attestation-report = { path = "../modules/attestation-report", features = ["dcap-quote-parser"] }
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.3" }
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "9d6fab9b7ca5621e58958515228a616f37f89a6d" }

[build-dependencies]
git2 = { version = "0.20", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions enclave-modules/ecall-handler/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
#![no_std]
extern crate alloc;

Expand Down
1 change: 0 additions & 1 deletion enclave-modules/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {

#[cfg(not(test))]
#[lang = "eh_personality"]
#[no_mangle]
unsafe extern "C" fn rust_eh_personality() {}

static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut());
Expand Down
2 changes: 1 addition & 1 deletion modules/attestation-report/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pem = { version = "2.0", default-features = false }
webpki = { version = "0.22", features = ["alloc"] }
anyhow = { version = "1", default-features = false }

dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.3", optional = true }
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "9d6fab9b7ca5621e58958515228a616f37f89a6d", optional = true }

[dev-dependencies]
tokio = { version = "1.0", default-features = false, features = ["macros"] }
Expand Down
1 change: 1 addition & 0 deletions modules/attestation-report/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions modules/commitments/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
#![cfg_attr(not(test), no_std)]
extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions modules/crypto/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions modules/enclave-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
pub use api::{EnclaveCommandAPI, EnclavePrimitiveAPI, EnclaveProtoAPI};
pub use enclave::{CommitStoreAccessor, Enclave, EnclaveInfo, HostStoreTxManager};
pub use errors::Error;
Expand Down
4 changes: 2 additions & 2 deletions modules/host-environment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ impl Environment {
Self { home, store }
}

pub fn get_store(&self) -> RwLockReadGuard<HostStore> {
pub fn get_store(&self) -> RwLockReadGuard<'_, HostStore> {
self.store.read().unwrap()
}

pub fn get_mut_store(&self) -> RwLockWriteGuard<HostStore> {
pub fn get_mut_store(&self) -> RwLockWriteGuard<'_, HostStore> {
self.store.write().unwrap()
}
}
3 changes: 2 additions & 1 deletion modules/keymanager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
pub mod errors;
pub use crate::errors::Error;
use anyhow::anyhow;
Expand Down Expand Up @@ -173,7 +174,7 @@ impl EnclaveKeyManager {
.to_hex_string(),
sealed_key.to_vec(),
Mrenclave::from(report.body.mr_enclave).to_hex_string(),
serialize_bytes(&report),
serialize_bytes(&report).as_slice(),
is_enclave_debug_enabled(&report.body),
qe_type.as_u32()
])?;
Expand Down
2 changes: 1 addition & 1 deletion modules/lcp-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ flex-error = { version = "0.4.4", default-features = false }
tiny-keccak = { version = "2.0" }
hex-literal = { version = "0.4.1" }
alloy-sol-types = { version = "0.8", default-features = false }
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.3" }
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "9d6fab9b7ca5621e58958515228a616f37f89a6d" }

attestation-report = { path = "../attestation-report", default-features = false }
remote-attestation = { path = "../remote-attestation", default-features = false }
Expand Down
11 changes: 11 additions & 0 deletions modules/lcp-client/src/client_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@ impl LCPClient {
} else {
Default::default()
};
if !client_state.operators.is_empty() {
assert!(
!operator.is_zero(),
"operator must be non-zero if operators are not empty"
);
assert!(
client_state.operators.contains(&operator),
"operator must be in the operators list"
);
}

let expected_operator = report_data.operator();
// check if the operator matches the expected operator in the report data
assert!(expected_operator.is_zero() || operator == expected_operator);
Expand Down
1 change: 1 addition & 0 deletions modules/lcp-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(unused_variables)]
#![allow(clippy::result_large_err)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;

Expand Down
4 changes: 2 additions & 2 deletions modules/light-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![no_std]
#![allow(clippy::result_large_err)]
#![allow(unused_imports)]
extern crate alloc;

#[allow(unused_imports)]

mod prelude {
pub use core::prelude::v1::*;

Expand Down
1 change: 1 addition & 0 deletions modules/mock-lc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
#![no_std]
extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions modules/remote-attestation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ serde_json = { version = "1.0", features = ["preserve_order"] }
rsa = { version = "0.9.2", features = ["pem"], optional = true }
chrono = { version = "0.4.38", features = ["now"], optional = true }

dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.3" }
dcap-pcs = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.3" }
dcap-collaterals = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.3" }
dcap-quote-verifier = { git = "https://github.com/datachainlab/zkdcap", rev = "9d6fab9b7ca5621e58958515228a616f37f89a6d" }
dcap-pcs = { git = "https://github.com/datachainlab/zkdcap", rev = "9d6fab9b7ca5621e58958515228a616f37f89a6d" }
dcap-collaterals = { git = "https://github.com/datachainlab/zkdcap", rev = "9d6fab9b7ca5621e58958515228a616f37f89a6d" }

lcp-types = { path = "../types" }
crypto = { path = "../crypto", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion modules/remote-attestation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[allow(clippy::doc_lazy_continuation)]
#![allow(clippy::doc_lazy_continuation)]
#![allow(clippy::result_large_err)]
pub mod common;
pub mod dcap;
pub mod dcap_simulation;
Expand Down
1 change: 1 addition & 0 deletions modules/tendermint-lc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::large_enum_variant)]
#![allow(clippy::result_large_err)]
#![no_std]
extern crate alloc;

Expand Down
25 changes: 14 additions & 11 deletions modules/types/src/transmuter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::prelude::*;
use alloc::string::ToString;
use alloc::vec::Vec;
use core::marker::PhantomData;
use serde::Deserialize;
use serde_with::{DeserializeAs, SerializeAs};
Expand All @@ -9,7 +10,6 @@ pub struct BytesTransmuter<T>(PhantomData<T>);

impl<T> SerializeAs<T> for BytesTransmuter<T>
where
[(); core::mem::size_of::<T>()]:,
T: ContiguousMemory,
{
fn serialize_as<S>(source: &T, serializer: S) -> Result<S::Ok, S::Error>
Expand All @@ -22,7 +22,6 @@ where

impl<'de, T> DeserializeAs<'de, T> for BytesTransmuter<T>
where
[(); core::mem::size_of::<T>()]:,
T: ContiguousMemory,
{
fn deserialize_as<D>(deserializer: D) -> Result<T, D::Error>
Expand All @@ -36,24 +35,28 @@ where
}
}

pub fn serialize_bytes<T>(source: &T) -> [u8; core::mem::size_of::<T>()]
pub fn serialize_bytes<T>(source: &T) -> Vec<u8>
where
[(); core::mem::size_of::<T>()]:,
T: ContiguousMemory,
{
unsafe { core::mem::transmute_copy::<_, [u8; core::mem::size_of::<T>()]>(source) }
let size = core::mem::size_of::<T>();
let ptr = source as *const T as *const u8;
let slice = unsafe { core::slice::from_raw_parts(ptr, size) };
slice.to_vec()
}

pub fn deserialize_bytes<T>(bz: &[u8]) -> Result<T, (usize, usize)>
where
[(); core::mem::size_of::<T>()]:,
T: ContiguousMemory,
{
let mut array = [0; core::mem::size_of::<T>()];
if bz.len() == array.len() {
array.copy_from_slice(bz);
Ok(unsafe { core::mem::transmute_copy(&array) })
let expected_size = core::mem::size_of::<T>();
if bz.len() == expected_size {
let mut value = core::mem::MaybeUninit::<T>::uninit();
let ptr = value.as_mut_ptr() as *mut u8;
let slice = unsafe { core::slice::from_raw_parts_mut(ptr, expected_size) };
slice.copy_from_slice(bz);
Ok(unsafe { value.assume_init() })
} else {
Err((bz.len(), array.len()))
Err((bz.len(), expected_size))
}
}
2 changes: 1 addition & 1 deletion modules/zkvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
risc0-zkvm = { version = "1.2.4", default-features = false }
risc0-zkvm = { version = "3.0.3", default-features = false }
flex-error = { version = "0.4.4", default-features = false }

[features]
Expand Down
1 change: 1 addition & 0 deletions proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(warnings, trivial_casts, trivial_numeric_casts, unused_import_braces)]
#![allow(clippy::large_enum_variant)]
#![allow(clippy::doc_overindented_list_items)]
#![allow(rustdoc::bare_urls)]
#![forbid(unsafe_code)]

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-09-05
nightly-2025-08-25
2 changes: 1 addition & 1 deletion tests/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ attestation-report = { path = "../../modules/attestation-report" }
keymanager = { path = "../../modules/keymanager" }
remote-attestation = { path = "../../modules/remote-attestation" }

zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "v0.0.3" }
zkdcap-risc0 = { git = "https://github.com/datachainlab/zkdcap", rev = "9d6fab9b7ca5621e58958515228a616f37f89a6d" }

[features]
default = []
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ use lcp_proto::{google::protobuf::Any as ProtoAny, protobuf::Protobuf};
use lcp_types::Any;
use std::str::FromStr;

/// WARNING: The following converters are very inefficient, so they should not be used except for testing purpose.
/// ibc-relayer(hermes) has owned ibc crate, not cosmos/ibc-rs. Therefore, the following converters are required for now.
// WARNING: The following converters are very inefficient, so they should not be used except for testing purpose.
// ibc-relayer(hermes) has owned ibc crate, not cosmos/ibc-rs. Therefore, the following converters are required for now.

/// relayer-types to lcp types
// relayer-types to lcp types

pub(crate) fn relayer_header_to_any(value: RHeader) -> Any {
let any = IBCRelayerAny::from(value);
Any::new(any.type_url, any.value)
}

/// relayer-types to ibc
// relayer-types to ibc

pub(crate) fn to_ibc_channel(value: RChannelEnd) -> ChannelEnd {
ChannelEnd::decode_vec(&value.encode_vec().unwrap()).unwrap()
Expand Down Expand Up @@ -63,7 +63,7 @@ pub(crate) fn to_ibc_consensus_state(value: RTendermintConsensusState) -> Tender
.unwrap()
}

/// ibc to relayer-types
// ibc to relayer-types

pub(crate) fn to_relayer_chain_id(value: ChainId) -> RChainId {
RChainId::from_str(value.as_str()).unwrap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-k $NODE_A_WALLETS_USER1_KEY_ID -d $NODE_A_DENOM
```
*/
#![allow(clippy::result_large_err)]

use ibc_relayer::keyring::Store;
use ibc_test_framework::prelude::*;
Expand Down
Loading