Commit Graph

69 Commits

Author SHA1 Message Date
Ignotus Peverell e4ca924b47 Various comment and dead wood cleanup 2017-04-20 11:31:02 -07:00
Ignotus Peverell e71ae27f77 Invert inputs and outputs commitment sums. Fixes #37. 2017-04-10 00:27:19 -07:00
Merope Riddle 39ddeb0a2a core: various cleanups, improvements, code comments (#38)
* core: cleanup slicing impls for Hash
* core: clean up Readable trait, implement Readable/Writeable for various integers
* core: change Hash debug output to hex
* core: correct warnings in all modules
2017-04-09 23:17:23 -07:00
Jacob Payne 9e82fb1774 Replace AsFixedBytes with Sized + AsRef<[u8]> (#35)
* Replace AsFixedBytes with Sized + AsRef<[u8]>
* Add AsRef<u8> to impl_array_newtype!
* Include AsFixedBytes as marker trait
* Related fixes
* Remove Deref
2017-04-06 22:54:54 -07:00
Ignotus Peverell 382754e54c Add workspace support for all crates 2017-04-05 23:41:49 -07:00
Ignotus Peverell afb219ce5c Hashed impl only needed for empty arrays. 2017-04-03 18:10:55 -07:00
Ignotus Peverell 38d5d67e79 Add features bitmask to Block, Output, Kernel; coinbase validation
Block, Output and Kernel now have bitmasks to hold supported
features and eventually versioning. Will make adding features and
updates easier and open the possibility of soft forks.

First added feature for Output and Kernel is the marking of coinbase
related ones. Allows the validation of the coinbase part of a block.
2017-03-23 17:06:00 -07:00
Ignotus Peverell b6b815f6c1 Reintroduce block tests with new tx building
The build module introduced some facilities to build transactions
that can now be leveraged when building blocks and in related
tests.
2017-03-20 14:32:11 -07:00
Ignotus Peverell 6bd3fc0d48 Cleanup of Transaction and Block data structures
Some renaming and cleanup of the Input, Output, Transaction and
Block structs. The main change is the removal of all the overt
structures which are now replaced by a specialized module to
build transactions easily. More specifically:

* Rename the TxProof to TxKernel in Block to reflect the current
naming consensus in MimbleWimble.
* Change Input and Output to be plain structs instead of enums
making their manipulation a lot easier. The building of
transactions is now handled by the build module.
* Input now directly includes the commitment of the Output it's
spending instead of going through an intermediate hash.
* The new build module encapsulates all the transaction building
logic, making it very straightforward by chaining combinators.
* Moves some tests to the core mod.rs as they required being able
to build a transaction to test it.
2017-03-20 14:07:00 -07:00
Ignotus Peverell cb84f588fb Small tweaks and addition to a Transaction to make 2-parts building easier. Unit test covering the standard exchange between 2 parties when building a transaction. 2017-03-11 13:48:33 -08:00
Ignotus Peverell f64d20749f Framework to define services as RESTful HTTP API services. Serde implementations for some core types. 2017-03-07 17:00:34 -08:00
Ignotus Peverell 45b134ab30 PoW only ever needs the block header, full block unnecessary. 2017-02-07 13:48:11 -08:00
Ignotus Peverell dde54beb3f Hash needs to be writeable for network serialization. 2017-02-06 12:08:35 -08:00
Ignotus Peverell 4a034018cb Block inputs and ouputs Merkle tree validation. 2017-01-25 11:44:37 -08:00
Ignotus Peverell dda223f25b Chain logic to support multiple forks, select the most worked fork as the head. Significantly simplified from the original direction as it doesn't seem that explicitly materializing forks is necessary. Simple total difficulty accounting in block headers helping a lot there. 2017-01-09 15:16:44 -08:00
Ignotus Peverell 85e3255ee4 Removed need for a PowHeader. Directly checking serialization mode in block header serialization instead. 2017-01-09 12:07:38 -08:00
Ignotus Peverell ce23dda6cb Block headers maintain total difficulty up to previous. Changed all references of target to difficulty to stay consistent. Ported retargeting algo to use difficulty as well. 2016-12-26 15:39:31 -08:00
Ignotus Peverell c1340223de Minor API change to PoW verify, to use the size provided by the block header by default. 2016-12-20 17:32:19 -08:00
GarrickOllivander 2e6d3d9fdb Safer serialization of base types (#18)
* use MESSAGE_SIZE constant instead of 32
* use Hashed trait in genesis
* safer serialization of Hash
* Hashed of [u8] should send only data to hash function, not length + data
* Safer serialization of Proof
* Safer serialization of Commitment
* Safer serialization of RangeProof
* introduce read_limited_vec instead of potential panic in conversion
2016-12-17 13:44:14 -08:00
Ignotus Peverell d395b3d128 Added another server implementation for when the client needs to stay in control of the event loop (i.e. multiple servers for tests). Test to spin up 5 servers and connect them all together. 2016-12-14 16:10:39 -08:00
Ignotus Peverell 8a255c0218 Formatting. 2016-12-13 19:21:49 -08:00
Ignotus Peverell 4b5c010b05 Rewrote most of p2p code to use futures-rs instead of mioco. Need some cleanup and support for a few more message types. 2016-12-10 19:11:49 -08:00
Ignotus Peverell eb56d40807 Removed limit on number of inputs or outputs in blocks and transactions. For DoS protection only a total message size needs to be enforced by the p2p layer. 2016-12-07 18:54:28 -08:00
Ignotus Peverell 4d7bc2269b Fixed retargeting tests for truncation. 2016-11-30 11:15:49 -08:00
Ignotus Peverell ea1820cff7 Fixed usages of block constructor. 2016-11-30 11:15:23 -08:00
Ignotus Peverell 55f5771a2a Avoid unecessary move of the previous block header to build a block. 2016-11-29 20:05:35 -08:00
Ignotus Peverell 2e52b13c35 Date format uses year since 1900. 2016-11-29 20:04:13 -08:00
Ignotus Peverell 1ab9001338 Target needs to be truncated after next target calculation, given that serialization in the block header does it anyway. 2016-11-29 20:03:43 -08:00
Ignotus Peverell 11b8a6222a Any size pow accesible to tests. 2016-11-29 18:46:28 -08:00
Ignotus Peverell d11c85dae1 Fixed missing previous in block header. 2016-11-29 18:42:43 -08:00
Ignotus Peverell 9795d9e452 Miner facility, using the current chain state to build on top of. 2016-11-27 12:31:15 -08:00
Ignotus Peverell ca26f0c3f7 Block header needs its own deserialization. Fixed pow verify to use the block target. 2016-11-16 14:08:46 -08:00
Ignotus Peverell 3c5e2b2958 Block now uses the new Target type. Consensus next_target calculation adjusting every block based on deviation and increasing Cuckoo size gradually. Block time of a minute until we learn more from mining ecosystem, so enough PoW attempts can be made even on CPUs. 2016-11-15 14:41:16 -08:00
Ignotus Peverell 44545525f4 Target addition and subtraction. A little more doc. 2016-11-15 14:41:16 -08:00
Roman Zeyde 151a0150b9 Fix a small typo in documentation 2016-11-14 21:21:18 +02:00
Ignotus Peverell f7b31dc5f3 Bitcoin-style target implementation. Large 32 byte number that can be compared and serializes truncated. 2016-11-13 21:04:01 -08:00
Garrick Ollivander 956dd6b816 fix file headers: Developer -> Grin Developer 2016-11-13 12:47:09 +01:00
Ignotus Peverell 2b8faf8709 A few more consensus values. 2016-11-10 17:19:03 -08:00
Ignotus Peverell d710301833 Missing consensus file. 2016-11-10 16:02:47 -08:00
Ignotus Peverell baeae7d1a5 Merged master. 2016-11-10 15:54:47 -08:00
Ignotus Peverell 4ade3ec1b8 Moved consensus related constants to their own core module. 2016-11-09 15:51:24 -08:00
Ignotus Peverell 6e2a232ca3 Cleaned up total fees from block header. Unnecessary now. 2016-11-09 13:25:40 -08:00
Ignotus Peverell 4e9aad639e Formatting fixes. 2016-11-09 11:10:02 -08:00
Ignotus Peverell 8317854b70 Slight changes to transaction signature. The transaction fee gets signed (instead of the empty string) and the fee amount is attached to the transaction proof in blocks. This allows fee accounting and the tracking of fees within a block. 2016-11-09 11:05:44 -08:00
Ignotus Peverell ea425dc614 Protocol cleanup. Tests cleanup. Additional test for transaction broadcast. 2016-11-05 16:31:45 -07:00
Ignotus Peverell edc6c62577 Fixed message serialization following changes in core. Sending of block and transaction. 2016-11-01 10:42:33 -07:00
Merope Riddle 33ccfe3b65 core: remove several unused imports 2016-11-01 13:19:38 +00:00
Merope Riddle ca89dae7e1 core: unify Hashed and Writeable to simplify things and remove allocations 2016-11-01 13:19:28 +00:00
Merope Riddle 245f0a8b56 core/ser: add default implementations for most methods of Writer 2016-11-01 13:14:26 +00:00
Merope Riddle 630c4eb6fb core/ser: replace write_vec with write_bytes, drop a bunch of clones 2016-11-01 02:14:52 +00:00