-
Notifications
You must be signed in to change notification settings - Fork 5
feat: ATs for blockscout and 1inch #235
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bf8b153
add skill to rearrange app benchmark
sevenzing a099085
rearrange blockscout-explorer to new structure
sevenzing 0aba81d
add blockscout-explorer case
sevenzing d6c28de
p lint
sevenzing 21c3c89
rearrange 1inch-defi benchmark to new structure
sevenzing 4d8c9b1
update skill to use values from technicalDetails
sevenzing 6d678e3
generate benchmark for 1inch
sevenzing 717a9ce
p lint
sevenzing c47d935
update benchmark of blockscout and etherscan accordingly
sevenzing 5e01547
apply fixes for AI review
sevenzing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,166 @@ | ||
| --- | ||
| name: rearrange-app-benchmarks | ||
| description: >- | ||
| Migrate an ENS Awards app's benchmarks/index.tsx from the old single-file | ||
| layout to the new per-best-practice split-module layout, without changing any | ||
| benchmark data. Use when asked to "rearrange <app> to new structure" / port an | ||
| app's benchmarks to the new structure. Works for any app under | ||
| ensawards.org/data/apps/. | ||
| disable-model-invocation: true | ||
| --- | ||
|
|
||
| # Rearrange App Benchmarks | ||
|
|
||
| Restructure an app's benchmarks to the new layout (canonical example: | ||
| `etherscan-explorer`) from the old layout (e.g. `blockscout-explorer`). This is a | ||
| **pure refactor**: the app must compile, lint, and render exactly as before. Do | ||
| **not** add, remove, or change any benchmark data, results, contributions, notes, | ||
| or images. | ||
|
|
||
| ## Input | ||
|
|
||
| - **app** — one app slug (directory under `ensawards.org/data/apps/`). | ||
|
|
||
| ## Target layout (new) | ||
|
|
||
| `benchmarks/index.tsx` references split modules and orders best practices as: | ||
|
|
||
| 1. `"ensv2-ready-resolution"` — imported from `./resolution/ensv2-ready-resolution` | ||
| 2. `"deposit-addresses"` — imported from `./resolution/deposit-address` | ||
| 3. legacy contract-naming best practices (`display-named-smart-contracts-mainnet`, | ||
| `display-named-smart-contracts-l2-chains`) — left **inline and unchanged**, moved | ||
| to the **bottom**, under their existing `TODO: Contract Naming ...` comment. | ||
|
|
||
| Each split module lives at `benchmarks/resolution/<dir>/index.tsx` and | ||
| `export default`s an `AcceptanceTestBenchmarks` object. Its proof image(s) sit in | ||
| the same directory. | ||
|
|
||
| ## Workflow | ||
|
|
||
| ``` | ||
| - [ ] Step 1: Read the app's benchmarks/index.tsx; note which best practices exist | ||
| - [ ] Step 2: Extract ensv2-ready-resolution into a split module (if present) | ||
| - [ ] Step 3: Extract deposit-addresses into a split module (if present) | ||
| - [ ] Step 4: Rewrite the main index.tsx (reorder + imports) | ||
| - [ ] Step 5: Typecheck + lint | ||
| ``` | ||
|
|
||
| ### Step 2: Extract `ensv2-ready-resolution` (only if the key exists) | ||
|
|
||
| 1. Create `benchmarks/resolution/ensv2-ready-resolution/`. | ||
| 2. Move the proof image(s) imported by this block into that directory, renamed `ac-1.<original-ext>`, `ac-2.<original-ext>`, ... using `git mv` to preserve history. | ||
| 3. Create `benchmarks/resolution/ensv2-ready-resolution/index.tsx` that | ||
| `export default`s the **same** benchmark object, copied **verbatim** (results, | ||
| contributions, notes, alt text unchanged). Update the proof image import(s) to | ||
| the local `./ac-1.png`. | ||
|
|
||
| Module template (mirror the verbatim content; only imports + image paths change): | ||
|
|
||
| ```tsx | ||
| import type { AcceptanceTestBenchmark } from "data/acceptance-tests/types"; | ||
| import type { AcceptanceTestBenchmarks } from "data/benchmarks/types"; | ||
| import { BenchmarkResults } from "data/benchmarks/types"; | ||
| import contributors from "data/contributors"; | ||
| import { acceptanceTestDetailsContainerStyles } from "data/ens-best-practices/styles"; | ||
|
|
||
| import { parseTimestamp } from "@ensnode/ensnode-sdk"; | ||
|
|
||
| import { cn } from "@/utils/tailwindClassConcatenation"; | ||
|
|
||
| import correctlyResolveEnsv2TestNameAddressProofImage from "./ac-1.png"; | ||
|
|
||
| const ensv2ReadyResolution = { | ||
| // ...the exact same entry/entries that were inline in the main file... | ||
| } as const satisfies AcceptanceTestBenchmarks; | ||
|
|
||
| export default ensv2ReadyResolution; | ||
| ``` | ||
|
|
||
| Only import the symbols the moved content actually uses (e.g. if every entry is | ||
| `undefined`, the module needs just `AcceptanceTestBenchmarks`). | ||
|
|
||
| ### Step 3: Extract `deposit-addresses` (only if the key exists) | ||
|
|
||
| 1. Create `benchmarks/resolution/deposit-address/` if it doesn't exist. | ||
| 2. If a legacy `benchmarks/deposit-address/` source folder exists (e.g. | ||
| `manual.json` + `at-*.png`), `git mv` it to `benchmarks/resolution/deposit-address/` | ||
| so source assets are co-located for a later `generate-app-benchmark` run. | ||
| **Do not** consume `manual.json` here — this skill adds no benchmarks. | ||
| 3. Create `benchmarks/resolution/deposit-address/index.tsx` that `export default`s | ||
| the **same** `deposit-addresses` record copied verbatim from the main file | ||
| (typically every acceptance test mapped to `undefined`). | ||
|
|
||
| All-`undefined` module example: | ||
|
|
||
| ```tsx | ||
| import type { AcceptanceTestBenchmarks } from "data/benchmarks/types"; | ||
|
|
||
| const depositAddresses = { | ||
| "correctly-resolve-direct-onchain-subname-address": undefined, | ||
| "correctly-resolve-names-requiring-normalization": undefined, | ||
| "correctly-implement-ccip-read-for-eth-subnames": undefined, | ||
| "correctly-implement-ccip-read-for-offchain-dns-names": undefined, | ||
| "correctly-resolve-names-for-different-evm-chains": undefined, | ||
| "correctly-resolve-names-for-bitcoin": undefined, | ||
| "correctly-resolve-names-for-solana": undefined, | ||
| "correctly-handle-resolution-for-chains-with-invalid-address-formatting": undefined, | ||
| } as const satisfies AcceptanceTestBenchmarks; | ||
|
|
||
| export default depositAddresses; | ||
| ``` | ||
|
|
||
| ### Step 4: Rewrite the main `benchmarks/index.tsx` | ||
|
|
||
| - Add imports for the new modules (`./resolution/ensv2-ready-resolution`, | ||
| `./resolution/deposit-address`). | ||
| - Remove the proof-image import(s) that moved into the ensv2 module. | ||
| - Keep imports still used by the inline legacy blocks (`AcceptanceTestBenchmark`, | ||
| `BenchmarkResults`, `contributors`, `acceptanceTestDetailsContainerStyles`, | ||
| `parseTimestamp`, `cn`, the example proof image). | ||
| - Reorder the `benchmarks` object: `ensv2-ready-resolution` first, | ||
| `deposit-addresses` second, then the legacy contract-naming blocks (verbatim) at | ||
| the bottom under their `TODO: Contract Naming ...` comment. Preserve any leading | ||
| commented-out blocks (e.g. `recognize-all-ens-names`). | ||
|
|
||
| Resulting shape: | ||
|
|
||
| ```tsx | ||
| import depositAddresses from "./resolution/deposit-address"; | ||
| import ensv2ReadyResolution from "./resolution/ensv2-ready-resolution"; | ||
| // ...kept imports... | ||
|
|
||
| const benchmarks = { | ||
| // ...preserved commented-out blocks... | ||
| "ensv2-ready-resolution": ensv2ReadyResolution, | ||
| "deposit-addresses": depositAddresses, | ||
|
|
||
| // TODO: `Contract Naming` category is temporarily hidden ... | ||
| "display-named-smart-contracts-mainnet": { /* unchanged inline */ }, | ||
| "display-named-smart-contracts-l2-chains": { /* unchanged inline */ }, | ||
| } as const satisfies BestPracticeBenchmarks; | ||
|
|
||
| defineAppBenchmarks(<App>, benchmarks); | ||
|
|
||
| export default benchmarks; | ||
| ``` | ||
|
|
||
| Only include the keys that existed before. Never introduce a best practice the | ||
| app didn't already have. | ||
|
|
||
| ### Step 5: Verify | ||
|
|
||
| ```bash | ||
| cd ensawards.org && pnpm astro sync && pnpm exec tsc --noEmit | ||
| ``` | ||
|
|
||
| Then lint the touched files. Everything must pass as before. The IDE may show a | ||
| stale "is not a module" error for a just-deleted/renamed file; `tsc` is the | ||
| source of truth. | ||
|
|
||
| ## Notes | ||
|
|
||
| - Pure refactor: identical compiled behavior. If you find yourself writing new | ||
| result/notes content, stop — that belongs to `generate-app-benchmark`. | ||
| - JSX requires `.tsx`. A split module with only `undefined` entries has no JSX, but | ||
| still use `.tsx` to match the target layout and ease later population. | ||
| - Use `git mv` for image/folder moves to preserve history. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.