Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NET-61 ci gamma diff report #1008

Merged
merged 33 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f523526
update bash script
jterzis Sep 6, 2024
e708d70
add new cmd to strictly calc bytecode hashes and split from root cmd
jterzis Sep 6, 2024
a43181b
render diff update report to html
jterzis Sep 6, 2024
49d715a
updated run_util cmd to render html report
jterzis Sep 7, 2024
7abde26
clean up report.html template and move to separate dir
jterzis Sep 7, 2024
ba87eef
Merge remote-tracking branch 'origin/main' into jt/net-62-upgrade-scr…
jterzis Sep 7, 2024
6489e9e
complete implementation ci job for alpha, gamma report
jterzis Sep 7, 2024
dd9d63e
prettier fix
jterzis Sep 7, 2024
74f1a59
add go setup
jterzis Sep 7, 2024
38d5c1b
run workflows with current branch to test
jterzis Sep 8, 2024
19ba465
allow for testing on current branch
jterzis Sep 8, 2024
ad052f3
combine steps into bytecode diff report to share directory space in g…
jterzis Sep 8, 2024
2908ad1
add env vars needed directory to each step
jterzis Sep 8, 2024
5335643
move env declaration
jterzis Sep 8, 2024
fc321e5
fix how secrets are passed to workflow call
jterzis Sep 8, 2024
dc50c68
add ellided basescal url for debugging
jterzis Sep 8, 2024
8762fd7
add missing basescan api key to step env
jterzis Sep 8, 2024
caf96b2
add http error handling and logging
jterzis Sep 8, 2024
5503763
print raw json response
jterzis Sep 8, 2024
f3123e6
throttle calls to basescan to avoid rate limit
jterzis Sep 8, 2024
275ea66
fix upgrade script filename path
jterzis Sep 8, 2024
48b381d
add foundry deps to gh action
jterzis Sep 8, 2024
957632f
use basescan_api_key
jterzis Sep 8, 2024
240c47f
add testnet private key to upgrade env
jterzis Sep 8, 2024
aa89146
remove pipefail short circuit from script
jterzis Sep 8, 2024
5577ba4
add right workign dir
jterzis Sep 8, 2024
f6929c4
run_util cmd, split out into root and run_util command in main.go, an…
jterzis Sep 9, 2024
b4518a4
upgrade-facets bash script running make targets
jterzis Sep 9, 2024
6ac5f84
Merge branch 'jt/net-80-upgrade-diff-report-render' into jt/net-61-ci…
jterzis Sep 9, 2024
04b0d44
remove unused workflow
jterzis Sep 9, 2024
fb23f54
add cron schedule initially for every monday morning 6 am UTC
jterzis Sep 9, 2024
f49c237
prettier fixes
jterzis Sep 9, 2024
aa9cc22
Merge remote-tracking branch 'origin/main' into jt/net-61-ci-implemen…
jterzis Sep 9, 2024
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
84 changes: 84 additions & 0 deletions .github/workflows/Bytecode_diff_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Bytecode Diff Report
env:
FOUNDRY_VERSION: nightly
TESTNET_PRIVATE_KEY: ${{ secrets.GAMMA_BASE_SEPOLIA_DEPLOYER_PK }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
BASE_SEPOLIA_RPC_URL: ${{ secrets.BASE_SEPOLIA_RPC_URL }}
FACET_SOURCE_PATH: ../../contracts/src
REPORT_OUT_DIR: ${{ vars.REPORT_OUT_DIR }}
BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }}
BASESCAN_SEPOLIA_API_KEY: ${{ secrets.BASESCAN_SEPOLIA_API_KEY }}
BASESCAN_SEPOLIA_URL: 'https://api-sepolia.basescan.org/api'
BLOCKSCOUT_SEPOLIA_URL: 'https://base-sepolia.blockscout.com/api'
BLOCKSCOUT_SEPOLIA_API_KEY: ${{ secrets.BLOCKSCOUT_BASE_SEPOLIA_API_KEY }}
GOWORK: off
on:
workflow_dispatch:
inputs:
origin_environment:
description: 'Origin environment'
required: true
type: choice
options:
- 'alpha'
- 'gamma'
- 'omega'
default: 'alpha'
target_environment:
description: 'Target environment'
required: true
type: choice
options:
- 'alpha'
- 'gamma'
- 'omega'
default: 'gamma'

workflow_call:
inputs:
origin_environment:
description: 'Origin environment'
required: true
type: string
target_environment:
description: 'Target environment'
required: true
type: string

jobs:
run:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || 'main' }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22' # Specify the Go version you need

- name: Install dependencies
run: |
go mod download
go mod tidy
working-directory: scripts/bytecode-diff

- name: Run report generation
run: |
go run main.go -v ${{ inputs.origin_environment }} ${{ inputs.target_environment }}
working-directory: scripts/bytecode-diff

- name: Get latest facet diff file
run: |
FACET_DIFF_FILE=$(find ${{ env.REPORT_OUT_DIR }} -name "facet_diff*.yaml" | sort -r | head -n 1)
echo "Latest facet diff file: $FACET_DIFF_FILE"
echo "FACET_DIFF_FILE=$FACET_DIFF_FILE" >> $GITHUB_ENV
working-directory: scripts/bytecode-diff
jterzis marked this conversation as resolved.
Show resolved Hide resolved

- name: Run facet upgrades based on diffs
run: |
./scripts/upgrade-facets.sh ${{ inputs.target_environment }} ${{ env.REPORT_OUT_DIR }} ${{ env.FACET_DIFF_FILE }}
working-directory: scripts/bytecode-diff
jterzis marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 6 additions & 5 deletions .github/workflows/Network_diff_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ on:
workflow_dispatch:

