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

latest develop features #89

Merged
merged 17 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 17 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ contracts
# docs
docs

# e2e
e2e

# test
test

# scripts
eth-node
transeptor
Expand Down Expand Up @@ -60,4 +66,14 @@ tags.json
.eslint.cjs
.nvmrc
.eslintrc.cjs
jest.config.js
register-hooks.js
vitest.config.js
vitest.setup.js

# yarn
.yarn-integrity
yarn-debug.log*
yarn-error.log*
.yarn/cache
.yarn/unplugged
.yarn/install-state.gz
14 changes: 8 additions & 6 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Required for production
TRANSEPTOR_MNEMONIC=test test test test test test test test test test test junk
TRANSEPTOR_ENTRYPOINT_ADDRESS=0x
TRANSEPTOR_INFURA_API_KEY=<your-infura-api-key>
TRANSEPTOR_ALCHEMY_API_KEY=<your-alcemy-api-key>
TRANSEPTOR_BENEFICIARY=<address_to_receive_funds>
TRANSEPTOR_ENTRYPOINT_ADDRESS=0x

# Optional
TRANSEPTOR_WHITE_LIST=<address_to_whitelist_SEPARATEDBY_COMMA>
TRANSEPTOR_BLACK_LIST=<address_to_blacklist_SEPARATEDBY_COMMA>
TRANSEPTOR_ALCHEMY_API_KEY=<your-alcemy-api-key>
TRANSEPTOR_INFLUX_TOKEN=DEV_TOKEN
TRANSEPTOR_LOG_LEVEL=debug
TRANSEPTOR_WHITE_LIST=<address_to_whitelist_SEPARATED_BY_COMMA>
TRANSEPTOR_BLACK_LIST=<address_to_blacklist_SEPARATED_BY_COMMA>
PEER_MULTIADDRS=<multiaddr_to_connect_SEPARATED_BY_COMMA>

# Local Development (not required for production)
# Local Development e2e testing (not required for production)
TRANSEPTOR_E2E_TRANSEPTOR_MNEMONIC=test test test test test test test test test test test junk
TRANSEPTOR_E2E_SIMPLE_ACCOUNT_FACTORY=0x
TRANSEPTOR_E2E_GLOBAL_COUNTER=0x
62 changes: 45 additions & 17 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,32 +1,60 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint/eslint-plugin',
overrides: [
{
files: ['src/**/*.ts'],
},
],
plugins: ['@typescript-eslint', 'jsdoc', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended',
'plugin:prettier/recommended',
],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-console': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'no-console': 'error',
'no-debugger': 'warn',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'semi': ['error', 'never'],
'quotes': ['error', 'single'],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
semi: ['error', 'never'],
quotes: ['error', 'single'],

// Prettier specific rule
'prettier/prettier': ['error', {
semi: false,
singleQuote: true
}],

// JSDoc-specific rules
'jsdoc/check-alignment': 'warn',
'jsdoc/check-param-names': 'error',
'jsdoc/check-tag-names': 'error',
'jsdoc/check-types': 'error',
'jsdoc/require-param': 'error',
'jsdoc/require-returns': 'error',
"jsdoc/tag-lines": ["error", "any",{"startLines":1}],
"jsdoc/require-returns-type": ["off", {"contexts":["never"]}],
"jsdoc/require-param-type": ["off", {"contexts":["never"]}]
},
ignorePatterns: ['node_modules', './src/validation/tracer.js', '.eslintrc.js', 'scripts' ],
overrides: [
{
files: ['*.ts'],
excludedFiles: './lib/**',
},
ignorePatterns: [
'node_modules',
'.eslintrc.cjs',
'**/*.js',
'**/.cache',
'**/dist',
'**/contracts',
],
parserOptions: {
'ecmaVersion': 'latest',
'sourceType': 'module'
ecmaVersion: 'latest',
sourceType: 'module',
},
settings: {
jsdoc: {
mode: 'typescript',
},
},
}
}
39 changes: 33 additions & 6 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build, Lint, and Test
name: Build, Lint, Test, and Build Docker Images(Dry run)

on:
workflow_call:
Expand All @@ -16,15 +16,42 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm install --no-package-lock
cache: "yarn"
- run: yarn
- name: Build
run: npm run build
run: yarn build
- name: Lint
run: npm run lint
run: yarn lint
- name: Test
run: npm run test
run: yarn test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build-docker-images:
name: Build Docker Image(Dry run)
runs-on: ubuntu-latest
needs: build-lint-test
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get short commit hash
id: get_short_hash
run: echo SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7) >> $GITHUB_ENV
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
file: ./Dockerfile
push: false
tags: |
transeptorlabs/bundler:${{ env.SHORT_SHA }}
- name: Verify Docker images
run: |
docker images
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ yarn-error.log*
/influxdb-data
/grafana-data

# Yarn
.yarn-integrity
yarn-debug.log*
yarn-error.log*
.yarn/cache
.yarn/unplugged
.yarn/install-state.gz
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.2.1.cjs
27 changes: 17 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
# Stage 1: Build the source code
FROM node:20-alpine3.18 as build_src
WORKDIR /usr/app
WORKDIR /app
RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*

# Copy the source code
COPY . .

# Install dependencies and build the project
RUN npm install
RUN npm run build
RUN yarn install
RUN yarn build

# Stage 2: Build the dependencies
FROM node:20-alpine3.18 as build_deps
WORKDIR /usr/app
WORKDIR /app
RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*

ENV NODE_ENV production

# Copy ./build files from the previous stage
COPY --from=build_src /usr/app/ .
COPY --from=build_src /app/dist ./dist
COPY --from=build_src /app/package.json ./

# Install production dependencies
RUN npm install --production --force
RUN yarn install --frozen-lockfile --production
RUN yarn cache clean --all

# Stage 3: Create the final image
FROM node:20-alpine3.18
WORKDIR /usr/app
WORKDIR /app

# Copy files from the previous build stage
COPY --from=build_deps /usr/app .
COPY --from=build_deps /app .

# Use a non-root user if possible
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser

ENTRYPOINT ["node", "./dist/esm/src/index.js"]
ENTRYPOINT ["node", "./dist/index.js"]
Loading
Loading