Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/pull-request-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22.9.0
# This only caches ~/.npm, therefore each subsequent
# job needs to run `npm ci` to install deps from npm cache
# alternative is to cache `node_modules` directly
Expand All @@ -39,7 +39,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22.9.0
cache: npm

- name: "Install dependencies"
Expand All @@ -57,7 +57,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22.9.0
cache: npm

- name: "Install dependencies"
Expand All @@ -80,7 +80,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22.9.0
cache: npm

- name: "Install dependencies"
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 22.9.0
cache: npm

- name: "Install dependencies"
Expand All @@ -145,7 +145,7 @@ jobs:
run: npm run build

- name: "Migrate DB"
run: npm run migrate
run: npm run prisma:migrate

- name: "Wait for lightnet readiness"
uses: o1-labs/wait-for-mina-network-action@v1
Expand Down
7 changes: 7 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"options": {
"cacheableOperations": [
"build",
"prisma:generate",
"lint",
"test",
"integration"
Expand All @@ -13,6 +14,12 @@
}
},
"targetDefaults": {
"prisma:generate": {
"inputs": [
"{projectRoot}/package.json",
"{projectRoot}/prisma/**/*"
]
},
"build": {
"dependsOn": [
"^build"
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"type": "module",
"scripts": {
"dev": "npx lerna run dev",
"build": "npx lerna run build",
"build": "npm run prisma:generate && lerna run build",
"build:clean": "npx nx reset && npm run build",
"build-docker": "docker build -t protokit-base -f ./packages/deployment/docker/base/Dockerfile .",
"lint": "npx lerna run lint",
"lint:staged": "eslint",
"test": "npx lerna run test -- --passWithNoTests",
"test:ci": "npx lerna run test -- --passWithNoTests --forceExit",
"test:integration": "npx lerna run test:integration -- --passWithNoTests --forceExit",
"test:ci": "npx lerna run test --concurrency=1 -- --passWithNoTests --forceExit",
"test:integration": "npx lerna run test:integration --concurrency=1 -- --passWithNoTests --forceExit",
"test:watch": "npx lerna run test:watch",
"migrate": "npx lerna run prisma-migrate",
"prisma-generate": "npx lerna run prisma-generate",
"prisma:migrate": "npx lerna run prisma:migrate",
"prisma:generate": "npx lerna run prisma:generate",
"commit": "cz",
"publish:canary": "npx lerna publish prerelease --no-private --exact --yes --canary --preid develop --dist-tag latest --loglevel verbose --force-git-tag --force-publish"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/common/test/zkProgrammable/ZkProgrammable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import { Field, Struct, Proof, ZkProgram } from "o1js";
import {
MOCK_PROOF,
provableMethod,
} from "../../src/zkProgrammable/provableMethod";
import {
AreProofsEnabled,
CompileArtifact,
MOCK_VERIFICATION_KEY,
ZkProgrammable,
} from "../../src/zkProgrammable/ZkProgrammable";
import { ProvableMethodExecutionContext } from "../../src/zkProgrammable/ProvableMethodExecutionContext";
ProvableMethodExecutionContext,
} from "../../src";

const appChainMock: AreProofsEnabled = {
areProofsEnabled: false,
Expand Down Expand Up @@ -86,6 +84,7 @@ class TestProgrammable extends ZkProgrammable<

return [
{
name: program.name,
compile: program.compile.bind(program),
verify: program.verify.bind(program),
analyzeMethods: program.analyzeMethods.bind(program),
Expand Down Expand Up @@ -129,6 +128,7 @@ class OtherTestProgrammable extends ZkProgrammable<undefined, void> {

return [
{
name: program.name,
compile: program.compile.bind(program),
verify: program.verify.bind(program),
analyzeMethods: program.analyzeMethods.bind(program),
Expand Down
2 changes: 1 addition & 1 deletion packages/deployment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DATABASE_URL=postgresql://admin:password@localhost:5432/protokit?schema=public
INDEXER_DATABASE_URL=postgresql://admin:password@localhost:5432/protokit-indexer?schema=public
2 changes: 1 addition & 1 deletion packages/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./src/** ./test/**",
"test:watch": "npm run test:file -- ./src/** ./test/** --watch",
"prisma:generate": "prisma generate --schema=./prisma/schema.prisma",
Expand Down
44 changes: 24 additions & 20 deletions packages/indexer/test/IndexerNotifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ import {
StateServiceQueryModule,
TestingAppChain,
} from "@proto-kit/sdk";
import { LocalTaskQueue, Sequencer, TaskPayload } from "@proto-kit/sequencer";
import {
LocalTaskQueue,
Sequencer,
TaskPayload,
VanillaTaskWorkerModules,
} from "@proto-kit/sequencer";

import { IndexerNotifier } from "../src/IndexerNotifier";
import { IndexBlockTaskParametersSerializer } from "../src/tasks/IndexBlockTaskParameters";
import { IndexerNotifier, IndexBlockTaskParametersSerializer } from "../src";

class TestBalances extends Balances {
@runtimeMethod()
Expand Down Expand Up @@ -90,22 +94,15 @@ function createAppChain() {
BlockTrigger: {},
Mempool: {},
BlockProducerModule: {},
LocalTaskWorkerModule: {
StateTransitionReductionTask: {},
StateTransitionTask: {},
RuntimeProvingTask: {},
BlockBuildingTask: {},
BlockProvingTask: {},
BlockReductionTask: {},
CircuitCompilerTask: {},
WorkerRegistrationTask: {},
},
LocalTaskWorkerModule: VanillaTaskWorkerModules.defaultConfig(),
BaseLayer: {},
BatchProducerModule: {},
TaskQueue: {
simulatedDuration: 0,
},
SequencerStartupModule: {},
IndexerNotifier: {},
FeeStrategy: {},
},
Signer: {
signer: PrivateKey.random(),
Expand Down Expand Up @@ -154,28 +151,35 @@ async function sendTransactions(
return await appChain.produceBlock();
}

describe("IndexerNotifier", () => {
// TODO This test currently doesn't work because the mock stops the queues
// from working as it intercepts calls. This is important both for the
// sequencer startup and also the block production
describe.skip("IndexerNotifier", () => {
let appChain: ReturnType<typeof createAppChain>;
const getQueueSpy = jest.spyOn(LocalTaskQueue.prototype, "getQueue");
const addTaskSpy = jest.fn(async (payload: TaskPayload) => ({
taskId: "0",
}));
const addTaskSpy = jest.fn(async (payload: TaskPayload) => {
return {
taskId: "0",
};
});

getQueueSpy.mockImplementation(async (queueName: string) => {
return {
name: queueName,
offCompleted: jest.fn(async (x) => {}),
addTask: addTaskSpy,
onCompleted: jest.fn(async () => {}),
onCompleted: jest.fn(async () => 5),
close: jest.fn(async () => {}),
};
});

beforeAll(async () => {
appChain = createAppChain();

await appChain.start();
await appChain.start(false, container.createChildContainer());

await sendTransactions(appChain, 2);
});
}, 20000);

it("should create a task for every unproven block produced", async () => {
const { block } = container
Expand Down
2 changes: 1 addition & 1 deletion packages/library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/library/src/sequencer/InMemorySequencerModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
BlockProducerModule,
VanillaTaskWorkerModules,
TaskWorkerModulesWithoutSettlement,
SequencerStartupModule,
} from "@proto-kit/sequencer";
import { TypedClass } from "@proto-kit/common";
import { ConstantFeeStrategy } from "@proto-kit/sequencer/src/protocol/baselayer/fees/ConstantFeeStrategy";

export type InMemorySequencerModulesRecord = {
Database: typeof InMemoryDatabase;
Expand All @@ -38,12 +40,14 @@ export class InMemorySequencerModules {
LocalTaskWorkerModule: LocalTaskWorkerModule.from({
...VanillaTaskWorkerModules.withoutSettlement(),
}),
FeeStrategy: ConstantFeeStrategy,
BaseLayer: NoopBaseLayer,
BatchProducerModule,
BlockProducerModule,
BlockTrigger: ManualBlockTrigger,
TaskQueue: LocalTaskQueue,
// SettlementModule: SettlementModule,
SequencerStartupModule: SequencerStartupModule,
...additionalModules,
} satisfies InMemorySequencerModulesRecord;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/persistance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"type": "module",
"version": "0.1.1-develop.833+397881ed",
"scripts": {
"build": "npm run prisma-generate && tsc -p tsconfig.json",
"prisma-generate": "npx prisma generate",
"prisma-migrate": "npx prisma migrate deploy",
"build": "npm run prisma:generate && tsc -p tsconfig.json",
"prisma:generate": "npx prisma generate",
"prisma:migrate": "npx prisma migrate deploy",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test ./test-integration",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:integration": "npm run test:file -- ./test-integration/** --runInBand",
"test:watch": "npm run test:file -- ./test/** --watch"
Expand Down
11 changes: 1 addition & 10 deletions packages/persistance/test-integration/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,7 @@ export function createPrismaAppchain(
BlockTrigger: {},
Mempool: {},
BatchProducerModule: {},
LocalTaskWorkerModule: {
StateTransitionTask: {},
RuntimeProvingTask: {},
StateTransitionReductionTask: {},
BlockReductionTask: {},
BlockProvingTask: {},
BlockBuildingTask: {},
CircuitCompilerTask: {},
WorkerRegistrationTask: {},
},
LocalTaskWorkerModule: VanillaTaskWorkerModules.defaultConfig(),
BaseLayer: {},
BlockProducerModule: {},
TaskQueue: {
Expand Down
2 changes: 1 addition & 1 deletion packages/processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"pretest": "npm run pre",
"pre": "npm run prisma:generate",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"prisma:generate": "prisma generate --schema=./test/prisma/schema.prisma",
"test": "npm run test:file -- ./src/** ./test/**",
"test:watch": "npm run test:file -- ./src/** ./test/** --watch"
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch"
},
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/test/BlockProver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class RuntimeZkProgrammable extends ZkProgrammable<

return [
{
name: program.name,
compile: program.compile.bind(program),
verify: program.verify.bind(program),
analyzeMethods: program.analyzeMethods.bind(program),
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/appChain/TestingAppChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ export class TestingAppChain<
LocalTaskWorkerModule: VanillaTaskWorkerModules.defaultConfig(),
BaseLayer: {},
BlockProducerModule: {},
SequencerStartupModule: {},
TaskQueue: {
simulatedDuration: 0,
},
FeeStrategy: {},
},
Signer: {
signer: PrivateKey.random(),
Expand Down
4 changes: 2 additions & 2 deletions packages/sequencer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"lint": "eslint ./src ./test",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads ../../node_modules/jest/bin/jest.js",
"test:file": "node --experimental-vm-modules --experimental-wasm-modules ../../node_modules/jest/bin/jest.js",
"test": "npm run test:file -- ./test/**",
"test:watch": "npm run test:file -- ./test/** --watch",
"integration": "npm run test:file -- ./test-integration/** --runInBand",
"start": "npm run build && node --experimental-vm-modules --experimental-wasm-modules --experimental-wasm-threads --es-module-specifier-resolution=node ./dist/src/entry.js"
"start": "npm run build && node --experimental-vm-modules --experimental-wasm-modules --es-module-specifier-resolution=node ./dist/src/entry.js"
},
"main": "dist/index.js",
"publishConfig": {
Expand Down
Loading