Skip to content

Commit 170f795

Browse files
committed
feat: railgun subgraph for shield and unshield events
- [x] Added subgraph boilerplate - [x] Implemented event handlers for Shield and Unshield events - [x] Added tests
1 parent f7571a8 commit 170f795

20 files changed

Lines changed: 6665 additions & 76 deletions

.github/workflows/gas-benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
version: latest
2525

2626
- name: Install dependencies
27-
run: pnpm install --frozen-lockfile
27+
run: pnpm install
2828

2929
- name: Test
3030
run: pnpm run test

.github/workflows/project-evaluations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
version: latest
2525

2626
- name: Install dependencies
27-
run: pnpm install --frozen-lockfile
27+
run: pnpm install
2828

2929
- name: Build
3030
run: pnpm run build

.github/workflows/root.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
version: latest
2525

2626
- name: Install dependencies
27-
run: pnpm install --frozen-lockfile
27+
run: pnpm install
2828

2929
- name: Lint
3030
run: pnpm run lint

.github/workflows/subgraph.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: subgraph
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
subgraph:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v6
15+
16+
- name: Setup Node
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version: 24
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v5
23+
with:
24+
version: latest
25+
26+
- name: Install dependencies
27+
run: pnpm install
28+
29+
- name: Codegen and build
30+
run: |-
31+
pnpm run codegen
32+
pnpm run build
33+
working-directory: subgraph
34+
35+
- name: Test
36+
run: pnpm run test
37+
working-directory: subgraph

eslint.config.js

Lines changed: 93 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ import unusedImports from "eslint-plugin-unused-imports";
1313
import globals from "globals";
1414

1515
import { readFileSync } from "fs";
16-
import { dirname } from "node:path";
17-
import { fileURLToPath } from "node:url";
18-
import { resolve } from "path";
16+
import { dirname, resolve } from "path";
17+
import { fileURLToPath } from "url";
1918

2019
const { configs } = pkg;
2120

@@ -206,18 +205,95 @@ const evalConfig = {
206205
"error",
207206
{
208207
builtinGlobals: true,
209-
allow: [
210-
"location",
211-
"event",
212-
"history",
213-
"name",
214-
"status",
215-
"Option",
216-
"test",
217-
"expect",
218-
"jest",
219-
"PropertyDefinition",
220-
],
208+
allow: ["name", "PropertyDefinition"],
209+
},
210+
],
211+
},
212+
};
213+
214+
const subgraphExtends = fixupConfigRules(
215+
compat.extends(
216+
"airbnb",
217+
"prettier",
218+
"plugin:import/recommended",
219+
"plugin:@typescript-eslint/eslint-recommended",
220+
"plugin:@typescript-eslint/recommended",
221+
"plugin:@typescript-eslint/strict",
222+
"plugin:@typescript-eslint/stylistic",
223+
"plugin:import/typescript",
224+
"plugin:@typescript-eslint/recommended-type-checked",
225+
"plugin:@typescript-eslint/strict-type-checked",
226+
// "plugin:@typescript-eslint/stylistic-type-checked",
227+
),
228+
);
229+
230+
const subgraphConfig = {
231+
files: ["subgraph/src/**/*.ts", "subgraph/tests/**/*.ts"],
232+
extends: subgraphExtends,
233+
plugins: sharedPlugins,
234+
languageOptions: {
235+
parser: tsParser,
236+
sourceType: "module",
237+
ecmaVersion: 2022,
238+
globals: globals.node,
239+
parserOptions: {
240+
...sharedParserOptions,
241+
project: resolve(__dirname, "./subgraph/tsconfig.json"),
242+
},
243+
},
244+
settings: {
245+
react: { version: "999.999.999" },
246+
"import/ignore": ["^assemblyscript"],
247+
"import/resolver": {
248+
typescript: {},
249+
node: { extensions: [".ts", ".js"], moduleDirectory: ["node_modules", "src", "tests", "generated"] },
250+
},
251+
},
252+
linterOptions: { reportUnusedDisableDirectives: isProduction },
253+
rules: {
254+
...sharedRules,
255+
"import/no-cycle": "off",
256+
"import/namespace": "off",
257+
"import/named": "off",
258+
"import/default": "off",
259+
"import/no-extraneous-dependencies": [
260+
"error",
261+
{
262+
devDependencies: ["**/*.test.ts", "**/tests/**"],
263+
},
264+
],
265+
"no-debugger": isProduction ? "error" : "off",
266+
"no-underscore-dangle": "error",
267+
"no-redeclare": ["error", { builtinGlobals: true }],
268+
"import/order": [
269+
"error",
270+
{
271+
groups: ["external", "builtin", "internal", "type", "parent", "sibling", "index", "object"],
272+
alphabetize: { order: "asc", caseInsensitive: true },
273+
warnOnUnassignedImports: true,
274+
"newlines-between": "always",
275+
},
276+
],
277+
"import/prefer-default-export": "off",
278+
"import/extensions": ["error", { json: "always" }],
279+
"class-methods-use-this": "off",
280+
"prefer-promise-reject-errors": "off",
281+
"max-classes-per-file": "off",
282+
"no-use-before-define": ["off"],
283+
"no-shadow": "off",
284+
curly: ["error", "all"],
285+
"no-return-await": "off",
286+
"prefer-destructuring": "off",
287+
"@typescript-eslint/prefer-for-of": "off",
288+
"@typescript-eslint/consistent-type-imports": "off",
289+
"@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],
290+
"@typescript-eslint/explicit-module-boundary-types": "error",
291+
"@typescript-eslint/no-use-before-define": ["error", { functions: false, classes: false }],
292+
"@typescript-eslint/no-shadow": [
293+
"error",
294+
{
295+
builtinGlobals: true,
296+
allow: ["BigInt", "Request", "describe", "afterEach", "beforeEach", "beforeAll"],
221297
},
222298
],
223299
},
@@ -228,5 +304,6 @@ const evalConfig = {
228304
export default defineConfig([
229305
gasConfig,
230306
evalConfig,
231-
globalIgnores(["**/node_modules", "**/dist", "**/coverage", "**/build", "eslint.config.js"]),
307+
subgraphConfig,
308+
globalIgnores(["**/node_modules", "**/dist", "**/coverage", "**/build", "eslint.config.js", "subgraph/generated"]),
232309
]);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"private": true,
66
"type": "module",
77
"scripts": {
8-
"lint": "eslint gas-benchmarks/src project-evaluations/src",
9-
"lint:fix": "eslint --fix gas-benchmarks/src project-evaluations/src",
8+
"lint": "eslint gas-benchmarks/src project-evaluations/src subgraph/src subgraph/tests",
9+
"lint:fix": "pnpm run lint --fix",
1010
"format": "prettier --check .",
1111
"format:fix": "prettier --write .",
1212
"prepare": "husky"

0 commit comments

Comments
 (0)