Commit graph

688 commits

Author SHA1 Message Date
Quentin Le Sceller
ccf8eb9eeb Add Inbound/Outbound for connected peers (#725)
* Add Inbound/Outbound for connected peers

* Fix tests

* Undo removing trailing commas

* Revert "Fix tests"

This reverts commit 0d024188d4.
2018-02-24 16:00:38 -05:00
Ignotus Peverell
16d778a99b
Zip integration tests 2018-02-24 20:30:42 +00:00
Ignotus Peverell
787891bf9e
First pass at a more formal contracts doc 2018-02-24 20:24:41 +00:00
Antioch Peverell
29044b5a32 last output in a block is the last regular output, failing that the last coinbase output (#727)
apply_block() processes regular outputs last so we need to be consistent with this
2018-02-24 19:40:23 +00:00
John Tromp
bc9a1cfeed tweak intro (#728) 2018-02-24 13:59:21 +00:00
Alexey Miroshkin
452996a421 Attempt to recover from isolated orphaning (#724)
Due to occasional bad network conditions, a node can miss a block.
When the next one is received and detected orphaned, we should at least try a request for the
previous block, assuming it's not already an orphan in itself and we're not syncing already.

No additinal tests were implemented, test like `simulate_full_sync` test this functionality because
sync starts later. It seems to be an issue with sync test coverage. As fix I'd suggest to start sync
as soon as we get a peer connection.

[https://github.com/mimblewimble/grin/issues/705]
2018-02-24 02:48:02 +00:00
Yeastplume
05d1c6c817
Take the 'Sum' out of 'Sumtree' (#702)
* beginning to remove sum

* continuing to remove sumtree sums

* finished removing sums from pmmr core

* renamed sumtree files, and completed changes+test updates in core and store

* updating grin/chain to include removelogs

* integration of flatfile structure, changes to chain/sumtree to start using them

* tests on chain, core and store passing

* cleaning up api and tests

* formatting

* flatfiles stored as part of PMMR backend instead

* all compiling and tests running

* documentation

* added remove + pruning to flatfiles

* remove unneeded enum

* adding sumtree root struct
2018-02-22 13:45:13 +00:00
Antioch Peverell
c2ca6ad03f
diagram how Merkle proof and pruning interact (proposed) (#722) 2018-02-21 12:20:02 -05:00
Ignotus Peverell
3b51ffd83c
Fixup MMR position in n_leaves if invalid
Allows the client to not worry about what position is a valid
MMR size. Associated tests.
2018-02-20 21:48:24 +00:00
Quentin Le Sceller
755d0b7902 Typo broadcast/transaction (#718) 2018-02-20 21:27:18 +00:00
Brad Neuman
f081f75283 Fix small typo in intro.md (#717)
fee -> feel
2018-02-20 12:04:56 -05:00
Ignotus Peverell
866ec977da
Factoring in mmr leaf count function 2018-02-19 23:20:32 +00:00
Antioch Peverell
4022b82817
cleanup various build warnings (#714)
* cleanup various build warnings

* use serde_json in tests only
2018-02-17 12:56:22 -05:00
Yeastplume
c63aa70a0b
Integrated bulletproofs into Grin with optional build parameter (enabled by default) (#711) 2018-02-16 20:34:54 +00:00
Antioch Peverell
5572fa075e
tx pool lookup for kernel short ids (compact block hydration) (#710)
* wip - basic tx pool lookup for kernel short ids (compact block hydration)

* use the nonce in the compact_block to correctly generate short_ids for lookup

* query the tx pool based on kernel short_ids

* tests passing

* cleanup some logging

* cleanup logging
2018-02-16 10:42:27 -05:00
Ignotus Peverell
b82fa0ea1d
Block deletion, to be used for pruning 2018-02-14 23:25:12 +00:00
Antioch Peverell
8bdf0be73e
compact block needs a random nonce in it (used to generate short_ids) (#709) 2018-02-14 09:19:24 -05:00
Antioch Peverell
6fb139670e archive_mode is optional in grin.toml (#707)
default to None in grin.toml (which defaults to false)
add example config in grin.toml
2018-02-13 18:08:21 +00:00
Antioch Peverell
ebd801f14e
Transaction contain kernels. Transactions and blocks maintain a kernel offset (split key). (#681)
* WIP - split the key in final tx step
store "offset" on transaction itself

* rebase

* commit

* tx with offset

* got a test tx validating successfully using a sig from a split key and the appropriate offset

* sum up the offset for the block_header

* fix size tests for blocks and compact blocks (header now includes offset)

* use txs with offsets in most of the core tests
some tests now failing

* build kernel from k1G (k2 stored on tx, sum stored on header)

* commit

* tx now has vec of kernels
rework tx and kernel validation

* add test for tx cut_through

* wip - working on splitting in aggsig

* split the key when creating the initial sender aggsig context

* cleanup

* cleanup

* code needs claning up but split keys working for sender/receiver aggsig flow

* cleanup debug logging

* fix tests

* fix merge and basic cleanup

* fix keychain tests to use new tx_id
2018-02-13 10:35:30 -05:00
Ignotus Peverell
76796738c1
Clean server shutdown, generalizes usage of Weak (#700)
* Clean server shutdown, generalizes usage of `Weak`. Introduces 2 main changes:

  * A shared `AtomicBool` that signals server shutdown. All server
threads regularly check it to break out of their main loops when
it changes to `true`.
  * Breaking of circular `Arc` references, which can never be
destroyed, by downgrading to `Weak` instead. Only the main server
keeps the `Arc` while all other components get the `Weak` variant.

Both of these are required for all long-living structs to be
cleanly destroyed. Note that in Rust this is fairly important as
most resource-freeing logic is associated with `drop`,
which is only called when said struct is free of scope or `Arc`
references.

Should address most of #536 (only need the stop hook to call
`Server` shutdown).

* Test for fast sync, followed by restart, followed by re-fast-sync

* P2P test fix

* Double sync taking too long for Travis, commenting out for now
2018-02-13 00:38:52 +00:00
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 ecda870d70.
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