Skip to content

Commit 127b7ef

Browse files
authored
Merge pull request #1280 from graphprotocol/issuance-baseline
Issuance related changes and deployment (contract changes audited and merged)
2 parents 7ab613f + ada3155 commit 127b7ef

455 files changed

Lines changed: 26131 additions & 5497 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
- name: Install Node.js
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: 20
20+
node-version: 22
2121
cache: 'pnpm'
2222
- name: Set up pnpm via Corepack
2323
shell: bash

.github/workflows/lint.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,35 @@ jobs:
230230
echo "No YAML files to lint"
231231
fi
232232
233+
- name: Lint Forge files
234+
id: lint_forge
235+
continue-on-error: true
236+
run: |
237+
# Find packages with lint:forge script defined
238+
FORGE_PACKAGES=$(find packages -name "package.json" -exec grep -l '"lint:forge"' {} \; | xargs -I{} dirname {} | sort)
239+
if [ -z "$FORGE_PACKAGES" ]; then
240+
echo "No packages with lint:forge script found"
241+
exit 0
242+
fi
243+
echo "Packages with lint:forge: $FORGE_PACKAGES"
244+
245+
if [ "${{ steps.lint_mode.outputs.mode }}" = "all" ]; then
246+
echo "Linting all Forge files..."
247+
pnpm lint:forge
248+
elif [ "${{ steps.changed_files.outputs.sol_count }}" -gt "0" ]; then
249+
# Build regex pattern from packages with lint:forge
250+
FORGE_PATTERN=$(echo "$FORGE_PACKAGES" | tr '\n' '|' | sed 's/|$//')
251+
FORGE_FILES=$(cat changed_sol.txt | grep -E "^($FORGE_PATTERN)/" || true)
252+
if [ -n "$FORGE_FILES" ]; then
253+
echo "Found Forge-related changes, running forge lint..."
254+
pnpm lint:forge
255+
else
256+
echo "No Forge-related Solidity files changed"
257+
fi
258+
else
259+
echo "No Solidity files to lint with Forge"
260+
fi
261+
233262
- name: Check lint results
234263
if: always()
235264
run: |
@@ -238,7 +267,8 @@ jobs:
238267
[ "${{ steps.lint_ts.outcome }}" = "failure" ] || \
239268
[ "${{ steps.lint_md.outcome }}" = "failure" ] || \
240269
[ "${{ steps.lint_json.outcome }}" = "failure" ] || \
241-
[ "${{ steps.lint_yaml.outcome }}" = "failure" ]; then
270+
[ "${{ steps.lint_yaml.outcome }}" = "failure" ] || \
271+
[ "${{ steps.lint_forge.outcome }}" = "failure" ]; then
242272
echo "❌ One or more linters failed"
243273
exit 1
244274
else

.gitignore

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,21 @@ packages/*/.eslintcache
2929
dist/
3030
dist-v5/
3131
build/
32+
deployments/hardhat/
33+
*.js.map
34+
*.d.ts.map
35+
36+
# Generated types (typechain output)
3237
typechain/
38+
typechain-src/
3339
typechain-types/
34-
types/
3540
types-v5/
3641
wagmi/
37-
types/
38-
deployments/hardhat/
39-
*.js.map
40-
*.d.ts.map
42+
packages/contracts/types/
43+
packages/contracts-test/types/
44+
packages/interfaces/types/
45+
packages/token-distribution/types/
46+
packages/issuance/types/
4147

4248
# TypeScript incremental compilation cache
4349
**/tsconfig.tsbuildinfo
@@ -52,6 +58,7 @@ bin/
5258
.env
5359
.DS_Store
5460
.vscode
61+
core
5562

5663
# Coverage and other reports
5764
coverage/
@@ -104,3 +111,5 @@ tx-builder-*.json
104111
# Tenderly
105112
.tenderly-artifacts/
106113

114+
# NFS stale file handles
115+
.nfs*

.markdownlint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"MD013": false,
66
"MD024": { "siblings_only": true },
77
"MD029": { "style": "ordered" },
8-
"MD033": false
8+
"MD033": false,
9+
"MD040": false
910
}

README.md

Lines changed: 5 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -165,157 +165,16 @@ pnpm publish --recursive
165165

166166
Alternatively, there is a GitHub action that can be manually triggered to publish a package.
167167

168-
## Linting Configuration
168+
## Linting
169169

