Skip to content

Commit

Permalink
Merge branch 'dev' into feat/manage-multiple-implementation-slots
Browse files Browse the repository at this point in the history
  • Loading branch information
Aboudjem authored Jun 1, 2024
2 parents 9a91b01 + abc6109 commit 32d5bd9
Show file tree
Hide file tree
Showing 14 changed files with 988 additions and 141 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/gas_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Gas Report

on:
pull_request:
branches:
- dev
- main

jobs:
generate-gas-report:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/yarn
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install

- name: Run gas report script
run: node scripts/foundry/generateGasReport.js

- name: Check gas report file exists
run: |
if [ ! -f GAS_REPORT.md ]; then
echo "GAS_REPORT.md does not exist."
exit 1
fi
- name: Upload gas report artifact
uses: actions/upload-artifact@v4
with:
name: gas-report-${{ github.sha }}
path: GAS_REPORT.md
if-no-files-found: warn

compare-gas-report:
runs-on: ubuntu-latest
needs: generate-gas-report
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download previous gas report
id: download-previous
uses: actions/download-artifact@v4
with:
name: gas-report-${{ github.event.pull_request.base.sha }}
path: previous_gas_report
continue-on-error: true

- name: Download current gas report
uses: actions/download-artifact@v4
with:
name: gas-report-${{ github.sha }}
path: current_gas_report

- name: Compare gas reports
id: compare-gas-reports
if: steps.download-previous.outcome == 'success'
run: |
node scripts/foundry/compareGasReports.js previous_gas_report/GAS_REPORT.md current_gas_report/GAS_REPORT.md > gas_report_diff.md
- name: Handle no previous report
if: steps.download-previous.outcome != 'success'
run: echo "No previous gas report found. Skipping comparison."

- name: Upload gas report comparison
if: steps.compare-gas-reports.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: gas-report-comparison-${{ github.sha }}
path: gas_report_diff.md

- name: Read gas report comparison
if: steps.compare-gas-reports.outcome == 'success'
id: read-gas-report-comparison
run: echo "gas_report_diff=$(<gas_report_diff.md)" >> $GITHUB_ENV

