Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
bbdb0aa
Improved the Ethereum migrations
jalextowle May 16, 2023
320dfdb
Fixes the docker services so that migrations runs consistently
jalextowle May 17, 2023
ac0091a
Increased the reliability of the docker images
jalextowle May 17, 2023
822fc8f
Miscallaneous improvements to the infrastructure
jalextowle May 17, 2023
b78ddba
Setup a github action to deploy the migrations image to the registry
jalextowle May 17, 2023
46146ab
Renamed the python scripts
jalextowle May 17, 2023
c11b29e
Bump node version in CI
jalextowle May 17, 2023
84a9747
Cleaned up `HyperdriveMath`
jalextowle May 17, 2023
be616ae
Experimenting with pushing to the registry
jalextowle May 17, 2023
b0bc6c8
Added submodules to the docker workflow
jalextowle May 17, 2023
64e00d2
Changed the tagging logic in the docker github action
jalextowle May 18, 2023
8548abc
Revert "Changed the tagging logic in the docker github action"
jalextowle May 18, 2023
bcf16d2
Updated tagging logic
jalextowle May 18, 2023
8252876
Build the foundry code in the image
jalextowle May 18, 2023
e98a598
Cleanup
jalextowle May 18, 2023
1c62a4c
Added semver tagging to the github workflows
jalextowle May 18, 2023
63034c1
Updated docker workflow to run when tags are pushed
jalextowle May 18, 2023
28c94be
Use the production profile
jalextowle May 18, 2023
86a9423
secret sauce
wakamex May 18, 2023
a265a18
Reverted to an earlier foundry version
jalextowle May 19, 2023
2df8760
Updated the CI
jalextowle May 19, 2023
b68de5c
Pinned ape to a working version
jalextowle May 19, 2023
3044ed9
Fixed the tests after foundry update
jalextowle May 19, 2023
4df58f5
Reverted the changes to the python requirements
jalextowle May 19, 2023
dd9b59c
Log the files
jalextowle May 19, 2023
13caea0
Removed python cache
jalextowle May 20, 2023
f545e4f
Updated python version
jalextowle May 20, 2023
6c37dbd
Updated the eth-ape dependency
jalextowle May 20, 2023
2807fe9
Fixed a numerical bug in `calculateCloseShort`
jalextowle May 20, 2023
d453cd1
Removed the deprecated ape setting
jalextowle May 20, 2023
f99f3b0
run anvil on 8549 by default
wakamex May 20, 2023
1a9abdc
more detailed pytest
wakamex May 20, 2023
dcfd460
try forge install
wakamex May 20, 2023
396bb6a
remove unnecessary dependency line
wakamex May 20, 2023
21dce6a
add compile step
wakamex May 20, 2023
3f7b2d7
additional update step to ape dependencies
wakamex May 20, 2023
b3575a7
Pinned to the previous ape-solidity version:
jalextowle May 20, 2023
da839fc
Merge remote-tracking branch 'origin/jalextowle/infra/private-testnet…
jalextowle May 20, 2023
9df71a0
install fix to eth-solidity
wakamex May 20, 2023
a9fce2a
fix the fix
wakamex May 20, 2023
0cf420b
fix ape-config
wakamex May 20, 2023
9ba4c7f
remove version pin, use upstream fix
wakamex May 22, 2023
89a228f
more descriptive pytest settings
wakamex May 22, 2023
02cd78d
try to unbreak the benchmark
wakamex May 22, 2023
a251cc2
actually test upstream, add github tokens to avoid rate limit
wakamex May 22, 2023
37b9aeb
more verbose pytest, for specific workflow step only
wakamex May 22, 2023
92ce213
remove pytest.ini after we use it
wakamex May 22, 2023
b326c30
add newline
wakamex May 22, 2023
4728e5e
fix pytest.ini
wakamex May 22, 2023
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: 7 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,27 @@ jobs:
- name: install node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x

- name: install packages
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- uses: actions/setup-python@v4
with:
python-version: "3.10"

# Run the gas benchmark and stores the output to a json file.
- name: Run benchmark
run: python scripts/gas_benchmarks.py benchmarks.json
run: python python/gas_benchmarks.py benchmarks.json

# Load the benchmarks cache. We use a different cache key for every run
# because Github Actions caches are currently immutable. By specifying the
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: install node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x

- name: install packages
uses: borales/actions-yarn@v4
Expand All @@ -34,6 +34,8 @@ jobs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run coverage
run: |
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish the artifacts image

