Commit Graph

431 Commits

Author SHA1 Message Date
Ignotus Peverell 66acee8f71 Cuckaroo validation implementation (#1911)
* First pass at iterative siphash
* Generalizing our siphash24 implementation slightly to make it friendlier to repeated hashing
* Block siphash algorithm, Cuckaroo placeholder
* Cuckaroo validator, still needs to be tested with vectors from the @tromp implementation
* Working cuckaroo validation with test vectors for cuckaroo19, will add cuckaroo29 vectors when a lean or mean implementation can find some solutions
2018-11-19 11:03:58 -08:00
Antioch Peverell f0fa410273 Streaming headers (#1989)
* headers msg is now "streamed" off the tcp stream

* rustfmt

* cleanup

* move StreamingReader into ser.rs
extract read_exact out into util crate

* rustfmt
2018-11-16 11:00:39 +00:00
Antioch Peverell 2e421191e2 implement read_multi with an internal iterating reader (#1981)
* rework read_multi to use an "iterating reader" internally
we are going to use this for reading headers in batches

* rustfmt
2018-11-14 14:52:43 +00:00
Yeastplume 5a06f5dac7 Split wallet client trait (#1970)
* complete trait split

* rustfmt
2018-11-13 13:18:33 +01:00
Antioch Peverell c631b45ab6 cleanup how we deal with flexible rproof size in ser/deser (#1965) 2018-11-13 09:30:40 +00:00
Antioch Peverell a3c1c6d603 Do not use mem::size_of() when calculating serialized size of data (#1967)
* use FixedLength to define serialized size in bytes of various structs
replace usages of mem::size_of() with ::LEN so we correctly calculate serialized sizes in bytes

* rustfmt
2018-11-13 09:30:02 +00:00
Antioch Peverell 207621b545 Tx kernel entry (#1957)
* Wrap tx kernels in tx kernel entries when storing them in the MMR.
Decouples the storage impl of kernels.

* rustfmt
2018-11-11 16:03:03 +01:00
Antioch Peverell d0d8d14ac2 cleanup unused compact_transaction code (#1958)
we use a simplified "kernel first" impl
2018-11-11 15:59:05 +01:00
Antioch Peverell 183d9c9f3e Refactor kernel sig msg creation (#1954)
* refactor kernel msg creation

* rustfmt

* Error not secp::Error

* fix tests for refactored errors
2018-11-10 16:24:11 +01:00
Antioch Peverell 29b2c3384c refactor secp errors in transaction (#1955)
* cleanup secp errors in transaction

* rustfmt
2018-11-10 15:48:45 +01:00
Gary Yu 9af9ca9518 refactor the state_sync to handle the long fork (#1902)
* split horizon into two explicit values for cut through and txhashset request

* let node which has 2-7 days of history be able to handle forks larger than 2 days

* add test simulate_long_fork

* add pause/resume feature on p2p for tests

* refactor the state_sync

* ignore the test case simulate_long_fork for normal Travis-CI

* refactor function check_txhashset_needed to be shared with body_sync

* fix: state TxHashsetDone should allow header sync
2018-11-10 11:27:52 +08:00
Antioch Peverell 39ebb33ba1 bump 0.4.0 -> 0.4.1 (tx kernel broadcast support) (#1950) 2018-11-09 14:57:25 +00:00
hashmap 0af1f13bf9 Fix IPV6 address deserialization (#1932)
Fuzz test found that we don't read IPV6 addr (as part of p2p message)
properly. The code is supposed to read 8 dwords, but [0..8] is not a
slice of 8 ints, but a slice of one Range, so we always read just one
dword
2018-11-05 20:38:41 -08:00
Antioch Peverell d23dec73d0 PMMRable cleanup (#1910)
* cleanup pmmrable and len()
introduce FixedLength trait with a const LEN
make Hash impl FixedLength for consistency

* rustfmt

* store tests cleanup

* rustfmt

* whats going on with those comments and rustfmt?
2018-11-01 20:14:46 +00:00
Antioch Peverell 12be191ecd validate root of header MMR when processing headers (during sync and full blocks) (#1836)
validate root of header MMR when processing headers (during sync and full blocks) (#1836)
2018-11-01 09:51:32 +00:00
Antioch Peverell d51522a9cd Genesis is height 0 (not height 1) (#1896) 2018-10-31 13:24:21 -07:00
Ignotus Peverell 385b385456 Minor block.rs cleanup (#1889) 2018-10-31 13:18:59 -07:00
Ignotus Peverell 0b22789865 Cleanup and minor fixes to core after transaction.rs review (#1854) 2018-10-30 14:09:56 -07:00
Ignotus Peverell 46051ee174 improve minimum difficulty handling (#1791)
* rename MIN_DIFFICULTY to UNIT_DIFFICULTY; define Difficulty::unit, fix INITIAL_DIFFICULTY
* improve minimum difficulty handling
* replace all Difficulty::one by ::min
* revert secondary scaling default in HeaderInfo; rename scaling_difficulty; refactor difficulty_data_to_vector
2018-10-27 10:37:44 -07:00
Ignotus Peverell bb5392548f Take 2 2018-10-26 16:28:15 -07:00
Ignotus Peverell 6f3ae4563a Small test fix 2018-10-26 16:07:12 -07:00
Ignotus Peverell c083312ad4 Improve crate descriptors to be more cargo-friendly (#1844)
* Update secp dependency to use crates.io version
* Add more details to various Cargo.toml
* Remove use of env variables that aren't reliably provided by cargo
2018-10-25 17:44:50 -07:00
Ignotus Peverell a42d66efff Merge branch 'master' into unitdiff 2018-10-25 14:20:41 -07:00
Antioch Peverell 4050f7fccb handle re-orgs in transaction_pool (#1829)
* use reorg_cache in transaction_pool to safely handle txs during a re-org

* rustfmt

* comments
2018-10-24 17:57:31 +01:00
hashmap 3efa7bdac9 Small style changes in core crate (#1816) 2018-10-23 21:09:16 +02:00
Antioch Peverell 38cbd6eafb full node == fast sync (no full archival guarantees) (#1809)
* wip - fast sync only

* wip

* cleanup

* cleanup

* cleanup comments in default config file around capabilities

* fixup p2p tests
2018-10-23 13:01:19 +01:00
eupn 8f42f7306c feat: remove expired peers from the storage (#1794)
* Initial expired peers removal
* Stop expired peers
* Simplify peer removal and remove only Defunct peers
* Make seed to check for expired peers every hour
* Get rid of unused vector of peers to remove
* Make peer deletion predicate closure immutable
2018-10-22 13:59:40 -07:00
Quentin Le Sceller 5f2e8db092 Fix shift by 1 block in TUI (#1780) (#1810)
* Fix shift by 1 block in TUI (#1780)
* Only use graph_weight
* Fix shift by 1 in block
* Remove debug logging
2018-10-22 10:44:14 -07:00
eupn 1195071f5b Replace logging backend to log4rs and add log rotation (#1789)
* Replace logging backend to flexi-logger and add log rotation
* Changed flexi_logger to log4rs
* Disable logging level filtering in Root logger
* Support different logging levels for file and stdout
* Don't log messages from modules other than Grin-related
* Fix formatting
* Place backed up compressed log copies into log file directory
* Increase default log file size to 16 MiB
* Add comment to config file on log_max_size option
2018-10-21 13:30:56 -07:00
Gary Yu 0d06561a91 replace stdlib RwLock and Mutex with parking_lot (#1793)
* replace all stdlib RwLock with parking_lot RwLock

* replace stdlib Mutex with parking_lot Mutex

* rustfmt
2018-10-20 08:13:07 +08:00
John Tromp 1cfc474817 forgot to take out assert 2018-10-19 22:21:13 +02:00
John Tromp e1b5d7f3c2 revert secondary scaling default in HeaderInfo; rename scaling_difficulty; refactor difficulty_data_to_vector 2018-10-19 21:39:54 +02:00
John Tromp b1ebfe1c73 found last few instrances of Difficulty::one 2018-10-18 23:29:32 +02:00
John Tromp 846b38308c replace all Difficulty::one by ::min 2018-10-18 21:18:16 +02:00
John Tromp 41293e9ef7 improve minimum difficulty handling 2018-10-18 20:37:33 +02:00
John Tromp e24e65399b rename MIN_DIFFICULTY to UNIT_DIFFICULTY; define Difficulty::unit, fix INITIAL_DIFFICULTY 2018-10-18 14:20:00 +02:00
yeastplume 6980278b95 merge T4 into master - rustfmt 2018-10-18 11:23:22 +01:00
Gary Yu 53b10a083c kick stuck peer out of connected peers. (#1782)
* cherry-picking commit 7754adb8 from master for #1746
2018-10-18 10:04:05 +08:00
Ignotus Peverell b5cb227322 Last genesis for T4, unless I messed up something 2018-10-17 19:36:12 +00:00
Ignotus Peverell 6db0bcefa5 Minor warning removal 2018-10-17 18:16:20 +00:00
Antioch Peverell 2c5469568f cleanup build warnings (#1773) (#1775)
add docs/comments
2018-10-17 16:53:52 +01:00
Yeastplume b43d6e4326 [T4] Set genesis block data + initial secondary scaling correctly (#1776)
* ensure genesis block+pre genesis is populated correctly with secondary scaling

* rustfmt
2018-10-17 16:53:31 +01:00
John Tromp e9dcc143bf refactor and change difficulty calcs; use sum instead of median (#1774) 2018-10-17 16:21:59 +01:00
Yeastplume 5cec885ef5 [T4] diff change (#1769)
* pre-t4 again

* rustfmt
2018-10-17 13:48:18 +01:00
Yeastplume 404165a8fd [T4] Add sec pow info to TUI, change magic number, genesis diff to 1 (temporarily) (#1768)
* add sec scaling stats to tui

* rustfmt
2018-10-17 10:37:28 +01:00
Antioch Peverell fbf955dd11 Commit to prev_root in block headers (#1764)
* commit to prev_root in block headers

* prev_root ready to go, mergeable onto testnet4
2018-10-17 10:06:38 +01:00
Ignotus Peverell fffe5154d2 Secondary PoW scaling factor dampening, cleanup (#1765)
* Remove useless time median window
* Secondary PoW factor dampening
* Fix off-by-one in time window, cleanup dampening, fix tests
2018-10-16 16:55:40 -07:00
John Tromp 8540e4f723 [T4] tweaks and fixes (#1766)
* refactor consensus.rs, tweaking some values
* move scale() there
* fix set_header_nonce bug
* remove maturity soft-fork code
* increase diff target precision
* fix weight comments and try resolve PR conflict
2018-10-16 16:14:22 -07:00
Yeastplume 01df981a1d [t4] fix header test sizes (#1756) 2018-10-16 14:39:51 +01:00
yeastplume 11bed215c1 rustfmt 2018-10-16 13:19:28 +01:00