Commit Graph

618 Commits

Author SHA1 Message Date
yeastplume 7dcbb8824d clarify transaction weight on diagram 2018-02-12 13:22:59 +00:00
yeastplume 2639f13710 error fix 2018-02-12 13:02:05 +00:00
yeastplume f22f9d83be adding transaction workflow diagram, for reference 2018-02-12 12:55:08 +00:00
Ignotus Peverell 22c521eec8 [WIP] Abridged sync (#440)
* Util to zip and unzip directories
* First pass at sumtree request/response. Add message types, implement the exchange in the protocol, zip up the sumtree directory and stream the file over, with necessary adapter hooks.
* Implement the sumtree archive receive logicGets the sumtree archive data stream from the network and write it to a file. Unzip the file, place it at the right spot and reconstruct the sumtree data structure, rewinding where to the right spot.
* Sumtree hash structure validation
* Simplify sumtree backend buffering logic. The backend for a sumtree has to implement some in-memory buffering logic to provide a commit/rollback interface. The backend itself is an aggregate of 3 underlying storages (an append only file, a remove log and a skip list). The buffering was previously implemented both by the backend and some of the underlying storages. Now pushing back all buffering logic to the storages to keep the backend simpler.
* Add kernel append only store file to sumtrees. The chain sumtrees structure now also saves all kernels to a dedicated file. As that storage is implemented by the append only file wrapper, it's also rewind-aware.
* Full state validation. Checks that:
    - MMRs are sane (hash and sum each node)
    - Tree roots match the corresponding header
    - Kernel signatures are valid
    - Sum of all kernel excesses equals the sum of UTXO commitments
minus the supply
* Fast sync handoff to body sync. Once the fast-sync state is fully setup, get bacj in body sync
mode to get the full bodies of the last blocks we're missing.
* First fully working fast sync
* Facility in p2p conn to deal with attachments (raw binary after message).
* Re-introduced sumtree send and receive message handling using the above.
* Fixed test and finished updating all required db state after sumtree validation.
* Massaged a little bit the pipeline orphan check to still work after the new sumtrees have been setup.
* Various cleanup. Consolidated fast sync and full sync into a single function as they're very similar. Proper conditions to trigger a sumtree request and some checks on receiving it.
2018-02-09 22:32:16 +00:00
yeastplume 75f721039e attempt to make CUDA gcc detection a bit more robust and handle more cases 2018-02-09 11:18:14 +00:00
Quentin Le Sceller 06bd78faed Sender pays the fee. Fix #274 (#694) 2018-02-09 05:33:24 +00:00
yeastplume 623bdb696b update cuda mining defaults and trompcode 2018-02-07 21:00:58 +00:00
Antioch Peverell ad594b53de Revert "add block validation consensus rule for block coinbase output" (#691)
also fix tests for size of blocks etc.

This reverts commit ecda870d70179a58a54f8bf8e1f0c9480d333374.
2018-02-07 12:23:48 -05:00
Antioch Peverell 78a6447a09 fix bad merge - missing support for header msg type (#690) 2018-02-07 11:26:52 -05:00
Starmute e485c158f3 fix grammar issue (go the extra step --> go the extra mile) (#688) 2018-02-07 10:00:42 +00:00
Yeastplume 92a23ec26d Allow multiple Aggsig contexts (#685)
* update mean cuda miner to latest trompcode, and added tweakable parameters to grin configuration file

* Added UUID for transactions, and store aggsig contexts indexed by transaction ID

* updating test framework to allow checking of wallet contents during test
2018-02-06 11:42:26 +00:00
Ignotus Peverell eb0ebab2d3 Add forgotten ping loop, fix TCP send interlacing 2018-02-05 23:09:57 +00:00
Ignotus Peverell a9f4f36117 P2p ping and partial header reads fixes (#684)
* Re-introduce peer regular ping/pong
* Fix partial header reads. Turns out that on async tcp streams, even a small chunk like a
header can be read partially. So header read needs to rely on our
fixed-up `read_exact`, with an additional boolean to allow yield
when no bytes were read.
2018-02-05 19:52:11 +00:00
Quentin Le Sceller fb46fad0ac Remove unused import and uniformize crates (#686)
* Removed unused crates
* Add listconnectedpeers in grin client
* Removed unused import and uniformize crates
2018-02-05 19:46:56 +00:00
Quentin Le Sceller 8a7eb94759 Update bitflags to ^0.1 (#682)
* Removed unused crates
* Add listconnectedpeers in grin client
* Update bitflags to ^0.1 globally
2018-02-05 19:43:54 +00:00
yeastplume 1f7dd4eb73 updating latest cuda miner 2018-02-04 20:45:06 +00:00
Quentin Le Sceller 53c85de43a List connected peers (#680)
* Removed unused crates
* Add listconnectedpeers in grin client
2018-02-03 00:37:35 +00:00
Antioch Peverell 62e44fa936 [WIP] Kernel investigation (#679)
* add some tests around building a tx_kernel from a tx
and adding secret keys together (and checking commitments)

* key addition tests
2018-02-02 09:51:55 -05:00
yeastplume 5f89d8abe9 bump cuckoo-miner tag 2018-02-02 11:33:35 +00:00
Ignotus Peverell c7418cfe04 [WIP] Rewrite peer-to-peer logic to replace tokio with simple threading (#664) 2018-02-02 02:03:12 +00:00
Quentin Le Sceller 1ad6505130 Fix api_test panic (#678) 2018-02-01 23:29:14 +00:00
Antioch Peverell 5fe06e3e3b we can now hydrate empty compact blocks and process them (#675)
* we can now hydrate empty compact blocks and process them

* add some tests to verify size of
various serialized blocks and compact blocks

* add_test_hydrate_empty_block

* fix broken test
2018-02-01 16:40:55 -05:00
Quentin Le Sceller 1e50d56c7e Add unit tests for API Endpoint (#653)
* First tests for API handlers

* Test chain UTXO handler

* Add test sumtrees handlers

* Fix typo

* Removed unused logger

* Update bitflags to ^1.0

* Missing test for bitflags update

* Moved test to grin directory

* Remove tests dependencies

* Add API P2P tests

* Fix hex string commitment

* Fix conflicting port

* Fix directory conflict and server port

* Wait for at least one block is mined on Travis
2018-02-01 13:14:32 -05:00
Yeastplume c59e0e788d update mean cuda miner to latest trompcode (#677)
* update mean cuda miner to latest trompcode, and added tweakable parameters to grin configuration file
2018-02-01 17:29:35 +00:00
Antioch Peverell e86de901fb block.merge() is unused (and misleading) (#674) 2018-01-31 21:58:41 +00:00
Antioch Peverell 3f15f7f2f9 Request compact blocks (#667)
* first pass at allow/deny lists for hard-coded peers (not just seeds)

* commit

* add peers_allow and peers_deny examples and comments to grin.toml

* always ask for compact block
always fail to hydrate
always fallback to requesting full block

* decide to send full (empty) block over compact (empty) block

* add some randomness to the decision around broadcasting an empty block
as a block or as a compact block (so we can exercise more code paths easily)
2018-01-31 15:39:55 -05:00
Quentin Le Sceller 33cb0902bd Fix 672 (#673) 2018-01-31 13:29:45 -05:00
Antioch Peverell c75026153c only include kern_ids in compact block (we can safely omit input and outputs ids) (#670) 2018-01-31 10:23:42 -05:00
Yeastplume f288a18b0c minor test fix (#669) 2018-01-31 10:56:41 +00:00
Antioch Peverell 5fd47fb875 peers_allow/peers_deny in grin.toml (#665)
* first pass at allow/deny lists for hard-coded peers (not just seeds)

* commit

* add peers_allow and peers_deny examples and comments to grin.toml

* fix build issue with simulnet tests

* fix p2p tests
2018-01-30 16:44:13 -05:00
Dean Ancajas 94bba20488 Added INFO when reconnecting to wallet (#662) 2018-01-30 19:44:08 +00:00
Antioch Peverell 6647823177 header first propagation (#654)
* [wip] header first propagation
successfully propagating headers (unless we mined the block itself)
not yet asking for the block if we receive a header

* call request_block after successful processing header

* cleanup and skip asking for block if header is an orphan

* comments around error handling in receive_header
2018-01-30 09:42:04 -05:00
Simon B 765996a630 rustfmt install instruction gotcha (#663)
* rustfmt install instruction gotcha

rustfmt stopped working for me. It turns out people started having trouble with this last year already https://github.com/rust-lang-nursery/rustfmt/issues/2304

* rustfmt on a single file now works! Secrets inside

After `rustup component add rustfmt-preview` I get rustfmt as a command in my terminal.

`rustfmt --help` reveals --write-mode [replace|overwrite|display|plain|diff|coverage|checkstyle] and we've been using the default which is either `overwrite` or `replace` (depending on rustfmt version) and this was changing a bunch of files and a messed up workflow.

* Newcomer-friendly explanation how to use `rustfmt`
2018-01-30 08:36:18 -05:00
Antioch Peverell 5dce526f90 fix bug - p2p store was ignoring port numbers (#657) 2018-01-29 09:45:01 -05:00
Matthew Slipper d754b8d1e4 Fix #566: serialize commit to hex (#574)
* Fix #566: Use serdes to serialize commit to hex

* Add printable UTXO
2018-01-29 09:36:09 -05:00
Simon B 86ff4e5bd0 Fix 658 and compiler complaints (#661)
* Tried but failed to fix `cargo build` complaint about unused #[macro use]. See also 7a803a8dc1
* Compiler complaints be-gone
* Give sumtree tests method-tagged folder names so they don't overwrite each others' files
Fixes #658
2018-01-28 06:12:33 +00:00
Yeastplume 783e4c250d [WIP] Difficulty Adjustment Updates (#651)
* large updates for mining, fix async mode, will list changes in PR

* reset config and build defaults

* change to difficulty calculations

* tweaking mining params and tests

* tweaking to tests

* including pre-genesis data for difficulty adjustments, adding adjustment scenario tests

* further clarifying next_difficulty function

* moving tests out of consensus.rs

* pow test fix

* changing pre-genesis generation
2018-01-27 07:48:53 +00:00
Antioch Peverell 84128964fa Add test to cover case where a block has no coinbase outputs or kernels (#656) 2018-01-26 22:35:58 +00:00
Antioch Peverell 5a7d22977e refactor/rework key derivation (#652)
seed -> ext_key -> many child_keys
2018-01-25 15:19:32 -05:00
Yeastplume 2def215553 Master port #605 (#606)
* port of stack overflow fix from testnet to master
* update process_block to encapsulate orphan check workflow
2018-01-24 18:20:34 +00:00
Morten Brøns-Pedersen 8710d52797 print default --key_derivations only once (#650)
Since the default value is also embedded in the help string it appears twice in the output from `grin wallet help`.  This PR just removes the default from the help string.
2018-01-23 18:37:56 +00:00
AntiochP 4be259e0de hashed switch commitments - BLAKE2(bJ, r) (#648)
* wip

* derive switch commit hash key from extended key in wallet

* fix failing pool test
2018-01-23 07:14:06 -05:00
AntiochP 92d0fc3c08 Add block validation consensus rule for block coinbase output (#647)
and kernel counts
2018-01-22 20:55:27 +00:00
AntiochP ba4c450d2f coinbase output(s) and kernel(s) always full in compact block (#641)
all other tx inputs/outputs/kernels can be reduced to their short_ids
2018-01-19 22:29:48 -05:00
AntiochP 9085e548f7 ShortId implementation (and CompactBlock) (#637)
* [wip] short_id implementation (first attempt)
todo - make this more reusable (a trait?) so we can use it for inputs/outputs/kernels easily

* factor short_id support out into ShortIdentifiable trait

* block can now be converted to compact_block
rename existing block.compact() -> block.cut_through()

* expose compact block representation via block api endpoint
optional with ?compact query param
2018-01-19 17:43:02 -05:00
Yeastplume f9726e8154 Mining/POW Updates (#639)
* large updates for mining, fix async mode, will list changes in PR

* reset config and build defaults
2018-01-19 17:48:18 +00:00
AntiochP 916d9cce57 Revert "move siphash out of pow and into util" (#635)
* Revert "move siphash out of pow and into util (#633)"

This reverts commit dae90543c2.
2018-01-18 19:53:53 -05:00
Simon B 885c2d73ea Making initial sync easier on the eyes [master] (#623)
* Making initial sync easier on the eyes:
- display "chain pointers" as: cumulative @ height [hash]
- clarify and line up to make the "pointers" easy to compare
- make every 100th block show info on debug level info, else as before
2018-01-18 22:47:42 +00:00
AntiochP 6b0f1fc20e summing two sum_commits rolls the switch commit hashes up (#634) 2018-01-18 17:25:10 -05:00
Quentin Le Sceller 911aadf8b4 Fix #439 Temporary peer banning (#631)
* Fix #439 Temporary peer banning
2018-01-18 18:39:56 +00:00