Skip to content

Commit

Permalink
Merge pull request #295 from rsksmart/hardhat-migration
Browse files Browse the repository at this point in the history
Hardhat migration -> QA-Test
  • Loading branch information
Luisfc68 authored Jan 17, 2025
2 parents f12d028 + 483a13c commit 12506d7
Show file tree
Hide file tree
Showing 112 changed files with 18,963 additions and 365,558 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
26 changes: 16 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ name: CI
# Controls when the workflow will run
on:
push:
branches: [ master, Stable-Test, QA-Test ]
branches: [master, Stable-Test, QA-Test]
pull_request:
branches: [ master, Stable-Test, QA-Test ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -27,21 +26,28 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Use Node.js 19.6.0
- name: Use Node.js 20.15.1
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: '19.6.0'

- name: Install truffle
run: npm install -g truffle
node-version: "20.15.1"

- name: NPM Login
run: npm config set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm config set //npm.pkg.github.com/:_authToken $GITHUB_TOKEN

- name: Install dependencies
run: npm ci
# - name: Lint source and tests
# run: npm run lint

- name: Lint contracts
run: npm run lint:sol

- name: Compile contracts
run: npm run compile

- name: Lint test and scripts
run: npm run lint:ts

- name: Unit test smart contracts
run: npm test
# - name: Coverage report
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@
# PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'
name: "Dependency Review"
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
- name: "Checkout Repository"
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Dependency Review'
- name: "Dependency Review"
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
with:
comment-summary-in-pr: true
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Scorecard supply-chain security
on:
branch_protection_rule:
schedule:
- cron: '0 0 * * 1'
- cron: "0 0 * * 1"
push:
branches: [ "master" ]
branches: ["master"]

permissions: read-all

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ jobs:
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Use Node.js 19.6.0
- name: Use Node.js 20.15.1
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: '19.6.0'
node-version: "20.15.1"

- name: NPM Login
run: npm config set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm config set //npm.pkg.github.com/:_authToken $GITHUB_TOKEN

- name: Install dependencies
run: npm ci
Expand Down
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,21 @@ coverage.json
.DS_Store
integration-test/test.config.json
.env

node_modules
.env

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types

# solidity-coverage files
/coverage
/coverage.json

# Hardhat Ignition default folder for deployments against a local node
ignition/deployments/chain-31337
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.15.1
77 changes: 43 additions & 34 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.3
hooks:
- id: gitleaks
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: "trailing-whitespace"
- id: "end-of-file-fixer"
exclude: '\.tf\.json$'
- id: "check-yaml"
args:
- "--unsafe"
- id: "check-executables-have-shebangs"
- id: "check-case-conflict"
# Project specific
- repo: local
hooks:
- id: code-style
name: Project Style Check
entry: npm run lint
language: system
types: [solidity]
- repo: local
hooks:
- id: unit-tests
name: Project Unit Tests
entry: npm run test
language: system
types: [solidity, javascript]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.3
hooks:
- id: gitleaks
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: "trailing-whitespace"
- id: "end-of-file-fixer"
exclude: '\.tf\.json$'
- id: "check-yaml"
args:
- "--unsafe"
- id: "check-executables-have-shebangs"
- id: "check-case-conflict"
# Project specific
- repo: local
hooks:
- id: code-style
name: Check contract code style
entry: npm run lint:sol
language: system
types: [file]
files: ^.*\.sol$
- repo: local
hooks:
- id: code-style
name: Check typescript code style
entry: npm run lint:ts
language: system
types: [file]
files: ^.*\.ts$
- repo: local
hooks:
- id: unit-tests
name: Project Unit Tests
entry: npm run test
language: system
types: [solidity, ts]
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build
contracts
typechain-types
artifacts
cache
node_modules
errorCodes.json
coverage/
coverage.json
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
7 changes: 2 additions & 5 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"extends": "solhint:recommended",
"rules": {
"avoid-throw": "off",
"compiler-version": [
"error",
"^0.8.3"
],
"compiler-version": ["error", "^0.8.18"],
"max-line-length": ["error", 120],
"max-states-count": ["error", 20],
"avoid-tx-origin": "off",
Expand All @@ -23,4 +20,4 @@
"no-unused-vars": "error",
"no-empty-blocks": "off"
}
}
}
23 changes: 12 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Contributing

## How to contribute to RSK

These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
Expand All @@ -7,15 +8,15 @@ These are mostly guidelines, not rules. Use your best judgment, and feel free to

Continued code reviews and audits are required for security. As such, we encourage interested security researchers to:

* Review our code, even if no contributions are planned.
* Publish their findings whichever way they choose, even if no particular bug or vulnerability was found. We can all learn from new sets of eyes and benefit from increased scrutiny.
- Review our code, even if no contributions are planned.
- Publish their findings whichever way they choose, even if no particular bug or vulnerability was found. We can all learn from new sets of eyes and benefit from increased scrutiny.

### Code contributions

A code contribution process starts with someone identifying a need for writing code. If you're thinking about making your first contribution, we suggest you take a moment to get in touch and see how your idea fits in the development plan:

* Is it a bug in our [issue tracker](https://github.com/rsksmart/liquidity-bridge-contract/issues)?
* Is it a novel idea that should be proposed and discussed first?
- Is it a bug in our [issue tracker](https://github.com/rsksmart/liquidity-bridge-contract/issues)?
- Is it a novel idea that should be proposed and discussed first?

#### Review process

Expand All @@ -30,9 +31,9 @@ We make use of GitHub Checks to ensure all changes meet a certain criteria:

Since this is a security-sensitive project, we encourage everyone to be proactive and participate in the review process. To help collaboration we propose adhering to these conventions:

* **Request changes** only for correctness and security issues.
* **Comment** when leaving feedback without explicit approval or rejection. This is useful for design and implementation discussions.
* **Approve** when changes look good from a correctness, security, design and implementation standpoint.
- **Request changes** only for correctness and security issues.
- **Comment** when leaving feedback without explicit approval or rejection. This is useful for design and implementation discussions.
- **Approve** when changes look good from a correctness, security, design and implementation standpoint.

All unit and integration tests pass without loss of coverage (e.g can't remove tests without writing equivalent or better ones).

Expand All @@ -46,7 +47,7 @@ When automatic code quality and security checks are ready in the pipeline for ex

### Pull request etiquette

* Separate your changes into multiple commits
* If your pull request gets too big, try to split it
* Each commit should at least compile, and ideally pass all unit tests
* Avoid merge commits, and always rebase your changes on top of `master`
- Separate your changes into multiple commits
- If your pull request gets too big, try to split it
- Each commit should at least compile, and ideally pass all unit tests
- Avoid merge commits, and always rebase your changes on top of `master`
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:20.15.1@sha256:6326b52a508f0d99ffdbfaa29a69380321b215153db6f32974835bac71b38fa4

RUN apt-get update -y && \
apt-get install -y -qq --no-install-recommends jq && \
apt-get clean

USER node

WORKDIR /home/node

COPY --chown=node:node package.json \
package-lock.json \
deploy.sh \
.solhint.json \
hardhat.config.ts \
tsconfig.json \
addresses.json ./

RUN npm ci --ignore-scripts

COPY --chown=node:node tasks ./tasks
COPY --chown=node:node scripts ./scripts
COPY --chown=node:node contracts ./contracts

RUN npm run compile

ENTRYPOINT [ "./deploy.sh" ]
Loading

0 comments on commit 12506d7

Please sign in to comment.