Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into feat/aa-v7
Browse files Browse the repository at this point in the history
  • Loading branch information
ylv-io committed Dec 18, 2024
2 parents b467593 + 20d6a0d commit 4344a5d
Show file tree
Hide file tree
Showing 723 changed files with 277,331 additions and 4,140 deletions.
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
ADMIN_KINTO_WALLET=""
PRIVATE_KEY=""
MAINNET_NETWORK_ID="7887"
TESTNET_NETWORK_ID="7887000"
KINTO_EXPLORER_URL="https://kinto-mainnet.calderaexplorer.xyz/"
LEDGER_ADMIN=""
KINTO_WALLET_FACTORY=""
HARDWARE_WALLET_TYPE="0"

KINTO_RPC_URL="https://kinto-mainnet.calderachain.xyz/http"
ETHEREUM_RPC_URL=""
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/certora-verifier/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ runs:
- name: Install solc
shell: bash
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.18/solc-static-linux
wget https://github.com/ethereum/solidity/releases/download/v0.8.24/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.18
sudo mv solc-static-linux /usr/local/bin/solc8.24
- name: Verify
run: |
Expand Down
18 changes: 10 additions & 8 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Install dependencies
description: Install foundry & other dependencies for use in other actions

name: 'Install dependencies'
description: 'Install foundry & other dependencies for use in other actions'
runs:
using: composite

steps:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -21,8 +19,12 @@ runs:
forge-${{ github.base_ref }}
forge-
- name: Install token-bridge-contracts submodule dependencies
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- name: Install dependencies
shell: bash
run: |
cd lib/token-bridge-contracts
yarn
run: yarn install --frozen-lockfile
45 changes: 5 additions & 40 deletions .github/scripts/comment.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,26 @@
module.exports = async ({ github, context, header, body }) => {
const comment = [header, body].join("\n");

let issueNumber;

console.log("context.eventName", context.eventName);
if (context.eventName === "pull_request") {
// For pull_request events, the number is directly available
if (!context.payload.pull_request) {
console.error("No pull request info available in payload");
return; // Exit if pull request info is not available
}
issueNumber = context.payload.pull_request.number;
console.log("Pull Request Number: ", issueNumber);
} else if (context.eventName === "push") {
// For push events, try to get the associated pull requests
const pullRequests = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
head: `${context.repo.owner}:${context.ref.replace("refs/heads/", "")}`,
});

if (pullRequests && pullRequests.data && pullRequests.data.length > 0) {
// If there are open pull requests associated with the push, take the first one
issueNumber = pullRequests.data[0].number;
console.log("Associated Pull Request Number: ", issueNumber);
} else {
console.log("No associated pull requests found for this push event.");
return; // Exit early if no associated PR is found
}
} else {
// If the event is neither pull_request nor push, log it and exit
console.log(`Unhandled event type: ${context.eventName}`);
return;
}

// Get the existing comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
issue_number: context.payload.number,
});

// Find any comment already made by the bot
const botComment = comments.find(
(comment) => comment.user.id === 41898282 && comment.body.startsWith(header)
(comment) =>
// github-actions bot user
comment.user.id === 41898282 && comment.body.startsWith(header)
);

const commentFn = botComment ? "updateComment" : "createComment";

// Create or update the comment
await github.rest.issues[commentFn]({
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
...(botComment
? { comment_id: botComment.id }
: { issue_number: issueNumber }),
: { issue_number: context.payload.number }),
});
};
137 changes: 46 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,21 @@ jobs:
runs-on: ubuntu-latest

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

- uses: ./.github/actions/install

- name: Check formatting
run: forge fmt --check

build:
needs: format

name: Build
runs-on: ubuntu-latest

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

- uses: ./.github/actions/install

Expand All @@ -62,9 +60,7 @@ jobs:
runs-on: ubuntu-latest

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

- uses: ./.github/actions/install

Expand Down Expand Up @@ -99,9 +95,7 @@ jobs:
runs-on: ubuntu-latest

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

- uses: ./.github/actions/install

Expand Down Expand Up @@ -130,17 +124,15 @@ jobs:
runs-on: ubuntu-latest

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

- uses: ./.github/actions/install

- name: Install LCOV
run: sudo apt-get install -y lcov

- name: Generate LCOV report
run: forge coverage --report lcov && mv lcov.info lcov-local.info && FOUNDRY_PROFILE=fork forge coverage --report lcov && mv lcov.info lcov-fork.info && lcov --add lcov-local.info --add lcov-fork.info -o lcov.info && rm lcov-local.info && rm lcov-fork.info && lcov --remove lcov.info -o lcov.info "test/*" "script/*" && genhtml lcov.info --branch-coverage --output-dir coverage
run: forge coverage --report lcov --allow-failure && mv lcov.info lcov-local.info && FOUNDRY_PROFILE=fork forge coverage --report lcov --allow-failure && mv lcov.info lcov-fork.info && lcov --add lcov-local.info --add lcov-fork.info -o lcov.info && rm lcov-local.info && rm lcov-fork.info && lcov --remove lcov.info -o lcov.info "test/*" "script/*" "src/nitro-contracts/*" && genhtml lcov.info --branch-coverage --output-dir coverage
env:
FOUNDRY_FUZZ_RUNS: 100
KINTO_RPC_URL: ${{ secrets.KINTO_RPC_URL }}
Expand Down Expand Up @@ -171,58 +163,21 @@ jobs:
name: Slither
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ./.github/actions/install