on:
workflow_dispatch:
push:
branches:
- "main"
tags:
- "v*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/migrations

jobs:
push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=sha,enable=true,prefix=nightly-,suffix=,format=long

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: install node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x

- name: install packages
uses: borales/actions-yarn@v4
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

- name: install node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
token: ${{ secrets.GITHUB_TOKEN }}

- name: install packages
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
token: ${{ secrets.GITHUB_TOKEN }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed

Expand All @@ -44,14 +47,20 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10.10"
cache: "pip"
cache: pip
token: ${{ secrets.GITHUB_TOKEN }}

- name: install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install eth-ape pytest
ape plugins install .
ape compile --force

- name: test python
run: python -m pytest .
run: |
echo "[pytest]
log_cli: true
log_level: DEBUG" > pytest.ini
python -m pytest . -r A --verbosity=2
rm pytest.ini
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Yarn Image ###

FROM node:lts AS yarn-builder

WORKDIR /src

COPY ./package.json ./package.json
COPY ./yarn.lock ./yarn.lock

RUN yarn install

### Foundry Image ###

FROM ghcr.io/foundry-rs/foundry:master

WORKDIR /src

# Load the ethereum environment variables.
ENV ETH_FROM=${ETH_FROM}
ENV PRIVATE_KEY=${PRIVATE_KEY}
ENV RPC_URL=${RPC_URL}

# Copy the contract dependencies required to run the migration script.
COPY --from=yarn-builder /src/node_modules/@openzeppelin/ ./node_modules/@openzeppelin/
COPY ./.git/ ./.git/
COPY ./contracts/ ./contracts/
COPY ./lib/ ./lib/
COPY ./script/ ./script/
COPY ./test/ ./test/
COPY ./foundry.toml ./foundry.toml

# Build the contracts using the "production" profile.
RUN FOUNDRY_PROFILE="production" forge build

# Copy the script used to run the migrations and set its permissions.
COPY ./run_migrations.sh ./run_migrations.sh
RUN chmod a+x ./run_migrations.sh

# Create the artifacts directory.
RUN mkdir -p ./artifacts

ENTRYPOINT ./run_migrations.sh
10 changes: 5 additions & 5 deletions ape-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ plugins:
- name: foundry

dependencies:
- name: OpenZeppelin
github: OpenZeppelin/openzeppelin-contracts
version: 4.8.1
- name: Aave
github: aave/aave-v3-core
version: 1.17.2
- name: OpenZeppelin
github: OpenZeppelin/openzeppelin-contracts
version: 4.8.3

solidity:
import_remapping:
- "@openzeppelin/contracts=OpenZeppelin/4.8.1"
- "@openzeppelin/contracts=OpenZeppelin/4.8.3"
- "@aave=Aave/1.17.2"

ethereum:
Expand All @@ -22,4 +22,4 @@ ethereum:
default_provider: foundry

foundry:
port: 8555
host: http://localhost:8555
4 changes: 2 additions & 2 deletions contracts/src/libraries/HyperdriveMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ library HyperdriveMath {
_sharePrice
);

if (_normalizedTimeRemaining > 0) {
bondReservesDelta = _amountOut.mulDown(_normalizedTimeRemaining);
bondReservesDelta = _amountOut.mulDown(_normalizedTimeRemaining);
if (bondReservesDelta > 0) {
shareReservesDelta = YieldSpaceMath.calculateSharesInGivenBondsOut(
_shareReserves,
_bondReserves,
Expand Down
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ cache_path = 'forge-cache'
remappings = ['forge-std=lib/forge-std/src', '@openzeppelin/=node_modules/@openzeppelin', '@aave/=lib/aave-v3-core/contracts']
# gas limit - max u64
gas_limit = "18446744073709551615"
# Allows the scripts to write the addresses to a file.
fs_permissions = [{ access = "write", path = "./artifacts/script_addresses.json" }]
# See more config options https://github.com/foundry-rs/foundry/tree/master/config

[profile.production]
Expand Down
59 changes: 0 additions & 59 deletions migrations/AaveFixedBorrowAction.s.sol

This file was deleted.

45 changes: 0 additions & 45 deletions migrations/MakerDsrHyperdrive.s.sol

This file was deleted.

45 changes: 0 additions & 45 deletions migrations/MockHyperdrive.s.sol

This file was deleted.

Loading