Skip to content
Draft
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
103 changes: 103 additions & 0 deletions .github/workflows/moonwell-live-state.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Moonwell live-state audit runner

on:
pull_request:
branches:
- main
workflow_dispatch:

permissions:
contents: read

jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 240
steps:
- name: Checkout runner branch
uses: actions/checkout@v4

- name: Restore Moonwell audit payload
shell: bash
run: |
set -euo pipefail
base64 -d moonwell-live-payload.b64 > /tmp/moonwell-live-payload.tgz
tar -xzf /tmp/moonwell-live-payload.tgz
python -m py_compile moonwell/scripts/snapshot.py
python - <<'PY'
import json
assert json.load(open('moonwell/scope.json'))['scope_count'] == 96
print('payload restored')
PY

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

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

- name: Install RPC and ABI tooling
run: python -m pip install --disable-pip-version-check requests eth-abi eth-utils pycryptodome

- name: Checkout current Moonwell source and full history
uses: actions/checkout@v4
with:
repository: moonwell-fi/moonwell-contracts-v2
path: repos/moonwell-contracts-v2
submodules: recursive
fetch-depth: 0

- name: Checkout current Mamo source and full history
uses: actions/checkout@v4
with:
repository: moonwell-fi/mamo-contracts
path: repos/mamo-contracts
submodules: recursive
fetch-depth: 0

- name: Record exact environment
shell: bash
run: |
set -euo pipefail
mkdir -p moonwell/results
{
echo "generated_utc=$(date -u +%FT%TZ)"
echo "runner_commit=$(git rev-parse HEAD)"
echo "moonwell_commit=$(git -C repos/moonwell-contracts-v2 rev-parse HEAD)"
echo "mamo_commit=$(git -C repos/mamo-contracts rev-parse HEAD)"
forge --version
cast --version
anvil --version
python --version
python -m pip freeze
} | tee moonwell/results/environment.txt

- name: Execute deployment and configuration snapshot
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: |
set +e
set -o pipefail
python moonwell/scripts/snapshot.py 2>&1 | tee moonwell/results/snapshot-run.log
rc=${PIPESTATUS[0]}
echo "$rc" > moonwell/results/snapshot-exit-code.txt
exit 0

- name: Upload complete result bundle
if: always()
uses: actions/upload-artifact@v4
with:
name: moonwell-live-state-results
path: moonwell
if-no-files-found: error
retention-days: 7
compression-level: 6

- name: Enforce successful snapshot
if: always()
run: test "$(cat moonwell/results/snapshot-exit-code.txt)" = "0"
Loading
Loading