Merged master.

This commit is contained in:
Ignotus Peverell 2016-11-10 15:54:47 -08:00
commit baeae7d1a5
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
7 changed files with 21 additions and 41 deletions

View file

@ -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. 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 ## Philosophy

View file

@ -23,9 +23,8 @@ use std::collections::HashSet;
use core::Committed; use core::Committed;
use core::{Input, Output, Proof, TxProof, Transaction}; use core::{Input, Output, Proof, TxProof, Transaction};
use core::transaction::merkle_inputs_outputs; 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::hash::{Hash, Hashed, ZERO_HASH};
use core::transaction::MAX_IN_OUT_LEN;
use ser::{self, Readable, Reader, Writeable, Writer}; use ser::{self, Readable, Reader, Writeable, Writer};
/// Block header, fairly standard compared to other blockchains. /// Block header, fairly standard compared to other blockchains.

View file

@ -19,25 +19,17 @@ pub mod hash;
pub mod transaction; pub mod transaction;
#[allow(dead_code)] #[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::fmt;
use std::cmp::Ordering; use std::cmp::Ordering;
use secp::{self, Secp256k1}; use secp::{self, Secp256k1};
use secp::pedersen::*; use secp::pedersen::*;
/// The block subsidy amount use consensus::PROOFSIZE;
pub const REWARD: u64 = 1_000_000_000; pub use self::block::{Block, BlockHeader};
pub use self::transaction::{Transaction, Input, Output, TxProof};
/// Block interval, in seconds use self::hash::{Hash, Hashed, ZERO_HASH};
pub const BLOCK_TIME_SEC: u8 = 15; use ser::{Writeable, Writer, Error};
/// Cuckoo-cycle proof size (cycle length)
pub const PROOFSIZE: usize = 42;
/// Implemented by types that hold inputs and outputs including Pedersen /// Implemented by types that hold inputs and outputs including Pedersen
/// commitments. Handles the collection of the commitments as well as their /// commitments. Handles the collection of the commitments as well as their

View file

@ -14,21 +14,17 @@
//! Transactions //! Transactions
use core::Committed;
use core::MerkleRow;
use core::hash::{Hash, Hashed};
use byteorder::{ByteOrder, BigEndian}; use byteorder::{ByteOrder, BigEndian};
use secp::{self, Secp256k1, Message, Signature}; use secp::{self, Secp256k1, Message, Signature};
use secp::key::SecretKey; use secp::key::SecretKey;
use secp::pedersen::{RangeProof, Commitment}; 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}; 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 /// A proof that a transaction sums to zero. Includes both the transaction's
/// Pedersen commitment and the signature, that guarantees that the commitments /// Pedersen commitment and the signature, that guarantees that the commitments
/// amount to zero. The signature signs the fee, which is retained for /// amount to zero. The signature signs the fee, which is retained for

View file

@ -31,6 +31,7 @@ extern crate tiny_keccak;
#[macro_use] #[macro_use]
pub mod macros; pub mod macros;
pub mod consensus;
pub mod core; pub mod core;
pub mod genesis; pub mod genesis;
pub mod pow; pub mod pow;

View file

@ -23,7 +23,8 @@ use std::cmp;
use crypto::digest::Digest; use crypto::digest::Digest;
use crypto::sha2::Sha256; use crypto::sha2::Sha256;
use core::{Proof, PROOFSIZE}; use consensus::PROOFSIZE;
use core::Proof;
use pow::siphash::siphash24; use pow::siphash::siphash24;
const MAXPATHLEN: usize = 8192; const MAXPATHLEN: usize = 8192;

View file

@ -27,28 +27,14 @@ mod cuckoo;
use time; use time;
use core::{Block, Proof, PROOFSIZE}; use consensus::{SIZESHIFT, EASINESS};
use core::{Block, Proof};
use core::hash::{Hash, Hashed}; use core::hash::{Hash, Hashed};
use pow::cuckoo::{Cuckoo, Miner, Error}; use pow::cuckoo::{Cuckoo, Miner, Error};
use ser; use ser;
use ser::{Writeable, Writer}; 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. /// 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 /// Basically the whole thing minus the PoW solution itself and the total
/// difficulty (yet unknown). We also add the count of every variable length /// 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)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use consensus::MAX_TARGET;
use core::Proof; use core::Proof;
use genesis; use genesis;