Commit Graph

666 Commits

Author SHA1 Message Date
Ignotus Peverell 1ab43df807 Update install instructions with rustfmt-preview 2018-03-06 00:53:08 +00:00
Antioch Peverell 449fabf24f cannot use write_mode in rustfmt.toml in stable (get rid of the warnings) (#752) 2018-03-05 15:23:52 -05:00
Yeastplume 1143d84238 Remove Sumtree References and disambiguate some naming (#747)
* start of renamathon

* api renaming

* Rename UTXO-Output to lessen ambiguity

* compile warning

* compile error

* readme fix

* remove file commit in error
2018-03-05 19:33:44 +00:00
Yeastplume 884906421c comment cuckoo genesis back in (#751) 2018-03-05 15:52:26 +00:00
Yeastplume 90f844d382 Include index as part of pmmr element hash (#748)
* storing index as part of pmmr element hash

* factor out hash_with_index into generic trait impl

* tighten up trait bounds for PMMRable
2018-03-05 15:05:42 +00:00
Ignotus Peverell 63c5795eb9 Removing test coverage until it actually works 2018-03-04 19:52:55 +00:00
Ignotus Peverell be8d9633e4 rustfmt all the things 2018-03-04 00:19:54 +00:00
Antioch Peverell 19565aea3d rustfmt now runs and reformats files (need to opt out explicitly) (#743) 2018-03-03 19:10:15 +00:00
Yeastplume 4c34c9ab52 PMMR Block to File positions metadata storage (#739)
* adding file position index data accessable to the chain, and allowing for storage of such within db

* missing file

* restart files at last recorded position in stored file metadata

* just use tip to store last pmmr index information

* error handling

* test fix
2018-03-03 09:08:36 +00:00
Antioch Peverell cc12798d7a Merkle Proofs (#716)
* family_branch() to recursively call family() up the branch
todo
  - we hit a peak, then we need to get to the root somehow
  - actually get the hashes to build the proof

* wip

* some additional testing around merkle tree branches

* track left/right branch for each sibling as we build the merkle path up

* MerkleProof and basic (incomplete) verify fn

* I think a MerkleProof verifies correctly now
need to test on test case with multiple peaks

* basic pmmr merkle proof working

* MerkleProof now serializable/deserializable

* coinbase maturity via merkle proof basically working

* ser/deser merkle proof into hex in api and wallet.dat

* cleanup

* wip - temporarily saving merkle proofs to the commit index

* assert merkle proof in store matches the rewound version
there are cases where it does not...

* commit

* commit

* can successfully rewind the output PMMR and generate a Merkle proof
need to fix the tests up now
and cleanup the code
and add docs for functions etc.

* core tests passing

* fixup chain tests using merkle proofs

* pool tests working with merkle proofs

* api tests working with merkle proof

* fix the broken comapct block hashing behavior
made nonce for short_ids explicit to help with this

* cleanup and comment as necessary

* cleanup variety of TODOs
2018-03-02 15:47:27 -05:00
Quentin Le Sceller f2d709cb01 Fix wrong images in Dandelion docs (#742) 2018-03-02 17:59:41 +00:00
Quentin Le Sceller 6d7125b336 Add Dandelion docs (#740)
* Add scenario
* Update dandelion aggregation explanation
2018-03-02 03:18:47 +00:00
Ignotus Peverell b3104fe2f6 Typo fix 2018-03-01 19:15:38 +00:00
Antioch Peverell a20ffc700b fix the broken comapct block hashing behavior (#738)
made nonce for short_ids explicit to help with this
2018-03-01 13:25:33 -05:00
Ignotus Peverell 7f478d79f6 Proper error when trying to rewind to empty genesis 2018-03-01 03:09:10 +00:00
Ignotus Peverell 07df881a72 Initialize sumtree if genesis isn't empty 2018-03-01 03:08:35 +00:00
Ignotus Peverell 9fa344383c Fix MMR compaction to take a horizon. Additional tests. 2018-02-28 21:20:54 +00:00
Alexey Miroshkin 9e11afe8a2 Error handling with failure (using Error and ErrorKind) (#713)
* Initial version

* store failure parameters inside ErrorKind variants

* continue failure transformation

* 4 errors left

* still two errors

* return old code back

* finally compiling

* Fix compilation and test errors after merge
2018-02-28 12:56:09 -05:00
Quentin Le Sceller 0d15e22f97 Update contracts.md (#737) 2018-02-28 12:46:25 -05:00
Yeastplume 5d1f1af892 Bulletproof messages (#730)
* beginning to add bullet proof messages

* Updated core transaction creation to embed the output's value and switch commit hash as part of the rangeproof message

* formatting issue

* more formatting issues

* Removing conditional feature compliation.. just bulletproofs from now on

* ensure MAX_PROOF_SIZE uses bulletproof sizing instead of earlier version

* updated with switch commit committed to in extra data

* accidentally commented out bullet-proof-size feature
2018-02-27 21:11:55 +00:00
Alexey Miroshkin d116a434bf Log the reason of peer ban (#736)
This PR fixed #455 by adding a few debug log messages
2018-02-27 20:33:40 +00:00
Ignotus Peverell 6f675e18e3 Clarified current limitation for atomic swap 2018-02-27 19:42:09 +00:00
Ignotus Peverell 47cc921486 Really, no blake2 here 2018-02-27 18:00:51 +00:00
Quentin Le Sceller a0d2fb0eab Add initial Dandelion doc (#732) 2018-02-26 22:43:08 +00:00
Ignotus Peverell 34e47749de secp256k1 uses sha 256, not blake2 2018-02-26 19:31:54 +00:00
Ignotus Peverell 4f95fcef47 Minor header formatting fix 2018-02-26 19:15:39 +00:00
Ignotus Peverell 341a3c9f4d Minor cleanup, range proof pmmr validation and tests 2018-02-24 23:40:13 +00:00
Ignotus Peverell 3ab616b8be Fix range proof deser (length issue) 2018-02-24 23:40:12 +00:00
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 0d024188d4f98950d24c3aeab482b4fd417182ce.
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