Commit graph

736 commits

Author SHA1 Message Date
Simon B
765996a630 rustfmt install instruction gotcha (#663)
* rustfmt install instruction gotcha

rustfmt stopped working for me. It turns out people started having trouble with this last year already https://github.com/rust-lang-nursery/rustfmt/issues/2304

* rustfmt on a single file now works! Secrets inside

After `rustup component add rustfmt-preview` I get rustfmt as a command in my terminal.

`rustfmt --help` reveals --write-mode [replace|overwrite|display|plain|diff|coverage|checkstyle] and we've been using the default which is either `overwrite` or `replace` (depending on rustfmt version) and this was changing a bunch of files and a messed up workflow.

* Newcomer-friendly explanation how to use `rustfmt`
2018-01-30 08:36:18 -05:00
Antioch Peverell
5dce526f90
fix bug - p2p store was ignoring port numbers (#657) 2018-01-29 09:45:01 -05:00
Matthew Slipper
d754b8d1e4 Fix #566: serialize commit to hex (#574)
* Fix #566: Use serdes to serialize commit to hex

* Add printable UTXO
2018-01-29 09:36:09 -05: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
Yeastplume
783e4c250d
[WIP] Difficulty Adjustment Updates (#651)
* large updates for mining, fix async mode, will list changes in PR

* reset config and build defaults

* change to difficulty calculations

* tweaking mining params and tests

* tweaking to tests

* including pre-genesis data for difficulty adjustments, adding adjustment scenario tests

* further clarifying next_difficulty function

* moving tests out of consensus.rs

* pow test fix

* changing pre-genesis generation
2018-01-27 07:48:53 +00:00
Antioch Peverell
84128964fa Add test to cover case where a block has no coinbase outputs or kernels (#656) 2018-01-26 22:35:58 +00:00
Antioch Peverell
5a7d22977e
refactor/rework key derivation (#652)
seed -> ext_key -> many child_keys
2018-01-25 15:19:32 -05:00
Yeastplume
2def215553 Master port #605 (#606)
* port of stack overflow fix from testnet to master
* update process_block to encapsulate orphan check workflow
2018-01-24 18:20:34 +00:00
Morten Brøns-Pedersen
8710d52797 print default --key_derivations only once (#650)
Since the default value is also embedded in the help string it appears twice in the output from `grin wallet help`.  This PR just removes the default from the help string.
2018-01-23 18:37:56 +00:00
AntiochP
4be259e0de
hashed switch commitments - BLAKE2(bJ, r) (#648)
* wip

* derive switch commit hash key from extended key in wallet

* fix failing pool test
2018-01-23 07:14:06 -05:00
AntiochP
92d0fc3c08 Add block validation consensus rule for block coinbase output (#647)
and kernel counts
2018-01-22 20:55:27 +00:00
AntiochP
ba4c450d2f
coinbase output(s) and kernel(s) always full in compact block (#641)
all other tx inputs/outputs/kernels can be reduced to their short_ids
2018-01-19 22:29:48 -05:00
AntiochP
9085e548f7
ShortId implementation (and CompactBlock) (#637)
* [wip] short_id implementation (first attempt)
todo - make this more reusable (a trait?) so we can use it for inputs/outputs/kernels easily

* factor short_id support out into ShortIdentifiable trait

* block can now be converted to compact_block
rename existing block.compact() -> block.cut_through()

* expose compact block representation via block api endpoint
optional with ?compact query param
2018-01-19 17:43:02 -05:00
Yeastplume
f9726e8154
Mining/POW Updates (#639)
* large updates for mining, fix async mode, will list changes in PR

* reset config and build defaults
2018-01-19 17:48:18 +00:00
AntiochP
916d9cce57
Revert "move siphash out of pow and into util" (#635)
* Revert "move siphash out of pow and into util (#633)"

This reverts commit dae90543c2.
2018-01-18 19:53:53 -05:00
Simon B
885c2d73ea Making initial sync easier on the eyes [master] (#623)
* Making initial sync easier on the eyes:
- display "chain pointers" as: cumulative @ height [hash]
- clarify and line up to make the "pointers" easy to compare
- make every 100th block show info on debug level info, else as before
2018-01-18 22:47:42 +00:00
AntiochP
6b0f1fc20e
summing two sum_commits rolls the switch commit hashes up (#634) 2018-01-18 17:25:10 -05:00
Quentin Le Sceller
911aadf8b4 Fix #439 Temporary peer banning (#631)
* Fix #439 Temporary peer banning
2018-01-18 18:39:56 +00:00
AntiochP
dae90543c2 move siphash out of pow and into util (#633)
we are going to use this for generating short ids
2018-01-18 18:29:44 +00:00
AntiochP
f1bbf5370e
add switch_commit_hash back into sum_commit (#630) 2018-01-18 10:53:54 -05:00
Casey Rodarmor
81c41449d5 Remove redundant key_derivations value (#629) 2018-01-18 07:26:11 -05:00
Casey Rodarmor
4ece454c67 Fix inconsistent key_derivations default in help string (#628) 2018-01-18 07:25:54 -05:00
AntiochP
bbdd4a91ce
rework WalletData and OutputData serialization so we serialize block hashes cleanly in wallet.dat (#625) 2018-01-17 11:25:34 -05:00
AntiochP
cbd3b2ff87
hash (features|commitment) in output mmr (#615)
* experiment with lock_heights on outputs

* playing around with lock_height as part of the switch commitment hash

* cleanup

* include features in the switch commit hash key

* commit

* rebase off master

* commit

* cleanup

* missing docs

* rework coinbase maturity test to build valid tx

* pool and chain tests passing (inputs have switch commitments)

* commit

* cleanup

* check inputs spending coinbase outputs have valid lock_heights

* wip - got it building (tests still failing)

* use zero key for non coinbase switch commit hash

* fees and height wrong order...

* send output lock_height over to wallet via api

* no more header by height index
workaround this for wallet refresh and wallet restore

* refresh heights for unspent wallet outputs where missing

* TODO - might be slow?

* simplify - do not pass around lock_height for non coinbase outputs

* commit

* fix tests after merge

* build input vs coinbase_input
switch commit hash key encodes lock_height
cleanup output by commit index (currently broken...)

* is_unspent and get_unspent cleanup - we have no outputs, only switch_commit_hashes

* separate concept of utxo vs output in the api
utxos come from the sumtrees (and only the sumtrees, limited info)
outputs come from blocks (and we need to look them up via block height)

* cleanup

* better api support for block outputs with range proofs

* basic wallet operations appear to work
restore is not working fully
refresh refreshes heights correctly (at least appears to)

* wallet refresh and wallet restore appear to be working now

* fix core tests

* fix some mine_simple_chain tests

* fixup chain tests

* rework so pool tests pass

* wallet restore now safely habndles duplicate commitments (reused wallet keys)
for coinbase outputs where lock_height is _very_ important

* wip

* validate_coinbase_maturity
got things building
tests are failing

* lite vs full versions of is_unspent

* builds and working locally
zero-conf - what to do here?

* handle zero-conf edge case (use latest block)

* introduce OutputIdentifier, avoid leaking SumCommit everywhere

* fix the bad merge

* pool verifies coinbase maturity via is_matured
this uses sumtree in a consistent way

* cleanup

* add docs, cleanup build warnings

* fix core tests

* fix chain tests

* fix pool tests

* cleanup debug logging that we no longer need

* make out_block optional on an input (only care about it for spending coinbase outputs)

* cleanup

* bump the build
2018-01-16 22:03:40 -05:00
AntiochP
7e7c8e157e
coinbase maturity and output lock height docs (#597)
* wip - coinbase maturity and output lock height docs

* tbd spend an output

* expand on how we prove ownership of an output to spend it

* add proposed solution

* fixup output hash description
2018-01-16 07:46:49 -05:00
Quentin Le Sceller
f067e142f7 Add ban/unban in grin client (#620)
* Added ban/unban in grin client
2018-01-16 01:44:03 +00:00
Yeastplume
9704cc35bd Aggsig Serialization (#618)
* changing ser of aggsig signature
* serialise Signature as raw 64 bytes
* remove compact sig
* remove to_compact
* remove unused import
2018-01-15 20:45:26 +00:00
Casey Rodarmor
41d4978d46 Fix code of conduct typo: adapter -> adapted (#614) 2018-01-15 20:26:12 +00:00
Simon B
40bc3386d5 User experience ux1 (#610)
* better error messages when `wallet restore` fails
* wallet info: show height, and where we got the height number from
* make "grin wallet listen" show some more lifesigns, so users can know it's running fine
2018-01-13 18:27:40 +00:00
Simon B
bff92128e7 Clarify error message for wallet info when server refresh fails. Better about text for wallet help restore (#608) 2018-01-12 20:08:18 +00:00
Simon B
d28f37d5b3 Coin selection cleanups (#607)
* coin selection (cleanup):
  - rename `selection_strategy: bool` and `default_strategy: bool`
  - use `selection_strategy_is_use_all` outside, and `use_all` inside wallet types (narrowly escaping rustfmt!)
2018-01-12 20:05:57 +00:00
Simon B
8b2f9503c9 Make total_difficulty the sum of network difficulty [testnet2] (#523)
* Make total_difficulty the sum of network difficulty, not whatever the miner happened to mine.
  - Only for Testnet2 / Mainnet (hardforks Testnet1)
  - update chain::pipe validate_header to validate according to Testnet2 rules for cumulative difference

Fixes #280

* tests that should ignore (network) difficulty

* fn new_block is explained as "utility to create a block without worrying about the key or previous header" so it gets network difficulty := 0 too

* update tx pool tests (going with "minimum" for network difficulty for now)

* add ERR outputs about bannable offences
(#406 should know about these)

* whitespace fix

* mine_simple_chain: Probably DON'T overwrite difficulty (?)

* core/mod tests "reward_empty_block" and "reward_with_tx_block" tests set to use lowest network difficulty possible
2018-01-12 18:35:37 +00:00
Heung B Lee
5edc63f617 [wallet] panic: 'attempt to subtract with overflow' when sending small quantities #396 (#603)
* Fund calculation inconsistent (#582)

* [wallet] panic: 'attempt to subtract with overflow' when sending small quantities (#396)
2018-01-12 12:44:15 +00:00
Brian Anderson
31f91dc487 Minor edits to FAQ (#602)
* Fix markup in faq

* faq: 'level 2' -> 'layer 2'

* faq: 'waller' -> 'wallet'

* Fix markup in TOC
2018-01-12 09:43:31 +00:00
Quentin Le Sceller
cbc40c9824 Update ``grin client status`` (#599)
* Add status type
* Add /v1/status handler
* Updated client for API::Status type
* Remove unused dependency
* Moved user agent up
2018-01-11 05:25:48 +00:00
Heung B Lee
ac5010e8f7 Fund calculation inconsistent (#582) (#595) 2018-01-10 23:05:06 +00:00
Ignotus Peverell
bc171a4423
A bit more doc on pruning and validation 2018-01-10 19:57:47 +00:00
Yeastplume
1199ed2cc1
[WIP] Aggsig Transactions (#530)
* First steps converting transaction workflow to be aggsig-enable

* integrating updated version of aggsig, which gives greater control over the contents of e

* added wallet transaction test to testing framework to enable testing the whole thing, completed interaction as far as inital response from recipient

* more aggsig work, final signature is produced now

* Construction of aggsig transaction now working to the point of the signature being built

* aggsig transactions working end-to-end in the nominal case

* refactor aggsig verify from commit and fix some tests

* more cleanup and test fixing

* cleaning up automated tests

* test+formatting fix
2018-01-10 19:36:27 +00:00
Ignotus Peverell
6a9a584c43
Fix pruning of last PMMR leaf, additional tests
Due to the construction of PMMRs the last element, when its a leaf,
can never be pruned as it has no parent yet and it will be needed
to calculate that hash. To work around this, we now insert coinbase
outputs first to add at least one output of padding.

Also changed the `set_sumtree_root` function on chain a bit to allow
setting the roots on a fork. Mostly useful for tests.

Added new test case to handle both the issue above and spending
transactions within a fork.
2018-01-08 01:23:23 +00:00
Ignotus Peverell
7f52b6c361
Minor: move fork setup out of pipe block validation 2018-01-07 19:01:17 +00:00
Ignotus Peverell
a7044307f2
One grin per second, fixes #569 2018-01-07 04:21:50 +00:00
Ignotus Peverell
7e86e76787
Remove reserved output on wallet receive failure 2018-01-07 03:57:38 +00:00
AntiochP
33c8e73403
maintain switch_commit_hashes in the output pmmr (not used yet) (#583) 2018-01-06 22:18:12 -05:00
Ignotus Peverell
3515bf748c
Improved receive error handling
Better errors and messages returned by the push tx API. And better
message in the command line receive. Fixes #585
2018-01-06 23:27:21 +00:00
Ignotus Peverell
abcecd82c1
Improved error handling in mining thread. Fixes #539 2018-01-06 22:34:06 +00:00
percytheprefect
a69b5af7c2 Adding kcov code coverage to chain and core modules (#547)
Fixing bug in .yml file. Adding cargo test --no-run command to after_success. Adding test coverage to rest of grin modules.
2018-01-06 20:54:46 +00:00
Quentin Le Sceller
7212a0e743 Fix #321 Limit length of API utxo queries (#579)
* Limit url length #321

* Formatting with rustfmt

* Typo
2018-01-05 16:03:53 -05: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
1c3034b17f Fix typo ''atheight'' instead of ''byheight'' in utxo handler (#577)
* Fix typo atheight instead of byheight in utxo handler

* Change atheight to byheight
2018-01-04 10:39:30 -05:00
Quentin Le Sceller
c8383dac93 Add POST peers/a.b.c.d/unban in REST API (#571)
Add unban peer in rest API and clean TODO
2018-01-04 03:25:14 +00:00