170-
This monorepo uses a comprehensive linting setup with multiple tools to ensure code quality and consistency across all packages.
171-
172-
### Linting Tools Overview
173-
174-
- **ESLint**: JavaScript/TypeScript code quality and style enforcement
175-
- **Prettier**: Code formatting for JavaScript, TypeScript, JSON, Markdown, YAML, and Solidity
176-
- **Solhint**: Solidity-specific linting for smart contracts
177-
- **Markdownlint**: Markdown formatting and style consistency
178-
- **YAML Lint**: YAML file validation and formatting
179-
180-
### Configuration Architecture
181-
182-
The linting configuration follows a hierarchical structure where packages inherit from root-level configurations:
183-
184-
#### ESLint Configuration
185-
186-
- **Root Configuration**: `eslint.config.mjs` - Modern flat config format
187-
- **Direct Command**: `npx eslint '**/*.{js,ts,cjs,mjs,jsx,tsx}' --fix`
188-
- **Behavior**: ESLint automatically searches up parent directories to find configuration files
189-
- **Package Inheritance**: Packages automatically inherit the root ESLint configuration without needing local config files
190-
- **Global Ignores**: Configured to exclude autogenerated files (`.graphclient-extracted/`, `lib/`) and build outputs
191-
192-
#### Prettier Configuration
193-
194-
- **Root Configuration**: `prettier.config.cjs` - Base formatting rules for all file types
195-
- **Direct Command**: `npx prettier -w --cache '**/*.{js,ts,cjs,mjs,jsx,tsx,json,md,sol,yml,yaml}'`
196-
- **Package Inheritance**: Packages that need Prettier must have a `prettier.config.cjs` file that inherits from the shared config
197-
- **Example Package Config**:
198-
199-
```javascript
200-
const baseConfig = require('../../prettier.config.cjs')
201-
module.exports = { ...baseConfig }
202-
```
203-
204-
- **Ignore Files**: `.prettierignore` excludes lock files, build outputs, and third-party dependencies
205-
206-
#### Solidity Linting (Solhint)
207-
208-
- **Root Configuration**: `.solhint.json` - Base Solidity linting rules extending `solhint:recommended`
209-
- **Direct Command**: `npx solhint 'contracts/**/*.sol'` (add `--fix` for auto-fixing)
210-
- **List Applied Rules**: `npx solhint list-rules`
211-
- **TODO Comment Checking**: `scripts/check-todos.sh` - Blocks commits and linting if TODO/FIXME/XXX/HACK comments are found in changed Solidity files
212-
- **Package Inheritance**: Packages can extend the root config with package-specific rules
213-
- **Configuration Inheritance Limitation**: Solhint has a limitation where nested `extends` don't work properly. When a local config extends a parent config that itself extends `solhint:recommended`, the built-in ruleset is ignored.
214-
- **Recommended Package Extension Pattern**:
215-
216-
```json
217-
{
218-
"extends": ["solhint:recommended", "./../../.solhint.json"],
219-
"rules": {
220-
"no-console": "off",
221-
"import-path-check": "off"
222-
}
223-
}
224-
```
225-
226-
#### Markdown Linting (Markdownlint)
227-
228-
- **Root Configuration**: `.markdownlint.json` - Markdown formatting and style rules
229-
- **Direct Command**: `npx markdownlint '**/*.md' --fix`
230-
- **Ignore Files**: `.markdownlintignore` automatically picked up by markdownlint CLI
231-
- **Global Application**: Applied to all markdown files across the monorepo
232-
233-
### Linting Scripts
234-
235-
#### Root Level Scripts
236-
237-
```bash
238-
# Run all linting tools
239-
pnpm lint
240-
241-
# Individual linting commands
242-
pnpm lint:ts # ESLint + Prettier for TypeScript/JavaScript
243-
pnpm lint:sol # TODO check + Solhint + Prettier for Solidity (runs recursively)
244-
pnpm lint:md # Markdownlint + Prettier for Markdown
245-
pnpm lint:json # Prettier for JSON files
246-
pnpm lint:yaml # YAML linting + Prettier
247-
248-
# Lint only staged files (useful for manual pre-commit checks)
249-
pnpm lint:staged # Run linting on git-staged files only
250-
```
251-
252-
#### Package Level Scripts
253-
254-
Each package can define its own linting scripts that work with the inherited configurations:
170+
This monorepo uses multiple linting tools: ESLint, Prettier, Solhint, Forge Lint, Markdownlint, and YAML Lint.
255171