- name: Run Slither
uses: crytic/slither-action@dev-foundryup-retry
uses: crytic/slither-action@v0.4.0
id: slither
continue-on-error: true
with:
node-version: 16
fail-on: none
slither-args: --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/

- name: Slither Comment
uses: actions/github-script@v6
# Run Slither Comment only for PRs
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
env:
OUTCOME: ${{ steps.slither.outcome }}
with:
script: |
const body = 'Slither analysis failed';
const repo = context.repo;
const issue_number = context.issue.number || context.payload.pull_request.number;
// find the existing Slither comment
async function findFailureComment() {
const comments = await github.rest.issues.listComments({
...repo,
issue_number,
});
return comments.data.find(comment => comment.body.includes(body));
}
// post or delete Slither failure comment
const failureComment = await findFailureComment();
if (process.env.OUTCOME == 'failure' && !failureComment) {
await github.rest.issues.createComment({
...repo,
issue_number,
body: body,
});
}
if (process.env.OUTCOME != 'failure' && failureComment) {
// if Slither succeeds and there's a previous failure comment, delete it
await github.rest.issues.deleteComment({
...repo,
comment_id: failureComment.id,
});
}
- name: Create/update checklist as PR comment
if: steps.slither.outcome != 'failure'
uses: actions/github-script@v6
- name: Slither PR Comment
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
env:
REPORT: ${{ steps.slither.outputs.stdout }}
with:
Expand All @@ -231,34 +186,34 @@ jobs:
const header = '# Slither report'
const body = process.env.REPORT
await script({ github, context, header, body })
certora:
needs:
- test-local
- test-fork

name: Certora
runs-on: ubuntu-latest
# Run Certora only on main
# if: github.ref == 'refs/heads/main'
strategy:
fail-fast: false
max-parallel: 16
matrix:
contract:
- KintoID_SanctionsTraits.conf
- KintoID_Monitor1.conf
- KintoID_Monitor2.conf
- KintoWallet.conf
- KintoWalletFactory.conf
- SponsorPaymaster.conf
- SponsorPaymaster_additional.conf
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Run verification
uses: ./.github/actions/certora-verifier
with:
contractFile: ${{ matrix.contract }}
certoraKey: ${{ secrets.CERTORAKEY }}
# certora:
# needs:
# - test-local
# - test-fork
#
# name: Certora
# runs-on: ubuntu-latest
# # Run Certora only on main
# # if: github.ref == 'refs/heads/main'
# strategy:
# fail-fast: false
# max-parallel: 16
# matrix:
# contract:
# - KintoID_SanctionsTraits.conf
# - KintoID_Monitor1.conf
# - KintoID_Monitor2.conf
# - KintoWallet.conf
# - KintoWalletFactory.conf
# - SponsorPaymaster.conf
# - SponsorPaymaster_additional.conf
# steps:
# - uses: actions/checkout@v4
#
# - uses: ./.github/actions/install
#
# - name: Run verification
# uses: ./.github/actions/certora-verifier
# with:
# contractFile: ${{ matrix.contract }}
# certoraKey: ${{ secrets.CERTORAKEY }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ bin

# Dotenv file
.env
hf.env

# node
node_modules/
Expand All @@ -23,3 +24,5 @@ certora/munged/*
# Ignore local chain
**/31337/**


jupyter/.ipynb_checkpoints/
48 changes: 0 additions & 48 deletions .gitmodules

This file was deleted.

3 changes: 3 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "solhint:default"
}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ This repository contains all the core smart contracts available at Kinto.
- Yarn or NPM

## Install dependencies
- Run `yarn install` to install all forge dependencies
- Alternative, you can run `forge install` and then `cd lib/token-bridge-contracts && yarn`
- Run `yarn install` to install all dependencies
- Copy `.env.sample` to `.env` and fill the values. After you deploy the proxy make sure to fill its address as well.

### Enable CREATE2 in a custom chain (only needed in a custom chain)
Expand Down
7,726 changes: 7,725 additions & 1 deletion artifacts/1.json

Large diffs are not rendered by default.

5,950 changes: 5,949 additions & 1 deletion artifacts/42161.json

Large diffs are not rendered by default.

18,198 changes: 18,197 additions & 1 deletion artifacts/7887.json

Large diffs are not rendered by default.

5,937 changes: 5,936 additions & 1 deletion artifacts/8453.json

Large diffs are not rendered by default.

Loading

0 comments on commit 4344a5d

Please sign in to comment.