Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
17 changes: 14 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ members = [
"consensus/service",
"crypto/box",
"crypto/digestible",
"crypto/digestible/test-utils",
"crypto/digestible/derive/test",
"crypto/keys",
"crypto/noise",
Expand Down
24 changes: 11 additions & 13 deletions consensus/enclave/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern crate alloc;
mod identity;

use alloc::{collections::BTreeSet, format, string::String, vec::Vec};
use core::convert::{TryFrom, TryInto};
use core::convert::TryFrom;
use identity::Ed25519Identity;
use mc_account_keys::PublicAddress;
use mc_attest_core::{
Expand All @@ -35,8 +35,7 @@ use mc_consensus_enclave_api::{
WellFormedEncryptedTx, WellFormedTxContext,
};
use mc_crypto_ake_enclave::AkeEnclaveState;
use mc_crypto_digestible::Digestible;
use mc_crypto_hashes::Blake2b256;
use mc_crypto_digestible::{DigestTranscript, Digestible, MerlinTranscript};
use mc_crypto_keys::{Ed25519Pair, Ed25519Public, RistrettoPrivate, RistrettoPublic, X25519Public};
use mc_crypto_message_cipher::{AesMessageCipher, MessageCipher};
use mc_crypto_rand::McRng;
Expand Down Expand Up @@ -462,16 +461,15 @@ impl ConsensusEnclave for SgxConsensusEnclave {

// Create an aggregate fee output.
let fee_tx_private_key = {
let hash_value: [u8; 32] = {
let mut hasher = Blake2b256::new();
FEES_OUTPUT_PRIVATE_KEY_DOMAIN_TAG.digest(&mut hasher);
parent_block.id.digest(&mut hasher);
transactions.digest(&mut hasher);
hasher
.result()
.as_slice()
.try_into()
.expect("Wrong length.")
let mut hash_value = [0u8; 32];
{
let mut transcript =
MerlinTranscript::new(FEES_OUTPUT_PRIVATE_KEY_DOMAIN_TAG.as_bytes());
parent_block
.id
.append_to_transcript(b"parent_block_id", &mut transcript);
transactions.append_to_transcript(b"transactions", &mut transcript);
transcript.extract_digest(&mut hash_value);
};

// This private key is generated from the hash of all transactions in this block.
Expand Down
4 changes: 3 additions & 1 deletion consensus/enclave/trusted/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 consensus/service/src/consensus_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ impl<E: ConsensusEnclaveProxy, R: RaClient + Send + Sync + 'static> ConsensusSer
block_height = Some(b);
latest_block_hash = ledger_db
.get_block(b - 1)
.map(|x| format!("{:X}", x.id.0))
.map(|x| format!("{:X?}", x.id.0))
.map_err(|e| log::error!(logger, "Error getting block {} {:?}", b - 1, e))
.ok();
latest_block_timestamp = ledger_db
Expand Down
11 changes: 5 additions & 6 deletions crypto/digestible/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ edition = "2018"

[dependencies]
cfg-if = "0.1"
digest = { version = "0.9", default-features = false }
merlin = { version = "2.0", default-features = false }
generic-array = { version = "0.14", default-features = false }

# For derive support
mc-crypto-digestible-derive = { path = "./derive", optional = true }

# Built-in support for dalek primitives
ed25519-dalek = { version = "1.0.0", default-features = false, optional = true }
# ed25519-dalek doesn't build without rand feature
ed25519-dalek = { version = "1.0.0", default-features = false, features = ["rand"], optional = true }
x25519-dalek = { version = "1.0.1", default-features = false, optional = true }

[target.'cfg(any(target_feature = "avx2", target_feature = "avx"))'.dependencies]
Expand All @@ -21,11 +23,8 @@ curve25519-dalek = { version = "3.0", default-features = false, features = ["sim
[target.'cfg(not(any(target_feature = "avx2", target_feature = "avx")))'.dependencies]
curve25519-dalek = { version = "3.0", default-features = false, features = ["nightly", "u64_backend"], optional = true }

[dev-dependencies]
sha3 = "0.9"

[features]
default=["alloc", "derive"]
default=["alloc", "derive", "dalek"]
# Enables support for types in alloc crate
alloc=[]
# Enables re-export of derive(Digestible) macro
Expand Down
Loading