Commit graph

160 commits

Author SHA1 Message Date
Antioch Peverell
2348214719
fix our check_known check for blocks/headers (#2943) 2019-07-11 17:08:36 +01:00
Antioch Peverell
b6daf1edfd
check for known robustly when processing header (#2834) 2019-07-04 12:30:22 +01:00
Antioch Peverell
fabff51dd3
Header version cleanup (#2809)
* introduce HeaderVersion (was u16) for type safety
cleanup pow ser/deser (version unused)

* fixup tests for HeaderVersion

* validate header version during header deserialization
2019-05-08 21:10:42 +01:00
hashmap
dc59f67c7b
Reduce number of unwraps in chain crate (#2679) 2019-03-17 13:32:48 +01:00
Antioch Peverell
c188b60a38
readonly verify_coinbase_maturity (#2164)
* move verify_coinbase_maturity into utxo_view
no longer need a write lock on txhashset

* rustfmt
2018-12-16 09:26:39 +00:00
Antioch Peverell
16641fe149
Cleanup compact block logging (#2126)
* cleanup logging, error logging around compact blocks

* rustfmt
2018-12-11 14:11:58 +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
Antioch Peverell
a3523028dc
Sync headers slice (#2085)
* pass slices of headers around, not vec of headers

* rustfmt
2018-12-05 16:50:32 +00:00
Antioch Peverell
8e3a3e1a40
Replace "header by height" index with reads into the header MMR (#2030)
* replace header_by_height index with reads into the header MMR

* rustfmt

* cleanup

* cleanup chain tests

* fix locate_headers to stop on our max header

* fix the deadlock in comact_blocks_db...

* cleanup and docs/comments
2018-11-29 09:26:24 +00:00
Ignotus Peverell
28e0d97e64
Cuckatoo size shift upgrade schedule (#2024)
* Cuckatoo size shift upgrade schedule
* Move the schedule into graph_weight instead of messing with min edge bits
* Cleanup and fixes now that we have an agreed upon schedule
2018-11-28 14:05:55 -08:00
Antioch Peverell
60cbcbd96b Get rid of block hashes cache (#2018)
check_known_head and check_known_orphans catches majority of cases
2018-11-28 09:48:50 -08:00
Antioch Peverell
1ea82d9abe
Refactor is_orphan and is_fork during block processing (#2015)
* refactor check_prev logic in process_block

* rustfmt
2018-11-25 10:22:19 +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
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
26d449a08b
only rewind and reapply on header extension if necessary (#1930)
* only rewind and reapply on header extension if necessary

* use head of full block chain
2018-11-05 19:59:39 +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
Ignotus Peverell
1121a38bd5
Logger fix 2018-10-26 15:35:21 -07:00
Ignotus Peverell
a42d66efff
Merge branch 'master' into unitdiff 2018-10-25 14:20:41 -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
e1b5d7f3c2 revert secondary scaling default in HeaderInfo; rename scaling_difficulty; refactor difficulty_data_to_vector 2018-10-19 21:39:54 +02: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
Quentin Le Sceller
701f0b9b60 Remove unecessary check in pipe.rs (#1763) 2018-10-16 12:04:00 -07:00
John Tromp
34646ddf51 [T4] Rename all shiftsize / cuckoo_size to edge_bits and change value for T4 (#1752)
* replace all size_shift / cuckoo_size by edge_bits and change some constants for T4
* replace remaining occurrences of sizeshift
2018-10-15 16:14:23 -07: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
Ignotus Peverell
805cc24e73
Removed kernel sum from header. Fixes #1568 2018-10-13 00:57:08 +00: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
Gary Yu
fa656ca44a
chain difficulty_iter don't need a WriteTransaction batch (#1710) 2018-10-10 16:49:07 +08:00
Antioch Peverell
770aca9a2d
check_known_mmr is the source of our deadlock - blitzing it for now (#1691) 2018-10-08 16:44:05 +01:00
Antioch Peverell
bcf41438dc
Simplify chain, remove head. (#1657)
* Go back to db for head and header_head
* Use batch consistently for db access
* Pass active txhashset and batch in the ctx
* Only update head in db if total work increases
* Only updated header_head if total work (on header chain) increases
2018-10-05 08:29:33 +01:00
Antioch Peverell
0635945740
cleanup verifier_cache (add it to block ctx) (#1638)
rename process_block_no_orphans -> process_block_single
2018-10-02 16:13:02 +01:00
Antioch Peverell
6d67cbdecb perf: update sync_head once per batch of headers (#1629)
perf: update sync_head once per batch of headers
2018-10-02 11:13:26 +08:00
Gary Yu
d8ca684260
fix: in case of all known, update header_head and sync_head (#1619)
* fix: in case of all known for Headers received, update sync_head to the last header

* refactor: push this logic down into pipe
2018-10-01 21:58:50 +08:00
Antioch Peverell
73ddd1d01d
no need to pass sync_head around in ctx (#1608) 2018-09-29 16:19:19 +01:00
Antioch Peverell
fd8c03679a
use sync_head consistently in sync_block_headers (#1604)
* use sync_head consistently in sync_block_headers

* rustfmt
2018-09-29 08:47:50 +01:00
Antioch Peverell
2cad812b29
use an lru_cache for the block_hashes_cache (#1602) 2018-09-28 17:27:31 +01:00
Yeastplume
e64f4fbcd1
Rust Cuckatoo for verifier and test-miner (#1558)
* cuck placeholder

* rustfmt

* cuckatoo, early days

* rustfmt

* data structures are in place, siphash key creation is consistent with @tromp

* solver in place, (not yet working)

* cuckatoo test solver working with test nonce

* rustfmt

* update solver to remove adjacency list removals

* verifier functioning

* rustfmt

* Proper error handing in Cuckatoo module, couple of tests

* modify cuckoo/cuckatoo solvers and verifiers to function identically, in advance of trait refactoring

* rustfmt

* refactor PoW context into trait, default to using cuckoo context

* rustfmt

* create macros for integer casting/unwraps

* don't instantiate structs when just verifying, add test validation vector for cuckatoo 29

* rustfmt

* don't init cuckoo structs if just validating

* test fix

* ensure BH hashing for POW is only done within miner/validators
2018-09-28 11:53:14 +01:00
Antioch Peverell
5a83989cf6
explicitly handle the header when processing blocks (#1600) 2018-09-27 15:12:08 +01:00
Antioch Peverell
4b0fdc2499
rework to only pass a single block_context to pipeline (#1599) 2018-09-27 11:44:50 +01:00
Antioch Peverell
56f84cc2f4
pass batch to process_block and process_block_header (#1594)
* use a batch consistently when processing blocks and headers

* rustfmt
2018-09-27 09:35:25 +01:00
Antioch Peverell
acec59e249
introduce rewindable_kernel_view (readonly but rewindable kernel MMR view) (#1587)
* introduce rewindable_kernel_view
cleanup header in extension

* cleanup and docs/comments

* txhashset does not need to be mutable here

* pull validate_kernel_history out into fn
2018-09-26 09:59:00 +01:00
Antioch Peverell
11f2d7b6d4
UTXOView (readonly, minimal, output only txhashset extension) (#1584)
* make the utxo view explicit

* introduce utxo_view (readonly, minimal txhashset extension)

* rustfmt

* cleanup

* cleanup

* rustfmt

* cleanup build warnings, comments etc.

* rustfmt

* utxo_view even more readonly now

* cleanup

* refactor pmmr, split out readonly_pmmr and backend

* rustfmt
2018-09-25 11:01:19 +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
Antioch Peverell
f042f67fcd
Reintroduce block sums, verify full kernel sums per block (#1559)
* block_sums and full kernel sum verification

* rustfmt

* add docs/comments

* docs

* rustfmt

* comment on fact total_kernel_sum is redundant now

* make sure we setup block_sums correctly on a fork

* rustfmt

* replace those asserts with errors

* rustfmt
2018-09-20 09:19:32 +01:00
Gary Yu
e1c8dc5a3a
fix: reset sync_head to header_head on initial transition to HeaderSync (#1531)
* fix for bug #1524, reset sync_head to header_head on initial transition to HeaderSync.
* using @antiochp fix solution in #1539
2018-09-20 07:29:24 +08: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
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
Antioch Peverell
77765796ab
improve "check known" steps during process_block() (#1475)
* document what we do during pipe::apply_block()

* rustfmt

* wip

* rustfmt

* wip

* additional check_known_store and check_known_mmr checks in process_block

* rustfmt

* cleanup coinbase maturity check in process_block

* consolidate the "check in store" logic
add TODOs around the 50 block OldBlock logic

* rustfmt

* cleanup
2018-09-05 10:51:29 +01:00