Skip to content

Commit

Permalink
Merge master to branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcnn committed Sep 30, 2022
2 parents f20de5c + 10ff036 commit 4521dfa
Show file tree
Hide file tree
Showing 866 changed files with 42,206 additions and 3,965 deletions.
66 changes: 16 additions & 50 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,50 +1,16 @@
########## Global owners ##########

* @jjcnn @vaivaswatha @anton-trunov


########## Source code ##########

## default OCaml reviewers
*.ml @vaivaswatha @jjcnn @anton-trunov
*.mli @vaivaswatha @jjcnn @anton-trunov

## default C and C++ reviewers
*.cpp @vaivaswatha @AmritKumar
*.c @vaivaswatha @AmritKumar
*.h @vaivaswatha @AmritKumar


########## Build system, CI, opam ##########

*dune* @vaivaswatha @anton-trunov
/.dockerignore @vaivaswatha @Gnnng
/.travis.yml @vaivaswatha @Gnnng
/Dockerfile* @vaivaswatha @Gnnng
/Makefile @vaivaswatha @anton-trunov
/scripts/build_openssl.sh @vaivaswatha
*.opam @vaivaswatha @anton-trunov


########## Test suite ##########

## Scilla contracts in the testsuite
/tests/*.scilla @edisonljh @evesnow91 @AmritKumar @vaivaswatha @jjcnn


########## Documentation ##########

/README.md @AmritKumar @jjcnn @vaivaswatha
/INSTALL.md @vaivaswatha @anton-trunov
/docs/ @jjcnn


########## Tools ##########

#/misc/emacs-mode @vaivaswatha
#/misc/vim-plugin @edisonljh


########## GitHub metadata, including this file ##########

/.github/ @AmritKumar @vaivaswatha @anton-trunov
# The scilla-team will be the default owners for everything in the repo.
# This way the devops can maintain it without the need to patch this file.
* @Zilliqa/scilla-team

## Devops-related things
/.dockerignore
/.travis.yml
/Dockerfile*
/scripts/build_deps.sh
/scripts/build_openssl.sh
/scripts/cryptoutils.sh
/scripts/install_cmake_ubuntu.sh
/scripts/install_opam2_ubuntu.sh
/scripts/install_secp256k1.sh
/scripts/install_shellcheck_ubuntu.sh
/scripts/schnorr.sh @Zilliqa/devops-team
3 changes: 2 additions & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
version=0.18.0
profile = default
version=0.22.4
20 changes: 8 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ matrix:
include:
- os: linux
dist: xenial
env: OCAML_VERSION=4.12.0
env: OCAML_VERSION=4.14.0
- os: linux
dist: xenial
env: OCAML_VERSION=4.11.1
env: OCAML_VERSION=4.11.2
- os: linux
dist: xenial
env: OCAML_VERSION=4.10.1
- os: linux
dist: xenial
env: OCAML_VERSION=4.09.1
dist: focal
env: OCAML_VERSION=4.14.0
- os: linux
dist: xenial
env: OCAML_VERSION=4.08.1
dist: focal
env: OCAML_VERSION=4.11.2
# - os: osx
# osx_image: xcode10.1

Expand All @@ -28,9 +25,8 @@ matrix:

addons:
apt:
sources:
- sourceline: 'ppa:tah83/secp256k1'
packages:
- sudo
- ocaml
- curl
- build-essential
Expand All @@ -43,7 +39,6 @@ addons:
- libboost-test-dev
- libpcre3-dev
- aspcud
- libsecp256k1-dev
# Needed to install shellcheck from its GitHub binary releases
- xz-utils
homebrew:
Expand All @@ -63,6 +58,7 @@ branches:
- master
- /^release-v.*$/
before_install:
- if [ $TRAVIS_OS_NAME = linux ]; then ./scripts/install_secp256k1.sh; fi
- if [ $TRAVIS_OS_NAME = linux ]; then ./scripts/install_opam2_ubuntu.sh; fi
- if [ $TRAVIS_OS_NAME = linux ]; then ./scripts/install_shellcheck_ubuntu.sh; fi
- if [ $TRAVIS_OS_NAME = linux ]; then bash ./scripts/install_cmake_ubuntu.sh; fi
Expand Down
7 changes: 6 additions & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ brew "libffi"
brew "openssl@1.1"
brew "boost"
brew "pcre"
brew "domt4/crypto/secp256k1", args: ["with-enable-module-recovery"]
brew "domt4/crypto/secp256k1"
brew "cmake"
brew "gmp"
# The following needed for `scilla-fmt --help` to work:
# the Cmdliner OCaml library uses it to format man pages.
# It can also use `groff` but it needs `-K` option support
# which is not generally available on BSD-like systems
brew "mandoc"
124 changes: 124 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Contributing to Scilla

## Building Scilla

You could build the source code according to installation instructions in the [README](./README.md#building-scilla) and the [INSTALL.md](./INSTALL.md), which contains OS-specific information about build dependencies.

## Running tests

### Running the testsuite

The testsuite is based on the `OUnit2` framework and is driven by the
main module in `tests/Testsuite.ml`. There are several types of
tests run in the testsuite. For instance, `contracts` tests run a full transition on
a contract with all input data provided, and `eval` tests only test
expression evaluation. To add more tests of either of these kinds,
look for the corresponding `.ml` files in their tests/directory and add
accordingly.

To run the testsuite:

```shell
make test
```

(this makes the Dune build system invoke `testsuite` executable with `-print-diff true` option to print colored diffs between error messages).

To run the `testsuite` executable manually using `dune exec tests/testsuite.exe`,
you have to provide the parameters `-bin-dir` and `-tests-dir`, which must be absolute paths to
the directory containing `eval-runner`, `type-checker`, `scilla-runner`, `scilla-checker` and
the `tests/` directory containing the tests.
Relative paths may not work.
Parameters to `testsuite` executable can be passed like so:
```shell
dune exec tests/testsuite.exe -- <space-separated-parameters>
```

To obtain a list of tests available:

```shell
dune exec tests/testsuite.exe -- -list-test
```

### Running an individual test
To run an individual test(s), for example
`tests:4:checker:0:good:1:exptests:5:one-accept.scilla`,
(it's one of the tests from the list obtained via `dune exec -- tests/testsuite.exe -list-test`,
this needs to be run from the project's root):

```shell
dune exec tests/testsuite.exe -- -only-test tests:4:checker:0:good:1:exptests:5:one-accept.scilla -print-cli true
```

The optional `-print-cli true` argument is to produce the command line
that has been used to run the test.

### Running a group of tests
If you'd like to run a group of tests, for instance, the typechecking tests
which are assigned the name `checker`, execute the following from the project's
root:

```shell
dune exec -- tests/testsuite.exe -only-test tests:4:checker
```

If you need to update the so-called `gold`-files which keep the expected output
for the `checker` tests, run the following command:

```shell
dune exec -- tests/testsuite.exe -only-test tests:4:checker -update-gold true
```

## Formatting and linting the codebase
Our CI checks that the source code is formatted properly. Use
```shell
make fmt
```
to ensure your code adheres to the style guide.
Note that the command will automatically change ("promote") your source code.
You will need the `ocamlformat` opam package for the command above to work.

To make sure you are good to go, before sending PR run
```shell
make lint
```
to check if there are any issues with your contribution.
In addition to the `ocamlformat` package, `make lint` uses `opam` and
[`shellcheck`](https://www.shellcheck.net).

## Debugging
To debug scilla-checker or scilla-runner, you must build `make debug`, which will generate
the OCaml bytecode versions of the binaries. These can be debugged using `ocamldebug`.
Executing a bytecode executable also requires the environment variable `LD_LIBRARY_PATH` to
be set to `_build/default/src/base/cpp`. An example debug command line is provided below.


```shell
LD_LIBRARY_PATH=${PWD}/_build/default/src/base/cpp ocamldebug _build/default/src/runners/scilla_checker.bc -libdir src/stdlib -gaslimit 10000 tests/contracts/helloworld.scilla
```

## Using OCaml with Emacs

Please, read the instructions in [INSTALL.md](./INSTALL.md) if you intend to hack on Scilla implementation.

<details><summary>Instructions</summary>

Scilla is written in [OCaml](https://ocaml.org/).
You can read about how to setup your OCaml development environment [here](https://dev.realworldocaml.org/install.html).
The following extensions would be useful for working on this codebase:

* [tuareg](https://github.com/ocaml/tuareg) for syntax highlighting
* [merlin](https://github.com/ocaml/merlin/wiki/emacs-from-scratch) for auto-completion
* [ocp-indent](https://github.com/OCamlPro/ocp-indent) for smart indentation

All those libraries can be installed via [opam-user-setup](https://github.com/OCamlPro/opam-user-setup):
```shell
opam install user-setup
```

Additionally, you might want to install a nice OCaml REPL called [utop](https://github.com/ocaml-community/utop).

To enable flycheck mode (integration of `scilla-checker` with Emacs for editing Scilla files), install
flycheck for Emacs. See installation instructions [here](http://www.flycheck.org/en/latest/user/installation.html).

</details>
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:avsm/ppa -y \
&& apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
wget \
cmake \
Expand All @@ -28,10 +29,11 @@ RUN apt-get update \
libsecp256k1-dev \
libboost-system-dev \
libboost-test-dev \
libboost-dev \
libpcre3-dev \
&& rm -rf /var/lib/apt/lists/*

ENV OCAML_VERSION 4.08.1
ENV OCAML_VERSION 4.11.2

# CMake gets installed here
ENV PATH="/root/.local/bin:${PATH}"
Expand Down
45 changes: 45 additions & 0 deletions Dockerfile-u2004
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# escape=\
ARG BASE_IMAGE=ubuntu:20.04

FROM ${BASE_IMAGE}

ARG MAJOR_VERSION=0

COPY . /scilla/${MAJOR_VERSION}

WORKDIR /scilla/${MAJOR_VERSION}

RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:avsm/ppa -y \
&& apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
wget \
cmake \
build-essential \
m4 \
ocaml \
opam \
pkg-config \
zlib1g-dev \
libgmp-dev \
libffi-dev \
libssl-dev \
libsecp256k1-dev \
libboost-system-dev \
libboost-test-dev \
libboost-dev \
libpcre3-dev \
&& rm -rf /var/lib/apt/lists/*

ENV OCAML_VERSION 4.11.2

# CMake gets installed here
ENV PATH="/root/.local/bin:${PATH}"

RUN bash scripts/install_cmake_ubuntu.sh \
&& make opamdep-ci \
&& echo '. ~/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true ' >> ~/.bashrc \
&& eval $(opam env) && \
make
45 changes: 45 additions & 0 deletions Dockerfile-u2004.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# escape=\
ARG BASE_IMAGE=ubuntu:20.04

FROM ${BASE_IMAGE}

ARG MAJOR_VERSION=0

COPY . /scilla/${MAJOR_VERSION}

WORKDIR /scilla/${MAJOR_VERSION}

RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:avsm/ppa -y \
&& apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
wget \
cmake \
build-essential \
m4 \
ocaml \
opam \
pkg-config \
zlib1g-dev \
libgmp-dev \
libffi-dev \
libssl-dev \
libsecp256k1-dev \
libboost-system-dev \
libboost-test-dev \
libboost-dev \
libpcre3-dev \
&& rm -rf /var/lib/apt/lists/*

ENV OCAML_VERSION 4.11.2

# CMake gets installed here
ENV PATH="/root/.local/bin:${PATH}"

RUN bash scripts/install_cmake_ubuntu.sh \
&& make opamdep-ci \
&& echo '. ~/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true ' >> ~/.bashrc \
&& eval $(opam env) && \
make slim
4 changes: 3 additions & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:avsm/ppa -y \
&& apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
wget \
cmake \
Expand All @@ -26,12 +27,13 @@ RUN apt-get update \
libffi-dev \
libssl-dev \
libsecp256k1-dev \
libboost-dev \
libboost-system-dev \
libboost-test-dev \
libpcre3-dev \
&& rm -rf /var/lib/apt/lists/*

ENV OCAML_VERSION 4.08.1
ENV OCAML_VERSION 4.11.2

# CMake gets installed here
ENV PATH="/root/.local/bin:${PATH}"
Expand Down

0 comments on commit 4521dfa

Please sign in to comment.