diff --git a/.github/workflows/ts_lint.yaml b/.github/workflows/ts_lint.yaml index 5a238f334..c72f8a1a2 100644 --- a/.github/workflows/ts_lint.yaml +++ b/.github/workflows/ts_lint.yaml @@ -42,7 +42,7 @@ jobs: echo '{ "abi": [], "bytecode": { "object": "" } }' > ethereum_history_api/contracts/out/UltraVerifier.sol/UltraVerifier.json - name: Run TypeScript Build - run: yarn build:all + run: yarn build - name: Run TypeScript format check run: yarn format:all:ci diff --git a/.github/workflows/ts_test.yaml b/.github/workflows/ts_test.yaml index 8fdf940b6..178b6140a 100644 --- a/.github/workflows/ts_test.yaml +++ b/.github/workflows/ts_test.yaml @@ -58,7 +58,7 @@ jobs: run: forge build - name: Run TypeScript Build - run: yarn build:all + run: yarn build - name: Run Unit Tests working-directory: ethereum_history_api/oracles diff --git a/ethereum_history_api/oracles/package.json b/ethereum_history_api/oracles/package.json index 7c63b7d9a..2cc6d73a9 100644 --- a/ethereum_history_api/oracles/package.json +++ b/ethereum_history_api/oracles/package.json @@ -1,8 +1,8 @@ { "name": "noir-ethereum-api-oracles", "version": "1.0.0", - "main": "dist/oracles/src/main.js", - "types": "dist/oracles/src/main.d.ts", + "main": "dist/src/main.js", + "types": "dist/src/main.d.ts", "type": "module", "scripts": { "test:unit": "vitest run --config vitest.unit.config.ts", diff --git a/ethereum_history_api/oracles/src/ethereum/index.ts b/ethereum_history_api/oracles/src/ethereum/index.ts deleted file mode 100644 index 2b9f9b598..000000000 --- a/ethereum_history_api/oracles/src/ethereum/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { verifyStorageProofInSolidity } from './verifier.js'; diff --git a/ethereum_history_api/oracles/src/main.ts b/ethereum_history_api/oracles/src/main.ts index af62543a9..8eb305742 100644 --- a/ethereum_history_api/oracles/src/main.ts +++ b/ethereum_history_api/oracles/src/main.ts @@ -1,3 +1,2 @@ export { incHexStr, assert, copy, updateNestedField } from './util/index.js'; -export { verifyStorageProofInSolidity } from './ethereum/index.js'; export { encodeHexString } from './noir/noir_js/encode.js'; diff --git a/ethereum_history_api/oracles/tsconfig.json b/ethereum_history_api/oracles/tsconfig.json index b4e69ae1f..fcafdfe53 100644 --- a/ethereum_history_api/oracles/tsconfig.json +++ b/ethereum_history_api/oracles/tsconfig.json @@ -1,6 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.common.json", + "include": ["src/**/*", "test/fixtures/*.json", "test/helpers.ts", "package.json"], "compilerOptions": { + "rootDirs": ["src", "test"], "outDir": "dist" } } diff --git a/ethereum_history_api/tests/src/e2e.test.ts b/ethereum_history_api/tests/src/e2e.test.ts index 1020a5ccd..6f16260b0 100644 --- a/ethereum_history_api/tests/src/e2e.test.ts +++ b/ethereum_history_api/tests/src/e2e.test.ts @@ -1,5 +1,5 @@ import { beforeAll, describe, expect, it } from 'vitest'; -import { copy, updateNestedField, incHexStr, assert, verifyStorageProofInSolidity } from 'noir-ethereum-api-oracles'; +import { copy, updateNestedField, incHexStr, assert } from 'noir-ethereum-api-oracles'; import { abiEncode, InputMap, WitnessMap } from '@noir-lang/noirc_abi'; import { Account, privateKeyToAccount } from 'viem/accounts'; @@ -7,6 +7,7 @@ import ultraVerifier from '../../contracts/out/UltraVerifier.sol/UltraVerifier.j import { Address, Hex } from 'viem'; import { createAnvilClient, AnvilClient } from './ethereum/anvilClient.js'; import { circuit, readInputMap, readProof, readWitnessMap } from './main.js'; +import { verifyStorageProofInSolidity } from './verifier.js'; const PROOF_PATH = '../../proofs/ethereum_history_api.proof'; const INPUT_MAP_PATH = '../circuits/lib/Verifier.toml'; diff --git a/ethereum_history_api/oracles/src/ethereum/verifier.ts b/ethereum_history_api/tests/src/verifier.ts similarity index 76% rename from ethereum_history_api/oracles/src/ethereum/verifier.ts rename to ethereum_history_api/tests/src/verifier.ts index e6d5b881e..a33cca03b 100644 --- a/ethereum_history_api/oracles/src/ethereum/verifier.ts +++ b/ethereum_history_api/tests/src/verifier.ts @@ -1,5 +1,5 @@ -import ultraVerifier from '../../../contracts/out/UltraVerifier.sol/UltraVerifier.json'; -import { decodeHexString } from '../noir/noir_js/encode.js'; +import ultraVerifier from '../../contracts/out/UltraVerifier.sol/UltraVerifier.json'; +import { decodeHexString } from 'noir-ethereum-api-oracles/src/noir/noir_js/encode.js'; import { Account } from 'viem/accounts'; import { Address, Hash, WalletClient } from 'viem'; import { WitnessMap } from '@noir-lang/noirc_abi'; diff --git a/ethereum_history_api/tests/tsconfig.json b/ethereum_history_api/tests/tsconfig.json index b4e69ae1f..d753d70a3 100644 --- a/ethereum_history_api/tests/tsconfig.json +++ b/ethereum_history_api/tests/tsconfig.json @@ -1,6 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.common.json", + "include": ["src/**/*"], "compilerOptions": { + "rootDir": "src", "outDir": "dist" } } diff --git a/package.json b/package.json index 8c0d92ab4..f68cead59 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,10 @@ "ethereum_history_api/tests" ], "scripts": { - "check": "yarn format:all && yarn lint:all && yarn typecheck:all", + "build": "tsc --build --verbose", + "watch": "tsc --build --verbose --watch", + "check": "yarn format:all && yarn lint:all", "lint:all": "yarn workspaces foreach --all --parallel --verbose run lint", - "build:all": "yarn workspaces foreach --all --topological --verbose run build", "format:all": "yarn workspaces foreach --all --parallel --verbose run format", "format:all:ci": "yarn workspaces foreach --all --parallel --verbose run format:ci" }, diff --git a/tsconfig.common.json b/tsconfig.common.json new file mode 100644 index 000000000..5c80eaed9 --- /dev/null +++ b/tsconfig.common.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "resolveJsonModule": true, + "allowJs": false, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitAny": true, + "declaration": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "skipLibCheck": true, + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./dist/.tsbuildinfo" + } +} diff --git a/tsconfig.json b/tsconfig.json index 0f52e2015..4f9049f64 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,7 @@ { - "compilerOptions": { - "target": "es2020", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "resolveJsonModule": true, - "allowJs": false, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitAny": true, - "declaration": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "skipLibCheck": true - } + "files": [], + "references": [ + { "path": "ethereum_history_api/oracles/tsconfig.json" }, + { "path": "ethereum_history_api/tests/tsconfig.json" } + ] }