Skip to content

Commit

Permalink
Merge pull request #46 from bcnmy/features/SMA-314-fix-ci
Browse files Browse the repository at this point in the history
1# Features/sma 314 fix ci
  • Loading branch information
Aboudjem authored Nov 10, 2023
2 parents b64565d + 2cc44bf commit b99c850
Show file tree
Hide file tree
Showing 11 changed files with 524 additions and 352 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## SDK Version

<!-- Please specify the version of the SDK you are using. -->

## Description
<!-- Briefly describe the bug you are facing. -->

## Steps to Reproduce

1.
2.
3.
<!-- Add any other context or screenshots about the feature request here. -->

## Expected Behavior
<!-- Describe what you expected to happen. -->

## Actual Behavior
<!-- Describe what actually happened. Include any error tracebacks if possible. -->

## Possible Fix (optional)
<!-- If you have an idea on how to fix this, please share! -->

## Environment Details

- **Browser Version**:
- **Node.js Version**:
- **NPM/Yarn Version**:

## Additional Context
<!-- Add any other details or context about the bug here. -->
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature Request
about: Propose an enhancement or new feature to improve the project
title: "Feature: <Your Feature>"
labels: feature-request, needs-review
assignees: ""
---

**Problem You're Facing**
<!-- Briefly describe the problem you're trying to solve or the limitation you've encountered. -->

**Proposed Solution**
<!-- What would you like to see happen? -->

**Alternatives Considered**
<!-- Any other solutions or features you've considered. -->

## Use Cases
<!-- Help us understand the broader context by providing some typical use cases where this feature would be helpful. -->

**Additional Info**
<!-- Provide any additional details, context, or screenshots about the feature request. -->
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Summary

<!-- Please provide a brief summary of the changes and the issue number this PR addresses. -->

Related Issue: # (issue number)

## Change Type

- [ ] Bug Fix
- [ ] Refactor
- [ ] New Feature
- [ ] Breaking Change
- [ ] Documentation Update
- [ ] Performance Improvement
- [ ] Other

# Checklist

- [ ] My code follows this project's style guidelines
- [ ] I've reviewed my own code
- [ ] I've added comments for any hard-to-understand areas
- [ ] I've updated the documentation if necessary
- [ ] My changes generate no new warnings
- [ ] I've added tests that prove my fix is effective or my feature works
- [ ] All unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published

# Additional Information
<!-- Any additional information or context about the PR. -->

# Branch Naming
<!-- Make sure your branch name follows the pattern: `features/`, `fixes/`, or `releases/`. -->
<!-- **Note**: The person creating the PR is responsible for merging and deleting the branch. Ensure the code has been tested, commented, linted, and documents updated if needed. -->
22 changes: 22 additions & 0 deletions .github/workflows/mark_stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Mark Inactive Issues and PRs

on:
schedule:
- cron: '0 0 * * *'

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "This issue has been inactive for 30 days. It will be closed due to inactivity. If this issue is still relevant, please comment to keep it open. Alternatively, you can create a new issue with updated information."
stale-pr-message: "This PR has been inactive for 30 days. If it's waiting for a review, please reach out to the team. Otherwise, please update the PR or it will be closed due to inactivity."
stale-issue-label: "inactive-issue"
stale-pr-label: "inactive-pr"
days-before-stale: 30
38 changes: 38 additions & 0 deletions .github/workflows/push_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test workflow
on: push
jobs:
unit_test:
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout
uses: "actions/checkout@main"

- name: Set Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Create a fake .secret file
run: echo "primary twist rack vendor diagram image used route theme frown either will" > .secret

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

- name: Install foundry dependencies
run: forge install

- name: Install hardhat dependencies
run: yarn install --frozen-lockfile

- name: Build Typechain and Foundry
run: yarn build

