Commit graph

278 commits

Author SHA1 Message Date
Quentin Le Sceller
663733e72b
Replace try! for ? (#1134)
* Replace try for ?
2018-06-04 12:05:49 -04:00
Antioch Peverell
68c7cff6db Fix the intermittent error in pool tests (#1123) 2018-06-01 23:18:58 +01:00
Antioch Peverell
4fda7a6899
Minimal Transaction Pool (#1067)
* verify a tx like we verify a block (experimental)

* first minimal_pool test up and running but not testing what we need to

* rework tx_pool validation to use txhashset extension

* minimal tx pool wired up but rough

* works locally (rough statew though)
delete "legacy" pool and graph code

* rework the new pool into TransactionPool and Pool impls

* rework pool to store pool entries
with associated timer and source etc.

* all_transactions

* extra_txs so we can validate stempool against existing txpool

* rework reconcile_block

* txhashset apply_raw_tx can now rewind to a checkpoint (prev raw tx)

* wip - txhashset tx tests

* more flexible rewind on MMRs

* add tests to cover apply_raw_txs on txhashset extension

* add_to_stempool and add_to_txpool

* deaggregate multi kernel tx when adding to txpoool

* handle freshness in stempool
handle propagation of stempool txs via dandelion monitor

* patience timer and fluff if we cannot propagate
to next relay

* aggregate and fluff stempool is we have no relay

* refactor coinbase maturity

* rewrote basic tx pool tests to use a real txhashset via chain adapter

* rework dandelion monitor to reflect recent discussion
works locally but needs a cleanup

* refactor dandelion_monitor - split out phases

* more pool test coverage

* remove old test code from pool (still wip)

* block_building and block_reconciliation tests

* tracked down chain test failure...

* fix test_coinbase_maturity

* dandelion_monitor now runs...

* refactor dandelion config, shared across p2p and pool components

* fix pool tests with new config

* fix p2p tests

* rework tx pool to deal with duplicate commitments (testnet2 limitation)

* cleanup and address some PR feedback

* add big comment about pre_tx...
2018-05-30 16:57:13 -04:00
Yeastplume
4121ea1240
Wallet+Keychain refactoring (#1035)
* beginning to refactor keychain into wallet lib

* rustfmt

* more refactor of aggsig lib, simplify aggsig context manager, hold instance statically for now

* clean some warnings

* clean some warnings

* fix wallet send test a bit

* fix core tests, move wallet dependent tests into integration tests

* repair chain tests

* refactor/fix pool tests

* fix wallet tests, moved from keychain

* add wallet tests
2018-05-09 10:15:58 +01:00
Ignotus Peverell
4e531435e0
Buffers writes in the MMR store types (#1050)
Adds a `BufWrite` around each file that gets incrementally written
to in the MMR store main types. Should speed up a few operations
quite a bit, but particularly flushing the remove log. Saving
txhashsets on new blocks is now 10x to 20x faster, making full
block syncs a lot faster.
2018-05-08 21:54:36 +01:00
Antioch Peverell
e22d025dc8 Simplify block marker metadata (#985)
* wip BlockMarker struct, get rid of PMMRMetadata
* use rewind to init the txhashet correctly on startup, we do not need to track pos via metadata (we have block markers), we do not need to open the txhashset with specific pos (we have rewind)
* better logging on init
* keep rewinding and validating on init, to find a good block
* use validate_roots on chain init
2018-04-24 19:53:01 +00:00
Antioch Peverell
46a7245ec1 Cleanup unused fn on rm_log (#999) 2018-04-24 00:46:06 +00:00
Antioch Peverell
ced6e647b8
still do not fully understand what PhantomData is *for* exactly (#991)
but standardized naming and usage to match https://doc.rust-lang.org/beta/nomicon/phantom-data.html
so at least it looks similar to the official docs
2018-04-21 17:03:45 -04:00
Antioch Peverell
f0cf903adc
fix various issues with rewinding data file (#983)
* fix issue with rewinding data file
also fix fragility around an empty MMR (and the memory map)

* cleanup
2018-04-19 19:52:46 +01:00
Ignotus Peverell
eefb4319f8
Fix buffer index in compact
Indexes used to be positions in the full file, not in the
intermediary buffer.
2018-04-02 21:49:35 +01:00
Ignotus Peverell
327293d28e Genesis, version changes and doc for testnet2 (#865)
* Bump up crates versions

* Finally add a Cargo.lock to avoid dependency breakages

* Build doc update for testnet2

* Fix test framework not really using its mining config

* Testnet2 genesis, best so far at 128 difficulty (a nice number)

* Minor build doc update
2018-03-26 10:48:46 +01:00
John Tromp
a327427178 0-based positions, bag peaks right-to-left with mmr size as index (#863)
* 0-based positions, bag peaks right-to-left with mmr size as index
* fix remaining instances of hash_with_index
* fix pmmr test
2018-03-26 02:26:11 +00:00
Simon B
9285de2c24 Here is a case where ~ is needed, to allow cargo update to only touch the patch level version (third number). Anything else than ~ means that both first numbers can be raised, so "2.1" updaates to "2.2" (#866) 2018-03-25 20:08:38 +00:00
Ignotus Peverell
2bf656646c
Force slog version to 2.1 (2.2 broke some traits) 2018-03-25 19:54:41 +01:00
Simon B
f9b87164e7 Idiomatic cargo toml (#862)
* Specify versions SemVer-style
 - slog and serde
* Comments for not update-able pre-1.0 crates:
 - urlencoded at "0.5" since 0.6+ lacks trait `plugin::Plugin<iron::Request<'_, '_>>`
* alpha-sort deps
* Specify versions SemVer-style
 - backtrace, bitflags, blake2-rfc, bodyparser, built, byteorder
 - chrono, clap, demonize, enum_primitive, env_logger
 - failure, failure_derive, futures
 - hyper, iron, itertools, lazy_static, libc
 - memmap, mount, net2, num_bigint, prettytable-rs
 - rand, regex, rocksdb, router, siphasher
 - term, time, tokio-core, tokio-retry, urlencoded, uuid, walkdir, zip
2018-03-25 17:44:27 +00:00
Antioch Peverell
7a8d6147f4 Split pmmr.get() into get_hash() and get_data() (#855) 2018-03-23 23:33:59 +00:00
Simon B
e3601b6c8e Travis cleaner caching (#833)
* speed up Travis startup
- keep all test tempdata in target/tmp
- purge before saving target/* to S3 cache

* allow 4 minutes for cache up/download from Travis' S3 cache stores
2018-03-21 16:05:07 +00:00
Simon B
4fa9ccc4f7 Cargo.toml (#818)
* Make sure no grin crates get published by mistake: https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish--field-optional
* add missing workspace = '..', [workspace docs for interested readers](https://doc.rust-lang.org/cargo/reference/manifest.html#the-workspace-section)
* dev- or dev_ works equally well, but dev- is what's typically used
* authors = Grin Developers <maillist>
* [dependencies] keep grin-* at the end + readability
2018-03-20 18:21:29 +00:00
Antioch Peverell
7816f35238
rewind to header as part of txhashset validation (#808)
* rewind to header as part of txhashset validation
otherwise we risk including a new block and the roots do not match

* fix bug in rm_log rewind (wants to be inclusive of provided index)

* put block marker in the index so we can rewind correctly
during validation of the new txhashset

* rustfmt
2018-03-19 21:31:57 -04:00
Antioch Peverell
cb71386097
hash with the pos for non-leaf nodes (#788)
* hash_with_index on non-leaf nodes
rework the Merkle proof to include the pos of each sibling in the path

* rustfmt

* cleanup

* cleanup

* use get_from_file in validate (children may have been "removed")

* rustfmt

* fixup store tests
2018-03-16 10:45:58 -04:00
Yeastplume
244fc8d32e
PMMR data compaction (#784)
* fix and re-introduce data file compaction

* rustfmt

* remove commented line

* test cleanup

* remove println

* fix to core test
2018-03-15 17:12:30 +00:00
Antioch Peverell
00bfc4ec38
add dump_stats so we can see pmmr sizes after compaction (#785)
* add dump_stats so we can see pmmr sizes after compaction

* rustfmt

* fix tests with dump_stats()
2018-03-15 12:53:40 -04:00
Antioch Peverell
65633c7611
check_compact retains leaves and roots until parents are pruned (#753)
* wip

* failing test for being too eager when pruning a sibling

* commit

* rustfmt

* [WIP] modified get_shift and get_leaf_shift to account for leaving "pruned but not compacted" leaves in place
Note: this currently breaks check_compact as nothing else is aware of the modified behavior

* rustfmt

* commit

* rustfmt

* basic prune/compact/shift working

* rustfmt

* commit

* rustfmt

* next_pruned_idx working (I think)

* commit

* horizon test uncovered some subtle issues - wip

* rustfmt

* cleanup

* rustfmt

* commit

* cleanup

* cleanup

* commit

* rustfmt

* contains -> binary_search

* rustfmt

* no need for height==0 special case

* wip - works for single compact, 2nd one breaks the mmr hashes

* commit

* rustfmt

* fixed it (needs a lot of cleanup)
we were not traversing all the way up to the peak if we pruned an entire tree
so rm_log and prune list were inconsistent

* multiple compact steps are working
data file not being copmacted currently (still to investigate)

* cleanup store tests

* cleanup

* cleanup up debug

* rustfmt

* take kernel offsets into account when summing kernels and outputs for full txhashset validation
validate chain state pre and post compaction

* rustfmt

* fix wallet refresh (we need block height to be refreshed on non-coinbase outputs)
otherwise we cannot spend them...

* rustfmt
2018-03-13 14:22:34 -04:00
Yeastplume
5cf780ab98
Rm log rewind on startup (#760)
* add rewind to block height to rm_log on startup

* add rewind to block height to rm_log on startup

* flush remove log
2018-03-09 17:17:48 +00:00
Ignotus Peverell
a9d1b76414
Compaction of pruned data for chain data structures (#746)
* Implementation of compaction for the chain. Single entry point on the chain triggers compaction of all MMRs as well as the cleanup of the positional index and full blocks.
* API endpoint, additional tests and more fixes for compaction
* Also prune PMMR metadata, minor bug fix
* PMMR store tests fix
2018-03-06 17:58:33 +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
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
be8d9633e4
rustfmt all the things 2018-03-04 00:19:54 +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
Ignotus Peverell
9fa344383c
Fix MMR compaction to take a horizon. Additional tests. 2018-02-28 21:20:54 +00:00
Ignotus Peverell
341a3c9f4d
Minor cleanup, range proof pmmr validation and tests 2018-02-24 23:40:13 +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
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
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
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
AntiochP
26c2669fe8
pmmr should not depend on switch_commit_hash to identify utxo (#576)
* pmmr does not depend on switch_commit_hash
for a given chain a commitment shold be sufficient to identify a utxo

* fix the tests
2018-01-04 13:38:46 -05:00
Quentin Le Sceller
2057525251 Bump RocksDB to ^0.8.0 (#555) 2017-12-28 15:25:01 -05:00
Ignotus Peverell
2caa0b79e0
Removed log should *always* be backed up before truncate 2017-12-17 21:26:43 +00:00
Ignotus Peverell
b893a6c8ee Back up the removed log before truncating in memory
Without a backup, the in-memory data structure stays truncated
even if the rewind is abandoned. Also add some logging on our
most problematic block in case it still is problematic.
2017-12-14 01:13:04 +01:00
Ignotus Peverell
d92b6ddddb
Fix for disappearing AlreadySpent error
Fixes buffer misalignment when reading back pruning data.
Everything after the buffer length (8000 bytes) was badly read on
restart, leading to accepting double spends.
2017-12-12 23:43:05 +00:00
Ignotus Peverell
6ba22e71c8
Fix for buffer-pruned positions in MMR store
The MMR storage has a buffer for all changes so they can either
be discarded without side effects or committed to disk. Pruning
can also happen in the buffer if an input directly spends an
output in a block (not likely), or a fork has an input spending
a previous output within it.

When the buffer gets flushed to storage, the pruned element was
just skipped, causing an offset within the underlying storage and
a shorter file than expected. This fix writes zeroes instead, so
the size is consistent. Note that the zeroes will be removed with
all other pruned elements on next compaction.

Fixes #444
2017-12-09 18:53:24 +00:00
Ignotus Peverell
db0cce9fa0
Correct mmr buffer index on remove, fixes #423 2017-12-05 00:37:37 +00:00
Ignotus Peverell
2c6c8ed688
Fix rm log not getting written to disk
Only the temporary remove log for the last block was written to
disk, and then overwritten for every block. The fix writes the
temp remove log (just last block) to the permanent remove log,
and saves that to disk.
2017-11-25 23:26:36 -05:00
Ignotus Peverell
8f0373b81e
Fix #235 sumtree size double-counting rm log 2017-11-04 13:34:33 -04:00
Ignotus Peverell
e4ebb7c7cb
Cleanup HTTP APIs, update ports to avoid gap, rustfmt
Moved the HTTP APIs away from the REST endpoint abstraction and
to simpler Hyper handlers. Re-established all routes as v1.
Changed wallet receiver port to 13415 to avoid a gap in port
numbers.

Finally, rustfmt seems to have ignored specific files arguments,
running on everything.
2017-10-31 19:42:56 -04:00
Yeastplume
e45593b1db Sumtree mmap fix (#217)
* fix mmap error with version 0.6.0, and change reference to include tag
2017-10-30 12:43:49 -04:00
Yeastplume
8f76746e84 Switch commitments (#179)
* Adding switch commit to grin outputs
* logging output fix
* adding switch commitment hash to sum tree node
* added hash_with to Hashed trait, to allow for hashing to include another writeable element
* adding hash_with as method in hashed trait
2017-10-16 21:23:10 +00:00
Yeastplume
49797853d9 tweaks to logging configuration (#176)
* tweaks to logging configuration
* doc port update
2017-10-13 16:42:04 +00:00
Yeastplume
8e382a7593 slog-rs logging (#171)
* added global slog instance, changed all logging macro formats to include logger instance
* adding configuration to logging, allowing for multiple log outputs
* updates to test, changes to build docs
* rustfmt
* moving logging functions into util crate
2017-10-12 16:56:44 +00:00
Ignotus Peverell
6b4f2a63da
Store test for sumtree rewind 2017-10-02 22:32:45 +00:00
Ignotus Peverell
8504efb796
Cargo fmt all the things 2017-09-29 18:44:25 +00:00
Ignotus Peverell
0a57258d42
Fix #144 with platform specific import. Add store crate to CI 2017-09-29 18:09:44 +00:00
Ignotus Peverell
36bcd3cc39 Integrate sum trees with the rest of the system (#116)
* Integrate PMMR and its persistent backend with the Chain
* Chain can set tree roots; PMMR backend discard
* Check spent and prune for each input in new block
* Handling of forks by rewinding the state
* More PMMR tests and fixes, mostly around rewind
* Rewrite get_unspent to use the sumtrees, fix remaining compilation issues
2017-09-27 23:46:32 +00:00
Ignotus Peverell
405a4bc985 Prunable MMR storage (#112)
* Base MMR storage structures

Implementations of the MMR append-only file structure and its
remove log. The append-only file is backed by a mmap for read
access. The remove log is stored in memory for quick checking
and backed by a simple file to persist it.
* Add PMMR backend buffer, make PMMR Backend mutable
* The Backend trait now has &mut self methods, and an &mut
reference in PMMR. This simplifies the implementation of all
backends by not forcing them to be interior mutable. Slight
drawback is that a backend can't be used directly as long as it's
used by a PMMR instance.
* Introduced a buffer in the PMMR persistent backend to allow
reads before the underlying files are fully flushed. Implemented
with a temporary VecBackend.
* Implement a prune list to use with dense backends
The PruneList is useful when implementing compact backends for a PMMR (for
example a single large byte array or a file). As nodes get pruned and
removed from the backend to free space, the backend will get more compact
but positions of a node within the PMMR will not match positions in the
backend storage anymore. The PruneList accounts for that mismatch and does
the position translation.
* PMMR store compaction
Implement actual pruning of the underlying PMMR storage by
flushing the remove log. This triggers a rewrite of the PMMR nodes
data (hashes and sums), removing pruned nodes. The information of
what has been removed is kept in a prune list and the remove log
is truncated.
* PMMR store pruning tests and fixes
2017-09-05 05:50:25 +00:00
AntiochP
3b4a48b2fd Cleanup build warnings (#87)
* minor cleanup - unused imports
* cleanup build warnings - unused vars
* make structs pub to get rid of the private_in_public lint warning
* missing docs on RangeProof
* add missing docs to store delete function
* cleaned up deprecation warning -
tokio_core -> tokio_io
complete() -> send()
2017-08-10 00:54:10 +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
eb11b14cab
Minor warning cleanup in core
Remove some unused import and add missing docs.
2017-07-20 14:22:40 +00: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
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
11c0d67805
Revert "Delegate Block Encoding to Store (#44)"
This reverts commit 8ffc0c6f8e.
2017-05-31 15:49:15 -07:00
Ignotus Peverell
40d23db6c1
Revert "[WIP] Partial Transition from Writeable/Readable to Codecs (#51)"
This reverts commit de4ebdde71.
2017-05-31 15:47:52 -07:00
Jacob Payne
de4ebdde71 [WIP] Partial Transition from Writeable/Readable to Codecs (#51)
* Sample Signatures for put_enc and get_dec
* Implement put_enc and get_dec
* Implement ChainCodec in grin_chain
* Truncate src only on complete Blocks
* Truncate src only on complete Tip + Check Len
* Move BlockHeader Encoding to BlockHeaderCodec
* Define put_enc for store::Batch
* Replace BlockCodec and BlockHeaderCodec with generic BlockCodec<T>
* Implement Default for BlockCodec Manually
* Replace get_ser/put_ser with get_enc/get_dec for chain::ChainKVStore
* Remove Writeable/Readable for chain::Tip
* Add Tokio-io and Bytes to grin_p2p
* Additional Setup for Message enum + Msg{Encode,Decode} traits
* base msg ping pong encoding and test
* fill out msg-codec tests
* Implement Hand Encoding/Decoding
* msg-encode shake
* msg-encode getpeeraddr
* codec peer-addrs message, SockAddr struct wierdness
* header message codec
* msg encoding finished prelim
* Implement PeerCodec Encoding/Decoding
* Set PeerStore to use PeerCodec for Encoding/Decoding
* Add a DecIterator
* Prune PeerStore
* Replace Decoding and Encoding in handle_payload
* Prune Writeable/Readable methods in store::Store
* Remove Incomplete Frame Testing ( Not Nessesary right now )
* separate block and tx codec tests
* Refactor {Tx,Block}Codec Tests
2017-05-22 19:16:13 +02:00
Jacob Payne
8ffc0c6f8e Delegate Block Encoding to Store (#44)
Builds codecs to encode and decode blocks, block headers, transactions, kernels, etc. Will be used by the store and peer-to-peer layer for serialization, but also to compute hashes. Separates out serialization from core.
2017-05-03 10:27:38 -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
d900f0b934
P2P server cleanup of disconnected peers. Mark those that don't respect the protocol as banned. 2017-02-27 14:17:53 -08:00
Ignotus Peverell
eb024e91d2
Discovery and seeding of other peers. Relies either on a gist with IP addresses or a static list. Connects to a first list, sending peer request messages to discover more. Monitor the server to make sure there's always enough peer connections. 2017-02-18 18:42:34 -08:00
Ignotus Peverell
85edf57366
Iterator for Readable impls stored in DB. 2017-02-09 20:15:22 -08:00
Ignotus Peverell
7ee408e067
Moved down to the store module some common persistence code. 2017-02-09 11:41:46 -08:00
Ignotus Peverell
426f4e9d6b
Added support for batched writes. Updated to rocksdb 0.6.0. 2017-02-04 11:10:07 -08:00
Ignotus Peverell
e688ff99e6
Started putting in place the adapter between the chain and p2p modules to forward blocks and transactions. Cleaned up chain store references. 2016-12-18 15:51:54 -08:00
Ignotus Peverell
1e5ff0eeff
Integration of target calculation with header validation and pow. Enforce strictly progessing time. 2016-11-16 17:03:23 -08:00
Ignotus Peverell
1d2b23a4a5
Several simple fixes to reflect changes from core (Result instead of Option for errors, consensus module, etc.) 2016-11-15 17:29:42 -08:00
Merope Riddle
9644fb6a73 Add apache 2.0 license header to all source files 2016-10-23 13:20:39 +00:00
Ignotus Peverell
f73a308bf3
Initial import. 2016-10-20 20:06:12 -04:00