Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request paritytech#113 from subspace/eliminate-common.rs-i…
Browse files Browse the repository at this point in the history
…n-farmer

Eliminate common.rs in farmer
  • Loading branch information
liuchengxu authored Nov 5, 2021
2 parents 4224086 + 1b613b7 commit 5f9df02
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 14 deletions.
4 changes: 2 additions & 2 deletions crates/subspace-farmer/src/commitments.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#[cfg(test)]
mod tests;

use crate::common::{Salt, Tag, BATCH_SIZE};
use crate::plot::Plot;
use async_lock::Mutex;
use async_std::io;
Expand All @@ -13,9 +12,10 @@ use rocksdb::{Options, DB};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::sync::Arc;
use subspace_core_primitives::{Piece, PIECE_SIZE};
use subspace_core_primitives::{Piece, Salt, Tag, PIECE_SIZE};
use thiserror::Error;

const BATCH_SIZE: u64 = (16 * 1024 * 1024 / PIECE_SIZE) as u64;
const COMMITMENTS_CACHE_SIZE: usize = 2;
const COMMITMENTS_KEY: &[u8] = b"commitments";

Expand Down
3 changes: 1 addition & 2 deletions crates/subspace-farmer/src/commitments/tests.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::commitments::Commitments;
use crate::common::{Salt, Tag};
use crate::plot::Plot;
use rand::prelude::*;
use rand::rngs::StdRng;
use std::sync::Arc;
use subspace_core_primitives::Piece;
use subspace_core_primitives::{Piece, Salt, Tag};
use tempfile::TempDir;

fn init() {
Expand Down
5 changes: 0 additions & 5 deletions crates/subspace-farmer/src/common.rs

This file was deleted.

3 changes: 1 addition & 2 deletions crates/subspace-farmer/src/farming.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use crate::commitments::Commitments;
use crate::common::Salt;
use crate::identity::Identity;
use crate::plot::Plot;
use crate::rpc::{ProposedProofOfReplicationResponse, RpcClient, SlotInfo, Solution};
use anyhow::Result;
use futures::{future, future::Either};
use log::{debug, error, info, trace};
use std::time::Instant;
use subspace_core_primitives::crypto;
use subspace_core_primitives::{crypto, Salt};

/// Farming Instance to store the necessary information for the farming operations,
/// and also a channel to stop/pause the background farming task
Expand Down
1 change: 0 additions & 1 deletion crates/subspace-farmer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

pub(crate) mod commands; // TODO: remove this again (temporarily inserted)
pub(crate) mod commitments;
pub(crate) mod common;
pub(crate) mod farming;
pub(crate) mod identity;
pub(crate) mod object_mappings;
Expand Down
1 change: 0 additions & 1 deletion crates/subspace-farmer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

mod commands;
mod commitments;
mod common;
mod farming;
mod identity;
mod object_mappings;
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::common::{Salt, Tag};
use hex_buffer_serde::{Hex, HexForm};
use jsonrpsee::types::traits::{Client, SubscriptionClient};
use jsonrpsee::types::v2::params::JsonRpcParams;
Expand All @@ -7,6 +6,7 @@ use jsonrpsee::ws_client::{WsClient, WsClientBuilder};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use subspace_core_primitives::objects::BlockObjectMapping;
use subspace_core_primitives::{Salt, Tag};

type SlotNumber = u64;

Expand Down

0 comments on commit 5f9df02

Please sign in to comment.