diff --git a/README.md b/README.md index 929d9df7..ed971404 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,11 @@ Find an area you can help with and do it. Open source is about collaboration and Additional tests are rewarded with an immense amount of positive karma. So is documentation. -Find us on Gitter: https://gitter.im/grin_community/Lobby +Find us: + +* IRC: Freenode #MimbleWimble +* Mailing list: TBD + ## Philosophy diff --git a/core/src/core/block.rs b/core/src/core/block.rs index 563d9675..b7826ac1 100644 --- a/core/src/core/block.rs +++ b/core/src/core/block.rs @@ -23,9 +23,8 @@ use std::collections::HashSet; use core::Committed; use core::{Input, Output, Proof, TxProof, Transaction}; use core::transaction::merkle_inputs_outputs; -use core::{PROOFSIZE, REWARD}; +use consensus::{PROOFSIZE, REWARD, MAX_IN_OUT_LEN}; use core::hash::{Hash, Hashed, ZERO_HASH}; -use core::transaction::MAX_IN_OUT_LEN; use ser::{self, Readable, Reader, Writeable, Writer}; /// Block header, fairly standard compared to other blockchains. diff --git a/core/src/core/mod.rs b/core/src/core/mod.rs index 0340493b..dbb79fff 100644 --- a/core/src/core/mod.rs +++ b/core/src/core/mod.rs @@ -19,25 +19,17 @@ pub mod hash; pub mod transaction; #[allow(dead_code)] -pub use self::block::{Block, BlockHeader}; -pub use self::transaction::{Transaction, Input, Output, TxProof}; -use self::hash::{Hash, Hashed, ZERO_HASH}; -use ser::{Writeable, Writer, Error}; - use std::fmt; use std::cmp::Ordering; use secp::{self, Secp256k1}; use secp::pedersen::*; -/// The block subsidy amount -pub const REWARD: u64 = 1_000_000_000; - -/// Block interval, in seconds -pub const BLOCK_TIME_SEC: u8 = 15; - -/// Cuckoo-cycle proof size (cycle length) -pub const PROOFSIZE: usize = 42; +use consensus::PROOFSIZE; +pub use self::block::{Block, BlockHeader}; +pub use self::transaction::{Transaction, Input, Output, TxProof}; +use self::hash::{Hash, Hashed, ZERO_HASH}; +use ser::{Writeable, Writer, Error}; /// Implemented by types that hold inputs and outputs including Pedersen /// commitments. Handles the collection of the commitments as well as their diff --git a/core/src/core/transaction.rs b/core/src/core/transaction.rs index 6d2baf49..91852e16 100644 --- a/core/src/core/transaction.rs +++ b/core/src/core/transaction.rs @@ -14,21 +14,17 @@ //! Transactions -use core::Committed; -use core::MerkleRow; -use core::hash::{Hash, Hashed}; - use byteorder::{ByteOrder, BigEndian}; use secp::{self, Secp256k1, Message, Signature}; use secp::key::SecretKey; use secp::pedersen::{RangeProof, Commitment}; +use consensus::MAX_IN_OUT_LEN; +use core::Committed; +use core::MerkleRow; +use core::hash::{Hash, Hashed}; use ser::{self, Reader, Writer, Readable, Writeable}; -/// The maximum number of inputs or outputs a transaction may have -/// and be deserializable. -pub const MAX_IN_OUT_LEN: u64 = 50000; - /// A proof that a transaction sums to zero. Includes both the transaction's /// Pedersen commitment and the signature, that guarantees that the commitments /// amount to zero. The signature signs the fee, which is retained for diff --git a/core/src/lib.rs b/core/src/lib.rs index aef09db2..ae4ccdaf 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -31,6 +31,7 @@ extern crate tiny_keccak; #[macro_use] pub mod macros; +pub mod consensus; pub mod core; pub mod genesis; pub mod pow; diff --git a/core/src/pow/cuckoo.rs b/core/src/pow/cuckoo.rs index 544aef68..1673c36e 100644 --- a/core/src/pow/cuckoo.rs +++ b/core/src/pow/cuckoo.rs @@ -23,7 +23,8 @@ use std::cmp; use crypto::digest::Digest; use crypto::sha2::Sha256; -use core::{Proof, PROOFSIZE}; +use consensus::PROOFSIZE; +use core::Proof; use pow::siphash::siphash24; const MAXPATHLEN: usize = 8192; diff --git a/core/src/pow/mod.rs b/core/src/pow/mod.rs index 5e339597..936a0edd 100644 --- a/core/src/pow/mod.rs +++ b/core/src/pow/mod.rs @@ -27,28 +27,14 @@ mod cuckoo; use time; -use core::{Block, Proof, PROOFSIZE}; +use consensus::{SIZESHIFT, EASINESS}; +use core::{Block, Proof}; use core::hash::{Hash, Hashed}; use pow::cuckoo::{Cuckoo, Miner, Error}; use ser; use ser::{Writeable, Writer}; -/// Default Cuckoo Cycle size shift used is 28. We may decide to increase it. -/// when difficuty increases. -const SIZESHIFT: u32 = 28; - -/// Default Cuckoo Cycle easiness, high enough to have good likeliness to find -/// a solution. -const EASINESS: u32 = 50; - -/// Max target hash, lowest difficulty -pub const MAX_TARGET: [u32; PROOFSIZE] = - [0xfff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff]; - /// Subset of a block header that goes into hashing for proof of work. /// Basically the whole thing minus the PoW solution itself and the total /// difficulty (yet unknown). We also add the count of every variable length @@ -166,6 +152,7 @@ fn pow_size(b: &Block, target: Proof, sizeshift: u32) -> Result<(Proof, u64), Er #[cfg(test)] mod test { use super::*; + use consensus::MAX_TARGET; use core::Proof; use genesis;