Commit graph

2539 commits

Author SHA1 Message Date
Ignotus Peverell
d32ab967f0
Prunable and easy to store MMR impl 2017-08-05 09:32:41 +00:00
Ignotus Peverell
ae9a9c8938
Merge branch 'master' of github.com:ignopeverell/grin 2017-08-04 19:52:04 +00:00
Ignotus Peverell
95fe570187
Prunable and easy to store MMR impl 2017-08-04 19:50:32 +00:00
Yeastplume
cdf4203dd1 Cuckoo miner integration, Queue implementation (#84)
* Adding ability to serialise parts of the header, pre-nonce and post-nonce
* Some test integration of queueing functions in cuckoo-miner
* more cuckoo-miner async mode integration, now more or less working
* integrating async miner workflow
* rocksdb update
* u64 internal difficulty representation, and integration of latest Cuckoo-miner API
* change to cuckoo-miner notify function
* Issue in testing, and if use_async value is None in grin.toml
* making async mode explicit in tests - 2
* fiddle with port numbers for CI
* update tag to ensure cuckoo-miner build doesn't fail on windows
* change the order in which tests are run
2017-08-03 16:57:55 +00:00
Ignotus Peverell
c994c7cba2
Capture options with orphan block, fix #83 2017-07-28 02:21:00 +00:00
Ignotus Peverell
b3e224b439
Minor fixes to orphan handling
Fixed sync pathway in validation pipeline not returning the proper
orphan error. Reduced chain head lock span to prevent deadlock on
reentrancy.
2017-07-27 23:47:33 +00:00
Ignotus Peverell
22bff54f66
rustfmt (new version) 2017-07-27 21:13:34 +00:00
Ignotus Peverell
3c3b12b13a
Chain handles orphaned blocks and retries them
When a new block is rejected by the validation pipeline as orphan,
the chain now keeps it in a ring buffer of capped size. Anytime
a new block is accepted, all orphans in the ring buffer are
retried. This is helpful to handle all the cases where we receive
blocks out of order for networking/timing reasons.
2017-07-27 19:08:48 +00:00
Ignotus Peverell
f0044c631f
Minor warnings cleanup, rustfmt 2017-07-26 01:43:17 +00:00
Ignotus Peverell
a6047903d2
Sum tree: n_children -> n_leaves (more explicit) 2017-07-24 21:46:22 +00:00
Ignotus Peverell
20e3382785
Merkle doc: fix typos, clarify diagram 2017-07-24 21:37:14 +00:00
Ignotus Peverell
3503ba7f66
Last (hopefully) blake2 loose ends 2017-07-24 19:24:51 +00:00
Ignotus Peverell
1d68a64edc
Extend MMR doc with storage design 2017-07-24 17:41:30 +00:00
Ignotus Peverell
22f3d42b94
Simple sum tree benchmark 2017-07-23 01:19:10 +00:00
Ignotus Peverell
87fc062f9b
Last snafu (hopefully) 2017-07-22 23:32:00 +00:00
Ignotus Peverell
2261415c27
Oops. Fix blake2 dependency issues. 2017-07-20 15:03:47 +00:00
Ignotus Peverell
eb11b14cab
Minor warning cleanup in core
Remove some unused import and add missing docs.
2017-07-20 14:22:40 +00:00
Ignotus Peverell
23816d1c2b
Add missing crate dependency 2017-07-20 14:11:42 +00:00
Ignotus Peverell
929943d8b1
Sum-tree only stores hashes
Couple improvements to the sum tree implementation. First change
is to not store the data but only its hashes, assuming a higher
level layer will take care of the data (KV store).

Second minor improvement is renaming Node into NodeData and vice
versa.
2017-07-20 14:07:57 +00:00
Ignotus Peverell
01b66de437
Replace SHA3 with BLAKE2b everywhere 2017-07-20 13:52:33 +00:00
Ignotus Peverell
9703cba92a
Formatting 2017-07-20 13:52:33 +00:00
Yeastplume
26ce1d27d7 Updates to ensure multithreaded CI tests don't fail (#81)
Locks loading of miner plugins so it only ever happens once.
2017-07-19 16:40:57 +00:00
Ignotus Peverell
dca5504203
Run grin crate tests single-threaded 2017-07-18 21:22:30 +00:00
Yeastplume
42376e68bc Cuckoo-miner better merged into Grin (#80)
* Adding cuckoo-miner into grin as a proper dependency now
* Defaulting to using cuckoo-miner
* Updates to tests to use cuckoo_miner by default, (using cuckoo16)
2017-07-18 20:57:09 +00:00
Ignotus Peverell
40090fcdbc
Fix api & pool tests, add the crates to Travis 2017-07-18 17:33:49 +00:00
Yeastplume
1ede61d2a2 Addition of configuration file (#79)
* addition of configuration file to grin executable, instructions on how it's picked up are in grin.toml
* Starting to add a configuration file, and change some elements of configuration structures to make them more consistent
2017-07-13 17:30:33 +00:00
Merope Riddle
e2ebd854e1 [WIP] Implement Merkle-sum-tree (#40)
* core: partially implement sumtree; appending and pruning work
* core: add simple merkle-root-sum-calculating function. 
* core: implement replacement in sumtree
* core: implement de/serialization for sumtree
* core: make sumtree index use hashes rather than data
* core: prevent double-adds to sumtrees
* core: replace sumtree's separate sums with a Summable trait
* core: make SumTree::contains() return the index if an element exists
2017-07-12 18:59:18 +00:00
Yeastplume
12480e7310 Changes to allow for testing and playing with cuckoo-miner integration (#76)
* Refactoring to allow for different miner implementations. Added conditional support for compiling and loading the cuckoo-miner plugin project.
* Small changes to experimentally integrate with cuckoo-miner and compatibility with latest version of cuckoo-miner.
* Turning off inclusion of cuckoo_miner by default
* Disabling simulate_parallel_mining test for now
2017-07-11 17:11:03 +00:00
Jacob Payne
60705eff76 Use io::Read/Write interface instead of AsyncRead/AsyncWrite + Finish Tests (#74) 2017-07-05 18:42:55 +00:00
Ignotus Peverell
15ea8da34a
New Chain struct acting as facade for all chain operations
Introduce a new Chain struct that maintains the current head,
acts as facade to the store and the block processing pipeline
and handles all appropriate locking.

All higher level components, like the overall server, REST APIs
and miner have been update to only depend on Chain. Cleaned up
some duplication and tests now that there's a single entry point
to all blockchain operations.
2017-07-04 09:17:11 -07:00
Yeastplume
8974cbc12c POW Doc updates (#73)
* Clarifications to SHA3 hash and addition of progress-freeness concept in Pooling Capacity
* Update to cuckoo cycle details based on John Tromp's comments.
* A couple of typos
* More clarifications based on John Tromp's feedback
2017-07-03 17:39:20 +02:00
Yeastplume
efcbea3307 Clarifications to SHA3 hash and addition of progress-freeness concept in Pooling Capacity (#72) 2017-07-02 23:28:17 +02:00
Ignotus Peverell
07a6f23880 Create LICENSE 2017-06-29 09:24:44 -07:00
Yeastplume
97b7421ce0 Mining test debug output, fixes to diff. adjustment and start of POW documentation (#69)
* Beginning to add a POW description, and some minor changes to mining testing, addition of further debug information to mining output.
* Many additions to create first draft of POW documentation
* Fixes to difficult adjustments by adding a MINIMUM_DIFFICULTY consensus value. Otherwise never adjusted above 1 due to flooring.
2017-06-29 16:49:11 +02:00
Yeastplume
5f8a0d9f1c Wallet HTTP posting, fixes and additions to port address configurability. (#66)
* Starting to refactor test, adding http post to wallet sender
* Implemented ability to run servers on different ports (mostly for testing), and implemented ability to post http requests directly to receiving wallets
* Adding detailed instructions on running multiple servers on the same machine
* Changes to build.doc to outline server running process
* Removed unwanted debug statements
* WIP Local server testing framework evolution
* More refactoring of server pool, checked in because there's a problem
* Added server reference structure, and ability to return server references from tests cleanly
* Added simulate_parallel_mining test, which puts some artificial slowdown into test mining loops, and the difficulty can currently be watched in the log
* Removing the ServerRef structure placed in earlier and replaced with a ServerStats structure, that just returns relevant info about the Server state without exposing it to the world
2017-06-27 04:09:01 +02:00
Ignotus Peverell
75f19ecfab
Fix difficulty tests, forgot to rename method 2017-06-20 10:21:31 -07:00
Ignotus Peverell
e8a6b61100
Apply new difficulty algo, remove configurable cuckoo size
Integrate the new difficulty calculation into the block chain
validation, the miner and tests. As the difficulty calculation
doesn't use varying Cuckoo sizes anymore and we narrowed down
reasonable final Cuckoo Cycle parameters, removed all Cuckoo
Cycle sizes from block headers.

Formalized easier Cuckoo Cycle sizes for testing (and possibly
testnet) by introducing a test mode in configuration. Updated
all tests.
2017-06-19 08:59:56 -07:00
Ignotus Peverell
163b1133a7
Implemented new difficulty calculation algorithm.
See #62 for background. Still needs to be integrated with proof
of work and validation.
2017-06-17 20:22:20 -07:00
Ignotus Peverell
55eb2f6887
Fixed vagueness on 2nd curve 2017-06-17 20:22:20 -07:00
Jacob Payne
6a15100c96 [WIP] Rate Limiting (#57)
* Setup tests for rate limiting
* Add send and receive rate configs to P2P Config
* Setup ThrottledConnection and ThrottledWrite
* Add Tokio io
* Fix ThrottledReader + Add Bytes
* Attach Rate Limiting to Connection
2017-06-18 01:15:46 +02:00
Yeastplume
a82f9ce415 Testing Framework [WIP] and new command line options to configure wallet ports and directories (#65)
* Beginning to refactor server tests
* Extended test framework to include running wallet servers and miners. Also some changes to the wallet reciever api to include a wallet config and set the data directly for the wallet file explicitly rather than assuming it's always in the working dir.
* Adding wallet config to main executable
* Adding ability to select wallet server while mining
* Configurable wallet receiver url
2017-06-16 18:47:29 +02:00
Ignotus Peverell
fbbd703e99
Protect wallet data file with a file lock
Operations on the wallet data file are now fenced by a lock to
avoid potentially messy concurrent modifications by multiple
processes (i.e. the wallet receiver and a send command). The lock
is done using a create-only lock file, which is an atomic
operation.
2017-06-14 21:42:58 -07:00
Ignotus Peverell
6523966f9e
Bug fixes in wallet and related API
Fixes a few loose ends in the full cycle of sending coins,
accepting them, pushing that transaction to the pool and having it
mined. More specifically:

* The API output endpoint needs to be a UTXO endpoint, as the
server can't make any guarantee about having a spent output.
* Bubbling up HTTP not found errors.
* Wallet output status checker now handles spent outputs.
* Transaction pool validates the transaction before accepting it.
* Fixed the operation API routes.
* Fixed too greedy wallet coin selection loop.
2017-06-12 16:41:27 -07:00
Ignotus Peverell
eb9cc7ef13
Integrate transaction pool with rest of the system
* Transactions coming from the network are now pushed to the pool
through the net adapter.
* New blocks accepted by the chain are sent to the pool for
eviction.
* The miner requests transactions from the pool to build its
blocks.
* The push API adds to the pool, removing the mock.
* Implementation of the adapter to the chain required by the pool
to get consistent UTXOs. Grossly unoptimized until we have the UTXO
MMR ready.
2017-06-10 12:51:33 -07:00
Ignotus Peverell
172c5e840b
TransactionPool uses non-dummy chain trait
Introduced new non-dummy trait for the blockchain as seen from the
pool that just produces a UTXO. Made to pool parametric on that
trait to get rid of the Box wrapper and still allow the test
implementation.
2017-06-10 11:31:05 -07:00
MoaningMyrtle
384554fc46 Change to pool->blockchain interface to avoid get_best_utxo_set (#60)
* Update DummyChain and DummyChainImpl to get_unspent
* Update pool to use get_unspent
2017-06-10 04:33:33 +02:00
Ignotus Peverell
dd1339a9c3
Sending of transaction to push to mocked up API
Once the wallet transaction is fully built, serializing it and
sending the push request to a node. Implemented the push node
API, mocked up for now (until the tx pool is integrated).
2017-06-08 16:34:27 -07:00
Ignotus Peverell
d26a659a97
Command-line receiving end of wallet
Parse the partial transaction encoded in JSON, adding a new output
and finalizing. Should push the final tx to a grin node for
broadcast once that's fleshed out. Should also add an endpoint for
the http receiver.
2017-06-07 18:12:15 -07:00
Ignotus Peverell
aeb3dfc0dd
Minor cleanup and fixes for wallet send 2017-06-06 13:18:16 -07:00
Ignotus Peverell
3d5411b6ad
Deprecated. 2017-06-06 12:27:39 -07:00