Commit Graph

222 Commits

Author SHA1 Message Date
vbotbol
e314ac635d Storage: add readonly option 2018-06-13 01:00:47 +02:00
Vincent Bernardoff
a726d7363b Opam: remove irmin-leveldb 2018-06-13 00:55:37 +02:00
Vincent Bernardoff
be459ef312 Vendors: import irmin-lmdb 2018-06-13 00:55:36 +02:00
Vincent Bernardoff
cbef4c4d0c Vendors: import ocaml-lmdb 2018-06-13 00:55:36 +02:00
Grégoire Henry
5fd5c1c5f7 Dune: upgrade to 1.0+beta20 2018-06-08 15:27:23 +00:00
Pierre Boutillier
330b670d59 Test a sequence of update in Hash.SHA256 2018-06-06 15:33:22 +02:00
Grégoire Henry
33c3d1fcbd Alpha/RPC: add a low-level but typed RPC for context introspection
Example:

```
> tezos-client rpc get /chains/main/blocks/head/context/raw/json/\?depth\=1 | jq
{
  "commitments": [],
  "contracts": {
    "global_counter": 0,
    "index": []
  },
  "cycle": [
    4,
    3,
    2,
    1,
    0
  ],
  "delegates": [
    "tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN",
    "tz1faswCTDciRzE4oJ9jn2Vm2dvjeyA9fUzU",
    "tz1ddb9NMYHZi5UzPdzTZMYQQZoMub195zgv",
    "tz1b7tUupMgCNw2cCLpKTkSD1NZzB5TkP2sv",
    "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx"
  ],
  "last_block_priority": 0,
  "rolls": {
    "index": [],
    "next": 2000,
    "owner": {}
  },
  "votes": {
    "ballots": [],
    "current_period_kind": "proposal",
    "current_quorum": 8000,
    "listings": [],
    "proposals": []
  }
}
> tezos-client rpc get /chains/main/blocks/head/context/raw/json/cycle/4\?depth\=2 | jq
{
  "last_roll": [
    [
      0,
      2000
    ]
  ],
  "nonces": [],
  "random_seed": "97d50852c159ada8e9f107e98f693b059ba28336c723e6cd0f6353eb3c0cb415",
  "roll_snapshot": 0
}
> tezos-client rpc get /chains/main/blocks/head/context/raw/json/cycle/5\?depth\=2 | jq
{
  "last_roll": [
    [
      1,
      2000
    ],
    [
      0,
      2000
    ]
  ],
  "nonces": [],
  "roll_snapshot": 2
}
```
2018-06-06 10:54:33 +02:00
Grégoire Henry
f5e3fb17c0 Resto: lift the lwt monad into Resto. 2018-06-06 10:54:33 +02:00
Grégoire Henry
b6b30875e4 Resto: export RPC_arg.eq to the protocol. 2018-06-06 10:54:33 +02:00
Grégoire Henry
89cbe0f8fa Docs/RPC: fix doc generation
The current doc generator does not handles path were multiple method
are registred. The fix remove the intermediate (compilation) tree.
2018-06-06 10:54:33 +02:00
Grégoire Henry
6149909e83 Opam: fix the hacl package 2018-06-06 10:49:48 +02:00
Pierre Boutillier
51ddb708d3 Fix ocaml-secp256k1 Scalar.const
It happened to work by chance on 64bits but it was clearly wrong
2018-06-06 10:00:37 +02:00
Marco Stronati
3ff99dfba3 hacl: build system for 32 bits architecture 2018-06-06 09:57:26 +02:00
Grégoire Henry
b2e6001007 Data_encoding: merge def and describe 2018-05-30 14:38:05 +02:00
Grégoire Henry
2164782fe0 Json_typed: use inline record for mu 2018-05-30 14:38:05 +02:00
Grégoire Henry
49de4be9a1 Json_typed: inline Describe in case fields. 2018-05-30 14:38:05 +02:00
Grégoire Henry
47f8bbbe68 Json_typed: use inline recode for case fields 2018-05-30 14:38:05 +02:00
Grégoire Henry
7aa753fea1 Json_typed: use inline record for Case 2018-05-30 14:38:05 +02:00
Grégoire Henry
4c170de9d3 Json_typed: use inline record for Describe 2018-05-30 14:38:05 +02:00
Grégoire Henry
1bc7b45fdb Data_encoding: forbids nested options 2018-05-24 15:43:15 +00:00
Fabrice Le Fessant
8986640a98 P2p: make nonces unpredictable when connecting
Avoid replay-attacks by preventing a node from determining one of the
nonces used in the encryption of a channel between two nodes.
2018-05-24 12:11:42 +02:00
Benjamin Canou
376f9b36f9 Vendors/Hacl: fix buffer size glitch in binding 2018-05-21 17:33:09 +02:00
Marco Stronati
b619b29483 Vendors: removed ocaml-tweetnacl 2018-05-17 10:20:22 +02:00
Marco Stronati
07a97ab94a Vendors: add ocaml-hacl binding for HACL* crypto library 2018-05-17 10:02:48 +02:00
Vincent Bernardoff
76bf25646c Resto: fix CORS
CORS also requires to send the "Access-Control-Allow-Origin" header on
direct requests or requests following preflight requests.
2018-05-12 23:58:20 +02:00
Milo Davis
f0612a96ea Client: improve printing of logged requests 2018-05-12 23:15:10 +02:00
Benjamin Canou
19b5ce4fba Vendors: update ocplib-json-typed 2018-05-05 01:29:06 +02:00
Benjamin Canou
cd731df938 Add missing opam dependency 2018-05-05 01:29:06 +02:00
Vincent Bernardoff
96d9f317c1 Ocplib_json_typed: adapt code for inclusion in vendors 2018-05-04 18:48:00 +02:00
Benjamin Canou
68f5c92c1e Import ocplib-json-typed in vendors 2018-05-04 18:48:00 +02:00
Grégoire Henry
387d863f18 Secp256k1: fix indent 2018-05-03 15:36:02 +02:00
Grégoire Henry
7ceb401d44 Tweetnacl: fix indent 2018-05-03 15:35:54 +02:00
Vincent Bernardoff
47f9c2460b Crypto: fixes for secp256k1 2018-04-26 21:24:21 +02:00
Vincent Bernardoff
3a0cdfd90a Crypto: Secp256k1 -> Libsecp256k1 2018-04-26 21:24:21 +02:00
Grégoire Henry
49ad5d585a Vendors: export Resto.Path.subst* 2018-04-22 13:41:26 +02:00
Vincent Bernardoff
7c546425d2 Vendors/tweetnacl: use bigstring 2018-04-19 10:31:56 +02:00
Vincent Bernardoff
230d495dc6 Vendors/blake2b: use bigstring 2018-04-19 10:21:01 +02:00
Grégoire Henry
aeaf2a240c Client: temporary hack
reaggregate http chunks for streamed RPC... :(
2018-04-17 10:39:26 +02:00
Vincent Bernardoff
9adee55234 Import: ocaml-secp256k1 in vendors 2018-04-16 17:21:10 +02:00
Arthur B
21efb2dc9d Jbuilder: update to beta.19.1 2018-04-06 11:47:22 +02:00
Vincent Bernardoff
5319752704 Vendors/tweetnacl: do not intermix tweetnacl with custom code 2018-03-22 14:39:55 +01:00
bruno
bdf6a5e564 General: update jbuilder to 1.0+beta19 2018-03-20 06:49:52 +01:00
Grégoire Henry
5ac629f335 More renaming registred -> registered 2018-03-16 18:38:41 +01:00
Raphaël Proust
e27a9e6aaf Minor code documentation fix in vendor crypto lib 2018-03-13 16:17:08 +00:00
Milo Davis
a405eb2d0e Fixes for jbuilder.1.0.0-beta18 2018-03-08 14:38:57 +01:00
Grégoire Henry
76a59af376 Opam: use jbuilder.1.0.0-beta18 2018-03-08 14:38:57 +01:00
Grégoire Henry
ad330db7e1 Opam: require jbuilder = 1.0.0-beta17 2018-03-07 18:12:12 +01:00
Grégoire Henry
a1b30417e2 Fix indent 2018-02-20 18:29:56 +01:00
Vincent Bernardoff
77bb186611 Vendors: add ocaml-pbkdf 2018-02-16 18:30:32 +01:00
Vincent Bernardoff
6096592a22 Vendors: add ocaml-bip39 2018-02-16 11:08:45 +01:00
Grégoire Henry
66c2a60530 Client refactor: use the error_monad for all RPC services 2018-02-12 16:54:08 +01:00
Grégoire Henry
c9822abab7 Resto: minor simplification (remove RPC_service.map) 2018-02-11 19:45:40 +01:00
Grégoire Henry
f2b7897572 Resto: add RPC_path.subst{0,1,2,3} 2018-02-11 19:17:39 +01:00
Grégoire Henry
d78fa86372 Resto: Add Resto.forge_partial_request 2018-02-11 19:17:39 +01:00
Grégoire Henry
db500b5ebd RPC_service: hide the 'error type parameter 2018-02-08 17:23:30 +01:00
Grégoire Henry
2f295a3af8 P2p: less types in lib_base
Let's only have types required for the RPCs.
2018-02-08 17:23:29 +01:00
Vincent Bernardoff
3be9928e54 Tweetnacl: bugfix 2018-02-08 14:34:46 +01:00
Grégoire Henry
632233ea0c Opam: fix typo in tweetnacl package 2018-02-08 05:32:39 +01:00
Vincent Bernardoff
e1d1292c09 Crypto: drop libsodium
We now use simpler OCaml bindings much easier to review.
2018-02-07 11:16:39 +01:00
Grégoire Henry
575e367026 Update copyright notice (2018) 2018-02-05 23:34:05 +01:00
Grégoire Henry
bd8eaddc8c Resto: properly handle text/ocaml.exception. 2018-01-25 12:33:13 +01:00
Milo Davis
2595c14944 Build: add -safe-string to more places 2017-12-12 11:42:18 +01:00
Grégoire Henry
0871911920 RPC: split modules RPC/RPC_server 2017-12-11 17:53:51 +00:00
Grégoire Henry
4aa1b14ba6 RPC: introduce Resto_cohttp.Client and RPC_clients. 2017-12-11 17:53:49 +00:00
Grégoire Henry
02fd021aa9 Resto: allow optional/multi argument in query string 2017-12-11 17:53:48 +00:00
Grégoire Henry
26d1c463f9 Resto: split Resto_cohttp.Server 2017-12-11 17:53:48 +00:00
Grégoire Henry
ebd067a261 Resto: now depends on package 'uri' 2017-12-11 17:53:47 +00:00
Grégoire Henry
34cca61f7b Resto: minor renaming 2017-12-11 17:53:45 +00:00
Grégoire Henry
d2708740c8 Opam: fix some dependencies and add some scripts/opam-*.sh.
Installation:

   `./scripts/opam-pin.sh && opam install tezos-node tezos-client`

Upgrade installed packages after a `git pull` (opam2 only):

   `./scripts/opam-upgrade.sh`

Remove and cleanup every from the opam repo:

   `./scripts/opam-unpin.sh`
2017-12-08 02:50:03 +01:00
Grégoire Henry
ab77eb250e Resto/Jbuilder: fix test packaging 2017-12-08 02:50:03 +01:00
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
Grégoire Henry
485d8bc26a Context: quick-and-dirty leveldb backend for Irmin
This is a dirty and non-optimized backend, it is still faster than the
current git backend.

Main drawbacks:
- the leveldb binding is non-coopertive, the node will
  block while committing a block to the disk ;
- the leveldb use 'string' while internally we use 'cstruct',
  this implies a lot of time-consuming 'memcpy'.
2017-11-26 22:49:17 +00:00