Commit graph

768 commits

Author SHA1 Message Date
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
Antioch Peverell
b78ace8329
bump version to v2.1.0-beta.3 (#3075) 2019-10-03 10:36:54 +01:00
Yeastplume
773961b6c1
Serde serialization for Option<Commitment> (#3074)
* add Option<Commit> serialization

* rustfmt
2019-10-03 10:27:25 +01:00
hashmap
62d865c479
Support protocol version 1 and 2 in fuzz targets (#3073) 2019-10-03 09:08:40 +02:00
hashmap
7861a40384
Fix reading POW for edge bits 59 and higher (#3069)
* Fix reading POW for edge bits 59 and higher

It requires reading more than 8 bytes
2019-10-02 11:52:10 +02:00
Quentin Le Sceller
6be6391225 Change 2018 to 2019 in copyright files (#3072) 2019-10-02 09:40:20 +01:00
Antioch Peverell
751ca06560
bump version number (#3066) 2019-09-30 10:58:49 +01:00
Antioch Peverell
fc4e2985d5
add block_hash to head_info so we can easily use them later (#3060) 2019-09-26 14:59:03 +01:00
Yeastplume
ae556a8a2a
change release versioning for 2.1.0 beta build (#3056) 2019-09-24 13:54:12 +01:00
Antioch Peverell
973a03c826
support for v2 txhashset (but only using v1 in mainnent and floonet) (#3051) 2019-09-24 09:57:34 +01:00
Antioch Peverell
f3baceb51b
bump version for 2.1.0 dev (still on master) (#3050) 2019-09-19 15:03:44 +01:00
Antioch Peverell
bc6108cf12
Kernels v2 (variable size) (#3034)
* wip

* exhaustive match

* write with fixed v1 strategy when writing for hashing

* local protocol version is 2

* cleanup "size" tests that exercise v1 vs v2 vs default protocol versions

* add proto version to Connected! log msg

* cleanup docs

* negotiate protocol version min(local, peer) when doing hand/shake
2019-09-19 14:31:46 +01:00
hashmap
d90b1c2723
Optimize POW read (#3035)
* Optimize POW read

This functionality is used to deserialize header (from network or from
DB), it was taking up to 40% cpu time during initial header sync. This
PR brings it down to 3-4%. Function read_number would look better as
closure, unfortunately the compliler doesn't inline it in this case, so
it would be 2x slower.

* Remove unused code
2019-09-10 15:14:33 +02:00
Antioch Peverell
383985292c Split header MMR (and sync MMR) out from txhashset (#3004)
* wip

* sync sort of works now

* get rid of the deadlock during compaction
there is *always* a deadlock in there when we make changes like this...

* cleanup how we rebuild the sync MMR on init

* cleanup rewind logic

* roll the "fix invalid root" changes into this PR

* move rebuild_height_pos_index into txhashset
and pass in header_pmmr for header lookups

* cleanup and remember to setup sync head on init

* cleanup unnecessary ref muts

* rebuild_height_pos_index when writing txhashset
2019-09-07 07:28:26 +08:00
Tengfei Niu
7aa27652b7 refactor code (#2990)
refactor: refactor code.
2019-09-04 09:53:05 -04:00
Gary Yu
928279a676 schnorr signature batch verification (#2961)
* schnorr signature batch verification

* Split the fee and lock_height verification out from the batch signature verification

* Remove the new added fee_height_verify to comply with #2859

* fix: the last n could not be leaf?
2019-09-03 15:44:10 +01:00
Antioch Peverell
97f961fc67
verify the ignored fee is still 0 (#3007)
* verify the ignored bytes are indeed 0

* check for !=0 (rather than >0)
2019-08-29 12:56:21 +01:00
Antioch Peverell
dcd405e263
cleanup deprecation warnings about missing dyn with trait objects (#2997) 2019-08-26 21:17:47 +01:00
Antioch Peverell
6036b671e8
fee and lock_height maintained in kernel features variants (#2859)
* fee and lock_height now maintained in kernel features enum variants

* sum fees via explicit enum variants

* cleanup semantics around with_fee and with_lock_height for tx builders

* document the kernel feature variants

* serialize kernel features correctly for api json

* cleanup

* commit

* bump to unstick azure
2019-08-19 14:28:02 +01:00
j01tz
d220410571 Improve error handling when computing PMMR roots (#2988)
* Improve error handling for invalid PMMR roots

* Update tests that rely on pmmr root

* Fix pmmr store tests
2019-08-09 15:10:54 +01:00
Yeastplume
705fcbb1a6
Updates to support XORed wallet keys/Tokens (#2982)
* updates to support xored tokens in wallet

* rustfmt
2019-08-02 11:30:26 +01:00
Antioch Peverell
4bd3aa109d
cleanup and simplify how we generate the genesis block in user_testing (and automated_testing) modes (#2986) 2019-08-01 17:22:12 +01:00
NaN-git
0d4d98db0d fix wording in comment (#2913) 2019-07-26 08:43:18 +01:00
Joseph Goulden
2ae76d39bb fix: move checks for automated test mode into global.rs (#2956)
* fix: move checks for test/production mode into one place - global.rs

* chore: rustfmt
2019-07-25 10:08:24 +01:00
antiochp
c6cea4744c
Merge branch 'master' into milestone/2.x.x 2019-07-24 15:10:26 +01:00
Antioch Peverell
fb33d3af1f
make sure user_testing uses a sensible txhashset interval (#2962) 2019-07-23 13:25:34 +01:00
Quentin Le Sceller
4966dc04f7
[2.x.x] Generate txhashset archives on 720 block intervals. (#2951)
Generate txhashset archives on 720 block intervals.
2019-07-23 10:46:29 +02:00
Joseph Goulden
b8c508d255 test: Re-enabled too large block test. Block tests now use ChainTypes:AutomatedTesting (#2950) 2019-07-16 13:02:21 +02:00
hashmap
d3dbafa80b
[2.x.x] Use blocking IO in P2P to reduce CPU load (#2855)
* Use blocking IO in P2P to reduce CPU load
2019-07-12 23:17:38 +02:00
Antioch Peverell
d284d8f6de
[2.x.x] Writeable protocol version aware (#2856)
* introduce protocol version to deserialize and read

* thread protocol version through our reader

* cleanup

* cleanup

* streaming_reader cleanup

* Pass protocol version into BinWriter to allow for version specific serialization rules.

* rustfmt

* read and write now protocol version specific
2019-07-06 15:51:03 +01:00
Yeastplume
e6bdc5987c
update version number for next potential beta release 2019-07-01 11:00:02 +01:00
Yeastplume
8f3be49dfa
change version to 2.0.0 for release 2019-07-01 09:24:33 +01:00
Antioch Peverell
5aaf2d058d
[2.x.x] deserialization now protocol version aware (#2824)
* introduce protocol version to deserialize and read

* thread protocol version through our reader

* example protocol version access in kernel read

* fix our StreamingReader impl (WouldBlock woes)

* debug log progress of txhashset download
2019-06-27 17:19:41 +01:00
Yeastplume
1609b041b1
Master merge 2.0.0 (#2927)
* create 2.0.0 branch

* fix humansize version

* update grin.yml version

* PoW HardFork (#2866)

* allow version 2 blocks for next 6 months

* add cuckarood.rs with working tests

* switch cuckaroo to cuckarood at right heights

* reorder to reduce conditions

* remove _ prefix on used args; fix typo

* Make Valid Header Version dependant on ChainType

* Rustfmt

* Add tests, uncomment header v2

* Rustfmt

* Add FLOONET_FIRST_HARD_FORK height and simplify logic

* assume floonet stays closer to avg 60s block time

* move floonet hf forward by half a day

* update version in new block when previous no longer valid

* my next commit:-)

* micro optimization

* Support new Bulletproof rewind scheme (#2848)

* Update keychain with new rewind scheme

* Refactor: proof builder trait

* Update tests, cleanup

* rustfmt

* Move conversion of SwitchCommitmentType

* Add proof build trait to tx builders

* Cache hashes in proof builders

* Proof builder tests

* Add ViewKey struct

* Fix some warnings

* Zeroize proof builder secrets on drop

* Modify mine_block to use wallet V2 API (#2892)

* update mine_block to use V2 wallet API

* rustfmt

* Add version endpoint to node API, rename pool/push (#2897)

* add node version API, tweak pool/push parameter

* rustfmt

* Upate version api call (#2899)

* Update version number for next (potential) release

* zeroize: Upgrade to v0.9 (#2914)

* zeroize: Upgrade to v0.9

* missed Cargo.lock

* [PENDING APPROVAL] put phase outs of C32 and beyond on hold (#2714)

* put phase outs of C32 and beyond on hold

* update tests for phaseouts on hold

* Don't wait for p2p-server thread (#2917)

Currently p2p.stop() stops and wait for all peers to exit, that's
basically all we need. However we also run a TCP listener in this thread
which is blocked on `accept` most of the time. We do an attempt to stop
it but it would work only if we get an incoming connection during the
shutdown, which is a week guarantee.

This fix remove joining to p2p-server thread, it stops all peers and
makes an attempt to stop the listener.

Fixes [#2906]

* rustfmt
2019-06-27 09:19:17 +01:00
Quentin Le Sceller
fd6fe35777 Revert #2813 (#2920)
* Revert #2813

* Rustfmt
2019-06-26 10:37:34 +01:00
Yeastplume
9398578947
update version number 2019-06-25 15:43:46 +01:00
Gary Yu
41fa0e27cf zeroize: Upgrade to v0.9 (#2914)
* zeroize: Upgrade to v0.9

* missed Cargo.lock
2019-06-25 15:13:07 +01:00
Yeastplume
71d16d1b4d
Update version number for next (potential) release 2019-06-18 21:17:48 +01:00
jaspervdm
e3f3064414 Support new Bulletproof rewind scheme (#2848)
* Update keychain with new rewind scheme

* Refactor: proof builder trait

* Update tests, cleanup

* rustfmt

* Move conversion of SwitchCommitmentType

* Add proof build trait to tx builders

* Cache hashes in proof builders

* Proof builder tests

* Add ViewKey struct

* Fix some warnings

* Zeroize proof builder secrets on drop
2019-06-12 10:28:55 +01:00
John Tromp
6429580b0c PoW HardFork (#2866)
* allow version 2 blocks for next 6 months

* add cuckarood.rs with working tests

* switch cuckaroo to cuckarood at right heights

* reorder to reduce conditions

* remove _ prefix on used args; fix typo

* Make Valid Header Version dependant on ChainType

* Rustfmt

* Add tests, uncomment header v2

* Rustfmt

* Add FLOONET_FIRST_HARD_FORK height and simplify logic

* assume floonet stays closer to avg 60s block time

* move floonet hf forward by half a day

* update version in new block when previous no longer valid

* my next commit:-)

* micro optimization
2019-06-12 10:28:14 +01:00
Cadmus Peverell
5ebe2aa397 Generate txhashset archives on 720 block intervals. (#2813)
* generate txhashset archives on 250 block intervals.

* moved txhashset_archive_interval to global and added a simple test.

* cleaning up the tests and adding license.

* increasing cleanup duration to 24 hours to prevent premature deletion of the current txhashset archive

* bug fixes and changing request_state to request height using archive_interval.

* removing stopstate from chain_test_helper to fix compile issue
2019-06-06 10:39:07 +08:00
Yeastplume
dfb4d5afae
set version number to next (possible) 1.1.x version 2019-06-05 21:37:25 +01:00
Yeastplume
75c229ba68
create 2.0.0 branch 2019-06-05 20:36:57 +01:00
Yeastplume
a89a1024b6
update version numbers for 1.1.0 release 2019-06-05 19:39:01 +01:00
eupn
329dc82924 Fix TODO in to_edge! macro (#2853)
* Fix to_edge macro hygene TODO
2019-06-03 11:10:01 +02:00
eupn
56b62a319b Fill BlindingFactor with zeros on Drop (#2847)
* Implement simple zeroing of BlindingFactor in Drop

* rustfmt

* Make Debug implementation for BlindingFactor empty

* Implement BlindingFactor zeroing unit test

* mnemonic.rs: fix deprecated warning in test_bip39_random test

* Use zeroize crate to clear BlindingFactor

* Fix comment and implement dummy Debug trait for BlindingFactor

* Fix formatter
2019-05-30 23:16:53 +02:00
hashmap
25a2ee1233 Fix unused doc warning in Rust 1.35 (#2863)
This version brings a new warning to inform that rustdoc doesn't add docs for macro
expansions
2019-05-30 08:04:17 +08:00
Yeastplume
bb793defa7
De/Serialize signatures (for slate consumption) to compressed format rather than raw (#2852)
* Serialize signatures in custom secp serializer as compact format instead of raw

* rustfmt
2019-05-28 16:48:24 +01:00
Mike Dallas
4b88a9b5bd impl Readable/Writable for PublicKey (#2841)
* impl Readable/Writable for PublicKey

* rustfmt
2019-05-27 10:19:24 +01:00
Antioch Peverell
e56cd55980
initial support for kernel data download (#2765)
* initial support for kernel data download

* fix vec backend for tests

* cleanup after rebase
2019-05-14 17:17:38 +01:00
Antioch Peverell
4ba7b0a46a make sure we use BigEndian when reading numbers via StreamingReader (#2821) 2019-05-13 15:04:14 -07: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
John Tromp
4ad2ed48a3 add proofsize check in pow verify (#2805) 2019-05-05 11:51:46 +02:00
Antioch Peverell
6352780d6a Bump rand crate to 0.6 (was 0.5) (#2790)
shuffle was deprecated, fix this up
2019-04-30 12:25:19 -07:00
Antioch Peverell
b2b96f3f81
bucket_transactions is now fee_to_weight aware (#2758)
* bucket_transactions is now fee_to_weight aware
bucket_transactions now returns the underlying txs

* cleanup

* simplify pool bucket sorting, no need for depth sort key
2019-04-30 12:14:02 +01:00
Antioch Peverell
e72409d804 Bump the version of croaring to 0.3.9 (#2763) 2019-04-24 11:17:20 -07:00
hashmap
3c400f7e2a Fix unused import warnings (#2775) 2019-04-23 18:16:03 +08:00
Antioch Peverell
d7f940e160 cleanup unused data_file_path (#2766) 2019-04-22 16:53:53 -07:00
Yeastplume
865b9b6b46
make field in tx_body public (#2762) 2019-04-19 11:55:48 +01:00
Yeastplume
a1c9da4276
version number update 2019-04-16 11:29:01 +01:00
Antioch Peverell
3d817f6cd0 [1.1.0] Support variable size PMMR (optional size_file) (#2734)
* Introduce optional size_file.
Support fixed size data file via an optional elmt_size.
Support variable size data file via optional size_file.

* remember to release the size_file

* fix scoping for windows support
2019-04-12 15:41:21 -07:00
Yeastplume
5cb8025ddd
[1.1.0] Merge master into 1.1.0 (#2720)
* cleanup legacy "3 dot" check (#2625)

* Allow to peers behind NAT to get up to preferred_max connections (#2543)

Allow to peers behind NAT to get up to preffered_max connections

If peer has only outbound connections it's mot likely behind NAT and we should not stop it from getting more outbound connections

* Reduce usage of unwrap in p2p crate (#2627)

Also change store crate a bit

* Simplify (and fix) output_pos cleanup during chain compaction (#2609)

* expose leaf pos iterator
use it for various things in txhashset when iterating over outputs

* fix

* cleanup

* rebuild output_pos index (and clear it out first) when compacting the chain

* fixup tests

* refactor to match on (output, proof) tuple

* add comments to compact() to explain what is going on.

* get rid of some boxing around the leaf_set iterator

* cleanup

* [docs] Add switch commitment documentation (#2526)

* remove references to no-longer existing switch commitment hash

(as switch commitments were removed in ca8447f3bd
and moved into the blinding factor of the Pedersen Commitment)

* some rewording (points vs curves) and fix of small formatting issues

* Add switch commitment documentation

* [docs] Documents in grin repo had translated in Korean.  (#2604)

*  Start to M/W intro translate in Korean
*  translate in Korean
*  add korean translation  on intro
* table_of_content.md translate in Korean.
*  table_of_content_KR.md finish translate in Korean, start to translate State_KR.md
*  add state_KR.md & commit some translation in State_KR.md
*  WIP stat_KR.md translation
*  add build_KR.md && stratum_KR.md
*  finish translate stratum_KR.md & table_of_content_KR.md
*  rename intro.KR.md to intro_KR.md
*  add intro_KR.md file path each language's  intro.md
*  add Korean translation file path to stratum.md & table_of_contents.md
*  fix difference with grin/master

* Fix TxHashSet file filter for Windows. (#2641)

* Fix TxHashSet file filter for Windows.

* rustfmt

* Updating regexp

* Adding in test case

* Display the current download rate rather than the average when syncing the chain (#2633)

* When syncing the chain, calculate the displayed download speed using the current rate from the most recent iteration, rather than the average download speed from the entire syncing process.

* Replace the explicitly ignored variables in the pattern with an implicit ignore

* remove root = true from editorconfig (#2655)

* Add Medium post to intro (#2654)

Spoke to @yeastplume who agreed it makes sense to add the "Grin Transactions Explained, Step-by-Step" Medium post to intro.md

Open for suggestions on a better location.

* add a new configure item for log_max_files (#2601)

* add a new configure item for log_max_files

* rustfmt

* use a constant instead of multiple 32

* rustfmt

* Fix the build warning of deprecated trim_right_matches (#2662)

* [DOC] state.md, build.md and chain directory documents translate in Korean.  (#2649)

*  add md files for translation.

*  start to translation fast-sync, code_structure. add file build_KR.md, states_KR.md

* add dandelion_KR.md && simulation_KR.md for Korean translation.

*  add md files for translation.

*  start to translation fast-sync, code_structure. add file build_KR.md, states_KR.md

* add dandelion_KR.md && simulation_KR.md for Korean translation.

* remove some useless md files for translation. this is rearrange set up translation order.

*  add dot end of sentence & translate build.md in korean

*  remove fast-sync_KR.md

*  finish build_KR.md translation

*  finish build_KR.md translation

*  finish translation state_KR.md & add phrase in state.md to move other language md file

* translate blocks_and_headers.md && chain_sync.md in Korean

*  add . in chain_sync.md , translation finished in doc/chain dir.

* fix some miss typos

* Api documentation fixes (#2646)

* Fix the API documentation for Chain Validate (v1/chain/validate).  It was documented as a POST, but it is actually a GET request, which can be seen in its handler ChainValidationHandler
* Update the API V1 route list response to include the headers and merkleproof routes.  Also clarify that for the chain/outputs route you must specify either byids or byheight to select outputs.

* refactor(ci): reorganize CI related code (#2658)

Break-down the CI related code into smaller more maintainable pieces.

* Specify grin or nanogrins in API docs where applicable (#2642)

* Set Content-Type in API client (#2680)

* Reduce number of unwraps in chain crate (#2679)

* fix: the restart of state sync doesn't work sometimes (#2687)

* let check_txhashset_needed return true on abnormal case (#2684)

*  Reduce number of unwwaps in api crate  (#2681)

* Reduce number of unwwaps in api crate

* Format use section

* Small QoL improvements for wallet developers (#2651)

* Small changes for wallet devs

* Move create_nonce into Keychain trait

* Replace match by map_err

* Add flag to Slate to skip fee check

* Fix secp dependency

* Remove check_fee flag in Slate

* Add Japanese edition of build.md (#2697)

* catch the panic to avoid peer thread quit early (#2686)

* catch the panic to avoid peer thread quit before taking the chance to ban
* move catch wrapper logic down into the util crate
* log the panic info
* keep txhashset.rs untouched
* remove a warning

* [DOC] dandelion.md, simulation.md ,fast-sync.md and pruning.md documents translate in Korean. (#2678)

* Show response code in API client error message (#2683)

It's hard to investigate what happens when an API client error is
printed out

* Add some better logging for get_outputs_by_id failure states (#2705)

* Switch commitment doc fixes (#2645)

Fix some typos and remove the use of parentheses in a
couple of places to make the reading flow a bit better.

* docs: update/add new README.md badges (#2708)

Replace existing badges with SVG counterparts and add a bunch of new ones.

* Update intro.md (#2702)

Add mention of censoring attack prevented by range proofs

* use sandbox folder for txhashset validation on state sync (#2685)

* use sandbox folder for txhashset validation on state sync

* rustfmt

* use temp directory as the sandbox instead actual db_root txhashset dir

* rustfmt

* move txhashset overwrite to the end of full validation

* fix travis-ci test

* rustfmt

* fix: hashset have 2 folders including txhashset and header

* rustfmt

* 
(1)switch to rebuild_header_mmr instead of copy the sandbox header mmr 
(2)lock txhashset when overwriting and opening and rebuild

* minor improve on sandbox_dir

* add Japanese edition of state.md (#2703)

* Attempt to fix broken TUI locale (#2713)

Can confirm that on the same machine 1.0.2 TUI looks great and is broken on
the current master. Bump of `cursive` version fixed it for me.
Fixes #2676

* clean the header folder in sandbox (#2716)

* forgot to clean the header folder in sandbox in #2685

* Reduce number of unwraps in servers crate (#2707)

It doesn't include stratum server which is sufficiently changed in 1.1
branch and adapters, which is big enough for a separate PR.

* rustfmt

* change version to beta
2019-04-01 11:47:48 +01:00
Yeastplume
1dd9a87452
0 the 0 that should have been a 1 (#2711) 2019-03-26 15:32:54 +00:00
Yeastplume
9fab8ee3fb
[1.1.0] CbData Serialization change + reward output test mode (#2710)
* cb serialization and coinbase test mode

* rustfmt
2019-03-26 12:26:03 +00:00
Yeastplume
2e72ed91f3
fix option_sig_serde (#2699) 2019-03-21 15:45:10 +00:00
Yeastplume
6949a0d341
add string_or_u64 serialization (#2698) 2019-03-21 14:06:30 +00:00
Yeastplume
bd6824ca4c
allow specific nonce in aggsig sign single call (#2696) 2019-03-21 11:44:55 +00:00
hashmap
16487a3eb7
[1.1.0] Bring fuzz test back (#2675)
Corpus generation was updated and simplified, plus small updates
2019-03-15 15:32:14 +01:00
Yeastplume
c3496b45dd
[1.1.0] Additional secp primitive serialization changes (#2669)
* serialize sig, not just option(sig)

* rustfmt

* serialise pubkeys in short form
2019-03-12 10:45:19 +00:00
Yeastplume
1b3eaba302
[1.1.0] Serialise sigs as raw data, not DER encoded (#2668)
* serialise signatures as raw data

* rustfmt
2019-03-11 11:56:23 +00:00
Andrew Dirksen
f30e59adc5 make error types serializable (#2659) 2019-03-07 19:08:29 +00:00
Yeastplume
557e77b218
comment out fuzz tests for now, remove wallet crate reference (#2635) 2019-02-27 11:12:09 +00:00
Mike Dallas
d560a36dd6 Event callbacks for Network and Chain Events (#2598)
* Add hooks for network and chain events. Move logging to an EventLogger
* implement webhooks
* fix failing test
* remove unnecessary 'pub'
* add some metadata to the json payload
* avoid unecessary init
* resolve conflicts
2019-02-26 12:24:50 -08:00
yeastplume
4f7e5bb0d9
rustfmt 2019-02-25 12:15:22 +00:00
yeastplume
91c91469a3
merge from master 2019-02-25 12:15:12 +00:00
Ignotus Peverell
8e2b0c7bc8
Bump version to 1.0.2 (#2623) 2019-02-24 21:57:56 -08:00
hashmap
e71eca1977 Remove some unwrap/expect in chain crate (#2621)
* Return Result instead of calling expect in root(). It would kill peer's thread. Perhaps we should ban this peer as malicious.
* Remove some unwraps
2019-02-24 21:57:21 -08:00
Yeastplume
ea4b4fc389
Remove wallet code [1.1.0] (#2593)
* Bump version to 1.1.0

* remove wallet crate

* wallet extracted + mine_block structs

* remove wallet doc

* remove unnecessary cargo deps

* rustfmt

* remove wallet from travis matrix

* move integration tests into separate crate

* rustfmt

* move integration crate to wallet
2019-02-21 11:57:45 +00:00
Jeremy Rubin
eafe730a65 refactor: allocation free cut through algorithms (#2567) 2019-02-19 10:02:59 +00:00
Jeremy Rubin
dc6542d82b chore/docs: eliminate warnings (#2583)
* chore: replace trim_right with $ sed -i'' 's/trim_right/trim_end/' **/*.rs

* docs: individually document macros to avoid warning, add TODO to make to_edge hygenic

* docs: document impl_array_newtype macros, refactor: move all impl_array_newtype macro traits into impl_array_netype_index
2019-02-15 15:32:37 -08:00
Jeremy Rubin
99494c6fa6 get rid of default implementation of Hashed trait for writable things (#2573) 2019-02-15 13:41:19 +00:00
Jeremy Rubin
d4540f32a3 refactor: use sort_unstable instead of sort, more efficient with_* methods for TransactionBody (#2564) 2019-02-14 11:01:54 +00:00
hashmap
5d904250d5 Use failure for Pool and Committed errors (#2570)
It doesn't play nice with failure-based error management, we have to
throw away an exisiting error and create a new one (failure-based)
2019-02-13 09:33:25 -08:00
Yoni Svechinsky
ee4eed71ea Feature/slate serialization (#2534)
* - Add backwards compatability
- Add hex serialization

* rustfmt

* rustfmt

* Windows Compatibility Fixes #1 (#2535)

* initial changes for windows build and unit/integration tests

* rustfmt

* wallet+store tests

* rustfmt

* fix linux daemonize

* better encapsulate file rename

* rustfmt

* remove daemonize commands

* rustfmt

* remove server start/stop commands

* add ability to drop pmmr backend files explicitly for txhashset unzip

* rustfmt

* fix pmmr tests

* rustfmt

* Windows TUI Fix (#2555)

* switch pancurses backend to win32

* revert changes to restore test

* compatibility fix + debug messages

* rustfmt

* Add content disposition for OK responses  (#2545)

* Testing http send and fixing accordingly

* add repost method into wallet owner api (#2553)

* add repost method into wallet owner api

* rustfmt

* Add ability to compare selection strategies (#2516)

Before tx creation user can estimate fee and locked amount
with different selection strategies by providing `-e` flag for
`wallet send` command.
2019-02-13 13:29:44 +00:00
Jeremy Rubin
563c674700 refactor: reserve capacity in aggregate (#2568) 2019-02-13 11:41:29 +01:00
John Tromp
91cca2bf61 test: add CuckAToo31 solution test (#2552)
add CuckAToo31 solution test
2019-02-12 19:10:17 -05:00
Yeastplume
15c7a270eb
Windows Compatibility Fixes #1 (#2535)
* initial changes for windows build and unit/integration tests

* rustfmt

* wallet+store tests

* rustfmt

* fix linux daemonize

* better encapsulate file rename

* rustfmt

* remove daemonize commands

* rustfmt

* remove server start/stop commands

* add ability to drop pmmr backend files explicitly for txhashset unzip

* rustfmt

* fix pmmr tests

* rustfmt
2019-02-09 21:14:27 +00:00
Jeremy Rubin
c1045842f5 refactor: use less memory in verifier_cache by storing zero-sized type instead of bool 2019-02-06 14:37:19 -08:00
Yeastplume
e69ce5ad82
Move slate code from core/libtx to wallet/libwallet (#2533)
* move slate from core to wallet crate

* rustfmt
2019-02-05 23:02:00 +00:00
David Burkett
c1d67cbec0 perf: Removing unnecessary array copy. (#2531) 2019-02-05 07:54:20 +01:00
Ignotus Peverell
c41ea4bcf2
Feature/slate version (#2491)
* Add a slate version field
* Move current slate version to constant
* Change slate version to uint
* Add default 0 incase it's missing (pre-versioning)
2019-02-01 11:17:54 -08:00
Antioch Peverell
19ce9cc28e
bump for v1.0.1 (#2511) 2019-02-01 14:43:18 +00:00
Antioch Peverell
a82e2a0126
Rework "bucket transactions" logic (buckets are now weight limited) (#2487)
* rework bucket txs

* introduce max_block_weight to global (based on chain_type)
not yet in use anywhere...

* now using global::max_block_weight() everywhere

* testing max_block_weight needs to be big enough to cover existing chain tests...

* add some test coverage for prepare mineable transactions at the block weight limit
introduce AsLimitedTx{max_weight} so we can build artifically small blocks (per mining config)

* cleanup

* default_mineable_max_weight is just the default max_block_weight
we do not need to account for coinbase reward here (tx vs block)

* 75 change outputs in a test is not valid now that we have a low block weight limit...
2019-02-01 10:44:04 +00:00
Yoni
1f7d3c6dc7 - Change slate version to uint
- Add default 0 incase it's missing (pre-versioning)
2019-01-31 16:25:57 +02:00
Yoni
e505726d73 Merge remote-tracking branch 'upstream/master' into feature/slate-version 2019-01-31 15:52:39 +02:00
Yeastplume
0c851c5140
Save slate participant messages in database (#2441)
* Save and display optional slate messages

* rustfmt

* fixes and test updates

* rustfmt

* output json

* rustfmt

* add better serialisation of slate message, rename to secp_ser, add tests for serialization functions

* rustfmt

* max length for message enforced by API

* rustfmt
2019-01-31 11:55:34 +00:00
Antioch Peverell
422db82667
no is_mainnet() to keep tests close to mainnet (#2496) 2019-01-31 09:23:19 +00:00
Yoni
569d7a3220 Move current slate version to constant 2019-01-30 10:26:23 +02:00
Yoni
99dda19f5e rustfmt 2019-01-30 10:19:52 +02:00
Yoni
a33502c108 Add a slate version field 2019-01-30 10:19:41 +02:00
Antioch Peverell
d1de3b0d6e default our chain type to mainnet (already doing this via config file) (#2485) 2019-01-29 20:09:30 -08:00