256172
```bash
257-
# Example from packages/contracts
258-
pnpm lint:sol # Solhint for contracts in this package only
259-
pnpm lint:ts # ESLint for TypeScript files in this package
173+
pnpm lint # Run all linters
174+
pnpm lint:staged # Lint only staged files
260175
```
261176

262-
### Pre-commit Hooks (lint-staged)
263-
264-
The repository uses `lint-staged` with Husky to run linting on staged files before commits:
265-
266-
- **Automatic**: Runs automatically on `git commit` via Husky pre-commit hook
267-
- **Manual**: Run `pnpm lint:staged` to manually check staged files before committing
268-
- **Configuration**: Root `package.json` contains lint-staged configuration
269-
- **Custom Script**: `scripts/lint-staged-run.sh` filters out generated files that shouldn't be linted
270-
- **File Type Handling**:
271-
- `.{js,ts,cjs,mjs,jsx,tsx}`: ESLint + Prettier
272-
- `.sol`: TODO check + Solhint + Prettier
273-
- `.md`: Markdownlint + Prettier
274-
- `.json`: Prettier only
275-
- `.{yml,yaml}`: YAML lint + Prettier
276-
277-
**Usage**: `pnpm lint:staged` is particularly useful when you want to check what linting changes will be applied to your staged files before actually committing.
278-
279-
### TODO Comment Enforcement
280-
281-
The repository enforces TODO comment resolution to maintain code quality:
282-
283-
- **Scope**: Applies only to Solidity (`.sol`) files
284-
- **Detection**: Finds TODO, FIXME, XXX, and HACK comments (case-insensitive)
285-
- **Triggers**:
286-
- **Pre-commit**: Blocks commits if TODO comments exist in files being committed
287-
- **Regular linting**: Flags TODO comments in locally changed, staged, or untracked Solidity files
288-
- **Script**: `scripts/check-todos.sh` (must be run from repository root)
289-
- **Bypass**: Use `git commit --no-verify` to bypass (not recommended for production)
290-
291-
### Key Design Principles
292-
293-
1. **Hierarchical Configuration**: Root configurations provide base rules, packages can extend as needed
294-
2. **Tool-Specific Inheritance**: ESLint searches up automatically, Prettier requires explicit inheritance
295-
3. **Generated File Exclusion**: Multiple layers of exclusion for autogenerated content
296-
4. **Consistent Formatting**: Prettier ensures consistent code formatting across all file types
297-
5. **Fail-Fast Linting**: Pre-commit hooks catch issues before they enter the repository
298-
299-
### Configuration Files Reference
300-
301-
| Tool | Root Config | Package Config | Ignore Files |
302-
| ------------ | --------------------- | -------------------------------- | ---------------------------- |
303-
| ESLint | `eslint.config.mjs` | Auto-inherited | Built into config |
304-
| Prettier | `prettier.config.cjs` | `prettier.config.cjs` (inherits) | `.prettierignore` |
305-
| Solhint | `.solhint.json` | `.solhint.json` (array extends) | N/A |
306-
| Markdownlint | `.markdownlint.json` | Auto-inherited | `.markdownlintignore` |
307-
| Lint-staged | `package.json` | N/A | `scripts/lint-staged-run.sh` |
308-
309-
### Troubleshooting
310-
311-
- **ESLint not finding config**: ESLint searches up parent directories automatically - no local config needed
312-
- **Prettier not working**: Packages need a `prettier.config.cjs` that inherits from root config
313-
- **Solhint missing rules**: If extending a parent config, use array format: `["solhint:recommended", "./../../.solhint.json"]` to ensure all rules are loaded
314-
- **Solhint inheritance not working**: Nested extends don't work - parent config's `solhint:recommended` won't be inherited with simple string extends
315-
- **Solhint rule reference**: Use `npx solhint list-rules` to see all available rules and their descriptions
316-
- **Generated files being linted**: Check ignore patterns in `.prettierignore`, `.markdownlintignore`, and ESLint config
317-
- **Preview lint changes before commit**: Use `pnpm lint:staged` to see what changes will be applied to staged files
318-
- **Commit blocked by linting**: Fix the linting issues or use `git commit --no-verify` to bypass (not recommended)
177+
See [docs/Linting.md](docs/Linting.md) for detailed configuration, inline suppression syntax, and troubleshooting.
319178

320179
## Documentation
321180

0 commit comments

Comments
 (0)