Skip to content

Commit

Permalink
(fix) Add emacs backups to .gitignore
Browse files Browse the repository at this point in the history
(fix) A tiny bit more documentation
(feat) respect VCPKG_ALWAYS_INSTALL
(fix) The protobuf library now appears to want curried arguments.
  • Loading branch information
rrw-zilliqa committed Jun 11, 2024
1 parent a5a81f7 commit b29cb9b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 12 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ deps/schnorr/install/
# -----------------------------------------------------------------------------
vcpkg_installed/

debug/
debug/

# Emacs backups
*~
\#*
.\#*
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Building and Developing Scilla

_These are old instructions - check out the (rather scatty) build instructions in README.md for how to build Scilla for ZQ2_

The recommended installation process is comprised of two separate steps:
- installation of system-wide packages using your OS native package manager and
- installation of OCaml packages using the [opam](https://opam.ocaml.org) package manager.
Expand Down
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,36 @@ found in [INSTALL.md](./INSTALL.md).

### 3. Compiling

To build the project from the root folder:
You'll need to install `vcpkg` and set `VCPKG_ROOT` to the root of your `vcpkg` installation, following the instructions at <https://github.com/microsoft/vcpkg>.

```sh
export VCPKG_ROOT=/my/directory/vcpkg
export SCILLA_REPO_ROOT=/where/you/checked/out/scilla
apt install libgmp-dev patchelf
```

If `vcpkg` installation fails, you'll need to set:

```sh
export VCPKG_ALWAYS_INSTALL=true
```

To force vcpkg to try again. You'll also need to do:

```
make opamdep
```

To make opam dependencies. You may well need to:

```
touch scilla/_build/default/vcpkg-ocaml/vcpkg-secp256k1/src/c_flags.exp
```

And retry to persuade `secp256k1` to rebuild.

Now, to build the project from the root folder:

```
make
```
Expand Down
5 changes: 4 additions & 1 deletion scripts/vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ then
fi

# If already installed, exit early.
if [[ -z "${VCPKG_ALWAYS_INSTALL}" ]]
then
if [[ -d vcpkg_installed ]]
then
echo "Found vcpkg_installed, not installing again"
exit 0
fi

fi

echo "Installing vcpkg"
if ! "$VCPKG_ROOT"/vcpkg install --triplet "$(scripts/vcpkg_triplet.sh)"
then
Expand Down
18 changes: 9 additions & 9 deletions src/eval/Ipcmessage_pb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,31 @@ let rec encode_proto_scilla_val_map (v : Ipcmessage_types.proto_scilla_val_map)
encoder =
let encode_key = Pbrt.Encoder.string in
let encode_value x encoder =
Pbrt.Encoder.nested (encode_proto_scilla_val x) encoder
Pbrt.Encoder.nested encode_proto_scilla_val x encoder
in
List.iter v.Ipcmessage_types.m ~f:(fun (k, v) ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.key 1 Pbrt.Bytes encoder;
let map_entry = ((k, Pbrt.Bytes), (v, Pbrt.Bytes)) in
Pbrt.Encoder.map_entry ~encode_key ~encode_value map_entry encoder)

and encode_proto_scilla_val (v : Ipcmessage_types.proto_scilla_val) encoder =
match v with
| Ipcmessage_types.Bval x ->
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.key 1 Pbrt.Bytes encoder;
Pbrt.Encoder.bytes x encoder
| Ipcmessage_types.Mval x ->
Pbrt.Encoder.key (2, Pbrt.Bytes) encoder;
Pbrt.Encoder.nested (encode_proto_scilla_val_map x) encoder
Pbrt.Encoder.key 2 Pbrt.Bytes encoder;
Pbrt.Encoder.nested encode_proto_scilla_val_map x encoder

let rec encode_proto_scilla_query (v : Ipcmessage_types.proto_scilla_query)
encoder =
Pbrt.Encoder.key (1, Pbrt.Bytes) encoder;
Pbrt.Encoder.key 1 Pbrt.Bytes encoder;
Pbrt.Encoder.string v.Ipcmessage_types.name encoder;
Pbrt.Encoder.key (2, Pbrt.Varint) encoder;
Pbrt.Encoder.key 2 Pbrt.Varint encoder;
Pbrt.Encoder.int_as_varint v.Ipcmessage_types.mapdepth encoder;
List.iter v.Ipcmessage_types.indices ~f:(fun x ->
Pbrt.Encoder.key (3, Pbrt.Bytes) encoder;
Pbrt.Encoder.key 3 Pbrt.Bytes encoder;
Pbrt.Encoder.bytes x encoder);
Pbrt.Encoder.key (4, Pbrt.Varint) encoder;
Pbrt.Encoder.key 4 Pbrt.Varint encoder;
Pbrt.Encoder.bool v.Ipcmessage_types.ignoreval encoder;
()

0 comments on commit b29cb9b

Please sign in to comment.