Commit graph

77 commits

Author SHA1 Message Date
Antioch Peverell
a0b9aa5967
Sign kernel features (#2104)
* include kernel features in msg being signed
hash the msg before signing it (for consistent 32 bytes)

* rustfmt

* fix various tests

* no HF for this (mainnet only)
2018-12-12 09:19:36 +00:00
hashmap
aedac483f5
Convert to Rust 2018 edition (#2084)
* Convert to Rust 2018 edition

* Update gitignore
2018-12-08 00:59:40 +01:00
Yeastplume
b8c8840cec
Refactor wallet commands (#2067)
* start wallet command refactoring

* another re-structuring attempt

* rustfmt

* begin splitting up wallet commands

* rustfmt

* clean up wallet arg checking

* rustfmt

* macro for arg parsing

* rustfmt

* factor out init commands

* rustfmt

* move recover to new format

* rustfmt

* add listen command to new format

* rustfmt

* Finish moving commands to new format

* rustfmt

* rustfmt

* propogate errors more cleanly

* rustfmt

* error handling cleanup
2018-12-06 12:04:02 +00:00
Dobby the House Elf
b8124676c7 Move libtx to core 2018-12-05 09:41:26 -08:00
Antioch Peverell
bf815aa5cd
Readonly pmmr cleanup (#2083)
* avoid locking txhashset by using a readonly PMMR

* rustfmt
2018-12-05 14:52:53 +00:00
Antioch Peverell
8d8f533b8e
store pmmr cleanup (#2075)
* introduce DataFile<T> to hide the LEN handling
use slices rather than vec<u8> where possible

* cleanup

* use DataFile<Hash> and not HashFile

* fix core tests
2018-12-05 13:02:24 +00:00
Antioch Peverell
8bad93c8c9
Reduce amount of clone() going on when applying data to MMRs (#2046)
* less cloning when pushing to PMMR

* pass a ref to data when applying to the MMR and appending to the backend

* cleanup

* rustfmt

* fixup tests
2018-12-02 19:59:24 +00:00
Antioch Peverell
1dffd4df1e
Fix secondary pow scaling bug (#2051)
* fix(es) for #1980

* rustfmt

* skip(1) is height dependent on testnet4
rename for clarity

* rustfmt
2018-11-30 11:19:55 +00:00
Antioch Peverell
7dee490962 Two year secondary pow ratio fix (#2037)
* Tweak (consensus breaking) secondary_pow_ratio
* Look at chain type for sec pow ratio calc (hardfork is t4 only)
2018-11-28 14:05:13 -08:00
Antioch Peverell
79d540cf86
Header MMR Refactor (#2028)
* refactor header MMR to use regular backend
this lets us store header hashes in the mmr data file
the hashes in the hash file are "hash with index"

* rustfmt

* get_header_hash(pos) on header extension

* rustfmt

* cleanup

* cleanup

* comments

* cleanup

* fixup testelem so tests work
2018-11-27 12:32:39 +00:00
Ignotus Peverell
c5b9d867ae
Cuckaroo Testnet4 hard fork (#1997)
* PoW context is now properly picked depending on the chain type,
edge bits and block height. Height const for T4 hard fork leaving
a couple weeks to have miners in place. Removed now unused Cuckoo context.
* Simplified block siphash
* Fix servers crate compilation
* Tiny bit cleaner block siphash. Maybe.
* Cuckatoo min edge bits update for T4 and mainnet
* Fix header size tests, Cuckatoo31 default means one more bit per edge
* Remove redundant param from verify_size
2018-11-24 12:33:17 -08:00
Yeastplume
5a06f5dac7
Split wallet client trait (#1970)
* complete trait split

* rustfmt
2018-11-13 13:18:33 +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
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
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
a42d66efff
Merge branch 'master' into unitdiff 2018-10-25 14:20:41 -07:00
hashmap
3efa7bdac9
Small style changes in core crate (#1816) 2018-10-23 21:09:16 +02: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
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
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
John Tromp
e9dcc143bf refactor and change difficulty calcs; use sum instead of median (#1774) 2018-10-17 16:21:59 +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
4bb31dbdb4 update new genesis block, change p2p msg magic number 2018-10-16 10:16:54 +01:00
Ignotus Peverell
a41022f1e3
Fix last tests broken by secondary PoW factor adjustment 2018-10-15 22:53:28 +00:00
Ignotus Peverell
eeb7680981
Secondary PoW factor adjustment adjustments 2018-10-15 21:18:00 +00:00
Antioch Peverell
86c1d7683b
The Header MMR (One MMR To Rule Them All) (#1716) (#1747)
* header MMR in use within txhashset itself
works with fast sync
not yet in place for initial header sync

* add the (currently unused) sync_head mmr

* use sync MMR during fast sync
rebuild header MMR after we validate full txhashset after download

* support missing header MMR (rebuild as necessary) for legacy nodes

* rename to HashOnly

* cleanup backend.append()

* simplify vec_backend to match simpler append api
2018-10-15 19:24:01 +01:00
Ignotus Peverell
43f4f92730
[T4] Secondary proof of work difficulty adjustments (#1709)
* First pass at secondary proof of work difficulty adjustments
* Core and chain test fixes
* Next difficulty calc now needs a height. Scaling calculation fixes. Setting scaling on mined block.
* Change factor to u32 instead of u64.
* Cleanup structs used by next_difficulty
* Fix header size calc with u32 scaling
2018-10-13 13:57:01 -07:00
Antioch Peverell
4dff68ab61 Remove kernel sum header (#1723)
We maintain this locally in block_sums in the db (sums can be rebuilt from local data)
2018-10-12 18:15:29 -07:00
Yeastplume
6c8c483172
[T4 ONLY] BIP32 Wallet Compliance - Aggsig Updates - Bulletproof Updates (#1501)
* change keychain to use bip32 paths

* convert keychain to use bip32

* change identifier to be serialisation of 4-level bip32 path

* wallet changes compiling, pass parent key into all wallet functions

* rustfmt

* fix tests in chain

* rustfmt

* core tests passing

* rustfmt

* pool tests

* rustfmt

* fixing wallet tests

* rustfmt

* remove file wallet

* wallet tests compiling

* rustfmt

* remove db_migrate

* successful tx exchange test using BIP32 paths

* rustfmt

* fix wallet derivation paths to m/0/0/0

* wallet test fixed again, working with default path

* rustfmt

* fix server tests

* rustfmt

* make parent_id a trait on walletbackend

* rustfmt

* add ability for wallet to switch between multiple named accounts, and tests (not complete)

* rustfmt

* account switching tests in place and passing

* rustfmt

* compile and test with latest libsecp changes

* added public key sum to calculated e for aggsig

* rustfmt

* Update secp to 26

* bulletproof bip32 path integration

* rustfmt

* wallet restore updated with bip32 paths, also restores accounts

* rustfmt

* rustfmt

* remove old extkey

* remove old extkey

* rustfmt

* add wallet account commands

* rustfmt

* update wallet documentation

* rustfmt

* merge from master

* update libsecp tag

* merge from upstream and fix server test

* rustfmt

* rustfmt

* merge from master

* update latest libsecp merge

* fix commitment to zero value generation
2018-10-10 10:11:01 +01:00
Yeastplume
92f826a917
[T4 ONLY] T4 PoW changes (#1663)
* T4 PoW changes

* rustfmt

* adjust sizeshift depending on pow type during ser/deser

* update block size tests for cuckatoo sizeshift
2018-10-10 10:09:44 +01:00
Antioch Peverell
e72d8b58e4
[WIP] txpool (tx validation) using block sums for full validation (#1567)
tx validation (txpool) rework/simplify
2018-09-24 09:24:10 +01:00
Ignotus Peverell
9cc7aed713
Dual proof of work, first step (#1534)
* Move Proof and Difficulty types to pow module. Difficulty scaling calculation.
* Diffculty scaling and size shift for 2nd PoW
* Backport e7eb26ee
* Test compilation fixes
* Scaling only need to go one way, as @tromp pointed out
2018-09-18 15:12:57 -07:00
Gary Yu
2c712fefff Small cleanup and perf improvement for peak_sizes_height and peaks (#1526)
* Small cleanup and perf improvement for  and

* rustfmt

* define a const 'ALL_ONES' for u64::MAX
2018-09-15 08:28:41 +01:00
Gary Yu
3c1d8c3f8b Small cleanup and perf improvement for peak_map_height (#1521) 2018-09-13 09:59:49 -07:00
Antioch Peverell
dca0d52dcd
Cleanup transaction with offset (#1514)
* cleanup build::transaction_with_offset

* rustfmt
2018-09-12 12:17:36 +01:00
Antioch Peverell
07eefc4d6b
cache get_shift() and get_leaf_shift() in prune_list (#1495)
* cache shift and leaf_shift values in prune_list for fast lookup later

* rustfmt

* fixup core tests
2018-09-12 08:19:05 +01:00
Ignotus Peverell
ecf20602d5
Hard fork tryout: better PoW encapsulation in block header (#1478)
* Improve encapsulation with ProofOfWork struct
* Add dual pow scaling factor, fix test
* Fix pre_pow serialization, chain tests
* Adjust header serialized size calc
* Hard fork handling, version-based serialization
2018-09-10 15:36:57 -07:00
Quentin Le Sceller
544a296f77
Fix typos and unused imports (#1466)
* Fix typos and unused imports
2018-09-03 13:09:28 +02:00
Gary Yu
60d62bfb97 add a test case for transaction deserialize (#1356) (#1381)
* add a test case for transaction deserialize (#1356)
* update rust-secp256k1-zkp to grin_integration_23
* add transaction explicit validation
2018-09-01 15:14:10 -04:00
Antioch Peverell
6d992e61d6 Add test coverage for verifier_cache 2018-08-30 15:08:16 -04:00
Antioch Peverell
939d391e0e
cache rangeproof and kernel signature verification results (#1419)
* wip - cache rangeproof verification

* rustfmt

* rustfmt

* rename to ok_verifier

* rustfmt

* wire in caching verifier in more places
skip rangeproof and kernel signature verification during deserialization

* rustfmt

* actually cache verification results via ok verifier

* rustfmt

* cleanup

* pass a cache around, not a verifier

* rustfmt

* cleanup trait shenanigans

* rustfmt

* core tests passing

* rustfmt

* rustfmt

* tests passing

* rustfmt

* verifier cache now takes vecs of data in and out

* rustfmt

* logging + rustfmt

* add docs and comments
2018-08-30 15:44:34 +01:00
Antioch Peverell
c334c557aa
Simplify tx.validate() and transaction::aggregate() (#1436)
* simplify tx validation and aggregation
we *only* need to account for reward when building a block from txs

* rustfmt

* cleanup and tests passing

* rustfmt

* better comments in with_reward()

* fix wallet tests
2018-08-28 20:00:25 +01:00
Antioch Peverell
7dfca6077c
Refactor compact block body (#1394)
* introduce CompactBlockBody

* rustfmt

* implement From<Block> for CompactBlock

* rustfmt

* remove debug logging

* wip

* rustfmt
2018-08-22 20:19:37 +01:00