Commit Graph

2323 Commits

Author SHA1 Message Date
John Tromp f4295917a0 header version 4 accompanied by new AR PoW (#3334) 2020-06-04 09:05:56 -04:00
Boqin Qin 450d235358 servers: fix possible deadlock (#3337) 2020-06-03 13:34:44 +02:00
Antioch Peverell e7d2c71ca6 display chain type on tui title bar (#3336) 2020-05-29 09:18:00 -04:00
Antioch Peverell 5b825fbf0d check_known now takes total_difficulty into consideration (#3298)
* check_known now takes total_difficulty into consideration

* update based on feedback
2020-05-29 10:21:12 +01:00
Antioch Peverell 988a05f023 Enable NRD kernel support (noop) feature flagged (#3303)
* wip

* commit

* add block level validation rule around NRD kernels and HF3 block height

* wip

* test coverage for kernel ser/deser for NRD kernels

* add some type safety around ser/deser of nrd relative height

* cleanup

* cleanup tx sig handling and add tests around NRD kernel sig

* test coverage for chain apply block containing NRD kernel

* verify kernel variants when adding tx to pool
NRD kernels will not be accepted until HF3

* add txpool test for NRD kernel handling

* fix merge

* fix api for NRD kernels

* commit

* wip - feature flag for NRD kernel support

* wip

* global config and thread local feature flag for NRD kernel support

* add feature flag support for NRD kernels
default to false when starting up node
allow it to be set to true in context of individual tests

* feature flag

* explicit testing of NRD kernel via feature flag

* add chain_type and feature flag logging on startup

* PR feedback and cleanup

* PR feedback
2020-05-29 09:56:24 +01:00
hashmap 731528c616 Some optimizsations in TUI (#3325)
* Do not allocate String for static status, use Cow instead, eg we allocate "Running" string at every refresh
* Use static dispatch for Views instead of Box<dyn View>
* Update only the current view
* Simplify Listener trait
2020-05-29 09:55:07 +01:00
Antioch Peverell a8b8dc3a7f add test to demonstrate pair of "half" kernels sharing same public excess (#3314)
* cleanup how we handle key splitting for transaction offset
add test to demonstrate a pair of transaction halves sharing same kernel excess

* cleanup

* cleanup
2020-05-28 15:26:18 +01:00
Antioch Peverell b570ac9925 ignore .vscode (#3333) 2020-05-24 23:34:33 +02:00
hashmap 26b411e79e Reduce memory allocations in PMMR (#3328)
We have a pattern in the code - return Vec, turn it into an iterator, filter and collect to another Vec. The idea was to return iterator where possible to avoid allocating intermediate vecs.
2020-05-24 16:50:27 +01:00
Antioch Peverell 6faa0e8d75 thread local chain type vs global chain type (#3327)
* Introduce GLOBAL_CHAIN_TYPE and make CHAIN_TYPE thread_local.
This makes testing more explicit and significantly more robust.

* set_local_chain_type() in tests

* cleanup - weird

* get pool tests working with explicit local chain_type config

* core tests working with explicit local chain_type

* p2p tests working with explicit local chain_type

* store tests working

* cleanup, feedback
2020-05-22 12:51:58 +01:00
David Burkett 096b6924ce Adding kernel_mmr_size and output_mmr_size to BlockHeaderPrintable (#3329) 2020-05-22 10:10:14 +01:00
Quentin Le Sceller d2d3e4c547 Remove compiler warning (#3331) 2020-05-21 13:08:01 -04:00
Quentin Le Sceller 5d0791bbd1 Add servers (#3315) 2020-05-21 13:07:28 -04:00
David Burkett 952bdcc4c8 Fixing doc (#3330) 2020-05-19 13:25:41 -04:00
Quentin Le Sceller 28644a63cf Fix miminum share difficulty in Stratum Server (#3323) 2020-05-19 11:07:33 -04:00
hashmap 93f5de3d29 Introduce a pause after calling Cursive.step (#3326)
Currently we call it in a loop without any delays which burns cpu cycles for little value.
On my machine I see decrease of cpu usage from 12% to 6% on a synced node after applying this fix.
2020-05-16 17:12:45 +02:00
Antioch Peverell 133a8da53e Refactor bucket_transactions() and evict_transaction() (#3319) 2020-05-14 14:21:41 -04:00
hashmap 2c62111561 Remove some unwraps in LMDB client (#3313) 2020-05-13 16:18:55 +02:00
Quentin Le Sceller e826cd82f9 Update (#3324) 2020-05-12 11:48:18 -04:00
hashmap 2397407dc4 Always return a typed structure from lmdb store (#3312)
We have a method get which returns a Vec, it's used in cases when we can't implement FromLmdbBytes or Readable on a desired type, eg when both traits and type are external for the current crate. This approach requires an extra allocation of a Vec, this PR introduces a method which accepts desirialzer as closure, which allows to desrialize in place without an intermidiate heap allocation.

It's still possible to get a Vec if needed, just pass a Vec constructor to get_with.
2020-05-05 11:00:23 +02:00
Antioch Peverell c82199bb97 cleanup weird egde_bits handling in tests (#3316) 2020-05-04 12:40:16 +01:00
hashmap 8a22fb516a Reduce number of allocations in to_key calls (#3311)
We have to make an extra allocation per db get request because key generation function to_key takes Vec. Taking byte slice (AsRef<[u8]> to be precise) also simplifes the code a bit.
2020-04-30 17:47:44 +02:00
hashmap a82041d0ed Refactor Readable trait (#3309)
Currently Writable accepts trait Write as a type parameter but Readable
takes Read as a trait object, which is not symmetrical and also less performant. This PR changes Readable trait and all places where it's used
2020-04-30 17:42:19 +02:00
hashmap 9e51e86538 Use generic types instead of trait objects in tx pool (#3308)
Tx pool takes some parameters as trait objects. It's not an idiomatic Rust code, in this particular case we should use generic types. Trait object makes sense when we accept in runtime different concrete types which implement the trait as a value of the same field. It's not the case here. Trait objects come with a price - instead of method dispatch in compile time we have to accept runtime dispatch. My guess we did it to not clutter the code with type parameters, which is understandable but still suboptimal.
2020-04-30 17:41:49 +02:00
Quentin Le Sceller 061bf3d08f Add depreciation warning (#3310) 2020-04-28 12:17:34 -04:00
Quentin Le Sceller be4779c923 Less cloning and pattern simplifications (#3305)
* Cleanup 
* Pattern simplification
2020-04-24 11:19:34 +02:00
hashmap 6556dd585d Pass byte slice to to_hex (#3307)
Currently we pass a Vec. This requires an extra allocation and copy of all elements if a caller doesn't have a Vec already, which is at least 95% of cases.
Another, a smaller issue, we have a function util::to_hex and some structs implement to_hex() on top of it, so we have a mix of it in the code. This PR introduces a trait and a blanket impl for AsRef<[u8]> which brings a uniform API (obj.to_hex()). One unfortunate case is arrays of size bigger than 32 - Rust doesn't implement AsRef for them so it requires an ugly hack (&array[..]).to_hex().
2020-04-24 11:18:26 +02:00
hashmap d8c6eef485 Refactor SyncState (#3297)
* Refactor SyncState

Method sync_error() retrun type was simplified.
update_txhashset_download() was  made type safe, which eliminates a runtime enum variant's  check, added an atomic status update
2020-04-20 12:30:04 +02:00
hashmap e64e90623b Reduce number of allocations in Headers message read (#3301)
We allocate 17 vectors (in the heap) per 512 headers, this PR reduces the number to 1 by resuing the buffer for headers and eliminating the need in the vector of indices
2020-04-18 14:07:26 +01:00
hashmap 0da88f7046 Don't swallow errors in body_sync (#3300)
We handle them inside but it makes the code more cluttered
2020-04-18 13:51:18 +01:00
Quentin Le Sceller 4024ee3839 Update Cursive to 0.14 and update backend. (#3291)
* Update Cursive to 0.14

* Replace ncurses backend with crossterm

* Update to latest Cursive code

* Remove git patch
2020-04-17 15:41:55 -04:00
jaspervdm cf128eb220 Fix rare panic in TUI (#3294) 2020-04-15 10:19:11 -04:00
Quentin Le Sceller e76dda6676 Use latest hosted agent for CI (#3278)
* Use latest hosted agent for CI
2020-04-14 09:25:10 -04:00
MCM-Mike d7e6ac6cfe Update seed.rs (#3282)
added mainnet-seed.grinnode.live
2020-04-13 15:38:39 -04:00
Yeastplume b2609b7214 Update rust-secp256k1 to v0.7.9 (#3293) 2020-04-10 18:44:02 +01:00
Antioch Peverell bab9f41343 go back to storing header_head in the db (#3268)
* go back to storing header_head in the db

* simplify and cleanup
2020-04-10 16:12:53 +01:00
goyle 34ff103bb0 Update link to podcast featuring tromp (#3283) 2020-03-30 11:10:42 -05:00
Antioch Peverell e49eecae5c Cleanup path handling with AsRef<Path> (#3284)
* AsRef<Path>

* bump
2020-03-30 11:35:21 +01:00
jaspervdm 7385e8ce7f Update API docs (#3277) 2020-03-28 12:53:20 +01:00
Yeastplume d036332028 Include new libsecp256k1 version (#3279) 2020-03-26 16:12:41 +00:00
jaspervdm 2fe0869321 Use croaring-mw with 'compat' feature (#3274) 2020-03-23 21:12:58 +01:00
jaspervdm 6bdf31f23d Remove unused code in message handling (#3269) 2020-03-13 12:50:35 +01:00
Antioch Peverell 3bbf60ee92 simplify when block_sums and spent_index are added to the db (#3253)
* simplify when block_sums and spent_index are added to the db

* fix pool tests

* cleanup
2020-03-10 14:58:32 +00:00
Antioch Peverell 8ca381a9c2 cleanup util::from_hex() (#3265)
* cleanup our from_hex()

* fix keychain tests

* add test coverage for empty hex string
2020-03-10 10:36:18 +00:00
Yeastplume ee5fe1ac63 Use smaller LMDB Allocation Size in non-production modes (#3264)
* add option to override lmdb allocation size in testing

* simplify to use global::is_production_mode
2020-03-10 09:30:12 +00:00
Yeastplume 31bd2d923a Add better LMDB error output (#3263) 2020-03-09 14:04:06 +01:00
jaspervdm d5b523248b API: don't error on missing output (#3256)
* Node API: don't error on missing output

* Propagate errors from get_output*

* Rename is_unspent and small refactor

* Forgot to rename function in tests

* Change Batch get_output_pos_height type signature
2020-03-04 23:42:10 +01:00
Antioch Peverell 5f5b1d2f13 no need to rehash with index to compare output with input spending it (#3260)
* no need to rehash with index to compare output with input spending it

* compare output identifier when checking is_unspent()

* output identifier from cleanup
2020-03-04 08:36:33 +00:00
Antioch Peverell 2527006e8d keep output and rangeproof mmrs together (#3254) 2020-03-03 15:32:01 +00:00
Yeastplume b73fc0bb9b Version bump for next development release 2020-03-02 12:27:16 +00:00