Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/publish-soldeer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Publish to Soldeer
on:
push:
tags:
- "v*"
jobs:
publish:
uses: rainlanguage/rainix/.github/workflows/publish-soldeer.yaml@main
secrets: inherit
5 changes: 5 additions & 0 deletions .github/workflows/rainix-sol-static.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: rainix-sol-static
on: [push]
jobs:
static:
uses: rainlanguage/rainix/.github/workflows/rainix-sol-static.yaml@main
11 changes: 2 additions & 9 deletions .github/workflows/rainix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,23 @@ on:
branches:
- main
pull_request:

concurrency:
group: ${{ github.ref }}-rainix
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
rainix:
strategy:
matrix:
os: [ubuntu-latest]
task: [rainix-sol-legal, rainix-sol-test, rainix-sol-static]
task: [rainix-sol-legal, rainix-sol-test]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
DEPLOYMENT_KEY: ${{ github.ref == 'refs/heads/main' && secrets.PRIVATE_KEY || secrets.PRIVATE_KEY_DEV }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
Expand All @@ -39,10 +35,7 @@ jobs:
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 5G
gc-max-store-size-macos: 5G

- run: nix develop -c rainix-sol-prelude
if: matrix.task == 'rainix-rs-test' || matrix.task == 'rainix-rs-static' || matrix.task == 'test-wasm-build'

- run: nix develop -c forge soldeer install
- name: Run ${{ matrix.task }}
env:
ETH_RPC_URL: ${{ secrets.CI_DEPLOY_SEPOLIA_RPC_URL || vars.CI_DEPLOY_SEPOLIA_RPC_URL }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cache
dependencies
out
.fixes
.env
.env
.pre-commit-config.yaml
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

24 changes: 24 additions & 0 deletions .soldeerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.DS_Store
.gas-snapshot
.git
.github
.gitignore
.gitmodules
.pre-commit-config.yaml
.soldeerignore
.vscode
/audit
/cache
/dependencies
/docs
/flake.lock
/flake.nix
/foundry.lock
/foundry.toml
/lib
/out
/remappings.txt
/slither.config.json
/soldeer.lock
/target
/test
96 changes: 71 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,79 @@
# rain.deploy

Tooling to deploy Solidity code managed with foundry and nix to production using
the Zoltu deterministic deployment proxy to supported networks.
Tooling to deploy Solidity contracts deterministically across EVM networks via
the Zoltu deployment proxy.

Fundamentally Rain code is EVM compatible so can be deployed to any EVM network.
All code is open source and permissionlessly deployable and useable, but only a
subset of all possible networks will be active deploy targets for the Rain
organisation/ecosystem based on use cases and demand.
Fundamentally Rain code is EVM-compatible and permissionlessly deployable
anywhere, but only a curated subset of networks are active deploy targets for
the Rain organisation. This library provides shared infrastructure for that
subset.

Additionally, because Rain is expected to operate across many networks, several
questions naturally arise:
It answers:

- Are the dependencies of the current deployment available on this network?
- Does this deployment match other deployments on other networks?
- Have I deployed sucessfully to all expected networks?
- Have I deployed successfully to all expected networks?
- How do I track deployments over time and share addresses with other people?
- How do I ensure the deployed code is bytecode equivalent to local compilations?

This repo helps to tool and answer these questions in as foolproof a way as
possible, without overreliance on processes that can be forgotten or
misunderstood.

- The Zoltu deterministic deployment proxy is used to ensure that addresses are
the same across all networks.
- The interface into the library allows lists of supported networks and
dependencies to be provided by the caller.
- Standard error handling and guards are provided to prevent deployments to
networks missing dependencies and other silent failures in the deployment.
- Deployments only succeed if the resulting address matches a precalculated
address (ideally committed to a repo somewhere)
- Post-deploy bytecode integrity checks are supported, such as those provided by
the Rain Extrospection lib.
- How do I ensure deployed code is bytecode-equivalent to local compilations?

Approach:

- Zoltu deterministic deployment proxy: same address on every supported network.
- Caller-provided supported-network and dependency lists.
- Hard guards against deploying to networks where dependencies are missing.
- Pre-calculated addresses asserted post-deploy: silent failures fail loudly.
- Bytecode integrity checks (e.g. via the Rain Extrospection lib) supported
post-deploy.

## Install

Via [soldeer](https://soldeer.xyz):

```sh
forge soldeer install rain-deploy~<version>
```

## Develop

This repo uses [nix](https://nixos.org/download.html). The default shell is the
slim `sol-shell` from [rainix](https://github.com/rainlanguage/rainix).

```sh
nix develop # enter the shell
forge soldeer install # install deps declared in foundry.toml
forge test
```

Tasks:

- `rainix-sol-test` — `forge test`
- `rainix-sol-static` — slither
- `rainix-sol-legal` — `reuse lint`

Use the nix-pinned `forge` for all development.

## Publish

Tag `v<x.y.z>` on `main`. The
[`Publish to Soldeer`](.github/workflows/publish-soldeer.yaml) wrapper delegates
to rainix's reusable workflow, which derives the package name from the repo name
(`rain.deploy` → `rain-deploy`).

## License

DecentraLicense 1.0 (DCL-1.0) — full text in
[`LICENSES/`](LICENSES/LicenseRef-DCL-1.0.txt). Roughly `CAL-1.0`
([opensource.org](https://opensource.org/license/cal-1-0)) plus user-data
disclosure obligations consistent with permissionless-blockchain assumptions.

This repo is [REUSE 3.2](https://reuse.software/spec-3.2/) compliant. Verify
locally:

```sh
nix develop -c rainix-sol-legal
```

## Contributions

Welcome under the same license. Contributors warrant that their contributions
are compliant.
26 changes: 15 additions & 11 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ version = 1

[[annotations]]
path = [
".gas-snapshot",
".github/**/",
".gitignore",
".gitmodules",
"audit/**/",
"README.md",
"flake.lock",
"flake.nix",
"foundry.toml",
"foundry.lock",
"slither.config.json",
".gas-snapshot",
".github/**/",
".gitignore",
".gitmodules",
".soldeerignore",
"audit/**/",
"README.md",
"flake.lock",
"flake.nix",
"foundry.toml",
"foundry.lock",
"remappings.txt",
"slither.config.json",
"REUSE.toml",
"soldeer.lock",
]
SPDX-FileCopyrightText = "Copyright (c) 2020 Rain Open Source Software Ltd"
SPDX-License-Identifier = "LicenseRef-DCL-1.0"
Loading
Loading