- name: Run Forge and Hardhat Tests
run: yarn test
4 changes: 1 addition & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint && git add .
. "$(dirname -- "$0")/_/husky.sh"
62 changes: 31 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@
"description": "ERC4337 Paymasters contracts repo and playground",
"main": "index.js",
"scripts": {
"test": "npx hardhat test",
"clean": "npx hardhat clean",
"build": "npm run clean && npx hardhat compile && npx hardhat typechain",
"test": "yarn test:hardhat && yarn test:foundry",
"clean": "yarn hardhat clean && forge clean",
"build": "yarn hardhat compile && yarn hardhat typechain && yarn prepare-typechain && yarn build:foundry",
"clean:build": "yarn clean && yarn build",
"build:foundry": "forge build --via-ir",
"test:hardhat": "yarn hardhat test",
"test:foundry": "forge test --via-ir",
"test:bundler": "./scripts/bundler-tests.sh",
"lint": "prettier --write 'contracts/**/*.sol'",
"lint": "yarn lint:ts && yarn lint:sol",
"lint:ts": "yarn eslint 'test/**/*.ts' 'scripts/**/*.ts'",
"lint:ts-fix": "yarn eslint 'test/**/*.ts' 'scripts/**/*.ts' --fix",
"lint:sol": "yarn solhint 'contracts/**/*.sol'",
"lint:sol-fix": "yarn prettier 'contracts/**/*.sol' --write && yarn solhint 'contracts/**/*.sol' --fix",
"lint:fix": "yarn lint:ts-fix && yarn lint:sol-fix",
"postinstall": "husky install",
"prepack": "pinst --disable && ./scripts/prepack-contracts.sh",
"postpack": "pinst --enable && ./scripts/postpack-contracts.sh",
"coverage": "COVERAGE=1 DISABLE_VIA_IR=true hardhat coverage",
"prepare-typechain": "cd lib/account-abstraction && yarn install && yarn hardhat typechain",
"prepare": "husky install"
},
"repository": {
Expand All @@ -34,50 +42,51 @@
"homepage": "https://github.com/bcnmy/biconomy-paymasters#readme",
"devDependencies": {
"@chainlink/contracts": "^0.6.0",
"@nomicfoundation/hardhat-foundry": "^1.0.0",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-foundry": "^1.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@typechain/ethers-v5": "^10.2.0",
"@typechain/hardhat": "^6.1.5",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"chai": "^4.3.7",
"merkletreejs": "^0.3.9",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^5.2.2",
"eslint": "^7.32.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.3.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-security": "^1.7.1",
"ethereum-waffle": "^4.0.10",
"ethers": "^5.7.2",
"hardhat": "^2.14.0",
"hardhat-deploy": "^0.11.26",
"hardhat-gas-reporter": "^1.0.9",
"husky": "^8.0.3",
"merkletreejs": "^0.3.9",
"pinst": "^3.0.0",
"prettier": "^2.6.2",
"prettier-plugin-solidity": "^1.1.2",
"solc": "^0.8.15",
"solhint": "^3.3.7",
"solhint-plugin-prettier": "^0.0.5",
"prettier-plugin-solidity": "^1.1.2",
"solidity-coverage": "^0.8.2"
"solidity-coverage": "^0.8.2",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^5.2.2"
},
"dependencies": {
"@biconomy-devx/account-contracts-v2": "^2.0.2",
"@account-abstraction/contracts": "^0.6.0",
"@biconomy-devx/account-contracts-v2": "^2.0.2",
"@biconomy/account-contracts": "^2.0.0",
"@chainlink/contracts": "^0.6.0",
"@ethersproject/abstract-signer": "^5.6.2",
Expand All @@ -86,7 +95,6 @@
"@openzeppelin/contracts": "4.8.1",
"@openzeppelin/contracts-upgradeable": "4.8.1",
"@pimlico/erc20-paymaster": "^0.0.1",
"@types/mocha": "^9.0.0",
"@uniswap/sdk-core": "^3.2.2",
"@uniswap/universal-router": "^1.4.1",
"@uniswap/v3-periphery": "^1.4.3",
Expand All @@ -96,18 +104,10 @@
"dotenv": "^16.0.3",
"eth-gas-reporter": "^0.2.24",
"ethereumjs-util": "^7.1.0",
"ethereumjs-wallet": "^1.0.1",
"ethers": "^5.6.8",
"ganache": "^7.1.0",
"ganache-cli": "^6.12.2",
"solc": "^0.8.15",
"solidity-bytes-utils": "^0.8.0",
"source-map-support": "^0.5.19",
"typescript": "^4.3.5"
},
"husky": {
"hooks": {
"pre-commit": ""
}
"source-map-support": "^0.5.19"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,13 @@ describe("Biconomy Token Paymaster (with Bundler)", function () {

after(async function () {
const chainId = (await ethers.provider.getNetwork()).chainId;
if (chainId !== BundlerTestEnvironment.BUNDLER_ENVIRONMENT_CHAIN_ID) {
this.skip();
if (chainId === BundlerTestEnvironment.BUNDLER_ENVIRONMENT_CHAIN_ID) {
await Promise.all([
environment.revert(environment.defaultSnapshot!),
environment.resetBundler(),
]);
}

await Promise.all([
environment.revert(environment.defaultSnapshot!),
environment.resetBundler(),
]);
});
});

describe("Token Payamster functionality: positive test", () => {
it("succeed with valid signature and valid erc20 pre approval for allowed ERC20 token: Deployed account", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,12 @@ describe("Biconomy Token Paymaster (with Bundler)", function () {

after(async function () {
const chainId = (await ethers.provider.getNetwork()).chainId;
if (chainId !== BundlerTestEnvironment.BUNDLER_ENVIRONMENT_CHAIN_ID) {
this.skip();
if (chainId === BundlerTestEnvironment.BUNDLER_ENVIRONMENT_CHAIN_ID) {
await Promise.all([
environment.revert(environment.defaultSnapshot!),
environment.resetBundler(),
]);
}

await Promise.all([
environment.revert(environment.defaultSnapshot!),
environment.resetBundler(),
]);
});

describe("Token Payamster functionality: positive test", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,12 @@ describe("Biconomy Token Paymaster (With Bundler)", function () {

after(async function () {
const chainId = (await ethers.provider.getNetwork()).chainId;
if (chainId !== BundlerTestEnvironment.BUNDLER_ENVIRONMENT_CHAIN_ID) {
this.skip();
if (chainId === BundlerTestEnvironment.BUNDLER_ENVIRONMENT_CHAIN_ID) {
await Promise.all([
environment.revert(environment.defaultSnapshot!),
environment.resetBundler(),
]);
}

await Promise.all([
environment.revert(environment.defaultSnapshot!),
environment.resetBundler(),
]);
});

describe("Token Paymaster with good and bad oracle aggregator", () => {
Expand Down
Loading

0 comments on commit b99c850

Please sign in to comment.