Commit graph

1449 commits

Author SHA1 Message Date
Antioch Peverell
985bced99d
remove duplicate dir creation code (#1603) 2018-09-29 09:50:32 +01:00
Antioch Peverell
fd8c03679a
use sync_head consistently in sync_block_headers (#1604)
* use sync_head consistently in sync_block_headers

* rustfmt
2018-09-29 08:47:50 +01:00
Michalis Kargakis
9e6ef6f237 Conform auth check to rfc2616 (#1607)
According to rfc2616[1], the response from a server to a request with
bad credentials should be a 401 instead of a 403. Grin does not have
the concept of identities so it does not actually recognize a user
request with bad credentials.

[1] https://tools.ietf.org/html/rfc2616#section-10.4.2
2018-09-29 09:28:25 +02:00
Antioch Peverell
2cad812b29
use an lru_cache for the block_hashes_cache (#1602) 2018-09-28 17:27:31 +01:00
Yeastplume
e64f4fbcd1
Rust Cuckatoo for verifier and test-miner (#1558)
* cuck placeholder

* rustfmt

* cuckatoo, early days

* rustfmt

* data structures are in place, siphash key creation is consistent with @tromp

* solver in place, (not yet working)

* cuckatoo test solver working with test nonce

* rustfmt

* update solver to remove adjacency list removals

* verifier functioning

* rustfmt

* Proper error handing in Cuckatoo module, couple of tests

* modify cuckoo/cuckatoo solvers and verifiers to function identically, in advance of trait refactoring

* rustfmt

* refactor PoW context into trait, default to using cuckoo context

* rustfmt

* create macros for integer casting/unwraps

* don't instantiate structs when just verifying, add test validation vector for cuckatoo 29

* rustfmt

* don't init cuckoo structs if just validating

* test fix

* ensure BH hashing for POW is only done within miner/validators
2018-09-28 11:53:14 +01:00
Quentin Le Sceller
a13c20ceb2 Fix API wallets calls (#1597)
* Add API Secret in wallet calls

* File node api secret default to same api secret and directly in http parameter
2018-09-27 21:45:48 +02:00
Antioch Peverell
5a83989cf6
explicitly handle the header when processing blocks (#1600) 2018-09-27 15:12:08 +01:00
Antioch Peverell
4b0fdc2499
rework to only pass a single block_context to pipeline (#1599) 2018-09-27 11:44:50 +01:00
Antioch Peverell
56f84cc2f4
pass batch to process_block and process_block_header (#1594)
* use a batch consistently when processing blocks and headers

* rustfmt
2018-09-27 09:35:25 +01:00
Quentin Le Sceller
62fd8f2124 Implement Basic Auth for API and Owner API (#1566)
* Add api_secret

* Add to base64 method

* Add basic auth in API

* Add Basic Auth to owner API

* Add flag to enable disable basic auth

* Add .api_secret file
2018-09-26 22:38:44 +02:00
Antioch Peverell
acec59e249
introduce rewindable_kernel_view (readonly but rewindable kernel MMR view) (#1587)
* introduce rewindable_kernel_view
cleanup header in extension

* cleanup and docs/comments

* txhashset does not need to be mutable here

* pull validate_kernel_history out into fn
2018-09-26 09:59:00 +01:00
Quentin Le Sceller
e55c3d2ec9
Replace rust-crypto with RustCrypto (#1573)
* Replace rust-crypto with RustCrypto
2018-09-25 16:24:05 -04:00
Michalis Kargakis
8c3f6eb8f7 Dockerfile updates (#1580)
* pregenerate config and disable tui
* install openssl now that native-tls is pulled in
* EXPOSE directive cleanup
* Update build instructions
2018-09-25 13:18:17 -07:00
Gary Yu
bbe0b0384b docs: add release instruction (#1571) 2018-09-25 13:14:10 -07:00
Antioch Peverell
11f2d7b6d4
UTXOView (readonly, minimal, output only txhashset extension) (#1584)
* make the utxo view explicit

* introduce utxo_view (readonly, minimal txhashset extension)

* rustfmt

* cleanup

* cleanup

* rustfmt

* cleanup build warnings, comments etc.

* rustfmt

* utxo_view even more readonly now

* cleanup

* refactor pmmr, split out readonly_pmmr and backend

* rustfmt
2018-09-25 11:01:19 +01:00
Gary Yu
830f4d6b7c
chore: automatic binaries release (#1540)
* automatic binaries release from Travis-CI server
* build both osx and linux binary
* add before_deploy for making tarball and show size
* set file_glob for wildcards
* automatic changelog generator
* remove the --depth flag entirely, travis-ci default depth 50 cause change log auto-generation fail
* note: 
  - '#' in file name will be converted as '.', replace '#' with '-'
  - file_glob wildcards don't support multiple lines of 'file'
2018-09-25 08:37:24 +08:00
Gary Yu
7a187d5c98
docs: update for obsoleted usage of 'rustfmt', update 'Find us' (#1570) 2018-09-25 06:50:43 +08:00
Gary Yu
8d62247c99 Small cleanup of rand usage (#1576)
Clean 3 build warning of deprecated item 'rand::Rand::rand'
2018-09-24 15:15:55 -07:00
Gary Yu
32486e2f63 Always enable header sync on initial state transition from NoSync / Initial (#1582) 2018-09-24 15:09:57 -07:00
Antioch Peverell
e72d8b58e4
[WIP] txpool (tx validation) using block sums for full validation (#1567)
tx validation (txpool) rework/simplify
2018-09-24 09:24:10 +01:00
hashmap
82b785282c
Remove println (#1575) 2018-09-22 21:22:02 +02:00
hashmap
274df3b8bb
Fix wallet APIs launch command (#1574)
We used to launch a thread for API server inside the wallet crate, now we do it inside api crate, so the cmd tool launches API and exit. This fix makes sure that command will wait for API thread.
2018-09-22 09:34:28 +02:00
hashmap
3a3ba4d636
Improve middleware support in web layer (#1572)
* Middleware and handler (mw implements the same trait) could be attached to multiple nodes inside the router
* Middleware could be attached to the router (syntactic sugar, it is attached to the root node) as well as to any node
* Handler's call method receives an iterator of handlers and responsible for calling the next handler if needed
2018-09-21 19:57:59 +02:00
hashmap
972c2e5aa9
Support TLS in ApiServer (#1565)
* Support TLS in ApiServer

This is ground work to support TLS in Grin APIs (like wallet ot node). Particular API implemention needs to decide if TLS is used or not and pass certificate data etc.

* P12 format support
* New method to start TLS server
* Transparent TLS support in API client (depends on URL scheme http/https)
* Refactoring
* Initial support for graceful shutdown (commentred out int this PR, unstable for now)
* API server tests (TLS server test is disabled by default, hyper client rejects self-signed certificates, so extra step is needed to install local CA (I used mkcert)
* Add a cert file to make test complile
2018-09-21 13:33:23 +02:00
hashmap
56234d1023
Merge pull request #1560 from yourowncrypto/bump-reqwest
Bump reqwest version to remove hyper 0.11
2018-09-21 09:53:10 +02:00
Ivy Evans
ac7d575d65 Bump Docker builder image to rust:1.29.0 (#1569) 2018-09-20 14:58:23 -04:00
Gary Yu
3adddfba76 Refactor: run_sync() ballooning, extract 3 utility functions (#1562) 2018-09-20 10:00:09 -07:00
Mike Dallas
0d7fa06fe0 Remove a dead link from docs (#1563)
* Update intro.zh-cn.md

remove link

* Update intro.md

remove link

* Undo

* Change link to point to original paper
2018-09-20 17:46:52 +01:00
Antioch Peverell
f042f67fcd
Reintroduce block sums, verify full kernel sums per block (#1559)
* block_sums and full kernel sum verification

* rustfmt

* add docs/comments

* docs

* rustfmt

* comment on fact total_kernel_sum is redundant now

* make sure we setup block_sums correctly on a fork

* rustfmt

* replace those asserts with errors

* rustfmt
2018-09-20 09:19:32 +01:00
Gary Yu
e1c8dc5a3a
fix: reset sync_head to header_head on initial transition to HeaderSync (#1531)
* fix for bug #1524, reset sync_head to header_head on initial transition to HeaderSync.
* using @antiochp fix solution in #1539
2018-09-20 07:29:24 +08:00
Gary Yu
56ffbee7e9
fix: all fast sync nodes report to peers as full nodes (#1547)
* fix: all fast sync nodes report to peers as full nodes
2018-09-20 07:09:39 +08:00
Gary Yu
2ca6ecc163
fix: early detection of peer connection lost when downloading txhashset (#1546) 2018-09-20 07:08:02 +08:00
Antioch Peverell
80bb1cb262 Cleanup new output commits (#1556)
No need for new_output_commits (batch handles this now)
2018-09-19 11:59:17 -07:00
Ignotus Peverell
7b6e219b5b
Minor: move raw_difficulty to Proof 2018-09-19 18:31:03 +00:00
hashmap
53250ec51e
Bump reqwest version to remove hyper 0.11
Follow up of #1371
2018-09-19 19:43:56 +02:00
hashmap
521ce901e4
Merge pull request #1557 from yourowncrypto/api-refactor
Refactor hyper router
2018-09-19 19:33:48 +02:00
Ignotus Peverell
9a15859b81
Scaling multiplier fix and slightly clearer structure 2018-09-19 16:25:44 +00:00
Roy Blankman
febe9076f0 fixes #1507 - proper tx confirmation calculation (#1552)
when self.height == current_height, # of confirmations should be 1 not 0
2018-09-19 16:55:03 +01:00
hashmap
d5ef3d9d12
Refactor hyper router
* Make it simpler to implement middleware
* Switch from the current thread runtime to the default one. It enables us to inject TLS support later one and potentially more scalable, unfortunately it involves some additonal cloning of the router, because we can't rely on thread local vars anymore
* Introduce `call` entrypoint for Handler, so it's possible to handle any HTTP method in one place, handy for middleware
* Implement example of middleware
2018-09-19 17:10:52 +02:00
Ignotus Peverell
ba72e6e29e
Last fixes that should have been part of #1534 2018-09-19 00:39:56 +00:00
Ignotus Peverell
9cc7aed713
Dual proof of work, first step (#1534)
* Move Proof and Difficulty types to pow module. Difficulty scaling calculation.
* Diffculty scaling and size shift for 2nd PoW
* Backport e7eb26ee
* Test compilation fixes
* Scaling only need to go one way, as @tromp pointed out
2018-09-18 15:12:57 -07:00
hashmap
7db8e5e2dd Improve API errors (#1543)
Address ##1525 in particular and improve error messages in general.
Instead of `Request Error: Error { inner:` a client would get:
`Generic error: Invalid request body: missing field `method` at line 1 column 162`
2018-09-18 15:11:58 -07:00
Roy Blankman
db7b686073 Exit code 1 on wallet send fail (#1550)
Fixes #1504
2018-09-18 14:59:41 -07:00
Antioch Peverell
c291c48436 Simplify block broadcast (#1549)
* removed random "block vs compact_block"
2018-09-18 10:51:37 -07:00
Antioch Peverell
a4476443bb
Compact transactions (initial prep work) (#1548)
* introduce CompactTransaction (unused currently)

* rustfmt

* fix comments
2018-09-18 15:25:26 +01:00
Quentin Le Sceller
345a6cb53e Update rand crate to 0.5 (#1542)
* Update rand crate to 0.5

* Rustfmt

* Misplaced import
2018-09-18 09:39:45 +01:00
hashmap
b35950790b Use POST to compact and validate chain (#1541)
* More comments
* Move HeaderHandler code
2018-09-17 16:37:23 -07:00
Gary Yu
a0deb18e77
Update version of some crates (#1536)
Update version of some crates
2018-09-17 10:47:48 +08:00
Gary Yu
8bef9bef02
Small cleanup of SIGINT and SIGTERM handler (#1535) 2018-09-17 07:02:23 +08:00
Ivy Evans
9aed3b9c7f Fix documented emission rate (#1537)
The emission rate was changed to 60 grin per minute (or approximately
1 grin/second) in #569.
2018-09-16 15:36:38 -07:00