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

BREAKING_CHANGE: refactor repo #138

Merged
merged 28 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9aebbd5
chore: rename src -> tools, contracts -> src
TuDo1403 Oct 18, 2024
d43d548
Merge pull request #133 from ronin-chain/implement-feature/refactor/a…
TuDo1403 Oct 18, 2024
303cbb0
chore: update config and remove unused files, logs
TuDo1403 Oct 18, 2024
97affc2
Merge pull request #134 from ronin-chain/implement-feature/refactor/u…
TuDo1403 Oct 18, 2024
c7b4912
test: restructure test
TuDo1403 Oct 18, 2024
0d9e555
Merge pull request #135 from ronin-chain/implement-feature/refactor/test
TuDo1403 Oct 18, 2024
b34690d
chore: apply new remapping config (#136)
github-actions[bot] Oct 18, 2024
aab0368
chore: remove bridge related componets (#137)
github-actions[bot] Oct 18, 2024
02adf1f
chore: remove unused component
TuDo1403 Oct 18, 2024
e48a702
chore: remove unused artifact
TuDo1403 Oct 18, 2024
834c1ab
chore: remove unused components
TuDo1403 Oct 18, 2024
a7b0982
chore: remove unused testss
TuDo1403 Oct 18, 2024
c23cdeb
chore: move config -> script/config/vrf
TuDo1403 Oct 18, 2024
04bfcc9
script: fix script
TuDo1403 Oct 18, 2024
eb0ace8
chore: fix config
TuDo1403 Oct 18, 2024
0852737
ci: update ci
TuDo1403 Oct 18, 2024
566f558
chore: update post-commit
TuDo1403 Oct 18, 2024
138b0b7
style(automated): post-commit forge fmt (*.sol)
TuDo1403 Oct 18, 2024
7d40e47
chore(automated): post-commit update .git-blame-ignore-revs
TuDo1403 Oct 18, 2024
3f5f8b1
ci: fix ci
TuDo1403 Oct 21, 2024
cf86a48
ci: fix ci
TuDo1403 Oct 21, 2024
8589a5b
test: skip fork test
TuDo1403 Oct 21, 2024
3cfb932
ci: add ci for slither-analyze, storage-layout-check, unit-test and r…
TuDo1403 Oct 24, 2024
081243c
chore: update .gitignore
TuDo1403 Oct 25, 2024
06ea9a3
chore: update post-commit
TuDo1403 Oct 25, 2024
31adc29
chore: add generate-artifact.sh
TuDo1403 Oct 25, 2024
5900eda
chore: update remappings.txt
TuDo1403 Oct 25, 2024
4b47075
ci: allow running check ci in implement-feature branch
TuDo1403 Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 0 additions & 6 deletions .debug.env

This file was deleted.

19 changes: 10 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Devnet configs
DEVNET_PK=0x0000000000000000000000000000000000000000000000000000000000000000
DEVNET_URL=http://localhost:8545
# Shadow configs
RONIN_MAINNET_SHADOW_PK=0x0000000000000000000000000000000000000000000000000000000000000000
RONIN_MAINNET_SHADOW_URL=http://

RONIN_TESTNET_SHADOW_PK=0x0000000000000000000000000000000000000000000000000000000000000000
RONIN_TESTNET_SHADOW_URL=http://

# Testnet configs
TESTNET_PK=0x0000000000000000000000000000000000000000000000000000000000000000
TESTNET_URL=https://testnet.skymavis.one/rpc
RONIN_TESTNET_PK=0x0000000000000000000000000000000000000000000000000000000000000000

# Mainnet configs
MAINNET_PK=0x0000000000000000000000000000000000000000000000000000000000000000
MAINNET_URL=https://api.roninchain.com/rpc
RONIN_MAINNET_PK=0x0000000000000000000000000000000000000000000000000000000000000000

# Report gas
REPORT_GAS=false
# Infura configs
INFURA_API_KEY=
13 changes: 0 additions & 13 deletions .gas-snapshot

This file was deleted.

6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# style(automated): post-commit forge fmt (*.sol)
a88906eaf3e08acc1f5517ddcbfaa26af7b8559b
# style(automated): post-commit forge fmt (*.sol)
04cca08e8242d2eff83fd895c4b56b456a52b37c
# style(automated): post-commit forge fmt (*.sol)
138b0b7fb7ebf761275fe9917243c89201f226c4
24 changes: 24 additions & 0 deletions .github/scripts/comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = async ({ github, context, header, body }) => {
const comment = [header, body].join("\n");

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

const botComment = comments.find(
(comment) =>
// github-actions bot user
comment.user.id === 41898282 && comment.body.startsWith(header)
);

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

await github.rest.issues[commentFn]({
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
...(botComment ? { comment_id: botComment.id } : { issue_number: context.payload.number }),
});
};
117 changes: 117 additions & 0 deletions .github/workflows/compare-storage-layout.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Check Storage Layout Changes

on:
pull_request:
branches:
- mainnet
- testnet
- "release/*"
- "feature/*"
- "features/*"
- "implement-feature/*"

env:
FOUNDRY_PROFILE: ci

jobs:
check-storage-layout:
strategy:
fail-fast: true

name: Check storage layout changes
runs-on: [self-hosted, dockerize]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: "Setup Node"
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 #v3.4.1
with:
node-version: v16.16.0

- name: Install package with soldeer
run: |
forge soldeer install

- name: Run Forge build
run: |
forge --version
forge build
id: build

- name: Install Dependencies
id: install-deps
run: |
sudo apt-get update
sudo apt-get install -y wget
sudo apt-get install bc
sudo wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq

- name: Run Storage Layout Check
id: storage-layout-check
run: |
git fetch --unshallow || git fetch --all

dependencies/storage-delta-0.3.2/run.sh \
--omit new \
--dst-commit ${{ github.event.pull_request.base.sha }} \
--src-commit ${{ github.event.pull_request.head.sha }} \
--github-root ${{ github.server_url }}/${{ github.repository }}/blob/

- name: Check for storage_delta folder
id: check-folder
run: |
if [ -d "storage_delta" ]; then
# Query all the subdirectories in the storage_delta folder to check any `.diff` files
# Echo the contents of the `.diff` files to the output with wrapped ```diff {content} ```
find storage_delta -type f -name "*.diff"
for file in $(find storage_delta -type f -name "*.diff"); do
clean_path=$(echo "$file" | sed -e 's|storage_delta/diffs/||' -e 's|https:/|https://|' -e 's|\.diff$||')
echo "## Layout Changes for [$(basename "${clean_path%.*}")]($clean_path)" >>storage_delta_report.md
echo '```diff' >>storage_delta_report.md
# Remove \ No newline at end of file from the diff file
grep -v '\\ No newline at end of file' $file >>storage_delta_report.md
echo '```' >>storage_delta_report.md
done
# Check if .removed files exist, if yes, add header `Removed Storage Layouts` and append the contents of the file to storage_delta_report.md
if [ -f "storage_delta/.removed" ]; then
echo "## Removed Components" >>storage_delta_report.md
cat storage_delta/.removed >>storage_delta_report.md
fi

# Check if the storage_delta_report.md file exists
if [ -f "storage_delta_report.md" ]; then
# Output the contents of the storage_delta_report.md file to the output
cat storage_delta_report.md
echo "storage_delta_exists=true" >>$GITHUB_OUTPUT
else
echo "No storage layout changes detected."
fi
fi
env:
GITHUB_OUTPUT: ${{ steps.check-folder.outputs.storage_delta_exists }}
shell: bash

- name: Set storage delta report output
if: ${{ steps.check-folder.outputs.storage_delta_exists == 'true' }}
id: set-report
run: |
REPORT=$(cat storage_delta_report.md)
echo "REPORT<<EOF" >> $GITHUB_ENV
echo "$REPORT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Create/update checklist as PR comment
uses: actions/github-script@v7
if: github.event_name == 'pull_request' && steps.check-folder.outputs.storage_delta_exists == 'true'
with:
script: |
const script = require('.github/scripts/comment');
const header = '# Storage Layout Change Report';
const body = process.env.REPORT;
await script({ github, context, header, body });
59 changes: 59 additions & 0 deletions .github/workflows/slither-analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Slither Analyze

on:
pull_request:
branches:
- mainnet
- testnet
- "feature/*"
- "features/*"
- "feat/*"
- "feats/*"
- "release/*"
- "implement-feature/*"

env:
FOUNDRY_PROFILE: ci

jobs:
check-slither:
strategy:
fail-fast: true

name: Slither Analyze
runs-on: [self-hosted, dockerize]

env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}

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

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

- name: Install package with soldeer
run: forge soldeer install

- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
node-version: 18
fail-on: none
slither-args: --exclude-optimization --exclude-low --exclude-medium --exclude-informational --exclude-dependencies --filter-paths "dependencies/|script/|test/foundry/" --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/

- name: Create/update checklist as PR comment
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
env:
REPORT: ${{ steps.slither.outputs.stdout }}
with:
script: |
const script = require('.github/scripts/comment')
const header = '# Slither report'
const body = process.env.REPORT
await script({ github, context, header, body })
33 changes: 25 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,52 @@ on:
- "release/*"
- "feature/*"
- "features/*"
- "implement-feature/*"

env:
FOUNDRY_PROFILE: ci

jobs:
check:
check-unit-test:
strategy:
fail-fast: true

name: Foundry project
name: Unit test
runs-on: [self-hosted, dockerize]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: "1.19"

- name: Setup external packages
run: |
sudo apt-get update
sudo apt-get install -y jq
sudo apt-get install -y gcc
sudo apt-get install -y wget
sudo wget https://github.com/mikefarah/yq/releases/download/v4.34.1/yq_linux_amd64 -O /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq

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

- name: Install package with soldeer
run: forge soldeer install

- name: Recursively update dependencies
- name: Build random beacon binary
run: |
chmod +x ./update-deps.sh
./update-deps.sh
id: update-deps
rm -rf temp && mkdir temp && cd temp
git clone https://github.com/ronin-chain/ronin-random-beacon.git
cd ronin-random-beacon && ls
go build -o ronin-random-beacon && ls
cp ./ronin-random-beacon ../../bin/
cd ../../
rm -rf temp

- name: Run Forge build
run: |
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ deployments/**/exported_address
config/config.json
config/config.yaml
dependencies
deployments/ronin-mainnet-shadow
deployments/*-shadow
bin/ronin-random-beacon
broadcast/**/6063/*
broadcast/**/31337/*
script/**/command
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

16 changes: 0 additions & 16 deletions .husky/generate-layout.sh

This file was deleted.

Loading
Loading