• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

solc-js/H03-May-2022-1,3921,132

README.mdH A D20-Dec-20216.7 KiB9485

colony.shH A D20-Dec-20212.3 KiB7036

common.shH A D20-Dec-202111.2 KiB384291

ens.shH A D20-Dec-20212.2 KiB6733

gnosis-v2.shH A D20-Dec-20212.5 KiB6834

gnosis.shH A D20-Dec-20212.3 KiB6733

zeppelin.shH A D20-Dec-20212 KiB6230

README.md

1## Solidity external tests
2This directory contains scripts for compiling some of the popular open-source projects using the
3current version of the compiler and running their test suites.
4
5Since projects often do not use the latest compiler, we keep a fork of each of these projects
6at https://github.com/solidity-external-tests/. If changes are needed to make a project work with the
7latest version of the compiler, they are maintained as a branch on top of the upstream master branch.
8This is especially important for testing our `breaking` branch because we can not realistically expect
9external projects to be instantly compatible with a compiler version that has not been released yet.
10Applying necessary changes ourselves gives us confidence that breaking changes are sane and that
11these projects *can* be upgraded at all.
12
13### Recommended workflow
14
15#### Adding a new external project
161. If the upstream code cannot be compiled without modifications, create a fork of the repository
17   in https://github.com/solidity-external-tests/.
182. In our fork, remove all the branches except for main one (`master`, `develop`, `main`, etc).
19    This branch is going to be always kept up to date with the upstream repository and should not
20    contain any extra commits.
21    - If the project is not up to date with the latest compiler version but has a branch that is,
22        try to use that branch instead.
233. In our fork, create a new branch named after the main branch and the compiler version from our
24 `develop` branch.
25     E.g. if the latest Solidity version is 0.7.5 and the main branch of the external project
26     is called `master`, create `master_070`. This is where we will be adding our own commits.
274. Create a script for compiling/testing the project and put it in `test/externalTests/` in the
28    Solidity repository.
29    - The script should apply workarounds necessary to make the project actually use the compiler
30        binary it receives as a parameter and possibly add generic workarounds that should
31        work across different versions of the upstream project.
32    - Very specific workarounds that may easily break with every upstream change are better done as
33        commits in the newly added branch in the fork instead.
345. List the script in `test/externalTests.sh`.
356. Add the script to CircleCI configuration. Make sure to add both a compilation-only run and one that
36    also executes the test suite. If the latter takes a significant amount of time (say, more than
37    15 minutes) make it run nightly rather than on every PR.
387. Make sure that tests pass both on `develop` and on `breaking`. If the compiler from `breaking`
39    branch will not work without additional changes, add another branch, called after it in turn,
40    and add necessary workarounds there. Continuing the example above, the new branch would be
41    called `master_080` and should be rebased on top of `master_070`.
42    - The fewer commits in these branches, the better. Ideally, any changes needed to make the compiler
43        work should be submitted upstream and our scripts should be using the upstream repository
44        directly.
45
46#### Updating external projects for a PR that introduces breaking changes in the compiler
47If a PR to our `breaking` branch introduces changes that will make an external project no longer
48compile or pass its tests, the fork needs to be modified (or created if it does not yet exist):
49- If a branch specific to the compiler version from `breaking` does not exist yet:
50    1. Create the branch. It should be based on the version-specific branch used on `develop`.
51    2. Make your PR modify the project script in `test/externalScripts/` to use the new branch.
52    3. You are free to add any changes you need in the new branch since it will not interfere with
53        tests on `breaking`.
54    4. Work on your PR until it is approved and merged into `breaking`.
55- If the branch already exists and our CI depends on it:
56    1. If the external project after your changes can still work with `breaking` even without your PR or
57        if you know that the PR is straightforward and will be merged immediately without interfering
58        with tests on `breaking` for a significant amount of time, you can just push your modifications
59        to the branch directly and skip straight to steps 4. and 6.
60    2. Create a PR in the fork, targeting the existing version-specific branch.
61    3. In your PR to `breaking`, modify the corresponding script in `test/externalScripts/` to
62        use the branch from your PR in the fork.
63    4. Work on your PR until it is approved and ready to merge.
64    5. Merge the PR in the fork.
65    6. Discard your changes to the script and merge your PR into `breaking`.
66
67#### Pulling upstream changes into a fork
681. Pull changes directly into the main branch in the fork. This should be straightforward thanks to
69    it not containing any of our customizations.
702. If the project has been updated to a newer Solidity version, abandon the current version-specific
71    branch used on `develop` (but do not delete it) and create a new one corresponding to the newer
72    version. Then update project script in `test/externalTests/` to use the new branch. E.g. if `develop` uses
73    `master_050` and the project has been updated to use Solidity 0.7.3, create `master_070`.
743. Otherwise, rebase the current version-specific branch on the main branch of the fork. This may require
75    tweaking some of the commits to apply our fixes in new places.
764. If we have a separate branch for `breaking`, rebase it on top of the one used on `develop`.
77
78The above is the workflow to use when the update is straightforward and looks safe. In that case it is
79fine to just modify the branches directly. If this is not the case, it is recommended to first perform the
80operation on copies of these version-specific branches and test them by creating PRs on `develop` and
81`breaking` to see if tests pass. The PRs should just modify project scripts in `test/externalScripts/`
82to use the updated copies of the branches and can be discarded aferwards without being merged.
83
84#### Changes needed after a breaking release of the compiler
85When a non-backwards-compatible version becomes the most recent release, `breaking` branch
86gets merged into `develop` which automatically results in a switch to the newer version-specific
87branches if they exist. If no changes on our part were necessary, it is completely fine to keep using
88e.g. the `master_060` of an external project in Solidity 0.8.x.
89
90Since each project is handled separately, this approach may result in a mix of version-specific branches
91between different external projects. For example, in one project we could could have `master_050` on
92both `develop` and `breaking` and in another `breaking` could use `master_080` while `develop` still
93uses `master_060`.
94