Commit graph

768 commits

Author SHA1 Message Date
Antioch Peverell
f48a23655d
bump 5.0.0-beta.2 after fixing windows release script (#3508) 2020-11-26 21:35:10 +00:00
jaspervdm
64c8e0cf0a
Bump version to 5.0.0-beta.1 (#3505) 2020-11-26 18:48:16 +01:00
John Tromp
48efb693e2
Fixfees (#3481)
* add FeeFields type

* use FeeFields with ::zero and try_into().unwrap()

* fixed tests

* avoid 0 accept_base_fee

* add aggregate_fee_fields method for transaction

* implement std::fmt::Display trait for FeeFields

* make base_fee argument non-optional in libtx::mod::tx_fee

* add global and thread local accept_fee_base; use to simplify tests

* set unusually high fee base for a change

* revert to optional base fee argument; default coming from either grin-{server,wallet}.toml

* remove optional base fee argument; can be set with global::set_local_accept_fee_base instead

* define constant global::DEFAULT_ACCEPT_FEE_BASE and set global value

* add Transaction::accept_fee() method and use

* Manual (de)ser impl on FeeFields

* fix comment bug

* Serialize FeeFields as int in tx

* allow feefields: u32:into() for tests

* try adding height args everywhere

* make FeeFields shift/fee methods height dependent

* prior to hf4 feefield testing

* rename selected fee_fields back to fee for serialization compatibility

* fix test_fee_fields test, merge conflict, and doctest use of obsolete fee_fields

* make accept_fee height dependent

* Accept any u64 in FeeFields deser

Co-authored-by: Jasper van der Maarel <j@sper.dev>
2020-11-26 18:03:06 +01:00
John Tromp
97425af637
make min_wtema difficulty chain type dependent (#3502)
* make min_wtema difficulty chain type dependent

* fix bad graph weights for automated and user testing

* only mainnet can get wtema difficulty unstuck at 59s blocks
2020-11-25 15:13:43 +00:00
John Tromp
f86102b2a6
fixDAA; implement wtema (#3477)
* implement wtema

* reduce FTL from 12 to 5 mins; fix inaccuracies in cuckoo doc

* rename difficulty window for DampedMovingAverage DAA

* fix FTL error msg

* secondary_scale becomes extended nonce past HF4

* secondary_scale change actually belongs in hardfork4 PR

* make future time limit configurable

* define constant global::DEFAULT_FUTURE_TIME_LIMIT and refactor a bit

* fix typos

* as_ref() feels safer than as_mut() :-)

* remove obsolete mut

* make future_time_limit non-mandatory in grin-server.toml
2020-11-25 10:58:39 +00:00
John Tromp
a5b8968826
HardFork4 (#3478)
* HardFork4 initial commit

* HF4 obsoletes secondary_scale, which becomes an nonce extension 8->12 bytes

* fix TESTNET_FOURTH_HARD_FORK height

* improve predicted height for testnet fork on dec 8

* move local variable as suggested by antiochp
2020-11-24 16:13:28 +00:00
Antioch Peverell
2125c05020
use extend_from_slice when appending multiple hashes to hash file (#3497)
* use extend_from_slice when appending multiple hashes to hash file

* bump
2020-11-24 14:24:19 +00:00
jaspervdm
055b684416
More efficient serialization for bitmap segments (#3492)
* More efficient serialization for bitmap segments

* Rename a const

* Correctly count number of chunks in a segment

* Enum for BitmapBlock (de)ser mode

* Add more segments in test

* Fix duplicate function
2020-11-24 15:19:07 +01:00
Antioch Peverell
cba3137338
add segmenter for generating segments from txhashset with consistent rewind (#3482)
* add segmenter for generating segments from txhashset with consistent rewind

* rework segmenter to take a txhashset wrapped in rwlock
rework our rewindable pmmr so we can convert to readonly easily

* placeholder code for rewinding readonly txhashset extension to build a rangeproof segment

* segment creation for outputs/rangeproofs/kernels/bitmaps

* placeholder segment impl

* commit

* rework segmenter to use a cached bitmap (rewind is expensive)

* cache segmenter instance based on current archive header

* integrate the real segment and segment identifier with our segmenter

* exercise the segmenter code on chain init

* wrap accumulator in an arc, no need to clone each time
2020-11-23 19:07:07 +00:00
jaspervdm
8faba4ef83
PMMR segment creation and validation (#3453)
* Chunk generation and validation

* Rename chunk -> segment

* Missed a few

* Generate and validate merkle proof

* Fix bugs in generation and validation

* Add test for unprunable MMR of various sizes

* Add missing docs

* Remove unused functions

* Remove segment error variant on chain error type

* Simplify calculation by using a Vec instead of HashMap

* Use vectors in segment definition

* Compare subtree root during tests

* Add test of segments for a prunable mmr

* Remove assertion

* Only send intermediary hashes for prunable MMRs

* Get hash from file directly

* Require both leaves if one of them is not pruned

* More pruning tests

* Add segment (de)serialization

* Require sorted vectors in segment deser

* Store pos and data separately in segment

* Rename log_size -> height

* Fix bitmap index in root calculation

* Add validation function for output (bitmap) MMRs

* Remove left over debug statements

* Fix test

* Edge case: final segment with uneven number of leaves

* Use last_pos instead of segment_last_pos

* Simplify pruning in test

* Add leaf and hash iterators

* Support fully pruned segments

* Drop backend before deleting dir in pruned_segment test

* Simplify output of first_unpruned_parent
2020-11-17 19:38:44 +01:00
Quentin Le Sceller
cf2a65242d
Rename Floonet to Testnet (#3431)
* Rename Floonet to Testnet

* Fix test

* Rename test and docker
2020-10-07 09:36:02 -04:00
jaspervdm
4c6d1dd4bd
Define get_data_from_file function on ReadablePMMR trait (#3464) 2020-10-07 14:09:27 +02:00
Antioch Peverell
cc4e608d1b
cleanup validate() no need to return kernel sums (#3456) 2020-10-01 14:56:37 +01:00
jaspervdm
0aec8b533b
Refactor PMMR read methods into trait (#3454) 2020-09-29 15:57:33 +02:00
jaspervdm
defc714f6e
Refactor p2p reader (#3433)
* Refactor p2p reader

* Rename Output enum

* Consume enum takes owned values instead of references

* Deserialization in codec, remove Consume enum

* Calculate block header size

* Read headers in batches

* Remove headers type from deserializer
2020-09-28 14:43:37 +01:00
Antioch Peverell
a22d98e9d5
bump working version on master to 4.2.0-alpha.1 (#3443)
we now have a current/4.1.x branch for 4.1.0 release
2020-09-15 17:26:44 +01:00
Antioch Peverell
06a09f25c4
bump protocol version to 1000 to facilitate deprecation of earlier versions (#3434) 2020-09-11 11:07:57 +01:00
Antioch Peverell
7dc94576bd
Introduce CommitOnly variant of Inputs (#3419)
* Introduce CommitOnly variant of Inputs.
Introduce CommitWrapper so we can sort commit only inputs correctly.

* rememebr to resort if converting

* write inputs based on variant and protocol version

* read and write protocol version specific inputs

* store full blocks in local db in v3
convert to v2 when relaying to v2 peers

* add debug version_str for inputs

* no assumptions about spent index sort order

* add additional version debug logs

* fix ser/deser tests for proto v3

* cleanup coinbase maturity

* rework pool to better handle v2 conversion robustly

* cleanup txpool add_to_pool

* fix nrd kernel test

* move init conversion earlier

* cleanup

* cleanup based on PR feedback
2020-09-07 16:58:41 +01:00
Antioch Peverell
133089e985
Refactor Output Identifiers (#3371)
* refactor output to have internal output identifier

refactor to use AsRef for output identifier

make the output MMR explicit in terms of output identifiers

* put the serde deser back for rangeproof

* add json test for transactions
2020-09-03 10:59:54 +01:00
Antioch Peverell
1cff387f61
Use mmr sizes in header to validate header weight (#3395)
* use mmr sizes in header to validate block weight given header only

* add global weight validaton to headers when reading them untrusted off the network

* fixup tests, one pending test

* add test for deserializing untrusted block header exceeeding weight limits

* validate header mmr sizes, must grow for each block

* remove redundant height check

* fix tests after rebase
block specific TooHeavy error
2020-08-19 09:40:56 +01:00
Antioch Peverell
29cffe9b3c
verify_cut_through and test coverage (#3424)
* fix inconsistent verify_cut_through() logic

* add test coverage for chain::process_block() and cut_through logic

* fix comment
2020-08-18 20:09:54 +01:00
John Tromp
9c517db3c3
add test cases for C32 and C33 solutions (#3422) 2020-08-10 11:05:13 -04:00
Antioch Peverell
4732a0b62b
convert tx for v2 compatibility on way into stempool/txpool (#3412)
cleanup passing extra_tx around

use output identifiers when converting tx to v2
2020-08-02 13:26:28 +01:00
Nym Seddon
6a12155738
Expose max_tx_weight API (#3407)
Add API for getting max transaction weight

Co-authored-by: Nym Seddon <unseddd@shh.xyz>
2020-08-02 08:50:59 +01:00
Antioch Peverell
880f9adcd3
use AsRef in cut_through for flexibility (#3411)
and use fold() to get len of inputs, outputs, kernels
2020-08-01 15:19:17 +01:00
Antioch Peverell
04c8713d83
refactor apply_inputs and support converting block for v2 compatibility (#3409)
* wip

* convert incoming block to v2, rework orphan and duplicate check earlier than conversion

* cleanup process_block_single

* cleanup block conversion

* cleanup

* leverage utxo_view when applying block inputs
2020-07-31 14:36:20 +01:00
Antioch Peverell
70c637fe4f
make cut_through significantly more useful by returning both cut-through and non-cut-through elements (#3410)
split the slices internally rather than simply taking sub-slices
2020-07-30 15:29:20 +01:00
Antioch Peverell
83b269961a
introduce Inputs enum variants for future commit only support (#3406) 2020-07-28 21:21:57 +01:00
Antioch Peverell
b43666af80
cleanup inputs_mut, outputs_mut, kernels_mut fns (#3405) 2020-07-27 11:54:43 +01:00
Antioch Peverell
80841f16d2
pass slices around and not refs to vecs (#3404)
* pass slices around and not refs to vecs

* use slice.swap()

* use inputs() not body.inputs
2020-07-27 11:07:18 +01:00
Antioch Peverell
105f50b26b
cleanup unused macros and error (#3367) 2020-07-27 11:06:16 +01:00
Antioch Peverell
824c51a346
bump version to 4.1.0 on master (4.0.1 on 4.0.x branch) (#3390) 2020-07-13 12:16:43 +01:00
Antioch Peverell
30db9c410e
bump master to 4.0.1-alpha.1 to differentiate from 4.0.0 official tagged build (#3374) 2020-07-02 15:51:11 +01:00
Yeastplume
7abe9fcb39
Versioning for 4.0.0 release (#3373) 2020-07-02 10:29:10 +01:00
Yeastplume
098d25e569
Version bump for 4.0.0-rc.1 (#3366) 2020-06-26 13:10:42 +01:00
John Tromp
238522a9fb
add CuckooParams::node_mask, obsolete EdgeType and sipnode shift arg (#3365) 2020-06-26 12:13:25 +01:00
Antioch Peverell
55a929e214
cleanup old unused code (#3355) 2020-06-15 15:05:47 +01:00
Antioch Peverell
dd88d28a7a
bump version to 4.0.0-beta.2 (#3351) 2020-06-12 14:08:12 +01:00
Antioch Peverell
6757a3040d
this test was jamming up in azure CI (#3349)
* this test was jamming up in azure CI

* peer handshake test requires global chain type
2020-06-10 21:56:28 +01:00
Antioch Peverell
20e5c1910b
NRD rules and "recent" kernel pos index (#3302)
* variants for output_pos linked list entries (head/tail/middle/unique)
next and prev and Vec<u8> lmdb keys

* get_pos on enum

* break list and list entries out into separate enums

* track output features in the new output_pos index, so we can determine coinbase maturity

* push entry impl for none and unique

* some test coverage for output_pos_list

* commit

* wip - FooListEntry

* use instance of the index

* linked list of output_pos and commit_pos both now supported

* linked_list

* cleanup and rename

* rename

* peek_pos

* push some, peek some, pop some

* cleanup

* commit pos
cleanup

* split list and entry out into separate db prefixes

* cleanup and add placeholder for pop_back

* pop_pos_back (for popping off the back of the linked list)
test coverage for pop_pos_back

* wip

* placeholder for prune via a trait
pos must always increase in the index

* rewind kernel_pos_idx when calling rewind_single_block

* RewindableListIndex with rewind support.

* test coverage for rewindable list index

* test coverage for rewind back to 0

* rewind past end of list

* add tests for kernel_pos_idx with multiple commits

* commit

* cleanup

* hook NRD relative lock height validation into block processing and tx validation

* cleanup

* set local chain type for kernel_idx tests

* add test coverage for NRD rules in block processing

* NRD test coverage and cleanup

* NRD relative height 1 test

* test coverage for NRD kernels in block processing

* cleanup

* start of test coverage for txpool NRD kernel rules

* wip

* rework pool tests to use real chain (was mock chain) to better reflect reality (tx/block validation rules etc.)

* cleanup

* cleanup pruneable trait for kernel pos index

* add clear() to kernel_pos idx and test coverage

* hook kernel_pos rebuild into node startup, compaction and fast sync

* verify full NRD history on fast sync

* return early if nrd disabled

* fix header sync issue
2020-06-10 16:38:29 +01:00
Quentin Le Sceller
093c500fed
Cargo Update (#3338) 2020-06-08 17:15:32 -04:00
John Tromp
e28e02ecd4
simplify by avoiding unnecessary conversions (#3343) 2020-06-08 17:04:06 -04:00
Antioch Peverell
c54568e69f
Rework pool tests to use real chain (was mock chain) (#3342)
* rework pool tests to use real chain (was mock chain) to better reflect reality (tx/block validation rules etc.)

* cleanup
2020-06-07 09:26:08 +01:00
Yeastplume
c7c9a32b9b
4.0.0-beta.1 Version Bump (#3339) 2020-06-04 14:52:26 +01:00
John Tromp
f4295917a0
header version 4 accompanied by new AR PoW (#3334) 2020-06-04 09:05:56 -04: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
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
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
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
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
jaspervdm
2fe0869321
Use croaring-mw with 'compat' feature (#3274) 2020-03-23 21:12:58 +01: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
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
Yeastplume
b73fc0bb9b
Version bump for next development release 2020-03-02 12:27:16 +00:00
Yeastplume
533da2d192
version bump for 3.1.0 release (#3258) 2020-03-02 10:38:56 +00:00
Antioch Peverell
ef755a5c49
bump to 3.1.0-beta.3 (#3252) 2020-02-28 12:42:08 +00:00
Antioch Peverell
5071084445
bump version to 3.1.0-beta.2 (#3244) 2020-02-27 09:35:44 +00:00
jaspervdm
6bdeefd27e
Fix warnings (#3240) 2020-02-25 18:33:50 +01:00
Quentin Le Sceller
ef853ae469
Update croaring (#3233) 2020-02-21 15:24:48 +00:00
Antioch Peverell
4c081b8f73
use backend file when compacting the output pos index (#3226) 2020-02-13 10:26:56 +00:00
Quentin Le Sceller
04a0123752
Less cloning and additional pattern simplifications (#3223)
* API Cleanup

* Chain Cleanup

* Core Cleanup

* Keychain Cleanup

* P2P Cleanup

* Pool Cleanup

* Store Cleanup

* Util Cleanup

* Cleanup clone_from_slice

* Address jasper comments
2020-02-12 19:35:33 +01:00
Quentin Le Sceller
c4e69717ab
Less cloning and pattern simplifications (#3216)
* Less cloning and pattern simplifications

* Revert inclusive range and remove unecessary Error:From
2020-02-05 11:02:07 -05:00
Quentin Le Sceller
ee25d0dfc9
Pass SwitchCommitment by value instead of reference (#3217) 2020-02-04 08:52:00 -05:00
Antioch Peverell
5e1fe44bed
remove writeable impl [u8; 4] (#3132) 2020-01-29 14:56:06 +00:00
François Garillot
dcdbdd4bcc
Some simple Option / Result / iterator pattern simplifications (#3205) 2020-01-29 14:20:57 +00:00
Antioch Peverell
616dad43fd
Cleanup redundant AsFixedBytes and FixedLength traits (#3131)
* no need for AsFixedBytes we can just use AsRef<[u8]>

* cleanup FixedLength trait

* revert this change for now

* fix store tests

* cleanup and fix tests after rebase

* fix tests

* update based on PR review
less hard-coded values now

* cleanup
2020-01-29 13:41:50 +00:00
Quentin Le Sceller
fb888a32d6
Remove unused crate (#3211) 2020-01-28 13:56:45 -05:00
Antioch Peverell
2f1e8299b1
cleanup unused hash_with impl (#3207) 2020-01-28 11:40:21 +00:00
Joseph Goulden
a1b6c31481 tests: split consensus tests into separate files for each chain type … (#3168)
* tests: split consensus tests into separate files for each chain type to avoid non deterministic behaviour due to shared global state in global.rs
2020-01-27 18:51:51 -05:00
Austin Abell
4152d9fc0c Build block header from pre pow data and proof (#3178)
* Implement validation and generation of block header by proof and pre pow

* Optimize

* handle missed ser result errors and test invalid pre_pow

* switch to specific error mapping

* clean import
2020-01-23 14:29:54 +00:00
mplsgrant
da3b3b23c6 Fixed issues with fuzz in core. (#3193)
* Include ser::ProtocolVersion in fuzz generator.
* Adjusted block_read_v1's path to appropriate file.
2020-01-21 11:03:24 +01:00
Quentin Le Sceller
6e5afe496b Update License to 2020 (#3196) 2020-01-20 11:40:58 +00:00
Quentin Le Sceller
d1b3f939b0
Remove old website for grin.mw (#3195)
* Remove old website for grin.mw

* Also update forum
2020-01-17 16:29:55 -05:00
hashmap
c2026bd686
Remove unused crates (#3185)
* Remove unused crates

also bump minor versions in Cargo.lock
2020-01-15 11:34:14 +01:00
Quentin Le Sceller
d31427f694 Fix compiler warning 'unnecessary parentheses around type' (#3175) 2020-01-06 09:53:49 +00:00
Yeastplume
2bf4080866
versioning for master 2019-12-20 11:13:39 +00:00
Yeastplume
266af4e91f
version bump for master 2019-12-20 11:07:58 +00:00
Yeastplume
a50200799b
version bump (#3174) 2019-12-19 16:24:02 +00:00
Yeastplume
2f8a1f2712
Versioning for 3.0.0-beta.2 (#3170)
* versioning for beta build

* Cargo.lock
2019-12-12 20:37:50 +00:00
Joseph Goulden
fd4c4c52f2 chore(test): remove deprecated try/r#try macro in favour of ? (#3163) 2019-12-10 16:13:30 +00:00
Yeastplume
6a54334576
Version bump for beta.1 (#3159) 2019-12-06 12:01:53 +00:00
Antioch Peverell
0b21ee607a
height (header version) specific output PMMR root rules (#3147)
* height (header version) specific output PMMR root rules

* cleanup

* cleanup based on PR feedback

* address feedback
2019-12-05 11:55:10 +00:00
Antioch Peverell
52ea906b61
cleanup HeaderVersion::default() (#3149)
* header version now explicit, no "default" version
"empty" block can safely have verion 0 as it needs to be set later

* default block header uses version 1

* HeaderVersion(1)
2019-12-02 12:35:17 +00:00
Antioch Peverell
c46343f279
cleanup HeaderVersion, "newtype" no need for constructor (#3150) 2019-11-30 23:14:35 +00:00
Antioch Peverell
869cfd2b82
explicit header version based on height rather than "increment" the version (#3148) 2019-11-29 14:32:39 +00:00
hashmap
ba9cdd323e Revert "Remove error serialization/deserialization (#3110)" (#3151)
This reverts commit 76ac9419b8.
2019-11-29 12:37:50 +00:00
John Tromp
82b1ff905d Hardfork2 (#3136)
* add 2nd HF and cuckaroom

* add cuckaroom and hardfork tests

* remove all traces of later phaseouts

* refactor header_version from valid_header_version
2019-11-27 20:36:36 +00:00
Antioch Peverell
11ac7d827a
Enable faster sync (#3108)
* add bitmap accumulator
refactor vec backend so we can use it outside of tests
introduce a "hash only" vec backend for the accumulator

* get core tests passing

* initial test coverage for bitmap_accumulator

* better test coverage for bitmap accumulator and cleanup code

* refactor txhashset roots, call validate() on roots during block validation

* fix store tests

* log the "merged" root when validating roots

* cleanup, revise based on feedback

* cleanup

* rework it to pass explicit size into bitmap accumulator when applying
2019-11-26 20:21:49 +00:00
Quentin Le Sceller
04e7d307ce Replace MimbleWimble by Mimblewimble (#3118)
* Replace MimbleWimble by Mimblewimble

* MimbleWimble->Mimblewimble
2019-11-19 10:49:32 +00:00
Joseph Goulden
6d864a813c fix: split state validation status into kernel and rproof updates. (#3096)
* fix: split state validation status into kernel and rproof updates. And fix sync status for these two states

* fix: show correct number of leaves for pruned MMR as well as unpruned

* docs: better docs for kernel/range proof validation

* fix: ordering of kernel and rproofs validation in TUI

* fix: typo in rangeproofs api and comments
2019-11-17 22:12:10 +01:00
hashmap
43bd5a56ff Make imports in core crate more Rust 2018 idiomatic (#3112)
We use crate renaming to remove grin prefix, as  result imports for util and keychain crates start with crate::
which looks like a part of the current crate. This PR fixes it.
Also some small improvements were made.
If this approach works I'll replicate it to other crates.
2019-11-14 10:27:30 -05:00
hashmap
76ac9419b8
Remove error serialization/deserialization (#3110)
it's not used
2019-11-13 21:08:20 +01:00
Yeastplume
38e6497919
Retrieve outputs within a block height range (#3103)
* add function to retrieve a set of pmmr indices between a given block height range

* typo

* change APU to just return required indices

* change pmmr index retrieval, change new function to only return pmmr indices between blocks
2019-11-04 15:04:21 +00:00
Antioch Peverell
50ce7ba043
Refactor transaction building combinators (#3057)
* tx combinators now take operate on Result to allow for more robust errors handling
replace with_fee() and with_lock_height() with a more flexible with_features()

* pass kernel features in as arg to build::transaction()

* fix chain tests

* fix pool tests

* do not pass kernel around in the combinators
just set it once on the tx when building

* build::partial_transaction now takes a existing tx to build on
2019-11-01 10:56:58 +00:00
Xavier Lau
a39ff54a7f optimize: avoid insert into Vec; use into_iter for less dereference (#3102) 2019-10-29 14:35:59 +00:00
hashmap
1f5de6beb9
Verify headers and blocks only when needed (#3023)
* Verify headers and blocks only when needed

Curretnly we have some lightweigt validation implemented as part of
entity deserialization, which is safer and allows us to not parse the
entire object if some part is invalid. At the same time this logic
always applies when we read an entity, eg when reading from DB.

This PR introduces UntrustedHeader/Block which is used when we read from
the network. It does partial validation during read, then it is supposed
to be converted into regular header/block which doesn't validate itself.

Also this PR adds "lightweight" validation to block header read like we have
for block body, so we don't parse block body if the header is invalid.

Fixes #1642

* Move version validation to untrusted header

* update fuzz tests
2019-10-27 08:40:52 +01:00
hashmap
8a7da89d47 Remove usage of try! macro, use ? instead (#3097)
We converted the major part of the code a while ago, but some occurences were left. It's a compiler warning on nightly already.
2019-10-21 15:01:18 -04:00
Yeastplume
24cf75cead
update versioning to 3.0.0 alpha (#3080) 2019-10-04 10:51:55 +01:00