- name: Create pull request comment
if: steps.compare-gas-reports.outcome == 'success'
uses: marocchino/sticky-pull-request-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
header: Gas Report Comparison
message: |
## Gas Report Comparison
```diff
${{ env.gas_report_diff }}
```
58 changes: 58 additions & 0 deletions GAS_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Gas Report
| **Protocol** | **Actions / Function** | **Account Type** | **Is Deployed** | **With Paymaster?** | **Receiver Access** | **Gas Used** | **Gas Difference** |
|:------------:|:---------------------:|:----------------:|:--------------:|:-------------------:|:-------------------:|:------------:|:------------------:|
| ERC20 | transfer | EOA | False | False | 🧊 ColdAccess | 49921 | 0 |
| ERC20 | transfer | EOA | False | False | 🔥 WarmAccess | 25221 | 0 |
| ERC20 | transfer | Smart Account | True | False | 🧊 ColdAccess | 94767 | 0 |
| ERC20 | transfer | Smart Account | True | False | 🔥 WarmAccess | 74867 | 0 |
| ERC20 | transfer | Smart Account | False | True | 🧊 ColdAccess | 335883 | 0 |
| ERC20 | transfer | Smart Account | False | True | 🔥 WarmAccess | 315984 | 0 |
| ERC20 | transfer | Smart Account | False | False | 🧊 ColdAccess | 319073 | 0 |
| ERC20 | transfer | Smart Account | False | False | 🔥 WarmAccess | 299174 | 0 |
| ERC20 | transfer | Smart Account | False | False | 🧊 ColdAccess | 367178 | 0 |
| ERC20 | transfer | Smart Account | False | False | 🔥 WarmAccess | 347278 | 0 |
| ERC20 | transfer | Smart Account | True | True | 🧊 ColdAccess | 111262 | 0 |
| ERC20 | transfer | Smart Account | True | True | 🔥 WarmAccess | 91363 | 0 |
| ERC721 | transferFrom | EOA | False | False | 🧊 ColdAccess | 48483 | 0 |
| ERC721 | transferFrom | EOA | False | False | 🔥 WarmAccess | 28583 | 0 |
| ERC721 | transferFrom | Smart Account | True | False | 🧊 ColdAccess | 98254 | 0 |
| ERC721 | transferFrom | Smart Account | True | False | 🔥 WarmAccess | 78354 | 0 |
| ERC721 | transferFrom | Smart Account | False | True | 🧊 ColdAccess | 334585 | 0 |
| ERC721 | transferFrom | Smart Account | False | True | 🔥 WarmAccess | 314685 | 0 |
| ERC721 | transferFrom | Smart Account | False | False | 🧊 ColdAccess | 317777 | 0 |
| ERC721 | transferFrom | Smart Account | False | False | 🔥 WarmAccess | 297877 | 0 |
| ERC721 | transferFrom | Smart Account | False | False | 🧊 ColdAccess | 365881 | 0 |
| ERC721 | transferFrom | Smart Account | False | False | 🔥 WarmAccess | 345981 | 0 |
| ERC721 | transferFrom | Smart Account | True | True | 🧊 ColdAccess | 114777 | 0 |
| ERC721 | transferFrom | Smart Account | True | True | 🔥 WarmAccess | 94877 | 0 |
| ETH | transfer | EOA | False | False | 🧊 ColdAccess | 53073 | 0 |
| ETH | transfer | EOA | False | False | 🔥 WarmAccess | 28073 | 0 |
| ETH | call | EOA | False | False | 🧊 ColdAccess | 53201 | 0 |
| ETH | call | EOA | False | False | 🔥 WarmAccess | 28201 | 0 |
| ETH | send | EOA | False | False | 🧊 ColdAccess | 53201 | 0 |
| ETH | send | EOA | False | False | 🔥 WarmAccess | 28201 | 0 |
| ETH | transfer | Smart Account | True | False | 🧊 ColdAccess | 102616 | 0 |
| ETH | transfer | Smart Account | True | False | 🔥 WarmAccess | 77616 | 0 |
| ETH | transfer | Smart Account | False | True | 🧊 ColdAccess | 338898 | 0 |
| ETH | transfer | Smart Account | False | True | 🔥 WarmAccess | 313898 | 0 |
| ETH | transfer | Smart Account | False | False | 🧊 ColdAccess | 322110 | 0 |
| ETH | transfer | Smart Account | False | False | 🔥 WarmAccess | 297110 | 0 |
| ETH | transfer | Smart Account | False | False | 🧊 ColdAccess | 370215 | 0 |
| ETH | transfer | Smart Account | False | False | 🔥 WarmAccess | 345215 | 0 |
| ETH | transfer | Smart Account | True | True | 🧊 ColdAccess | 119101 | 0 |
| ETH | transfer | Smart Account | True | True | 🔥 WarmAccess | 94101 | 0 |
| UniswapV2 | swapExactETHForTokens | EOA | False | False | N/A | 149263 | 0 |
| UniswapV2 | swapExactETHForTokens | Smart Account | True | False | N/A | 199242 | 0 |
| UniswapV2 | swapExactETHForTokens | Smart Account | False | True | N/A | 435648 | 0 |
| UniswapV2 | swapExactETHForTokens | Smart Account | False | False | N/A | 418767 | 0 |
| UniswapV2 | swapExactETHForTokens | Smart Account | False | False | N/A | 466872 | 0 |
| UniswapV2 | swapExactETHForTokens | Smart Account | True | True | N/A | 215805 | 0 |
| UniswapV2 | swapExactTokensForTokens | EOA | False | False | N/A | 118252 | 0 |
| UniswapV2 | swapExactTokensForTokens | Smart Account | True | False | N/A | 168221 | 0 |
| UniswapV2 | swapExactTokensForTokens | Smart Account | False | True | N/A | 404616 | 0 |
| UniswapV2 | swapExactTokensForTokens | Smart Account | False | False | N/A | 387734 | 0 |
| UniswapV2 | approve+swapExactTokensForTokens | Smart Account | True | False | N/A | 200217 | 0 |
| UniswapV2 | approve+swapExactTokensForTokens | Smart Account | False | True | N/A | 436814 | 0 |
| UniswapV2 | approve+swapExactTokensForTokens | Smart Account | False | False | N/A | 419743 | 0 |
| UniswapV2 | approve+swapExactTokensForTokens | Smart Account | False | False | N/A | 467849 | 0 |
| UniswapV2 | swapExactTokensForTokens | Smart Account | True | True | N/A | 184796 | 0 |
58 changes: 0 additions & 58 deletions gas_report.md

This file was deleted.

Loading

0 comments on commit 32d5bd9

Please sign in to comment.