Commit graph

563 commits

Author SHA1 Message Date
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
yeastplume
c805f67020 adding clang dependency to build doc 2018-01-03 10:14:59 +00:00
Matthew Slipper
e83e696a6f Fix #506 - use OS-assigned port in peer_handshake (#570) 2018-01-03 01:53:50 +00:00
udiWertheimer
23e045d9b7 Add another rocksdb compile error fix to FAQ entry (#565)
On Fedora, Linux headers aren't enough to build `rocksdb`, as suggested in #549. `clang` is also required. Adds note to troubleshooting to help with this.
2018-01-03 01:05:56 +00:00
Quentin Le Sceller
7b13b25782 Add GET peers/a.b.c.d handler in REST API (#564)
* Change name of get_peer to get_connected_peer and add a get_peer method with store
* Change to get_connected_peer
* Added handler for GET peers/a.b.c.d
2018-01-03 01:03:44 +00:00
Harm Aarts
dc3a2113bd Add rocksdb compile error help (#563)
* Add minor document fixes

- fix broken link
- fix shell command formatting
- fix typo

* Add FAQ entry dealing with rocksdb

When compiling Grin without Linux headers the build process exits with
an opaque error message. Adding the header files fixes this.

References #549.
2017-12-31 21:47:26 +00:00
yeastplume
f08d386790 semversion regex dependency, as rocksdb build was failing as a result 2017-12-31 10:35:23 +00:00
AntiochP
30c20294f5
reset header_head and sync_head on peer ban (#551) (#553)
handle orphan blocks based on age (not fixed count)
2017-12-28 19:49:27 -05:00
Quentin Le Sceller
2057525251 Bump RocksDB to ^0.8.0 (#555) 2017-12-28 15:25:01 -05:00
AntiochP
2450ff376b
reset sync_head on restart (#546) (#550)
* reset sync_head on restart (handle banned peers and sync against invalid chain)

* reset both sync_head and header_head on restart
2017-12-27 19:09:11 -05:00
Daniel Tsui
521678bd23 Add kcov support (#545)
* Adding kcov code coverage to chain and core modules
* Adjust travis.yml to wget kcov from mimblewimble org
* Add codecov badge to README.md
* Fix repo name in badge to grin, from kcov
2017-12-27 02:09:10 +00:00
Ignotus Peverell
da4b349d49
Fix AlreadySpent when UTXO created and spent on fork
When applying a fork, everything is done in memory to be able to
rewind if it's either invalid or doesn't have more work. But
checking for the UTXO index was done only against the store. Now
checking the memory as well to find UTXOs that haven't been
stored yet.
2017-12-25 00:32:39 +00:00
Ignotus Peverell
707a2073a5
Fix is_unspent to consider MMR and not only index
The method `is_unspent` hadn't been fixed with the other sumtree
functions to check the MMR before deciding whether something is
really unspent. This is now fixed and also checks the output
hash is the one we expect.
2017-12-25 00:31:51 +00:00
Quentin Le Sceller
2dac10a690 Display chain status with grin client status (#543)
* Add term and grin_p2p for grin client

* Setting msg as public for the client

* Specifying binary for cargo build

* Minimal client implementation

* Using server configuration for the client

* Display current chain height

* Display difficulty and last block pushed

* Remove unneeded secp256k1 dependency
2017-12-22 18:46:28 +00:00
AntiochP
4ba453694d
fix - sort tx inputs/outputs (#533) (#542)
* added debug logging to see what we're doing in save_pos_index

* add counts to logging

* make sure inputs/outputs in tx are sorted
tweak debug logging

* DRY up sorting of inputs/outputs/kernels via a simple sort() in ser/deser

* add explicit validation fo sort order during tx and block validation

* sort order consensus rule for inputs/outputs/kernels in blocks

* we want a max of 10*num_peers blocks during sync...
not min

* fix test imports
2017-12-22 12:15:44 -05:00
AntiochP
9ddb1489a5
Smarter orphan blocks (#537)
* wip

* rework check_orphans to be smart about _which_ orphan(s) to check

* cleanup

* limit max of 100 blocks at a time, and corresponding 100 max orphan blocks
2017-12-21 17:29:24 -05:00
Ignotus Peverell
74ba0d5e88
Fix small typo and remove traling spaces at PoW docs (#534)
Fix small typo and remove traling spaces at PoW docs
2017-12-21 19:32:43 +00:00
AntiochP
f8bb55a086
fixup error handling in wallet restore (was failing when unable to recover amount) (#526) (#527) 2017-12-20 17:16:40 -05:00
Ignotus Peverell
c5a055db1e
Merge pull request #528 from antiochp/git_commit_hook_fix
fix the bash array loop
2017-12-20 20:51:31 +00:00
antiochp
121cce7e51
fix the bash array loop 2017-12-20 15:37:23 -05:00
AntiochP
6ff4b41f2e
100_000 keys max in a wallet (was 10_000) and someone maxed this out... (#520) 2017-12-18 20:33:44 -05:00
AntiochP
ea752d509b
fix build warning about unreachable code (#519) 2017-12-18 20:33:27 -05:00
AntiochP
b37820bd40
broadcast all accepted blocks, main chain or fork (#515) (#517)
tweak logging to be more consistent
2017-12-18 16:18:36 -05:00
Simon B
99186e90f0 better error messages + some cleanup (#497)
* distinguish select (among futures) from select coins. Regex search in project for select\b shows we hardly use select, but maybe could use it to add timeouts more cleanly. ("Want to add a timeout to any future? Just do a select of that future and a timeout future!" from https://aturon.github.io/blog/2016/08/11/futures/)

* remove a trailing space

* FAQ.md - fix typo

* wallet: display problematic tx

* update FAQ build troubleshooting to cover #443

* stdout_log_level = Info
file_log_level = Debug

* sync: show total diff @ height when syncronization is completed

* better wallet send dest format error

* move INFO "Client conn ... lost" and "Connected to peer" down to Debug

* move some level=Info to Debug, add 1000-block outputs
2017-12-18 08:17:11 -05:00