Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2bef8fd
Add github actions config for the repo
shyam-patel-kira Dec 19, 2024
ce1ce25
Update .gitignore
shyam-patel-kira Dec 19, 2024
7774cf5
add prettier config; package contract in yarn
shyam-patel-kira Dec 19, 2024
708182e
run CI on PR
shyam-patel-kira Dec 19, 2024
ca373ad
rename the repo secret
shyam-patel-kira Dec 19, 2024
ee9a871
Merge branch 'feat/stakeTokens' of https://github.com/luminolabs/cont…
shyam-patel-kira Dec 19, 2024
60df4fd
fix testcases for jobs and stake manager
shyam-patel-kira Dec 19, 2024
de14346
keep version to prevent warning and build error
shyam-patel-kira Dec 19, 2024
8cd48ff
Update solidity version
shyam-patel-kira Dec 19, 2024
e1e1cf5
add slither report to .gitignore
shyam-patel-kira Dec 20, 2024
f8ecb51
run forge build before running slither checks
shyam-patel-kira Dec 20, 2024
f2afaba
Add deployment to the pipeline
shyam-patel-kira Dec 20, 2024
485fe24
add remappings for correctly using imports
shyam-patel-kira Dec 20, 2024
3b88a0a
Update imports to not use relative path
shyam-patel-kira Dec 20, 2024
44ac481
Update imports to not use relative path
shyam-patel-kira Dec 20, 2024
206fa4f
Update gitmodules and method for dependency installation
shyam-patel-kira Dec 20, 2024
5781b00
remove default module
shyam-patel-kira Dec 20, 2024
8024a17
fix testcases that were broken
shyam-patel-kira Dec 20, 2024
25537a8
Add gas snapshot; update config
shyam-patel-kira Dec 20, 2024
6d890f9
don't exit procses on snapshot
shyam-patel-kira Dec 20, 2024
4e50d46
remove codecov app
shyam-patel-kira Dec 23, 2024
1de43ae
remove --use solc; update .gitignore
shyam-patel-kira Dec 23, 2024
108084f
fix indent
shyam-patel-kira Dec 23, 2024
dc9fff0
remove debug flag
shyam-patel-kira Dec 23, 2024
c0e7189
nit: stlye
shyam-patel-kira Dec 23, 2024
430a08b
remove codecov app
shyam-patel-kira Dec 23, 2024
e188c54
Add remappings.txt
shyam-patel-kira Dec 23, 2024
fc5c4e9
Update upgradable contracts version
shyam-patel-kira Dec 23, 2024
9e16df7
remove remappings forge
shyam-patel-kira Dec 23, 2024
f727471
reinitialize mappings
shyam-patel-kira Dec 23, 2024
e3d9159
remove uploading sarif file
shyam-patel-kira Dec 23, 2024
34becf5
remove lib from git repo
shyam-patel-kira Dec 23, 2024
6b235d3
add lib to repo
shyam-patel-kira Dec 23, 2024
1d72ca7
reset readme
shyam-patel-kira Dec 23, 2024
c03a716
remove initial files
shyam-patel-kira Dec 23, 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
21 changes: 21 additions & 0 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
JobsManagerTest:testCreateJob() (gas: 197562)
JobsManagerTest:testCreateMultipleJobs() (gas: 789598)
JobsManagerTest:testGetActiveJobs() (gas: 484465)
JobsManagerTest:testInitialization() (gas: 20413)
JobsManagerTest:testJobDetailsRetrieval() (gas: 195057)
JobsManagerTest:testNonExistentJobDetails() (gas: 14082)
JobsManagerTest:testUpdateJobStatus() (gas: 401370)
JobsManagerTest:testUpdateJobStatusInvalidTransition() (gas: 324846)
JobsManagerTest:testUpdateJobStatusUnauthorized() (gas: 191908)
JobsManagerTest:testUpdateNonExistentJob() (gas: 14142)
StakeManagerTest:testInitialization() (gas: 17084)
StakeManagerTest:testStake() (gas: 147646)
StakeManagerTest:testStakeInsufficientAmount() (gas: 22857)
StakeManagerTest:testUnstake() (gas: 191933)
StakeManagerTest:testWithdraw() (gas: 163469)
StakeManagerTest:testWithdrawBeforeUnlock() (gas: 190212)
StateManagerTest:testBufferState() (gas: 9526)
StateManagerTest:testCommitState() (gas: 9998)
StateManagerTest:testNonBufferState() (gas: 9894)
StateManagerTest:testProposeState() (gas: 10306)
StateManagerTest:testRevealState() (gas: 10203)
32 changes: 32 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
codecov:
require_ci_to_pass: yes
notify:
wait_for_ci: yes

coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: 80% # minimum coverage ratio
threshold: 1% # allow coverage to drop by 1% and still succeed
patch:
default:
target: 80%
threshold: 1%
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,files,footer"
behavior: default
require_changes: no
156 changes: 145 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
name: test
name: Lumino Protocol CI/CD

on: workflow_dispatch
on:
pull_request:
branches:
- "**"
- '!main'
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'testnet'
type: choice
options:
- testnet

env:
FOUNDRY_PROFILE: ci
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
TESTNET_RPC_URL: ${{ secrets.TESTNET_RPC_URL }}

jobs:
check:
strategy:
fail-fast: true

unit-tests:
name: Foundry project
runs-on: ubuntu-latest
steps:
Expand All @@ -22,13 +35,134 @@ jobs:
with:
version: nightly

- name: Run Forge build
- name: Install Dependencies
run: |
forge --version
forge build --sizes
forge install OpenZeppelin/openzeppelin-contracts --no-commit
forge install OpenZeppelin/openzeppelin-contracts-upgradeable --no-commit

- name: Check contract sizes
run: forge build --sizes
id: build

- name: Run Forge tests
- name: Check gas snapshots
run: |
forge test -vvv
forge snapshot --check || (
echo "Gas snapshot check failed. Generating new snapshot for reference..."
forge snapshot
echo "Please commit the updated .gas-snapshot file"
)
id: snapshot

- name: Run tests
run: forge test -vvv
id: test

- name: Run coverage
run: forge coverage --report lcov --report summary
--report debug
--optimize
--optimizer-runs 200
--no-auto-detect
id: coverage

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./lcov.info
# fail_ci_if_error: true
# verbose: true

slither:
name: Slither Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Slither
run: |
python -m pip install --upgrade pip
pip3 install slither-analyzer

- name: Run Slither
run: |
forge build
slither . --sarif slither-results.sarif || true

# - name: Upload SARIF file
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: slither-results.sarif
# token: ${{ secrets.GITHUB_TOKEN }}

lint:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install Prettier and Solidity Plugin
run: |
npm install --save-dev prettier prettier-plugin-solidity

- name: Check formatting
run: npx prettier --check "src/**/*.sol" "test/**/*.sol"

deploy-testnet:
name: Deploy to Testnet
needs: [unit-tests, slither, lint]
if: |
(github.ref == 'refs/heads/develop' && github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'testnet')
runs-on: ubuntu-latest
environment: testnet
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Deploy to Testnet
env:
RPC_URL: ${{ env.TESTNET_RPC_URL }}
run: |
forge script script/DeployUpgradeableLuminoProtocol.s.sol:DeployUpgradeableLuminoProtocol \
--rpc-url $RPC_URL \
--broadcast \
--verify \
-vvvv

- name: Save deployment artifacts
uses: actions/upload-artifact@v3
with:
name: testnet-deployment
path: broadcast/
if-no-files-found: error
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ docs/
.env

.vscode
/lib/*
.idea

slither-results.sarif

node_modules
lcov.info

repomix-output.txt
10 changes: 5 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
20 changes: 20 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 100,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
}
],
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "es5"
}
11 changes: 11 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ src = "src"
out = "out"
libs = ["lib"]

[profile.default.fuzz]
runs = 1000

[profile.ci]
fuzz_runs = 10000
verbosity = 4

[profile.gas]
gas_reports = ["*"]


[etherscan]
holesky = { key = "<your-etherscan-api-key>", url = "https://api-holesky.etherscan.io/api" }

Expand Down
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at b93cf4
1 change: 0 additions & 1 deletion lib/forge-std/.gitattributes

This file was deleted.

Loading
Loading