Commit Graph

160 Commits

Author SHA1 Message Date
Grégoire Henry
5b50279851 Import new version of vendors/ocplib-resto
The new version of ocplib-resto :

- uses jbuilder ;
- is functorized over `Json_encoding` rather than `Json_repr` ;
- handles query parameters ;
- handles HTTP methods (GET, POST, DELETE, PUT, PATCH) ;
- replaces `custom_service` by a more generic trailer argument ;
- replaces generic answer `(code, body)` by a more ad-hoc sum type
  (allowing distinct encoding for success and error) ;
- includes a minimal HTTP-server based on Cohttp
  (includings CORS and media type negotiation).
- adds a function `Directory.transparent_lookup` to lookup/call
  a service handler without serializing the various parameters
  (path, query, request body).

As a first consequences in Tezos, this patch allows binary
communication between the client and the node.

This patch tries to be minimal inside the tezos source code and
therefore it introduces a minimal compatibility layer in
`RPC.ml`. This code should be removed as soon as possible.
2017-12-04 15:51:59 +01:00
Milo Davis
b4495568cb Fixes OSX select exception
This patch is primarily authored by @chambart
2017-11-30 14:50:36 +01:00
Benjamin Canou
e91f5bc588 Node: Cleanup a few error messages. 2017-11-28 15:43:58 +01:00
Benjamin Canou
606c6e55e4 Node: update shutdown order to prevent some leveldb read errors. 2017-11-28 15:43:47 +01:00
Grégoire Henry
8f30934220 Validator: always log invalid block 2017-11-27 10:40:43 +00:00
Grégoire Henry
471006b2dd Validator: properly handle termination of Block_validator. 2017-11-27 10:40:43 +00:00
Grégoire Henry
10d1b08c85 Validator: do not try to validate twice an invalid block 2017-11-27 10:40:42 +00:00
Benjamin Canou
61f7a95102 RPCs: fix encoding of list_invalid RPC 2017-11-27 10:40:41 +00:00
Milo Davis
9f45ae9126 Node: listing of invalid blocks 2017-11-27 10:40:41 +00:00
Milo Davis
42e29c8f4a Node: allow invalid block errors to be stored 2017-11-27 10:40:40 +00:00
Milo Davis
059e4cac79 Fix spelling mistake 2017-11-27 10:40:39 +00:00
Grégoire Henry
c6b4a83e2b Reset the chain. 2017-11-26 22:49:20 +00:00
Grégoire Henry
f9e6831363 Shell: enforce maximum operation size 2017-11-20 05:03:00 +01:00
Grégoire Henry
84a2f1ee29 Shell: enforce the maximum number of operation per block 2017-11-20 05:03:00 +01:00
Grégoire Henry
06a6cf5b9a Proto: allow to update 'max_number_of_operations'
The constant is now defined per block and not per protocol.
Also allows to set a limit per validation pass.
2017-11-20 04:57:09 +01:00
Benjamin Canou
1d357587d0 Node: register error Validator.Inactive_network 2017-11-17 14:13:55 +01:00
Grégoire Henry
659d1aa63a Shell: remove unrequired net_id from network messages 2017-11-17 14:13:55 +01:00
Grégoire Henry
178d839ee1 Shell: remove net_id from the block header. 2017-11-17 14:13:55 +01:00
Grégoire Henry
b7deebaf42 Shell: Remove net_id from the operation header.
The `branch` of the operation contains enough information to induce
the `net_id`, and the code of the validator/prevalidator is now mature
enough to efficiently determine the `net_id` of an incoming operation.
2017-11-17 14:13:55 +01:00
Grégoire Henry
4d2bc49960 Shell: memorize the current list of live blocks and operations 2017-11-17 14:13:55 +01:00
Grégoire Henry
1d71ea5718 Fix docstring attachment 2017-11-17 14:13:55 +01:00
Grégoire Henry
6a00c55c4e Shell: add docstrings for the validator. 2017-11-17 14:13:55 +01:00
Grégoire Henry
119f724e64 Mempool: also broadcast 'branch_{delayed,refused}' operations 2017-11-17 14:13:55 +01:00
Grégoire Henry
3e39f82bee Shell/baker: inline full operation contents in RPC. 2017-11-17 14:13:55 +01:00
Grégoire Henry
1163c19213 Shell: add configuration variable for various timeouts. 2017-11-17 14:13:55 +01:00
Grégoire Henry
f3555488c7 Shell: use one 'validation worker' per peer.
The single validation module is split in multiple (simpler)
modules. In the process, we introduce one "validation worker" per
peer. This worker handle all the `New_head` and `New_branch`
advertised by a given peer. For so, it sends "fetching request" and
"validation request" to respectively the `Distributed_db` and and the
`Block_validator`. These two global workers are responsible of the
'fair' allocation of network and CPU ressources amongst the connected
'peers'.
2017-11-17 14:13:55 +01:00
Grégoire Henry
529795efd7
Reset the chain 2017-11-17 02:51:39 +01:00
Grégoire Henry
1429a6c8e6 Almost too late for copyright update. 2017-11-15 13:13:16 +01:00
Grégoire Henry
44364295ee Jbuilder: use --dev for running test and other minor improvments 2017-11-14 00:12:40 +01:00
Pietro Abate
6ecfca9396 Reindent all files
Now `make test` fails when sources are not indented correctly, the
indentation test is also executed in the CI.
2017-11-13 23:13:34 +01:00
Milo Davis
32a466556e Jbuilder: use --dev option 2017-11-13 22:30:35 +01:00
Benjamin Canou
6a38f76956 Reset the chain. 2017-11-13 22:18:17 +01:00
Benjamin Canou
602a10651c Prevalidator: log_debug canceled operation fetches 2017-11-13 22:18:16 +01:00
Benjamin Canou
d5a2bd9604 Distributed_db: register new internal errors 2017-11-13 22:17:56 +01:00
Grégoire Henry
d866b1bfa5 Distributed_db: add primitive for sending 'message'. 2017-11-13 11:04:17 +00:00
Grégoire Henry
f63c5acbf5 Distributed_db: inline the header when broadcasting a new block.
This adds a small size overhead in the network message, but in most
cases it will avoid a subsequent 'fetch' of the header.
2017-11-13 11:04:15 +00:00
Grégoire Henry
06873da197 Distributed_db: add an argument timeout to 'prefetch`. 2017-11-13 11:04:15 +00:00
Grégoire Henry
e5c931c6a3 Shell: rename Distributed_db.state -> net_state 2017-11-13 11:04:14 +00:00
Grégoire Henry
16cc5b7ec8 Shell: add more timeout in the prevalidator 2017-11-13 11:04:14 +00:00
Grégoire Henry
ed75bc5acd Distributed_db: handle timeout in fetch. 2017-11-10 09:52:35 +00:00
Grégoire Henry
a8a906b1ae Distributed_db: use the error monad for fetch. 2017-11-10 09:52:34 +00:00
Grégoire Henry
f40c418d0f Distributed_db: remove the last "lol-object". 2017-11-10 09:52:33 +00:00
Grégoire Henry
41c82d7481 Distributed_db: handle cancelation of call to fetch.
We properly count the number of waiters and cleanup the table when the
count drops to zero.
2017-11-10 09:52:33 +00:00
Grégoire Henry
2b4e898407 Distributed_db: use a record instead of a tuple. 2017-11-10 09:52:30 +00:00
Grégoire Henry
1a10504959 Shell: fixme broken invariant in Distributed_db_functors.
The invariant of the `clear` function was not properly inforced by the
module interface. This patch remove the inappropriate invariant and
properly rename the function.
2017-11-10 09:52:29 +00:00
Milo Davis
5109db2813 Node: adds error for directory parsing failure 2017-11-08 17:41:54 +01:00
Pietro Abate
48d7ba29e8 Generate html API documentation
- add a new targert "make doc-html" to generate the html doc via
  jbuilder
- this patch adds public_name to jbuild files for all libraries
2017-11-08 15:55:40 +01:00
Grégoire Henry
0c3a54c2f9 Distributed_db: export disconnect 2017-11-03 15:12:09 +00:00
Grégoire Henry
06e4ec4d9b Distributed_db: proper logging
New category:

- node.distributed_db.p2p_reader

    log all incoming message, from any peer (debug)

- node.distributed_db.scheduler.*

    log the request scheduler of the given ressources (notice/debug),
    where '*' might be:

    - Operation_hash   (individual operation)
    - Block_hash       (block header)
    - operation_hashes (aggregated operation_hashes of a block)
    - operations       (aggregated operations of a block)
    - Protocol_hash    (protocol)
2017-11-03 15:12:08 +00:00
Grégoire Henry
616ca33498 Distributed_db: randomly selecting peer 2017-11-03 15:12:08 +00:00