Commit graph

588 commits

Author SHA1 Message Date
Jeremy Rubin
d4540f32a3 refactor: use sort_unstable instead of sort, more efficient with_* methods for TransactionBody (#2564) 2019-02-14 11:01:54 +00:00
hashmap
5d904250d5 Use failure for Pool and Committed errors (#2570)
It doesn't play nice with failure-based error management, we have to
throw away an exisiting error and create a new one (failure-based)
2019-02-13 09:33:25 -08:00
Yoni Svechinsky
ee4eed71ea Feature/slate serialization (#2534)
* - Add backwards compatability
- Add hex serialization

* rustfmt

* rustfmt

* Windows Compatibility Fixes #1 (#2535)

* initial changes for windows build and unit/integration tests

* rustfmt

* wallet+store tests

* rustfmt

* fix linux daemonize

* better encapsulate file rename

* rustfmt

* remove daemonize commands

* rustfmt

* remove server start/stop commands

* add ability to drop pmmr backend files explicitly for txhashset unzip

* rustfmt

* fix pmmr tests

* rustfmt

* Windows TUI Fix (#2555)

* switch pancurses backend to win32

* revert changes to restore test

* compatibility fix + debug messages

* rustfmt

* Add content disposition for OK responses  (#2545)

* Testing http send and fixing accordingly

* add repost method into wallet owner api (#2553)

* add repost method into wallet owner api

* rustfmt

* Add ability to compare selection strategies (#2516)

Before tx creation user can estimate fee and locked amount
with different selection strategies by providing `-e` flag for
`wallet send` command.
2019-02-13 13:29:44 +00:00
Jeremy Rubin
563c674700 refactor: reserve capacity in aggregate (#2568) 2019-02-13 11:41:29 +01:00
John Tromp
91cca2bf61 test: add CuckAToo31 solution test (#2552)
add CuckAToo31 solution test
2019-02-12 19:10:17 -05:00
Yeastplume
15c7a270eb
Windows Compatibility Fixes #1 (#2535)
* initial changes for windows build and unit/integration tests

* rustfmt

* wallet+store tests

* rustfmt

* fix linux daemonize

* better encapsulate file rename

* rustfmt

* remove daemonize commands

* rustfmt

* remove server start/stop commands

* add ability to drop pmmr backend files explicitly for txhashset unzip

* rustfmt

* fix pmmr tests

* rustfmt
2019-02-09 21:14:27 +00:00
Jeremy Rubin
c1045842f5 refactor: use less memory in verifier_cache by storing zero-sized type instead of bool 2019-02-06 14:37:19 -08:00
Yeastplume
e69ce5ad82
Move slate code from core/libtx to wallet/libwallet (#2533)
* move slate from core to wallet crate

* rustfmt
2019-02-05 23:02:00 +00:00
David Burkett
c1d67cbec0 perf: Removing unnecessary array copy. (#2531) 2019-02-05 07:54:20 +01:00
Ignotus Peverell
c41ea4bcf2
Feature/slate version (#2491)
* Add a slate version field
* Move current slate version to constant
* Change slate version to uint
* Add default 0 incase it's missing (pre-versioning)
2019-02-01 11:17:54 -08:00
Antioch Peverell
19ce9cc28e
bump for v1.0.1 (#2511) 2019-02-01 14:43:18 +00:00
Antioch Peverell
a82e2a0126
Rework "bucket transactions" logic (buckets are now weight limited) (#2487)
* rework bucket txs

* introduce max_block_weight to global (based on chain_type)
not yet in use anywhere...

* now using global::max_block_weight() everywhere

* testing max_block_weight needs to be big enough to cover existing chain tests...

* add some test coverage for prepare mineable transactions at the block weight limit
introduce AsLimitedTx{max_weight} so we can build artifically small blocks (per mining config)

* cleanup

* default_mineable_max_weight is just the default max_block_weight
we do not need to account for coinbase reward here (tx vs block)

* 75 change outputs in a test is not valid now that we have a low block weight limit...
2019-02-01 10:44:04 +00:00
Yoni
1f7d3c6dc7 - Change slate version to uint
- Add default 0 incase it's missing (pre-versioning)
2019-01-31 16:25:57 +02:00
Yoni
e505726d73 Merge remote-tracking branch 'upstream/master' into feature/slate-version 2019-01-31 15:52:39 +02:00
Yeastplume
0c851c5140
Save slate participant messages in database (#2441)
* Save and display optional slate messages

* rustfmt

* fixes and test updates

* rustfmt

* output json

* rustfmt

* add better serialisation of slate message, rename to secp_ser, add tests for serialization functions

* rustfmt

* max length for message enforced by API

* rustfmt
2019-01-31 11:55:34 +00:00
Antioch Peverell
422db82667
no is_mainnet() to keep tests close to mainnet (#2496) 2019-01-31 09:23:19 +00:00
Yoni
569d7a3220 Move current slate version to constant 2019-01-30 10:26:23 +02:00
Yoni
99dda19f5e rustfmt 2019-01-30 10:19:52 +02:00
Yoni
a33502c108 Add a slate version field 2019-01-30 10:19:41 +02:00
Antioch Peverell
d1de3b0d6e default our chain type to mainnet (already doing this via config file) (#2485) 2019-01-29 20:09:30 -08:00
Antioch Peverell
c8fd0575ed Pool tx weight verification (#2466) 2019-01-25 12:48:15 -08:00
hashmap
2e22e2c6ec
Merge pull request #2465 from sesam/catchingClippy
Catching clippy
2019-01-24 22:00:34 +01:00
Yoni Svechinsky
a523f82820 Add hex serialization functions (#2436)
* Change slate seralization to hex

* rustfmt

* Comment out serde directives
Move serialization functions into a seperate module

* Remove commented code
2019-01-24 13:18:13 +00:00
Simon B
0d606c0356 clippy says: fn new should usually return self <-- I picked ignore, since this is test code waiting to be moved. And likely also renamed from "new" to maybe "new_mock_block" to make sure nobody finds it and wants to use it to build a non-test block 2019-01-24 01:59:20 +01:00
Simon B
9335f11c6c clippy says: unreadable literal, please use a lot of _ everywhere (!!!) or ignore <-- picking ignore 2019-01-24 01:56:04 +01:00
Simon B
dda8497d54 clippy says: avoid needless "1 *"
clippy says: make operator precedence explicit
2019-01-24 01:53:36 +01:00
Antioch Peverell
f8aab05d76 Use weight_as_block for quick weight check (#2443) 2019-01-22 08:55:36 -08:00
eupn
8badb58665 Cleanup genesis.rs a bit (#2390) 2019-01-15 18:37:17 -08:00
Ignotus Peverell
e7485ab5f1
Version bump to 1.0.0 2019-01-15 16:24:29 +00:00
Ignotus Peverell
8fc489a808
Finalized mainnet genesis block 2019-01-15 15:27:51 +00:00
Ignotus Peverell
6bb611a2f0
Fix spurious change added by git merge 2019-01-14 20:19:17 +00:00
Ignotus Peverell
224a26faed
Mainnet enablement
1. Remove the exit guarding running a node in mainnet mode.
2. Set initial difficulty in genesis.
2019-01-14 20:07:10 +00:00
Ignotus Peverell
49612543d4
Merge remote-tracking branch 'upstream/master' 2019-01-14 19:54:44 +00:00
Ignotus Peverell
d7be94fafb
More range proof tests (#2373)
Trying to cheat with range proofs to make sure it still fails at
the block level. Defense in depth, belt and suspenders and all that
good stuff.

* rustfmt

* Revert bad carry-over
2019-01-14 10:15:42 -08:00
Ignotus Peverell
ba994248ac
Prevent reward overflow (#2372)
* Prevent reward overflow

Without this, a miner could cause a crash by including a kernel
with an insane fee directly in the block.

* Plus and minus, not so similar

* Can't be trusted with more code today
2019-01-14 09:37:34 -08:00
Ignotus Peverell
bfd0613275
Plus and minus, not so similar 2019-01-14 06:30:52 +00:00
Ignotus Peverell
e3a1c2c6b1
Fix/serializing hash (#2355)
* Remvoe 3 dots from hash formatting
* Move 3 dots to the TUI
* Add backwards check
* Add triple dot to check_and_remove_files + typo
2019-01-12 13:07:03 -08:00
John Tromp
762da8c491 Fix bug that crashes network with probability 2^-64 (#2358) 2019-01-12 10:41:22 -08:00
Yoni
2873d14a98 Remvoe 3 dots from hash formatting 2019-01-12 17:19:30 +02:00
Ignotus Peverell
60d3ee3c44
Bump version to 0.5.2 for release 2019-01-11 01:26:30 +00:00
Simon B
950fa0e496 Cleanup compiler warnings (#2323)
* cleanup compiler warnings
* allow(dead_code) in tests/{framework,simulnet}
2019-01-10 12:18:25 -08:00
Eugene P
94974ec19a Strip hash in fmt::Debug and use fmt::Debug for fmt::Display 2019-01-10 13:01:45 +03:00
Eugene P
bc7b701de3 Show full hex string of hash in fmt::Debug for core::Hash 2019-01-10 12:55:10 +03:00
Eugene P
faff529260 Show first 12 digits of Hash 2019-01-10 12:39:47 +03:00
Eugene P
b4e4992a5c rustfmt 2019-01-10 12:30:21 +03:00
Eugene P
29fc3e61de Implement fmt::Display for core::Hash 2019-01-10 12:30:10 +03:00
Ignotus Peverell
1806ee34f5
Off by one 2019-01-08 22:43:33 +00:00
Ignotus Peverell
5caddc01db
Enforce zeroing of serialized proof excess bits 2019-01-08 19:18:44 +00:00
Antioch Peverell
27801f6a93
Implement kernel and output features as enums (#2312)
* use enums for kernel and output features

* rustfmt

* add test coverage around deserializing kernel features
2019-01-08 16:07:38 +00:00
Ignotus Peverell
2c5ba853f7
Version bump to 0.5.1 2019-01-07 19:41:07 +00:00
hashmap
3b4492495f
Check if message in slate comes with signature (#2284)
Fixes #2281
2019-01-03 13:05:23 +01:00
Elichai Turkel
f2a29ce37a Optimizing the code and making it more idiomatic (#2269) 2019-01-01 15:29:16 -08:00
Gary Yu
dbf8e97b3f
fix 2 minor build warning (#2260) 2018-12-30 20:03:36 +08:00
Ignotus Peverell
9bf2c7fb5e
Test cleanup 2018-12-29 02:00:44 +00:00
Ignotus Peverell
9234e3c251
Re-launch floonet (#2249)
*  Fix secondary scaling bugs;  rename is_testnet -> is_floonet (#2215)
* add global::is_mainnet()
* use it to change pre-genesis pow type
* rename is_testnet -> is_floonet
* Support multiple chain configurations (#2217)
* Support multiple chain configurations
Supports generating the proper configuration for each chain type
(mainnet, floonet, usernet). Will run them by default under
their respective root directory (~/.grin/main, ~/.grin/floo, etc).
Assigned default ports for mainnet, overriding them to keep Floonet
ports unchanged.
For now, starting on mainnet will abort.
* Fixed usernet command line help message. Fixes #2217
* Differing magic numbers for each chain type (#2208)
* stick to e=H(R|P|m) when use schnorr signature (#2200)
* stick to e=H(R|P|m) when use schnorr signature
* (1)add verify_slate_messages for wallet receive (2)log the message content
* remove debug log on verify_slate_messages
* verify the sender's message signature when receive_tx in wallet listen
* Revert "remove debug log on verify_slate_messages"

This reverts commit 65ea32a407.

* Revert "rustfmt"

This reverts commit c380ab9185.

* Revert "(1)add verify_slate_messages for wallet receive (2)log the message content"

This reverts commit 9584ca7a89.

* [re-floonet] Keychain Floonet BIP32 version/network option (#2235)

* add 'is_floonet' property to keychain
* fix hex encoding and tests

* Fix couple floonet loose ends (#2230)

* Fix couple floonet loose ends. Fixes #2216
* Doc fix for sig message

* Refuse unkown kernel features (#2244)

* Minor: magic number change for re-floonet

* Set pre genesis is_secondary to true (#2247)

* Minor: tx validation error display underlying

* New floonet genesis

* genesis rustfmt

* Use chain-specific config for wallet toml gen

* Fix default wallet_listener_url

* New more reasonable genesis block, bumped version

* genesis rustfmt

* Couple minor fixes to genesis generation script
2018-12-28 14:46:21 -08:00
Gary Yu
45ca7cff79
verify message signature on wallet (#2203)
* add verify_slate_messages for wallet receive

* log the message content

* rustfmt

* verify the sender's message signature when receive_tx in wallet listen

* verify the sender's message signature when send by keybase
2018-12-23 07:25:02 +08:00
Ignotus Peverell
7a52c0ecd5
Revert "Verify features in one place; comment on needed Features enum type (#2191)"
This reverts commit 151aa1c842.
2018-12-22 19:42:07 +00:00
John Tromp
151aa1c842 Verify features in one place; comment on needed Features enum type (#2191) 2018-12-22 10:27:54 -08:00
John Tromp
976bf1dbae Fix secondary scaling bugs; add global::is_mainnet(); use it to change pre-genesis pow type (#2205) 2018-12-22 10:22:36 -08:00
Ignotus Peverell
ecf736d78a
Merge pull request #2196 from mimblewimble/floonet
* Get last bitcon block hash, setup genesis header without PoW (for now)
* More a few properties to mainnet genesis. Don't get too excited, several are placeholders.
* Mine a valid Cuckaroo solution for genesis block
* Use miner as library to get a solution for genesis. Replace final values in genesis.rs before committing it.
* Complete genesis replacement
* Fixed various replacements to obtain a compilable, well-formed genesis
* Check plugin errors, uncomment PoW validation
* Fixes to nonce handling in genesis mining
* Also produce full block hashes
* Fix genesis hash test
* Switch commitments (#2157)
* [Floonet] Use switch commits for all blinding factors (#2178)
* move wallet mods back into dirs
* use switched keys for blinding factor in all cases
* re-implement flag to turn off switch commit derivation
* rename tx log entry field tx_hex -> stored_tx (#2181)
* [Floonet] add feature for height locked kernels (#2168)
* add feature for height locked kernels
* add function to compute kernel features appropriate for lock height, and use it
* only sign kernel-features relevant fields; refactor Features
* simplify invalid kernel logic
* remove unused height arg to reward::output and run some rustfmt
* replace nested if/else by match
* Floonet chain type and genesis, testnets cleanup (#2182)
* [Floonet] Encrypt private slate data upon storage in DB (#2189)
* xor encrypt stored nonce and blind sum in transaction data
* stop doc tests splatting wallet files throughout
* Remove bzip2 dependency
* Changed magic number and seeds for Floonet (#2188)
* Genesis generator now loads a local wallet seed to build coinbase.
* Floonet genesis block
* Add floonet to generated grin-server.toml comments
* Test with final Floonet genesis hashes
* Fix get_header_for_output for genesis (#2192)
* start search with min height 0 (#2195)
2018-12-20 18:12:08 -08:00
Ignotus Peverell
5faeeedf65
Test with final Floonet genesis hashes 2018-12-20 21:07:53 +00:00
Ignotus Peverell
84d4777545
Add floonet to generated grin-server.toml comments 2018-12-20 21:04:57 +00:00
Ignotus Peverell
439a3915f6
Floonet genesis block 2018-12-20 20:34:25 +00:00
Ignotus Peverell
a42250445d
Floonet chain type and genesis, testnets cleanup (#2182) 2018-12-18 14:03:55 -08:00
Ignotus Peverell
87d256a318
Utility to automatically generate mainnet genesis block (#2122)
* Get last bitcon block hash, setup genesis header without PoW (for now)

* More a few properties to mainnet genesis. Don't get too excited, several are placeholders.

* Mine a valid Cuckaroo solution for genesis block

* Use miner as library to get a solution for genesis. Replace final values in genesis.rs before committing it.

* Complete genesis replacement

* Fixed various replacements to obtain a compilable, well-formed genesis

* Check plugin errors, uncomment PoW validation

* Fixes to nonce handling in genesis mining

* Also produce full block hashes

* Fix genesis hash test
2018-12-18 11:26:29 -08:00
hashmap
0d44c5405f Make tx weight safer (#2180)
Currently it fails on fuzz tests. Also type conversion to i32 is
dangerous per se
2018-12-18 11:19:19 -08:00
John Tromp
f43df5f601 [Floonet] add feature for height locked kernels (#2168)
* add feature for height locked kernels

* add function to compute kernel features appropriate for lock height, and use it

* only sign kernel-features relevant fields; refactor Features

* simplify invalid kernel logic

* remove unused height arg to reward::output and run some rustfmt

* replace nested if/else by match
2018-12-18 18:26:34 +00:00
Yeastplume
230fe191e0
[Floonet] Use switch commits for all blinding factors (#2178)
* move wallet mods back into dirs

* move wallet mod files

* use switched keys for blinding factor in all cases

* rustfmt

* test fix

* test fix

* test fix

* rustfmt

* re-implement flag to turn off switch commit derivation

* rustfmt
2018-12-18 15:44:55 +00:00
jaspervdm
75d2c1cc56 Switch commitments (#2157) 2018-12-18 11:51:44 +00:00
Ignotus Peverell
b2178f5665
Merge branch 'master' into gen_gen 2018-12-16 19:48:05 +00:00
Ignotus Peverell
cb0d09c492
Fix genesis hash test 2018-12-14 22:35:59 +00:00
Ignotus Peverell
052981d596
rustfmt 2018-12-14 22:13:05 +00:00
Ignotus Peverell
a71af7adae
Also produce full block hashes 2018-12-14 22:12:54 +00:00
Ignotus Peverell
80726c7f8f
Fixed various replacements to obtain a compilable, well-formed genesis 2018-12-14 02:56:45 +00:00
Ignotus Peverell
2386ce3b8a
Complete genesis replacement 2018-12-14 00:46:41 +00:00
Antioch Peverell
793e3843f0
HeaderEntry for storing subset of header info in the header MMR (#2137)
* HeaderEntry for storing subset of header info in the header MMR

* cleanup

* cleanup
2018-12-13 09:57:24 +00:00
Ignotus Peverell
18416e8528
Use miner as library to get a solution for genesis. Replace final values in genesis.rs before committing it. 2018-12-13 01:54:25 +00:00
Antioch Peverell
305b36dcce
replace is_mainnet() with !is_testnet() (#2125)
* replace is_mainnet() with !is_testnet()
makes testing "mainnet" code significantly easier (its the default)

* fix next_target_adjustment test based on tromp analysis

* rustfmt

* cleanup wallet db files and add to gitignore

* fix
2018-12-12 16:49:35 +00:00
Antioch Peverell
a0b9aa5967
Sign kernel features (#2104)
* include kernel features in msg being signed
hash the msg before signing it (for consistent 32 bytes)

* rustfmt

* fix various tests

* no HF for this (mainnet only)
2018-12-12 09:19:36 +00:00
Ignotus Peverell
e4ecc30884
Merged upstream 2018-12-11 18:54:44 +00:00
Ignotus Peverell
934b11d06f
More a few properties to mainnet genesis. Don't get too excited, several are placeholders. 2018-12-11 01:07:17 +00:00
hashmap
aedac483f5
Convert to Rust 2018 edition (#2084)
* Convert to Rust 2018 edition

* Update gitignore
2018-12-08 00:59:40 +01:00
Ignotus Peverell
3fdfa0b607
Fixed missing versioned dependency in core 2018-12-07 00:17:35 +00:00
Ignotus Peverell
87bfd9aaa4
Mark all crates as publishable 2018-12-07 00:08:15 +00:00
Ignotus Peverell
ef55b35416
Support for genesis block that includes a coinbase (#2079)
* Chain init now handles genesis body properly, related unit test creating the genesis with reward
* Avoid making block body public by adding a with_reward method
* apply_block in all genesis cases works
2018-12-06 15:38:15 -08:00
Yeastplume
b8c8840cec
Refactor wallet commands (#2067)
* start wallet command refactoring

* another re-structuring attempt

* rustfmt

* begin splitting up wallet commands

* rustfmt

* clean up wallet arg checking

* rustfmt

* macro for arg parsing

* rustfmt

* factor out init commands

* rustfmt

* move recover to new format

* rustfmt

* add listen command to new format

* rustfmt

* Finish moving commands to new format

* rustfmt

* rustfmt

* propogate errors more cleanly

* rustfmt

* error handling cleanup
2018-12-06 12:04:02 +00:00
Ignotus Peverell
54a034c40a
Fix txpool double spend edge case (#2081)
Sorting validation on inputs, outputs and kernels now also checks for uniqueness.
2018-12-05 09:44:32 -08:00
Dobby the House Elf
b8124676c7 Move libtx to core 2018-12-05 09:41:26 -08:00
Antioch Peverell
bf815aa5cd
Readonly pmmr cleanup (#2083)
* avoid locking txhashset by using a readonly PMMR

* rustfmt
2018-12-05 14:52:53 +00:00
Antioch Peverell
8d8f533b8e
store pmmr cleanup (#2075)
* introduce DataFile<T> to hide the LEN handling
use slices rather than vec<u8> where possible

* cleanup

* use DataFile<Hash> and not HashFile

* fix core tests
2018-12-05 13:02:24 +00:00
antiochp
6a4278c67e
fix 2018-12-05 12:10:27 +00:00
antiochp
fd41b4918e
rustfmt 2018-12-05 10:28:21 +00:00
antiochp
bd771ecbc5
fix txpool double spend edge case 2018-12-05 10:27:46 +00:00
Antioch Peverell
a24d613b05
no need for write lock on txhashset for chain.is_unspent() (#2066)
* no need for write lock on txhashset

* commit
2018-12-03 09:35:40 +00:00
Antioch Peverell
8bad93c8c9
Reduce amount of clone() going on when applying data to MMRs (#2046)
* less cloning when pushing to PMMR

* pass a ref to data when applying to the MMR and appending to the backend

* cleanup

* rustfmt

* fixup tests
2018-12-02 19:59:24 +00:00
Antioch Peverell
7b07fe99a7
bump 0.4.1 -> 0.4.2 so we can watch the HF (#2057) 2018-11-30 11:20:12 +00:00
Antioch Peverell
1dffd4df1e
Fix secondary pow scaling bug (#2051)
* fix(es) for #1980

* rustfmt

* skip(1) is height dependent on testnet4
rename for clarity

* rustfmt
2018-11-30 11:19:55 +00:00
Antioch Peverell
f05d3dd920
decouple outputs from output MMR (#2044) 2018-11-29 10:17:44 +00:00
Antioch Peverell
8e62130a7a
decouple kernels from the kernel MMR (#2043) 2018-11-29 10:01:59 +00:00
Ignotus Peverell
e356280841
Quick fix for graph_weight used with AR PoW (#2042) 2018-11-28 20:33:46 -08:00