fn new_epoch(nonce_map: &mut HashMap<U256, Epoch>, worker_params:
            &InputWorkerParams, nonce: U256, seed: U256) -> Result<Epoch, EnclaveError> {
    let mut marker_doc: SealedDocumentStorage<EpochNonce> = SealedDocumentStorage {
        version: 0x1234, // TODO: what's this?
        data: [0; 32],
    };
    marker_doc.data = nonce.into();
    let mut sealed_log_in = [0u8; SEAL_LOG_SIZE];
    marker_doc.seal(&mut sealed_log_in)?;
    // Save sealed_log to file
    let marker_path = get_epoch_nonce_path();
    save_sealed_document(&marker_path, &sealed_log_in)?;
    println!("Sealed the epoch marker: {:?}", marker_path);

    let epoch = Epoch { nonce, seed, worker_params: worker_params.clone() };
    // TODO: seal the epoch
    println!("Storing epoch: {:?}", epoch);
    match nonce_map.insert(nonce, epoch.clone()) {
        Some(prev) => println!("New epoch stored successfully, previous epoch: {:?}", prev),
        None => println!("Initial epoch stored successfully"),
    }
    Ok(epoch)
}
/// Creates new epoch both in the cache and as sealed documents
Creates new epoch both in the cache and as sealed documents
Creates new epoch both in the cache and as sealed documents
fn new_epoch(nonce_map: &mut HashMap<U256, Epoch>, worker_params:
            &InputWorkerParams, nonce: U256, seed: U256) -> Result<Epoch, EnclaveError> {
    let mut marker_doc: SealedDocumentStorage<EpochNonce> = SealedDocumentStorage {
        version: 0x1234, // TODO: what's this?
        data: [0; 32],
    };
    marker_doc.data = nonce.into();
    let mut sealed_log_in = [0u8; SEAL_LOG_SIZE];
    marker_doc.seal(&mut sealed_log_in)?;
    // Save sealed_log to file
    let marker_path = get_epoch_nonce_path();
    save_sealed_document(&marker_path, &sealed_log_in)?;
    println!("Sealed the epoch marker: {:?}", marker_path);
    let epoch = Epoch { nonce, seed, worker_params: worker_params.clone() };
    // TODO: seal the epoch
    println!("Storing epoch: {:?}", epoch);
    match nonce_map.insert(nonce, epoch.clone()) {
        Some(prev) => println!("New epoch stored successfully, previous epoch: {:?}", prev),
        None => println!("Initial epoch stored successfully"),
    }
    Ok(epoch)
}
fn new_epoch ( nonce_map : & mut HashMap < U256 , Epoch > , worker_params : & InputWorkerParams , nonce : U256 , seed : U256 ) -> Result < Epoch , EnclaveError > { let mut marker_doc : SealedDocumentStorage < EpochNonce > = SealedDocumentStorage { version : 0x1234 , // TODO: what's this? data : [ 0 ; 32 ] , } ; marker_doc . data = nonce . into ( ) ; let mut sealed_log_in = [ 0u8 ; SEAL_LOG_SIZE ] ; marker_doc . seal ( & mut sealed_log_in ) ? ; // Save sealed_log to file let marker_path = get_epoch_nonce_path ( ) ; save_sealed_document ( & marker_path , & sealed_log_in ) ? ; println ! ( " " marker_path ) ; let epoch = Epoch { nonce , seed , worker_params : worker_params . clone ( ) } ; // TODO: seal the epoch println ! ( " " epoch ) ; match nonce_map . insert ( nonce , epoch . clone ( ) ) { Some ( prev ) => println ! ( " " prev ) , None => println ! ( " " ) , } Ok ( epoch ) }
Creates new epoch both in the cache and as sealed documents
Creates new epoch both in the cache and as sealed documents
nonce_map
&mut HashMap<U256, Epoch>
worker_params
&InputWorkerParams
nonce
U256
seed
U256
nonce_map
&mut HashMap<U256, Epoch>
worker_params
&InputWorkerParams
nonce
U256
seed
U256