jobs:
Run_Bytecode_Diff_Upgrade:
Run_Gamma_Bytecode_Diff_Upgrade:
name: Run Gamma Bytecode Diff Upgrade
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || 'main' }}

- name: Gamma Network Diff Report
- name: Network Diff Report
uses: ./.github/workflows/Bytecode_diff_report.yml
with:
origin_environment: alpha
target_environment: gamma

- name: Upgrade Gamma Facets
uses: ./.github/workflows/Upgrade_network_facets.yml
- name: Render Network Diff Upgrade Report
uses: ./.github/workflows/Render_diff_upgrade_report.yml
with:
environment_name: gamma
91 changes: 91 additions & 0 deletions .github/workflows/Render_diff_upgrade_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Render Diff Upgrade Report
env:
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
BASE_SEPOLIA_RPC_URL: ${{ secrets.BASE_SEPOLIA_RPC_URL }}
REPORT_OUT_DIR: ${{ vars.REPORT_OUT_DIR }}
AWS_ACCESS_KEY_ID: ${{ secrets.RIVER_S3_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RIVER_S3_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.RIVER_S3_AWS_REGION }}
GOWORK: off

on:
workflow_dispatch:
inputs:
environment_name:
description: 'Environment name'
required: true
type: choice
options:
- 'alpha'
- 'gamma'
- 'omega'

workflow_call:
inputs:
environment_name:
description: 'Environment name'
required: true
type: string

jobs:
Render_Diff_Upgrade_Report:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || 'main' }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22' # Specify the Go version you need

- name: Install dependencies
run: |
go mod download
go mod tidy
working-directory: scripts/bytecode-diff

- name: Get latest facet diff file
run: |
FACET_DIFF_FILE=$(find ${{ env.REPORT_OUT_DIR }} -name "facet_diff*.yaml" | sort -r | head -n 1)
echo "Latest facet diff file: $FACET_DIFF_FILE"
echo "FACET_DIFF_FILE=$FACET_DIFF_FILE" >> $GITHUB_ENV

jterzis marked this conversation as resolved.
Show resolved Hide resolved
- name: Run final html report generation w/ updated hashes
id: gen_html_report
run: |
go run main.go add-hashes ${{ inputs.environment_name }} ${{ env.FACET_DIFF_FILE }}
working-directory: scripts/bytecode-diff

- name: Configure AWS credentials
if: steps.gen_html_report.outcome == 'success'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

jterzis marked this conversation as resolved.
Show resolved Hide resolved
- name: Copy HTML report to S3
if: steps.gen_html_report.outcome == 'success'
run: |
# Find the latest hashed HTML file
HTML_FILE=$(find ${{ env.REPORT_OUT_DIR }} -name "*_hashed_*.html" | sort -r | head -n 1)

if [ -z "$HTML_FILE" ]; then
echo "Error: No hashed HTML file found"
exit 1
fi

echo "Latest hashed HTML file: $HTML_FILE"

# Copy to report.html
aws s3 cp $HTML_FILE s3://${{ inputs.environment_name }}-reports/report.html

# Copy to report_YYYYMMDD.html
DATED_FILENAME="report_$(date -u +%Y%m%d).html"
aws s3 cp $HTML_FILE s3://${{ inputs.environment_name }}-reports/$DATED_FILENAME

echo "HTML report copied to S3 bucket ${{ inputs.environment_name }}-reports files report.html and $DATED_FILENAME"
jterzis marked this conversation as resolved.
Show resolved Hide resolved
jterzis marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ yarn.lock

packages/generated/*

scripts/bytecode-diff/templates/*
packages/proto/src/protocol_*.ts
22 changes: 22 additions & 0 deletions scripts/bytecode-diff/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,28 @@ diamonds:

```

### Run keccak256 hash generation on deployed contracts

```bash
GOWORK=off go run main.go add-hashes gamma deployed-diffs/facet_diff_090624_1.yaml

# output to new yaml file suffixed with _hashed.yaml including bytecodeHash for each contract in deployments section
➜ bytecode-diff git:(jt/net-62-upgrade-script-2) ✗ yq e '.deployments' deployed-diffs/facet_diff_090624_1_hashed.yaml
Architect:
address: 0xa18a3df4f63cdcae943d9c76730adf2812388de4
baseScanLink: https://sepolia.basescan.org/tx/0x4280ef1300fe001e7d85e7495eba13fc99be53ee7a7060e753d466f8bebf1622
bytecodeHash: 0x20d0a86e9ea31a39663285aacfe88705983520a4482a7bac5ada891c9adfe090
deploymentDate: 2024-09-06 19:04
transactionHash: 0x4280ef1300fe001e7d85e7495eba13fc99be53ee7a7060e753d466f8bebf1622
Banning:
address: 0x4d88d1fbba6ce6bcdb4381549ee0b7c0d2b56919
baseScanLink: https://sepolia.basescan.org/tx/0x4ccbaf9750bcd0971975e73a24b05f1c51d4703cf72a406356c79eb54de9c33c
bytecodeHash: 0xa2ce3e77ba060ff1d59ed384e1c6c5788f308ad8bbbef612eb3e5de4e1d79de8
deploymentDate: 2024-09-06 19:05
transactionHash: 0x4ccbaf9750bcd0971975e73a24b05f1c51d4703cf72a406356c79eb54de9c33c
...
```

### Flags

```bash
Expand Down
Loading
Loading