-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fcfe2c
commit 4101fb2
Showing
48 changed files
with
7,217 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin', 'import'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
// https://gist.github.com/phatnguyenuit/149094cb3a28e30f5f4c891d264bf7e6 | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, // don't want to sort import lines, use eslint-plugin-import instead | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], | ||
allowSeparatedGroups: true, | ||
}, | ||
], | ||
// turn on errors for missing imports | ||
'import/no-unresolved': 'error', | ||
// 'import/no-named-as-default-member': 'off', | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [ | ||
'builtin', // Built-in imports (come from NodeJS native) go first | ||
'external', // <- External imports | ||
'internal', // <- Absolute imports | ||
['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together | ||
'index', // <- index imports | ||
'unknown', // <- unknown | ||
], | ||
'newlines-between': 'always', | ||
alphabetize: { | ||
/* sort in ascending order. Options: ["ignore", "asc", "desc"] */ | ||
order: 'asc', | ||
/* ignore case. Options: [true, false] */ | ||
caseInsensitive: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Tests and Checks | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
jobs: | ||
security: | ||
uses: lidofinance/linters/.github/workflows/security.yml@master | ||
actions: | ||
uses: lidofinance/linters/.github/workflows/actions.yml@master | ||
# docker: | ||
# uses: lidofinance/linters/.github/workflows/docker.yml@master | ||
|
||
linters: | ||
name: Linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: yarn | ||
cache-dependency-path: "**/yarn.lock" | ||
|
||
- name: Install Node dependencies | ||
run: yarn install --frozen-lockfile --non-interactive | ||
|
||
- name: Linters check | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
|
||
# ENV | ||
/.env | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.17.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/swcrc", | ||
"sourceMaps": true, | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true, | ||
"dynamicImport": true | ||
}, | ||
"transform": { | ||
"legacyDecorator": true, | ||
"decoratorMetadata": true | ||
}, | ||
"baseUrl": "./" | ||
}, | ||
"minify": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<p align="center"> | ||
<img src="logo.png" width="120" alt="CSM Logo"/> | ||
</p> | ||
<h1 align="center"> CSM Prover Tool </h1> | ||
|
||
## Description | ||
|
||
Tool for reporting Slashings and Withdrawals for Lido Community Staking Module | ||
|
||
## Installation | ||
|
||
```bash | ||
$ yarn install | ||
``` | ||
|
||
## Running the app | ||
|
||
```bash | ||
# development | ||
$ yarn run start | ||
|
||
# watch mode | ||
$ yarn run start:dev | ||
|
||
# production mode | ||
$ yarn run start:prod | ||
``` | ||
|
||
## Test | ||
|
||
```bash | ||
# unit tests | ||
$ yarn run test | ||
|
||
# e2e tests | ||
$ yarn run test:e2e | ||
|
||
# test coverage | ||
$ yarn run test:cov | ||
``` | ||
|
||
## Linter | ||
|
||
```bash | ||
# check | ||
$ yarn run lint | ||
|
||
# fix | ||
$ yarn run lint:fix | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src", | ||
"compilerOptions": { | ||
"builder": { | ||
"type": "swc", | ||
"options": { | ||
"swcrcPath": ".swcrc" | ||
} | ||
}, | ||
"typeCheck": true, | ||
"deleteOutDir": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"name": "csm-prover-tool", | ||
"version": "0.0.1", | ||
"description": "Tool for proving info from CL through EL for CSM validators", | ||
"repository": "https://github.com/lidofinance/csm-prover-tool.git", | ||
"author": "Community Staking Team <[email protected]>", | ||
"private": true, | ||
"license": "GPL-3.0", | ||
"scripts": { | ||
"build": "nest build", | ||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"start": "nest start", | ||
"start:dev": "nest start --watch", | ||
"start:debug": "nest start --debug --watch", | ||
"start:prod": "node dist/main", | ||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"", | ||
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
"test:e2e": "jest --config ./test/jest-e2e.json" | ||
}, | ||
"dependencies": { | ||
"@lido-nestjs/logger": "^1.3.2", | ||
"@nestjs/common": "^10.0.0", | ||
"@nestjs/config": "^3.1.1", | ||
"@nestjs/core": "^10.0.0", | ||
"@nestjs/platform-express": "^10.0.0", | ||
"nest-commander": "^3.12.5", | ||
"nest-winston": "^1.9.4", | ||
"reflect-metadata": "^0.1.13", | ||
"rxjs": "^7.8.1", | ||
"winston": "^3.11.0" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/cli": "^10.0.0", | ||
"@nestjs/schematics": "^10.0.0", | ||
"@nestjs/testing": "^10.0.0", | ||
"@swc/cli": "^0.1.63", | ||
"@swc/core": "^1.3.104", | ||
"@swc/jest": "^0.2.30", | ||
"@types/express": "^4.17.17", | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^20.3.1", | ||
"@types/supertest": "^6.0.0", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"eslint": "^8.42.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"jest": "^29.5.0", | ||
"prettier": "^3.0.0", | ||
"source-map-support": "^0.5.21", | ||
"supertest": "^6.3.3", | ||
"ts-jest": "^29.1.0", | ||
"ts-loader": "^9.4.3", | ||
"ts-node": "^10.9.1", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.1.3" | ||
}, | ||
"jest": { | ||
"moduleFileExtensions": [ | ||
"js", | ||
"json", | ||
"ts" | ||
], | ||
"rootDir": "src", | ||
"testRegex": ".*\\.spec\\.ts$", | ||
"transform": { | ||
"^.+\\.(t|j)s?$": [ | ||
"@swc/jest" | ||
] | ||
}, | ||
"collectCoverageFrom": [ | ||
"**/*.(t|j)s" | ||
], | ||
"coverageDirectory": "../coverage", | ||
"testEnvironment": "node" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { CliService } from './cli.service'; | ||
import { ConfigModule } from '../common/config/config.module'; | ||
import { HandlersModule } from '../common/handlers/handlers.module'; | ||
import { LoggerModule } from '../common/logger/logger.module'; | ||
import { ProvidersModule } from '../common/providers/providers.module'; | ||
|
||
@Module({ | ||
imports: [LoggerModule, ConfigModule, ProvidersModule, HandlersModule], | ||
providers: [CliService], | ||
}) | ||
export class CliModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
|
||
import { CliService } from './cli.service'; | ||
import { LoggerModule } from '../common/logger/logger.module'; | ||
|
||
describe('CliService', () => { | ||
let service: CliService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
imports: [LoggerModule], | ||
providers: [CliService], | ||
}).compile(); | ||
|
||
service = module.get<CliService>(CliService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { LOGGER_PROVIDER } from '@lido-nestjs/logger'; | ||
import { | ||
Inject, | ||
Injectable, | ||
LoggerService, | ||
OnApplicationBootstrap, | ||
} from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class CliService implements OnApplicationBootstrap { | ||
constructor( | ||
@Inject(LOGGER_PROVIDER) protected readonly logger: LoggerService, | ||
) {} | ||
async onApplicationBootstrap() { | ||
this.logger.log('Working mode: CLI'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Global, Module } from '@nestjs/common'; | ||
import { ConfigModule as ConfigModuleSource } from '@nestjs/config'; | ||
|
||
import { ConfigService } from './config.service'; | ||
import { validate } from './env.validation'; | ||
|
||
@Global() | ||
@Module({ | ||
imports: [ | ||
ConfigModuleSource.forRoot({ | ||
validate: validate, | ||
isGlobal: true, | ||
cache: true, | ||
}), | ||
], | ||
providers: [ConfigService], | ||
exports: [ConfigService], | ||
}) | ||
export class ConfigModule {} |
Oops, something went wrong.