From 234d4a2e7cd1128c558a5bd0ccf06e158ec090f7 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Mon, 9 Feb 2026 13:16:21 +0000 Subject: [PATCH 01/18] Small changes --- README.md | 82 ++++++++----------- package.json | 4 +- .../src/core/environments/development/.env | 2 +- .../environments/development/worker.config.ts | 2 +- .../chain/src/core/environments/inmemory/.env | 4 +- .../environments/inmemory/chain.config.ts | 4 +- pnpm-lock.yaml | 6 +- 7 files changed, 46 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index e62cfce..4f3c9fb 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,10 @@ You can learn more about the Protokit framework at the [official documentation]( - pnpm `v9.8.0` - nvm - (optional) For running with persistance / deploying on a server - - docker `>= 24.0` - - docker-compose `>= 2.22.0` + - docker `>= 24.0` + - docker-compose `>= 2.22.0` **Run the following commands to get started:** - ```zsh # clone the repository git clone https://github.com/proto-kit/starter-kit my-chain @@ -30,13 +29,11 @@ pnpm env:development prisma:generate # starts both the UI and the sequencer (file watcher / live reload enabled) pnpm env:inmemory dev ``` - Visit http://localhost:3000 to view the example UI, or http://localhost:8080/graphql to explore the sequencer's GraphQL APIs. ### Structural overview The starter kit contains the following files and folders: - ``` ├── apps │ └── web // example UI that connects to the app-chain's sequencer @@ -44,7 +41,7 @@ The starter kit contains the following files and folders: │ ├── containers // smart components ("containers") │ └── lib │ └── stores // data stores for interacting with the app-chain's sequencer -│ +│ ├── docker │ └── data // mounted as a volume for the docker containers │ @@ -56,7 +53,7 @@ The starter kit contains the following files and folders: │ │ └── processor // processor configuration (handlers, graphql resolvers, graphql server, ...) │ ├── protocol // protocol modules (transaction fees, ...) │ └── runtime // runtime modules (your app-chain's business logic) - │ └── modules + │ └── modules │ ├── balances.ts // built-in example runtime module for Balances, with a faucet │ └── withdrawals.ts // withdrawal functionality module └── test // tests for various app-chain components @@ -72,9 +69,8 @@ The starter-kit offers different environments to run you appchain. You can use those environments to configure the mode of operation for your appchain depending on which stage of development you are in. The starter kit comes with a set of pre-configured environments: - - `inmemory`: Runs everything in-memory without persisting the data. Useful for early stages of runtime development. -- `development`: Runs the sequencer locally and persists all state in databases running in docker. +- `development`: Runs the sequencer locally and persists all state in databases running in docker. - `sovereign`: Runs your appchain fully in docker (including the UI) for testnet deployments without settlement or bridging. Every command you execute should follow this pattern: @@ -117,7 +113,7 @@ pnpm env:development prisma:migrate #### Pruning data -Persisted data is stored under `docker/data`, you can delete this folder in case you're experiencing issues with persistence and need to reset your environment setup entirely. +Persisted data is stored under `docker/data`, you can delete this folder in case you're experiencing issues with persistence and need to reset your environment setup entirely. However to prune data during development, you should use the `--pruneOnStartup` CLI option [documented here](#cli-options) @@ -127,7 +123,7 @@ Ensure you've successfully started the dockerized dependencies, generated and mi #### With live reload -> ⚠️ Be aware, the dev command will automatically restart your application when your sources change. +> ⚠️ Be aware, the dev command will automatically restart your application when your sources change. > Please keep in mind that running the components below in `dev` mode (with live reload / watchersr) is advisable only when you're working on that specific component. In case you're experiencing issues with watches cross-triggering reload of different components, you can use the `start` command instead. ```zsh @@ -145,7 +141,6 @@ pnpm env:development sequencer:start --filter=chain Protokit has the ability to report metrics, logs and traces to a Grafana instance for visualisation. These can be configured by the following environment variables - ```zsh OPEN_TELEMETRY_TRACING_URL= OPEN_TELEMETRY_TRACING_ENABLED= @@ -153,8 +148,7 @@ OPEN_TELEMETRY_TRACING_ENABLED= OPEN_TELEMETRY_METRICS_URL= OPEN_TELEMETRY_METRICS_ENABLED= OPEN_TELEMETRY_METRICS_SCRAPING_FREQUENCY= -``` - +```` Note that the functionality is not configured for the `in-memory` mode. ### Running the UI @@ -165,6 +159,7 @@ pnpm env:development dev --filter=web > You can also build/start the UI as well, instead of using `dev` command with live-reload. + ### Running the indexer ⚠️ Indexer only runs with docker-enabled environments, therefore it is not available with the `inmemory` environment @@ -221,46 +216,38 @@ You can define which resolvers are available in `chain/src/processor/api/resolve At this point in time, the starter-kit offers settlement & bridging integration with lightnet (local mina network). You can enable these features by setting the `PROTOKIT_SETTLEMENT_ENABLED` environment variable to `true` in development .env file. Follow these steps to get the sequencer to settle & bridge: - - Initialize the lightnet process, fund the sequencer operator & deploy settlement+bridging contracts: - - ``` - pnpm env:development lightnet:start -d - pnpm protokit lightnet initialize --env development - ``` + ``` + pnpm env:development lightnet:start -d + pnpm protokit lightnet initialize + ``` - Run a worker, alongside with the sequencer in separate shell instances - - ``` - pnpm env:development worker:dev - pnpm env:development sequencer:dev - ``` + ``` + pnpm env:development worker:dev + pnpm env:development sequencer:dev + ``` - Fund a testing account on lightnet (defined in the .env file) - - ``` - pnpm protokit lightnet faucet B62qkVfEwyfkm5yucHEqrRjxbyx98pgdWz82pHv7LYq9Qigs812iWZ8 --env development - ``` + ``` + pnpm lightnet faucet B62qkVfEwyfkm5yucHEqrRjxbyx98pgdWz82pHv7LYq9Qigs812iWZ8 + ``` - Bridge the L1 $MINA to your app-chain, and observe your app-chain $MINA balance change after the next settlement lifecycle has been completed by the sequencer - > Token ID of MINA is `1` on both the L1 and app-chain - - ``` - pnpm protokit bridge deposit 1 TEST_ACCOUNT_1_PRIVATE_KEY TEST_ACCOUNT_1_PUBLIC_KEY 100 --env development - ``` + > Token ID of MINA is `1` on both the L1 and app-chain + ``` + pnpm protokit bridge deposit 1 TEST_ACCOUNT_1_PRIVATE_KEY TEST_ACCOUNT_1_PUBLIC_KEY 100 + ``` - Withdraw your app-chain $MINA tokens back to the L1 - - ``` - pnpm protokit bridge withdraw 1 TEST_ACCOUNT_1_PRIVATE_KEY 100 --env development - ``` - -For more detailed information about the protokit CLI commands used in this section, refer to the [Protokit CLI documentation](http://github.com/proto-kit/framework/tree/develop/packages/cli#proto-kit-cli). + ``` + pnpm protokit bridge withdraw 1 TEST_ACCOUNT_1_PRIVATE_KEY 100 + ``` ## Deployments (sovereign environment) -When deploying to a server, you should push your code along with your forked starter-kit to some repository, +When deploying to a server, you should push your code along with your forked starter-kit to some repository, then clone it on your remote server and execute it. > Don't forget to run `pnpm env:sovereign docker:build` to build the required images. @@ -275,7 +262,6 @@ UI will be accessible at `https://localhost` and GQL inspector will be available ### Configuration Go to `docker/proxy/Caddyfile` and replace the `*` matcher with your domain. - ``` yourdomain.com { ... @@ -295,8 +281,7 @@ The caddy reverse-proxy automatically uses https for all connections, use this g ### Monitoring -Protokit offers monitoring via three different kinds of data and a collection of preconfigured services: - +Protokit offers monitoring via three different kinds of data and a collection of preconfigured services: - Logs via Promtail and Loki - Metrics via OpenTelemetry and Prometheus - Traces via OpenTelemetry, OTel Collector and Tempo @@ -307,11 +292,10 @@ Protokit offers monitoring via three different kinds of data and a collection of In Development mode, monitoring is disabled by default. To enabled, edit the `development/.env` file in the following way: - 1. Add the monitoring profile to `COMPOSE_PROFILES` -2. Uncomment `...DefaultModules.metrics()` in the sequencer's module definition. - Important: This has to be in front of all other modules (i.e. has to be first in the modules record) -3. Uncomment `...DefaultConfigs.metrics()` in the configuration call. +2. Uncomment `...metricsSequencerModules` in the sequencer's module definition. +Important: This has to be in front of all other modules (i.e. has to be first in the modules record) +3. Uncomment `...metricsSequencerModulesConfig` in the configuration call. Then, run `pnpm env:development docker:up` like usual. This should start all the services needed for monitoring. Grafana is available at `localhost:3000`. @@ -332,6 +316,6 @@ More information about monitoring can be found [here](https://github.com/proto-k 1. Make sure the framework is located under ../framework from the starter-kit's location 2. Adapt your starter-kit's `packages/chain` and `apps/web` package.json to use the file:// references to framework, including - references to `o1js` and `tsyringe`. Important: Make sure to update references in both chain and web, otherwise the location of the node_modules will be different and lead to errors +references to `o1js` and `tsyringe`. Important: Make sure to update references in both chain and web, otherwise the location of the node_modules will be different and lead to errors 3. Go into the framework folder, and build a docker image containing the sources with `docker build -f ./packages/deployment/docker/development-base/Dockerfile -t protokit-base .` 4. Replace the first line of `docker/base/Dockerfile` and `docker/web/Dockerfile` to use `FROM protokit-base:latest` diff --git a/package.json b/package.json index 0953158..bff5536 100644 --- a/package.json +++ b/package.json @@ -41,12 +41,12 @@ "turbo": "^2.1.2" }, "dependencies": { + "@proto-kit/cli": "../framework/packages/cli", "@types/graphql-fields": "^1.3.9", "chain": "^0.4.0", "dotenv-cli": "^7.4.2", "tslib": "^2.7.0", - "type-graphql": "2.0.0-rc.2", - "@proto-kit/cli": "../framework/packages/cli" + "type-graphql": "2.0.0-rc.2" }, "packageManager": "pnpm@9.8.0+sha256.56a9e76b51796ca7f73b85e44cf83712862091f4d498c0ce4d5b7ecdc6ba18f7", "name": "starter-kit" diff --git a/packages/chain/src/core/environments/development/.env b/packages/chain/src/core/environments/development/.env index a4ff88a..fe4fc1d 100644 --- a/packages/chain/src/core/environments/development/.env +++ b/packages/chain/src/core/environments/development/.env @@ -104,4 +104,4 @@ OPEN_TELEMETRY_METRICS_HOST=0.0.0.0 OPEN_TELEMETRY_METRICS_SCRAPING_FREQUENCY=10 GF_SECURITY_ADMIN_USER=admin -GF_SECURITY_ADMIN_PASSWORD=grafana \ No newline at end of file +GF_SECURITY_ADMIN_PASSWORD=grafana diff --git a/packages/chain/src/core/environments/development/worker.config.ts b/packages/chain/src/core/environments/development/worker.config.ts index e894ceb..c1924f2 100644 --- a/packages/chain/src/core/environments/development/worker.config.ts +++ b/packages/chain/src/core/environments/development/worker.config.ts @@ -22,7 +22,7 @@ const appChain = AppChain.from({ ...(settlementEnabled ? protocol.settlementModules : {}), }), Sequencer: Sequencer.from({ - ...DefaultModules.worker(), + ...DefaultModules.remoteWorker(), ...(!settlementEnabled ? { LocalTaskWorkerModule: LocalTaskWorkerModule.from( diff --git a/packages/chain/src/core/environments/inmemory/.env b/packages/chain/src/core/environments/inmemory/.env index ef9ed19..b7c1f14 100644 --- a/packages/chain/src/core/environments/inmemory/.env +++ b/packages/chain/src/core/environments/inmemory/.env @@ -5,9 +5,11 @@ PROTOKIT_GRAPHQL_HOST=localhost PROTOKIT_GRAPHQL_PORT=8080 PROTOKIT_GRAPHIQL_ENABLED=true +PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY=B62qk4sNnzZqqjHp8YQXZUV3dBpnjiNieJVnsuh7mD2bMJ9PdbskH5H + # expose graphql configuration to the client app-chain NEXT_PUBLIC_PROTOKIT_GRAPHQL_URL=http://localhost:8080/graphql FORCE_COLOR=3 TS_NODE_TRANSPILE_ONLY=true -PROTOKIT_ENV_FOLDER=inmemory \ No newline at end of file +PROTOKIT_ENV_FOLDER=inmemory diff --git a/packages/chain/src/core/environments/inmemory/chain.config.ts b/packages/chain/src/core/environments/inmemory/chain.config.ts index afe8bc7..66cdda2 100644 --- a/packages/chain/src/core/environments/inmemory/chain.config.ts +++ b/packages/chain/src/core/environments/inmemory/chain.config.ts @@ -17,7 +17,7 @@ const appChain = AppChain.from({ ...DefaultModules.core({ settlementEnabled, }), - ...DefaultModules.localTaskQueue(), + ...DefaultModules.localWorker({ settlementEnabled }), }), ...DefaultModules.appChainBase(), }); @@ -30,7 +30,7 @@ export default async (): Promise => { settlementEnabled, }), ...DefaultConfigs.inMemoryDatabase(), - ...DefaultConfigs.localTaskQueue(), + ...DefaultConfigs.localWorker(), }, ...DefaultConfigs.appChainBase(), }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7eb2f44..ce7dfb3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2398,15 +2398,16 @@ packages: glob@10.4.5: resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me hasBin: true glob@7.1.7: resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me globals@13.24.0: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} @@ -3094,6 +3095,7 @@ packages: next@14.0.1: resolution: {integrity: sha512-s4YaLpE4b0gmb3ggtmpmV+wt+lPRuGtANzojMQ2+gmBpgX9w5fTbjsy6dXByBuENsdCX5pukZH/GxdFgO62+pA==} engines: {node: '>=18.17.0'} + deprecated: This version has a security vulnerability. Please upgrade to a patched version. See https://nextjs.org/blog/security-update-2025-12-11 for more details. hasBin: true peerDependencies: '@opentelemetry/api': ^1.1.0 From a30027326ce4f582cd27ac95cb3bbeaf1423b229 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Tue, 10 Feb 2026 13:11:28 +0000 Subject: [PATCH 02/18] Few docker changes --- docker/base/Dockerfile | 6 +++--- docker/worker/docker-compose.yml | 3 ++- .../chain/src/core/environments/development/.env | 5 +++-- packages/chain/src/core/environments/sovereign/.env | 13 +++++++------ 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 77d2d0e..c85b61c 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -1,8 +1,8 @@ # For regular deployment -# FROM node:18 +# FROM node:22 # For locally built and imported framework references -# Make sure you build the base-image first +# Make sure you build the base image first FROM protokit-base:latest WORKDIR /app @@ -37,4 +37,4 @@ RUN dos2unix ./entry.sh RUN chmod +x ./entry.sh # Migrate + execute -ENTRYPOINT ["./entry.sh"] \ No newline at end of file +ENTRYPOINT ["./entry.sh"] diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index 482f4fe..c10d522 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -10,7 +10,6 @@ services: - REDIS_PORT=${REDIS_PORT} - REDIS_PASSWORD=${REDIS_PASSWORD} - - PROTOKIT_TRANSACTION_FEE_RECIPIENT_PRIVATE_KEY=${PROTOKIT_TRANSACTION_FEE_RECIPIENT_PRIVATE_KEY} - PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY=${PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY} - PROTOKIT_LOG_LEVEL=${PROTOKIT_LOG_LEVEL} @@ -31,5 +30,7 @@ services: condition: service_healthy networks: - db-net + volumes: + - ./o1js-cache:/home/node/.cache/o1js command: ["./packages/chain/dist/start.js start ./environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] diff --git a/packages/chain/src/core/environments/development/.env b/packages/chain/src/core/environments/development/.env index fe4fc1d..c2034bd 100644 --- a/packages/chain/src/core/environments/development/.env +++ b/packages/chain/src/core/environments/development/.env @@ -1,6 +1,6 @@ COMPOSE_PROFILES=db,indexer-db,processor-db ; monitoring -COMPOSE_PROJECT_NAME=starter-kit +COMPOSE_PROJECT_NAME=starterkit POSTGRES_PASSWORD=password POSTGRES_USER=admin @@ -13,7 +13,7 @@ REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD=password -PROTOKIT_PROOFS_ENABLED=false +PROTOKIT_PROOFS_ENABLED=true PROTOKIT_SHOULD_ATTEMPT_DB_MIGRATION=true PROTOKIT_PRUNE_ON_STARTUP=false @@ -85,6 +85,7 @@ PROTOKIT_CUSTOM_TOKEN_ADMIN_PRIVATE_KEY=EKENQ2QRc4gAJkZjQXU86ZS9MDm1e7HFiNN6LgRJ PROTOKIT_CUSTOM_TOKEN_BRIDGE_PRIVATE_KEY=EKENQ2QRc4gAJkZjQXU86ZS9MDm1e7HFiNN6LgRJnniHJt1WXDn1 # lightnet only +MINA_NETWORK=lightnet MINA_ACCOUNT_MANAGER_HOST=http://localhost MINA_ACCOUNT_MANAGER_PORT=8084 MINA_EXPLORER_PORT=3001 diff --git a/packages/chain/src/core/environments/sovereign/.env b/packages/chain/src/core/environments/sovereign/.env index 41fec50..a13186a 100644 --- a/packages/chain/src/core/environments/sovereign/.env +++ b/packages/chain/src/core/environments/sovereign/.env @@ -1,6 +1,7 @@ -COMPOSE_PROFILES=db,indexer-db,monolithic-sequencer,monolithic-indexer,proxy,web,processor-db,monolithic-processor,worker,monitoring +# COMPOSE_PROFILES=db,indexer-db,monolithic-sequencer,monolithic-indexer,proxy,web,processor-db,monolithic-processor,worker,monitoring +COMPOSE_PROFILES=db,monolithic-sequencer,proxy,web,worker -COMPOSE_PROJECT_NAME=starter-kit +COMPOSE_PROJECT_NAME=starterkit POSTGRES_PASSWORD=password POSTGRES_USER=admin @@ -18,8 +19,8 @@ PROTOKIT_PRUNE_ON_STARTUP=false PROTOKIT_LOG_LEVEL=INFO PROTOKIT_BLOCK_INTERVAL=10000 PROTOKIT_SETTLEMENT_INTERVAL=30000 -PROTOKIT_SETTLEMENT_ENABLED=true +PROTOKIT_SETTLEMENT_ENABLED=false PROTOKIT_GRAPHQL_HOST=0.0.0.0 PROTOKIT_GRAPHQL_PORT=8080 @@ -35,7 +36,7 @@ INDEXER_POSTGRES_DB=protokit-indexer INDEXER_POSTGRES_HOST=indexer-postgres INDEXER_POSTGRES_PORT=5432 INDEXER_DATABASE_URL=postgresql://$INDEXER_POSTGRES_USER:$INDEXER_POSTGRES_PASSWORD@$INDEXER_POSTGRES_HOST:$INDEXER_POSTGRES_PORT/$INDEXER_POSTGRES_DB?schema=public -PROTOKIT_SHOULD_ATTEMPT_INDEXER_DB_MIGRATION=true +PROTOKIT_SHOULD_ATTEMPT_INDEXER_DB_MIGRATION=false PROTOKIT_INDEXER_GRAPHQL_HOST=0.0.0.0 PROTOKIT_INDEXER_GRAPHQL_PORT=8081 @@ -48,7 +49,7 @@ PROCESSOR_POSTGRES_DB=protokit-processor PROCESSOR_POSTGRES_HOST=processor-postgres PROCESSOR_POSTGRES_PORT=5432 PROCESSOR_DATABASE_URL=postgresql://$PROCESSOR_POSTGRES_USER:$PROCESSOR_POSTGRES_PASSWORD@$PROCESSOR_POSTGRES_HOST:$PROCESSOR_POSTGRES_PORT/$PROCESSOR_POSTGRES_DB?schema=public -PROTOKIT_SHOULD_ATTEMPT_PROCESSOR_DB_MIGRATION=true +PROTOKIT_SHOULD_ATTEMPT_PROCESSOR_DB_MIGRATION=false PROTOKIT_PROCESSOR_GRAPHQL_HOST=0.0.0.0 PROTOKIT_PROCESSOR_GRAPHQL_PORT=8082 @@ -101,4 +102,4 @@ OPEN_TELEMETRY_METRICS_HOST=0.0.0.0 OPEN_TELEMETRY_METRICS_SCRAPING_FREQUENCY=10 GF_SECURITY_ADMIN_USER=admin -GF_SECURITY_ADMIN_PASSWORD=grafana \ No newline at end of file +GF_SECURITY_ADMIN_PASSWORD=grafana From 5b84ed94a47801b6378fc8b1b5954734a4ee46df Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Tue, 10 Feb 2026 13:17:32 +0000 Subject: [PATCH 03/18] Fixed sovereign config --- .../src/core/environments/sovereign/worker.config.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/chain/src/core/environments/sovereign/worker.config.ts b/packages/chain/src/core/environments/sovereign/worker.config.ts index 8bfa2e1..99992ca 100644 --- a/packages/chain/src/core/environments/sovereign/worker.config.ts +++ b/packages/chain/src/core/environments/sovereign/worker.config.ts @@ -22,14 +22,7 @@ const appChain = AppChain.from({ ...(settlementEnabled ? protocol.settlementModules : {}), }), Sequencer: Sequencer.from({ - ...DefaultModules.worker(), - ...(!settlementEnabled - ? { - LocalTaskWorkerModule: LocalTaskWorkerModule.from( - VanillaTaskWorkerModules.withoutSettlement() - ), - } - : {}), + ...DefaultModules.remoteWorker(), }), }); From 2c338cf49f1ab5b2339824437d15df567d64cd5a Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Tue, 10 Feb 2026 13:33:20 +0000 Subject: [PATCH 04/18] Added core path to compose commands --- docker/indexer/docker-compose.yml | 2 +- docker/processor/docker-compose.yml | 4 ++-- docker/sequencer/docker-compose.yml | 4 ++-- docker/worker/docker-compose.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/indexer/docker-compose.yml b/docker/indexer/docker-compose.yml index c8dacf1..12f3e35 100644 --- a/docker/indexer/docker-compose.yml +++ b/docker/indexer/docker-compose.yml @@ -41,7 +41,7 @@ services: - 8081:8080 command: [ - "./packages/chain/dist/start.js start ./environments/${PROTOKIT_ENV_FOLDER}/indexer.config.js", + "./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/indexer.config.js", ] labels: logging: "promtail" diff --git a/docker/processor/docker-compose.yml b/docker/processor/docker-compose.yml index 820205a..fcaddef 100644 --- a/docker/processor/docker-compose.yml +++ b/docker/processor/docker-compose.yml @@ -29,10 +29,10 @@ services: ports: - 8082:8080 working_dir: /app - command: ["./packages/chain/dist/start.js start ./environments/${PROTOKIT_ENV_FOLDER}/processor.config.js",] + command: ["./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/processor.config.js",] labels: logging: "promtail" logging_jobname: "processor" networks: - processor-net: \ No newline at end of file + processor-net: diff --git a/docker/sequencer/docker-compose.yml b/docker/sequencer/docker-compose.yml index 865adcf..eb03737 100644 --- a/docker/sequencer/docker-compose.yml +++ b/docker/sequencer/docker-compose.yml @@ -61,10 +61,10 @@ services: - lightnet-net ports: - 8080:8080 - command: ["./packages/chain/dist/start.js start ./environments/${PROTOKIT_ENV_FOLDER}/chain.config.js"] + command: ["./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/chain.config.js"] labels: logging: "promtail" logging_jobname: "sequencer" networks: - chain-net: \ No newline at end of file + chain-net: diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index c10d522..699dff5 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -32,5 +32,5 @@ services: - db-net volumes: - ./o1js-cache:/home/node/.cache/o1js - command: ["./packages/chain/dist/start.js start ./environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] + command: ["./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] From 567f8cfff416f373f7d01709caeeb5e2f65a55a6 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Tue, 10 Feb 2026 13:40:52 +0000 Subject: [PATCH 05/18] Removed duplicate settlement env var --- package.json | 1 + packages/chain/src/core/environments/sovereign/.env | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index bff5536..fdf14a9 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "docker:build": "docker compose -f docker/docker-compose.yml build", "docker:up": "docker compose -f docker/docker-compose.yml up", "docker:down": "docker compose -f docker/docker-compose.yml down", + "docker": "docker", "env:development": "dotenv -e ./packages/chain/src/core/environments/development/.env -- pnpm", "env:inmemory": "dotenv -e ./packages/chain/src/core/environments/inmemory/.env -- pnpm", "env:sovereign": "dotenv -e ./packages/chain/src/core/environments/sovereign/.env -- pnpm", diff --git a/packages/chain/src/core/environments/sovereign/.env b/packages/chain/src/core/environments/sovereign/.env index a13186a..6e225d1 100644 --- a/packages/chain/src/core/environments/sovereign/.env +++ b/packages/chain/src/core/environments/sovereign/.env @@ -72,8 +72,6 @@ MINA_ARCHIVE_GRAPHQL_PORT=8282 PROTOKIT_TRANSACTION_FEE_RECIPIENT_PRIVATE_KEY=EKEssvj33MMBCg2tcybTzL32nTKbbwFHm6yUxd3JassdhL3J5aT8 PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY=B62qk4sNnzZqqjHp8YQXZUV3dBpnjiNieJVnsuh7mD2bMJ9PdbskH5H -PROTOKIT_SETTLEMENT_ENABLED=true - PROTOKIT_SEQUENCER_PRIVATE_KEY=EKEdKhgUHMuDvwWJEg2TdCMCeiTSd9hh2HrEr6uYJfPVuwur1s43 PROTOKIT_SEQUENCER_PUBLIC_KEY=B62qizW6aroTxQorJz4ywVNZom4jA6W4QPPCK3wLeyhnJHtVStUNniL PROTOKIT_SETTLEMENT_CONTRACT_PRIVATE_KEY=EKErS9gYHZNawqKuwfMiwYYJtNptCrvca491QEvB3tz8sFsS5w66 From 8cb1958a32c068065893dc68865662391e4e42d9 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Tue, 10 Feb 2026 18:11:25 +0000 Subject: [PATCH 06/18] Fixed deployment with extra scripts.env --- .../src/core/environments/sovereign/.env | 4 +- .../core/environments/sovereign/scripts.env | 37 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 packages/chain/src/core/environments/sovereign/scripts.env diff --git a/packages/chain/src/core/environments/sovereign/.env b/packages/chain/src/core/environments/sovereign/.env index 6e225d1..794391a 100644 --- a/packages/chain/src/core/environments/sovereign/.env +++ b/packages/chain/src/core/environments/sovereign/.env @@ -20,6 +20,8 @@ PROTOKIT_LOG_LEVEL=INFO PROTOKIT_BLOCK_INTERVAL=10000 PROTOKIT_SETTLEMENT_INTERVAL=30000 +PROTOKIT_PROOFS_ENABLED=false + PROTOKIT_SETTLEMENT_ENABLED=false PROTOKIT_GRAPHQL_HOST=0.0.0.0 @@ -83,7 +85,7 @@ PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY=B62qn8XRkWcaBvv6F7kvarKs4cViaKRMbTUHT8F # lightnet only MINA_ACCOUNT_MANAGER_HOST=http://lightnet -MINA_ACCOUNT_MANAGER_PORT=8084 +MINA_ACCOUNT_MANAGER_PORT=8181 MINA_EXPLORER_PORT=3001 TEST_ACCOUNT_1_PRIVATE_KEY=EKF5p3wQTFd4tRBiGicRf93yXK82bcRryokC1qoazRM6wq6gMzWJ diff --git a/packages/chain/src/core/environments/sovereign/scripts.env b/packages/chain/src/core/environments/sovereign/scripts.env new file mode 100644 index 0000000..858ede8 --- /dev/null +++ b/packages/chain/src/core/environments/sovereign/scripts.env @@ -0,0 +1,37 @@ +PROTOKIT_PRUNE_ON_STARTUP=false +PROTOKIT_LOG_LEVEL=INFO + +PROTOKIT_PROOFS_ENABLED=false + +PROTOKIT_SETTLEMENT_ENABLED=true + +FORCE_COLOR=3 +TS_NODE_TRANSPILE_ONLY=true +PROTOKIT_ENV_FOLDER=sovereign + +# mina endpoints +MINA_NETWORK=lightnet +MINA_NODE_GRAPHQL_HOST=http://localhost +MINA_NODE_GRAPHQL_PORT=8083 +MINA_ARCHIVE_GRAPHQL_HOST=http://localhost +MINA_ARCHIVE_GRAPHQL_PORT=8085 + +PROTOKIT_TRANSACTION_FEE_RECIPIENT_PRIVATE_KEY=EKEssvj33MMBCg2tcybTzL32nTKbbwFHm6yUxd3JassdhL3J5aT8 +PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY=B62qk4sNnzZqqjHp8YQXZUV3dBpnjiNieJVnsuh7mD2bMJ9PdbskH5H + +PROTOKIT_SEQUENCER_PRIVATE_KEY=EKEdKhgUHMuDvwWJEg2TdCMCeiTSd9hh2HrEr6uYJfPVuwur1s43 +PROTOKIT_SEQUENCER_PUBLIC_KEY=B62qizW6aroTxQorJz4ywVNZom4jA6W4QPPCK3wLeyhnJHtVStUNniL +PROTOKIT_SETTLEMENT_CONTRACT_PRIVATE_KEY=EKErS9gYHZNawqKuwfMiwYYJtNptCrvca491QEvB3tz8sFsS5w66 +PROTOKIT_SETTLEMENT_CONTRACT_PUBLIC_KEY=B62qjKhzrvDgTPXCp34ozmpFSx4sC9owZe6eDzhdGPdoiUbGPmBkHTt +PROTOKIT_DISPATCHER_CONTRACT_PRIVATE_KEY=EKF9Ei5G9PeB5ULMh9R6P5LfWX2gs15XxPNsect1pbcbMY9vs6v7 +PROTOKIT_DISPATCHER_CONTRACT_PUBLIC_KEY=B62qmAzUJ1jqcsEf2V3K1k2Ec4MLsEKnodEvvJ5uweTFSLYEUALe1zs +PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY=EKFKTGqWU2egLKhMgoxX8mQ21zXSE1RZYkY82mmK9F3BxdSA7E5M +PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY=B62qn8XRkWcaBvv6F7kvarKs4cViaKRMbTUHT8FrDXLnvxuV6n7CHsN + +# lightnet only +MINA_ACCOUNT_MANAGER_HOST=http://localhost +MINA_ACCOUNT_MANAGER_PORT=8084 +MINA_EXPLORER_PORT=3001 + +TEST_ACCOUNT_1_PRIVATE_KEY=EKF5p3wQTFd4tRBiGicRf93yXK82bcRryokC1qoazRM6wq6gMzWJ +TEST_ACCOUNT_1_PUBLIC_KEY=B62qkVfEwyfkm5yucHEqrRjxbyx98pgdWz82pHv7LYq9Qigs812iWZ8 From 823942b25a30ad4ab2bff1c9c536f36cf024fbf2 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Tue, 10 Feb 2026 23:10:09 +0000 Subject: [PATCH 07/18] Made it work with containers --- docker/base/entry.sh | 10 +- docker/indexer/docker-compose.yml | 2 +- docker/processor/docker-compose.yml | 2 +- docker/sequencer/docker-compose.yml | 2 +- docker/worker/docker-compose.yml | 3 +- package.json | 4 +- packages/chain/package.json | 3 +- .../src/core/environments/sovereign/.env | 9 +- .../environments/sovereign/chain.config.ts | 11 +- packages/chain/tsconfig.json | 3 +- pnpm-lock.yaml | 160 ++++++++++++++++-- 11 files changed, 177 insertions(+), 32 deletions(-) diff --git a/docker/base/entry.sh b/docker/base/entry.sh index 9134078..06c05b6 100644 --- a/docker/base/entry.sh +++ b/docker/base/entry.sh @@ -3,26 +3,28 @@ if [[ ${PROTOKIT_SHOULD_ATTEMPT_DB_MIGRATION} ]]; then echo "Migrating on ${DATABASE_URL}" cd packages/chain/node_modules/@proto-kit/persistance - pnpm dlx prisma migrate deploy + pnpx prisma@5.18.0 migrate deploy cd ../../../../.. fi if [[ ${PROTOKIT_SHOULD_ATTEMPT_INDEXER_DB_MIGRATION} ]]; then echo "Migrating on ${INDEXER_DATABASE_URL}" cd packages/chain/node_modules/@proto-kit/indexer - pnpm dlx prisma migrate deploy + pnpx prisma@5.18.0 migrate deploy cd ../../../../.. fi if [[ ${PROTOKIT_SHOULD_ATTEMPT_PROCESSOR_DB_MIGRATION} ]]; then echo "Migrating on ${PROCESSOR_DATABASE_URL}" cd packages/chain/src/processor - pnpm dlx prisma migrate deploy + pnpx prisma@5.18.0 migrate deploy cd ../../../../.. fi cd /app +cd packages/chain echo $@ + # We can't use start:headless here bcs that task hardcodes the .js file, we want it to be extensible -node --experimental-vm-modules --experimental-wasm-modules --es-module-specifier-resolution=node $@ \ No newline at end of file +node --loader ts-node/esm --experimental-vm-modules --experimental-wasm-modules --es-module-specifier-resolution=node $@ diff --git a/docker/indexer/docker-compose.yml b/docker/indexer/docker-compose.yml index 12f3e35..c6965f8 100644 --- a/docker/indexer/docker-compose.yml +++ b/docker/indexer/docker-compose.yml @@ -41,7 +41,7 @@ services: - 8081:8080 command: [ - "./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/indexer.config.js", + "./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/indexer.config.js", ] labels: logging: "promtail" diff --git a/docker/processor/docker-compose.yml b/docker/processor/docker-compose.yml index fcaddef..1c4ca03 100644 --- a/docker/processor/docker-compose.yml +++ b/docker/processor/docker-compose.yml @@ -29,7 +29,7 @@ services: ports: - 8082:8080 working_dir: /app - command: ["./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/processor.config.js",] + command: ["./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/processor.config.js",] labels: logging: "promtail" logging_jobname: "processor" diff --git a/docker/sequencer/docker-compose.yml b/docker/sequencer/docker-compose.yml index eb03737..8f48d68 100644 --- a/docker/sequencer/docker-compose.yml +++ b/docker/sequencer/docker-compose.yml @@ -61,7 +61,7 @@ services: - lightnet-net ports: - 8080:8080 - command: ["./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/chain.config.js"] + command: ["./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/chain.config.js"] labels: logging: "promtail" logging_jobname: "sequencer" diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index 699dff5..f91f0c4 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -30,7 +30,8 @@ services: condition: service_healthy networks: - db-net + - lightnet-net volumes: - ./o1js-cache:/home/node/.cache/o1js - command: ["./packages/chain/dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] + command: ["./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] diff --git a/package.json b/package.json index fdf14a9..636c63e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "docker:build": "docker compose -f docker/docker-compose.yml build", "docker:up": "docker compose -f docker/docker-compose.yml up", "docker:down": "docker compose -f docker/docker-compose.yml down", - "docker": "docker", "env:development": "dotenv -e ./packages/chain/src/core/environments/development/.env -- pnpm", "env:inmemory": "dotenv -e ./packages/chain/src/core/environments/inmemory/.env -- pnpm", "env:sovereign": "dotenv -e ./packages/chain/src/core/environments/sovereign/.env -- pnpm", @@ -47,7 +46,8 @@ "chain": "^0.4.0", "dotenv-cli": "^7.4.2", "tslib": "^2.7.0", - "type-graphql": "2.0.0-rc.2" + "type-graphql": "2.0.0-rc.2", + "ts-node": "^10.9.2" }, "packageManager": "pnpm@9.8.0+sha256.56a9e76b51796ca7f73b85e44cf83712862091f4d498c0ce4d5b7ecdc6ba18f7", "name": "starter-kit" diff --git a/packages/chain/package.json b/packages/chain/package.json index 2dff613..1c47429 100644 --- a/packages/chain/package.json +++ b/packages/chain/package.json @@ -61,7 +61,7 @@ }, "devDependencies": { "@jest/globals": "^29.6.1", - "@prisma/client": "5.18", + "@prisma/client": "^5.18.0", "@types/jest": "^29.5.7", "@types/node": "^20.8.10", "@types/react-dom": "^18.2.7", @@ -83,7 +83,6 @@ "stream-browserify": "^3.0.0", "string_decoder": "^1.3.0", "ts-jest": "^29.1.1", - "ts-node": "^10.9.2", "tsconfig": "workspace:*", "typegraphql-prisma": "^0.28", "typescript": "5.4.5", diff --git a/packages/chain/src/core/environments/sovereign/.env b/packages/chain/src/core/environments/sovereign/.env index 794391a..131b4cd 100644 --- a/packages/chain/src/core/environments/sovereign/.env +++ b/packages/chain/src/core/environments/sovereign/.env @@ -15,14 +15,14 @@ REDIS_PORT=6379 REDIS_PASSWORD=password PROTOKIT_SHOULD_ATTEMPT_DB_MIGRATION=true -PROTOKIT_PRUNE_ON_STARTUP=false +PROTOKIT_PRUNE_ON_STARTUP=true PROTOKIT_LOG_LEVEL=INFO -PROTOKIT_BLOCK_INTERVAL=10000 -PROTOKIT_SETTLEMENT_INTERVAL=30000 +PROTOKIT_BLOCK_INTERVAL=20000 +PROTOKIT_SETTLEMENT_INTERVAL=60000 PROTOKIT_PROOFS_ENABLED=false -PROTOKIT_SETTLEMENT_ENABLED=false +PROTOKIT_SETTLEMENT_ENABLED=true PROTOKIT_GRAPHQL_HOST=0.0.0.0 PROTOKIT_GRAPHQL_PORT=8080 @@ -44,7 +44,6 @@ PROTOKIT_INDEXER_GRAPHQL_HOST=0.0.0.0 PROTOKIT_INDEXER_GRAPHQL_PORT=8081 PROTOKIT_INDEXER_GRAPHIQL_ENABLED=true - PROCESSOR_POSTGRES_PASSWORD=password PROCESSOR_POSTGRES_USER=admin PROCESSOR_POSTGRES_DB=protokit-processor diff --git a/packages/chain/src/core/environments/sovereign/chain.config.ts b/packages/chain/src/core/environments/sovereign/chain.config.ts index aa71783..d502385 100644 --- a/packages/chain/src/core/environments/sovereign/chain.config.ts +++ b/packages/chain/src/core/environments/sovereign/chain.config.ts @@ -38,11 +38,18 @@ export default async (args: Arguments): Promise => { ...DefaultConfigs.core({ settlementEnabled, preset: "sovereign" }), ...DefaultConfigs.sequencerIndexer(), //...DefaultConfigs.metrics({ preset: "sovereign" }), - ...DefaultConfigs.redisTaskQueue({ preset: "sovereign" }), + ...DefaultConfigs.redisTaskQueue({ + preset: "sovereign", + overrides: { + redisDb: 1, + }, + }), ...DefaultConfigs.prismaRedisDatabase({ preset: "sovereign", overrides: { - pruneOnStartup: args.pruneOnStartup, + pruneOnStartup: + args.pruneOnStartup || + Boolean(process.env.PROTOKIT_PRUNE_ON_STARTUP ?? "false"), }, }), }, diff --git a/packages/chain/tsconfig.json b/packages/chain/tsconfig.json index 8d4d3bd..a7cbc25 100644 --- a/packages/chain/tsconfig.json +++ b/packages/chain/tsconfig.json @@ -24,6 +24,7 @@ "exclude": ["jest.config.cjs"], "ts-node": { "experimentalResolver": true, - "esm": true + "esm": true, + "transpileOnly": true, } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ce7dfb3..289e2c9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: dotenv-cli: specifier: ^7.4.2 version: 7.4.4 + ts-node: + specifier: ^10.9.2 + version: 10.9.2(@types/node@20.19.24)(typescript@5.4.5) tslib: specifier: ^2.7.0 version: 2.8.1 @@ -255,7 +258,7 @@ importers: specifier: ^29.6.1 version: 29.7.0 '@prisma/client': - specifier: '5.18' + specifier: ^5.18.0 version: 5.18.0(prisma@5.22.0) '@types/jest': specifier: ^29.5.7 @@ -320,9 +323,6 @@ importers: ts-jest: specifier: ^29.1.1 version: 29.4.5(@babel/core@7.28.5)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.28.5))(jest-util@29.7.0)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)))(typescript@5.4.5) - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@20.19.24)(typescript@5.4.5) tsconfig: specifier: workspace:* version: link:../tsconfig @@ -346,7 +346,7 @@ importers: devDependencies: '@vercel/style-guide': specifier: ^5.0.0 - version: 5.2.0(@next/eslint-plugin-next@14.0.1)(eslint@8.57.1)(jest@29.7.0)(prettier@3.6.2)(typescript@4.9.5) + version: 5.2.0(@next/eslint-plugin-next@14.0.1)(eslint@8.57.1)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)))(prettier@3.6.2)(typescript@4.9.5) eslint-config-turbo: specifier: ^1.10.12 version: 1.13.4(eslint@8.57.1) @@ -4544,6 +4544,42 @@ snapshots: jest-util: 29.7.0 slash: 3.0.0 + '@jest/core@29.7.0(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5))': + dependencies: + '@jest/console': 29.7.0 + '@jest/reporters': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 20.19.24 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + ci-info: 3.9.0 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-changed-files: 29.7.0 + jest-config: 29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-resolve-dependencies: 29.7.0 + jest-runner: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + jest-watcher: 29.7.0 + micromatch: 4.0.8 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-ansi: 6.0.1 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + - ts-node + optional: true + '@jest/core@29.7.0(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5))': dependencies: '@jest/console': 29.7.0 @@ -5469,7 +5505,7 @@ snapshots: '@unrs/resolver-binding-win32-x64-msvc@1.11.1': optional: true - '@vercel/style-guide@5.2.0(@next/eslint-plugin-next@14.0.1)(eslint@8.57.1)(jest@29.7.0)(prettier@3.6.2)(typescript@4.9.5)': + '@vercel/style-guide@5.2.0(@next/eslint-plugin-next@14.0.1)(eslint@8.57.1)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)))(prettier@3.6.2)(typescript@4.9.5)': dependencies: '@babel/core': 7.28.5 '@babel/eslint-parser': 7.28.5(@babel/core@7.28.5)(eslint@8.57.1) @@ -5481,9 +5517,9 @@ snapshots: eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.1) eslint-plugin-eslint-comments: 3.2.0(eslint@8.57.1) eslint-plugin-import: 2.32.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) - eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0)(typescript@4.9.5) + eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)))(typescript@4.9.5) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1) - eslint-plugin-playwright: 0.16.0(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0)(typescript@4.9.5))(eslint@8.57.1) + eslint-plugin-playwright: 0.16.0(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)))(typescript@4.9.5))(eslint@8.57.1) eslint-plugin-react: 7.37.5(eslint@8.57.1) eslint-plugin-react-hooks: 4.6.2(eslint@8.57.1) eslint-plugin-testing-library: 6.5.0(eslint@8.57.1)(typescript@4.9.5) @@ -5940,6 +5976,22 @@ snapshots: safe-buffer: 5.2.1 sha.js: 2.4.12 + create-jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)): + dependencies: + '@jest/types': 29.6.3 + chalk: 4.1.2 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-config: 29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) + jest-util: 29.7.0 + prompts: 2.4.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + optional: true + create-jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)): dependencies: '@jest/types': 29.6.3 @@ -6377,13 +6429,13 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0)(typescript@4.9.5): + eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)))(typescript@4.9.5): dependencies: '@typescript-eslint/utils': 5.62.0(eslint@8.57.1)(typescript@4.9.5) eslint: 8.57.1 optionalDependencies: '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5) - jest: 29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)) + jest: 29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) transitivePeerDependencies: - supports-color - typescript @@ -6407,11 +6459,11 @@ snapshots: safe-regex-test: 1.1.0 string.prototype.includes: 2.0.1 - eslint-plugin-playwright@0.16.0(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0)(typescript@4.9.5))(eslint@8.57.1): + eslint-plugin-playwright@0.16.0(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)))(typescript@4.9.5))(eslint@8.57.1): dependencies: eslint: 8.57.1 optionalDependencies: - eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0)(typescript@4.9.5) + eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(typescript@4.9.5))(eslint@8.57.1)(jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)))(typescript@4.9.5) eslint-plugin-react-hooks@4.6.2(eslint@8.57.1): dependencies: @@ -7123,6 +7175,26 @@ snapshots: - babel-plugin-macros - supports-color + jest-cli@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)): + dependencies: + '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + chalk: 4.1.2 + create-jest: 29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) + exit: 0.1.2 + import-local: 3.2.0 + jest-config: 29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) + jest-util: 29.7.0 + jest-validate: 29.7.0 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + optional: true + jest-cli@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)): dependencies: '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)) @@ -7142,6 +7214,38 @@ snapshots: - supports-color - ts-node + jest-config@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)): + dependencies: + '@babel/core': 7.28.5 + '@jest/test-sequencer': 29.7.0 + '@jest/types': 29.6.3 + babel-jest: 29.7.0(@babel/core@7.28.5) + chalk: 4.1.2 + ci-info: 3.9.0 + deepmerge: 4.3.1 + glob: 7.2.3 + graceful-fs: 4.2.11 + jest-circus: 29.7.0 + jest-environment-node: 29.7.0 + jest-get-type: 29.6.3 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-runner: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + micromatch: 4.0.8 + parse-json: 5.2.0 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-json-comments: 3.1.1 + optionalDependencies: + '@types/node': 20.19.24 + ts-node: 10.9.2(@types/node@20.19.24)(typescript@4.9.5) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + optional: true + jest-config@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)): dependencies: '@babel/core': 7.28.5 @@ -7390,6 +7494,19 @@ snapshots: merge-stream: 2.0.0 supports-color: 8.1.1 + jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)): + dependencies: + '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) + '@jest/types': 29.6.3 + import-local: 3.2.0 + jest-cli: 29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5)) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + optional: true + jest@29.7.0(@types/node@20.19.24)(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)): dependencies: '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5)) @@ -8474,6 +8591,25 @@ snapshots: '@ts-morph/common': 0.24.0 code-block-writer: 13.0.3 + ts-node@10.9.2(@types/node@20.19.24)(typescript@4.9.5): + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.11 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 20.19.24 + acorn: 8.15.0 + acorn-walk: 8.3.4 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 4.9.5 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + optional: true + ts-node@10.9.2(@types/node@20.19.24)(typescript@5.4.5): dependencies: '@cspotcode/source-map-support': 0.8.1 From e30ea6d410a7ddc715f3e734cfef42a199149ed1 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Wed, 11 Feb 2026 12:56:46 +0000 Subject: [PATCH 08/18] Added proofs enabled to containers --- docker/sequencer/docker-compose.yml | 1 + docker/worker/docker-compose.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/docker/sequencer/docker-compose.yml b/docker/sequencer/docker-compose.yml index 8f48d68..753649f 100644 --- a/docker/sequencer/docker-compose.yml +++ b/docker/sequencer/docker-compose.yml @@ -39,6 +39,7 @@ services: - PROTOKIT_DISPATCHER_CONTRACT_PUBLIC_KEY=${PROTOKIT_DISPATCHER_CONTRACT_PUBLIC_KEY} - PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY} - PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY} + - PROTOKIT_PROOFS_ENABLED=${PROTOKIT_PROOFS_ENABLED} - OPEN_TELEMETRY_TRACING_ENABLED=${OPEN_TELEMETRY_TRACING_ENABLED} - OPEN_TELEMETRY_TRACING_URL=${OPEN_TELEMETRY_TRACING_URL} diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index f91f0c4..cc261f5 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -23,6 +23,7 @@ services: - PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY} - PROTOKIT_SETTLEMENT_INTERVAL=${PROTOKIT_SETTLEMENT_INTERVAL} - PROTOKIT_SETTLEMENT_ENABLED=${PROTOKIT_SETTLEMENT_ENABLED} + - PROTOKIT_PROOFS_ENABLED=${PROTOKIT_PROOFS_ENABLED} profiles: - worker depends_on: From 985b0a2eeabca2da2ca81c6c1eb51835081d865f Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Wed, 11 Feb 2026 15:57:20 +0000 Subject: [PATCH 09/18] Added circuit constant env vars --- docker/base/entry.sh | 2 +- docker/sequencer/docker-compose.yml | 2 ++ docker/worker/docker-compose.yml | 2 ++ packages/chain/src/core/environments/sovereign/.env | 3 +++ packages/chain/src/core/environments/sovereign/scripts.env | 3 +++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docker/base/entry.sh b/docker/base/entry.sh index 06c05b6..191261c 100644 --- a/docker/base/entry.sh +++ b/docker/base/entry.sh @@ -27,4 +27,4 @@ cd packages/chain echo $@ # We can't use start:headless here bcs that task hardcodes the .js file, we want it to be extensible -node --loader ts-node/esm --experimental-vm-modules --experimental-wasm-modules --es-module-specifier-resolution=node $@ +node --loader ts-node/esm --experimental-vm-modules --experimental-wasm-modules --es-module-specifier-resolution=node --no-warnings $@ diff --git a/docker/sequencer/docker-compose.yml b/docker/sequencer/docker-compose.yml index 753649f..bea62dc 100644 --- a/docker/sequencer/docker-compose.yml +++ b/docker/sequencer/docker-compose.yml @@ -40,6 +40,8 @@ services: - PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY} - PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY} - PROTOKIT_PROOFS_ENABLED=${PROTOKIT_PROOFS_ENABLED} + - PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=${PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE} + - PROTOKIT_STATE_TRANSITION_BATCH_SIZE=${PROTOKIT_STATE_TRANSITION_BATCH_SIZE} - OPEN_TELEMETRY_TRACING_ENABLED=${OPEN_TELEMETRY_TRACING_ENABLED} - OPEN_TELEMETRY_TRACING_URL=${OPEN_TELEMETRY_TRACING_URL} diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index cc261f5..ca74991 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -24,6 +24,8 @@ services: - PROTOKIT_SETTLEMENT_INTERVAL=${PROTOKIT_SETTLEMENT_INTERVAL} - PROTOKIT_SETTLEMENT_ENABLED=${PROTOKIT_SETTLEMENT_ENABLED} - PROTOKIT_PROOFS_ENABLED=${PROTOKIT_PROOFS_ENABLED} + - PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=${PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE} + - PROTOKIT_STATE_TRANSITION_BATCH_SIZE=${PROTOKIT_STATE_TRANSITION_BATCH_SIZE} profiles: - worker depends_on: diff --git a/packages/chain/src/core/environments/sovereign/.env b/packages/chain/src/core/environments/sovereign/.env index 131b4cd..4712a80 100644 --- a/packages/chain/src/core/environments/sovereign/.env +++ b/packages/chain/src/core/environments/sovereign/.env @@ -24,6 +24,9 @@ PROTOKIT_PROOFS_ENABLED=false PROTOKIT_SETTLEMENT_ENABLED=true +PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=40 +PROTOKIT_STATE_TRANSITION_BATCH_SIZE=25 + PROTOKIT_GRAPHQL_HOST=0.0.0.0 PROTOKIT_GRAPHQL_PORT=8080 PROTOKIT_GRAPHIQL_ENABLED=true diff --git a/packages/chain/src/core/environments/sovereign/scripts.env b/packages/chain/src/core/environments/sovereign/scripts.env index 858ede8..3d4c45e 100644 --- a/packages/chain/src/core/environments/sovereign/scripts.env +++ b/packages/chain/src/core/environments/sovereign/scripts.env @@ -5,6 +5,9 @@ PROTOKIT_PROOFS_ENABLED=false PROTOKIT_SETTLEMENT_ENABLED=true +PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=40 +PROTOKIT_STATE_TRANSITION_BATCH_SIZE=25 + FORCE_COLOR=3 TS_NODE_TRANSPILE_ONLY=true PROTOKIT_ENV_FOLDER=sovereign From d0a34b2db64eaf3fe38d12710de336d7866c2395 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Wed, 11 Feb 2026 16:36:04 +0000 Subject: [PATCH 10/18] Correct o1js cache mapping --- docker/worker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index ca74991..93d1610 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -35,6 +35,6 @@ services: - db-net - lightnet-net volumes: - - ./o1js-cache:/home/node/.cache/o1js + - ${PWD}/.cache/o1js:/home/node/.cache/o1js command: ["./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] From c0e23e3e1eefaf9886cc96d4db41f8912cce4073 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Wed, 11 Feb 2026 16:48:03 +0000 Subject: [PATCH 11/18] Actually correct o1js cache mapping --- docker/worker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index 93d1610..90b5db0 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -35,6 +35,6 @@ services: - db-net - lightnet-net volumes: - - ${PWD}/.cache/o1js:/home/node/.cache/o1js + - ${HOME}/.cache/o1js:/home/node/.cache/o1js command: ["./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] From 1ec5d780ca1f7848555f88df7f45a935bd347c32 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Wed, 11 Feb 2026 17:19:51 +0000 Subject: [PATCH 12/18] Removed leftover hardcoded loglevel --- packages/chain/src/core/environments/sovereign/worker.config.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/chain/src/core/environments/sovereign/worker.config.ts b/packages/chain/src/core/environments/sovereign/worker.config.ts index 99992ca..275fb2b 100644 --- a/packages/chain/src/core/environments/sovereign/worker.config.ts +++ b/packages/chain/src/core/environments/sovereign/worker.config.ts @@ -41,7 +41,5 @@ export default async (args: Arguments): Promise => { }), }); - log.setLevel("DEBUG"); - return appChain; }; From 1fff48ff1c765794674684c6d186b67bada87396 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Tue, 24 Feb 2026 11:14:22 -0300 Subject: [PATCH 13/18] Fixed inmemory ordering --- packages/chain/src/core/environments/inmemory/chain.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/chain/src/core/environments/inmemory/chain.config.ts b/packages/chain/src/core/environments/inmemory/chain.config.ts index 66cdda2..b87ad05 100644 --- a/packages/chain/src/core/environments/inmemory/chain.config.ts +++ b/packages/chain/src/core/environments/inmemory/chain.config.ts @@ -13,11 +13,11 @@ const appChain = AppChain.from({ Runtime: Runtime.from(runtime.modules), Protocol: Protocol.from(protocol.modules), Sequencer: Sequencer.from({ + ...DefaultModules.localWorker({ settlementEnabled }), ...DefaultModules.inMemoryDatabase(), ...DefaultModules.core({ settlementEnabled, }), - ...DefaultModules.localWorker({ settlementEnabled }), }), ...DefaultModules.appChainBase(), }); @@ -26,11 +26,11 @@ export default async (): Promise => { Runtime: runtime.config, Protocol: protocol.config, Sequencer: { + ...DefaultConfigs.localWorker(), ...DefaultConfigs.core({ settlementEnabled, }), ...DefaultConfigs.inMemoryDatabase(), - ...DefaultConfigs.localWorker(), }, ...DefaultConfigs.appChainBase(), }); From 4a6f15b526ea63c7805391c8110b869528773ba1 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Sat, 28 Feb 2026 15:34:34 -0300 Subject: [PATCH 14/18] Some changes --- README.md | 4 ++++ packages/chain/src/core/environments/development/.env | 7 +++++-- .../src/core/environments/development/chain.config.ts | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4f3c9fb..31cad3b 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,10 @@ If you want to remove the monitoring services, remove the docker profile `monito More information about monitoring can be found [here](https://github.com/proto-kit/framework/pull/272). +*Deploying contracts* + +`pnpm protokit lightnet initialize --env-path ./packages/chain/src/core/environments/sovereign/scripts.env` + ## Building the framework from source 1. Make sure the framework is located under ../framework from the starter-kit's location diff --git a/packages/chain/src/core/environments/development/.env b/packages/chain/src/core/environments/development/.env index c2034bd..f62d91d 100644 --- a/packages/chain/src/core/environments/development/.env +++ b/packages/chain/src/core/environments/development/.env @@ -13,7 +13,7 @@ REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD=password -PROTOKIT_PROOFS_ENABLED=true +PROTOKIT_PROOFS_ENABLED=false PROTOKIT_SHOULD_ATTEMPT_DB_MIGRATION=true PROTOKIT_PRUNE_ON_STARTUP=false @@ -55,6 +55,9 @@ PROTOKIT_PROCESSOR_GRAPHIQL_ENABLED=true PROTOKIT_PROCESSOR_INDEXER_GRAPHQL_HOST=0.0.0.0 +PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=40 +PROTOKIT_STATE_TRANSITION_BATCH_SIZE=25 + # expose graphql configuration to the client app-chain NEXT_PUBLIC_PROTOKIT_GRAPHQL_URL=http://localhost:8080/graphql NEXT_PUBLIC_PROTOKIT_INDEXER_GRAPHQL_URL=http://localhost:8081/graphql @@ -69,7 +72,7 @@ MINA_ARCHIVE_GRAPHQL_PORT=8085 PROTOKIT_TRANSACTION_FEE_RECIPIENT_PRIVATE_KEY=EKEssvj33MMBCg2tcybTzL32nTKbbwFHm6yUxd3JassdhL3J5aT8 PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY=B62qk4sNnzZqqjHp8YQXZUV3dBpnjiNieJVnsuh7mD2bMJ9PdbskH5H -PROTOKIT_SETTLEMENT_ENABLED=true +PROTOKIT_SETTLEMENT_ENABLED=false PROTOKIT_SEQUENCER_PRIVATE_KEY=EKEdKhgUHMuDvwWJEg2TdCMCeiTSd9hh2HrEr6uYJfPVuwur1s43 PROTOKIT_SEQUENCER_PUBLIC_KEY=B62qizW6aroTxQorJz4ywVNZom4jA6W4QPPCK3wLeyhnJHtVStUNniL diff --git a/packages/chain/src/core/environments/development/chain.config.ts b/packages/chain/src/core/environments/development/chain.config.ts index 00f8897..8a56cc6 100644 --- a/packages/chain/src/core/environments/development/chain.config.ts +++ b/packages/chain/src/core/environments/development/chain.config.ts @@ -1,6 +1,6 @@ import { Runtime } from "@proto-kit/module"; import { Protocol } from "@proto-kit/protocol"; -import { AppChain, Sequencer } from "@proto-kit/sequencer"; +import { AppChain, BatchProducerModule, Sequencer } from "@proto-kit/sequencer"; import runtime from "../../../runtime"; import * as protocol from "../../../protocol"; @@ -23,6 +23,7 @@ const appChain = AppChain.from({ ...DefaultModules.core({ settlementEnabled }), ...DefaultModules.redisTaskQueue(), ...DefaultModules.sequencerIndexer(), + BatchProducerModule, }), ...DefaultModules.appChainBase(), }); @@ -50,6 +51,7 @@ export default async (args: Arguments): Promise => { pruneOnStartup: args.pruneOnStartup, }, }), + BatchProducerModule: {}, }, ...DefaultConfigs.appChainBase(), }); From 35b9491cdafa22cb23475d5dedf95096dc6f3410 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Mon, 2 Mar 2026 18:36:36 -0300 Subject: [PATCH 15/18] Added granulized workers to sovereign env --- docker/worker/docker-compose.yml | 41 ++++++++++++++- .../src/core/environments/development/.env | 2 + .../src/core/environments/sovereign/.env | 8 ++- .../environments/sovereign/worker.config.ts | 52 +++++++++++++++---- 4 files changed, 91 insertions(+), 12 deletions(-) diff --git a/docker/worker/docker-compose.yml b/docker/worker/docker-compose.yml index 90b5db0..118b0db 100644 --- a/docker/worker/docker-compose.yml +++ b/docker/worker/docker-compose.yml @@ -21,13 +21,14 @@ services: - PROTOKIT_DISPATCHER_CONTRACT_PUBLIC_KEY=${PROTOKIT_DISPATCHER_CONTRACT_PUBLIC_KEY} - PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY} - PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY} - - PROTOKIT_SETTLEMENT_INTERVAL=${PROTOKIT_SETTLEMENT_INTERVAL} - PROTOKIT_SETTLEMENT_ENABLED=${PROTOKIT_SETTLEMENT_ENABLED} - PROTOKIT_PROOFS_ENABLED=${PROTOKIT_PROOFS_ENABLED} - PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=${PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE} - PROTOKIT_STATE_TRANSITION_BATCH_SIZE=${PROTOKIT_STATE_TRANSITION_BATCH_SIZE} + - PROTOKIT_WORKER_VARIANT=${PROTOKIT_WORKER_VARIANT} profiles: - worker + - worker-specialized depends_on: redis: condition: service_healthy @@ -38,3 +39,41 @@ services: - ${HOME}/.cache/o1js:/home/node/.cache/o1js command: ["./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] + worker-2: + image: starterkit-chain-base + build: + dockerfile: ./docker/base/Dockerfile + context: ../.. + container_name: starterkit-worker-2 + environment: + - REDIS_HOST=${REDIS_HOST} + - REDIS_PORT=${REDIS_PORT} + - REDIS_PASSWORD=${REDIS_PASSWORD} + + - PROTOKIT_TRANSACTION_FEE_RECIPIENT_PRIVATE_KEY=${PROTOKIT_TRANSACTION_FEE_RECIPIENT_PRIVATE_KEY} + - PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY=${PROTOKIT_TRANSACTION_FEE_RECIPIENT_PUBLIC_KEY} + - PROTOKIT_LOG_LEVEL=${PROTOKIT_LOG_LEVEL} + - PROTOKIT_SEQUENCER_PRIVATE_KEY=${PROTOKIT_SEQUENCER_PRIVATE_KEY} + - PROTOKIT_SEQUENCER_PUBLIC_KEY=${PROTOKIT_SEQUENCER_PUBLIC_KEY} + - PROTOKIT_SETTLEMENT_CONTRACT_PRIVATE_KEY=${PROTOKIT_SETTLEMENT_CONTRACT_PRIVATE_KEY} + - PROTOKIT_SETTLEMENT_CONTRACT_PUBLIC_KEY=${PROTOKIT_SETTLEMENT_CONTRACT_PUBLIC_KEY} + - PROTOKIT_DISPATCHER_CONTRACT_PRIVATE_KEY=${PROTOKIT_DISPATCHER_CONTRACT_PRIVATE_KEY} + - PROTOKIT_DISPATCHER_CONTRACT_PUBLIC_KEY=${PROTOKIT_DISPATCHER_CONTRACT_PUBLIC_KEY} + - PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PRIVATE_KEY} + - PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY=${PROTOKIT_MINA_BRIDGE_CONTRACT_PUBLIC_KEY} + - PROTOKIT_SETTLEMENT_ENABLED=${PROTOKIT_SETTLEMENT_ENABLED} + - PROTOKIT_PROOFS_ENABLED=${PROTOKIT_PROOFS_ENABLED} + - PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=${PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE} + - PROTOKIT_STATE_TRANSITION_BATCH_SIZE=${PROTOKIT_STATE_TRANSITION_BATCH_SIZE} + - PROTOKIT_WORKER_VARIANT=${PROTOKIT_WORKER_VARIANT_2} + profiles: + - worker-specialized + depends_on: + redis: + condition: service_healthy + networks: + - db-net + - lightnet-net + volumes: + - ${HOME}/.cache/o1js:/home/node/.cache/o1js + command: ["./dist/start.js start ./core/environments/${PROTOKIT_ENV_FOLDER}/worker.config.js"] diff --git a/packages/chain/src/core/environments/development/.env b/packages/chain/src/core/environments/development/.env index f62d91d..e3fcf0f 100644 --- a/packages/chain/src/core/environments/development/.env +++ b/packages/chain/src/core/environments/development/.env @@ -55,6 +55,8 @@ PROTOKIT_PROCESSOR_GRAPHIQL_ENABLED=true PROTOKIT_PROCESSOR_INDEXER_GRAPHQL_HOST=0.0.0.0 +PROTOKIT_WORKER_VARIANT=default + PROTOKIT_BLOCK_ARGUMENT_BATCH_SIZE=40 PROTOKIT_STATE_TRANSITION_BATCH_SIZE=25 diff --git a/packages/chain/src/core/environments/sovereign/.env b/packages/chain/src/core/environments/sovereign/.env index 4712a80..468bf68 100644 --- a/packages/chain/src/core/environments/sovereign/.env +++ b/packages/chain/src/core/environments/sovereign/.env @@ -1,5 +1,5 @@ -# COMPOSE_PROFILES=db,indexer-db,monolithic-sequencer,monolithic-indexer,proxy,web,processor-db,monolithic-processor,worker,monitoring -COMPOSE_PROFILES=db,monolithic-sequencer,proxy,web,worker +# COMPOSE_PROFILES=db,indexer-db,monolithic-sequencer,monolithic-indexer,proxy,web,processor-db,monolithic-processor,worker-specialized,monitoring +COMPOSE_PROFILES=db,monolithic-sequencer,proxy,web,worker-specialized COMPOSE_PROJECT_NAME=starterkit @@ -61,6 +61,10 @@ PROTOKIT_PROCESSOR_GRAPHIQL_ENABLED=true PROTOKIT_PROCESSOR_INDEXER_GRAPHQL_HOST=indexer +PROTOKIT_WORKER_VARIANT=l2 +PROTOKIT_WORKER_VARIANT_2=l1 + +PUBLIC_DOMAIN=* # expose graphql configuration to the client app-chain NEXT_PUBLIC_PROTOKIT_GRAPHQL_URL=https://localhost/graphql # NEXT_PUBLIC_PROTOKIT_GRAPHQL_URL=http://yourdomain.com/graphql diff --git a/packages/chain/src/core/environments/sovereign/worker.config.ts b/packages/chain/src/core/environments/sovereign/worker.config.ts index 275fb2b..3190feb 100644 --- a/packages/chain/src/core/environments/sovereign/worker.config.ts +++ b/packages/chain/src/core/environments/sovereign/worker.config.ts @@ -5,16 +5,48 @@ import { AppChain, LocalTaskWorkerModule, VanillaTaskWorkerModules, + SettlementProvingTask, + SettlementCompileTask, } from "@proto-kit/sequencer"; +import { BullQueue } from "@proto-kit/deployment"; import runtime from "../../../runtime"; import * as protocol from "../../../protocol"; import { Arguments } from "../../../start"; -import { log, Startable } from "@proto-kit/common"; -import { DefaultConfigs, DefaultModules } from "@proto-kit/stack"; +import { ModulesConfig, Startable } from "@proto-kit/common"; +import { DefaultConfigs } from "@proto-kit/stack"; const settlementEnabled = process.env.PROTOKIT_SETTLEMENT_ENABLED! === "true"; +const variants = { + default: VanillaTaskWorkerModules.allTasks(), + l2: VanillaTaskWorkerModules.withoutSettlement(), + l1: { + SettlementProvingTask, + SettlementCompileTask, + }, +}; + +const variantConfigs = { + default: VanillaTaskWorkerModules.defaultConfig(), + l2: VanillaTaskWorkerModules.defaultConfig(), + l1: { + SettlementProvingTask: {}, + SettlementCompileTask: {}, + } satisfies ModulesConfig<(typeof variants)["l1"]>, +}; + +const variant = process.env.PROTOKIT_WORKER_VARIANT ?? "default"; + +function validateVariant( + variant: string +): asserts variant is keyof typeof variants { + if (variant! in variants) { + throw new Error(`Worker variant ${variant} not found`); + } +} +validateVariant(variant); + const appChain = AppChain.from({ Runtime: Runtime.from(runtime.modules), Protocol: Protocol.from({ @@ -22,7 +54,8 @@ const appChain = AppChain.from({ ...(settlementEnabled ? protocol.settlementModules : {}), }), Sequencer: Sequencer.from({ - ...DefaultModules.remoteWorker(), + TaskQueue: BullQueue, + LocalTaskWorkerModule: LocalTaskWorkerModule.from(variants[variant]), }), }); @@ -33,12 +66,13 @@ export default async (args: Arguments): Promise => { ...protocol.config, ...(settlementEnabled ? protocol.settlementModulesConfig : {}), }, - Sequencer: DefaultConfigs.worker({ - preset: "sovereign", - overrides: { - redisDb: 1, - }, - }), + Sequencer: { + ...DefaultConfigs.redisTaskQueue({ + preset: "sovereign", + overrides: { redisDb: 1 }, + }), + ...variantConfigs[variant], + }, }); return appChain; From 0bfc15c030f3b5c4aa1b56d2b61e1684d6c60a94 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Mon, 2 Mar 2026 19:15:26 -0300 Subject: [PATCH 16/18] Fixed assertion mistake --- packages/chain/src/core/environments/sovereign/worker.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/chain/src/core/environments/sovereign/worker.config.ts b/packages/chain/src/core/environments/sovereign/worker.config.ts index 3190feb..efe30c2 100644 --- a/packages/chain/src/core/environments/sovereign/worker.config.ts +++ b/packages/chain/src/core/environments/sovereign/worker.config.ts @@ -41,7 +41,7 @@ const variant = process.env.PROTOKIT_WORKER_VARIANT ?? "default"; function validateVariant( variant: string ): asserts variant is keyof typeof variants { - if (variant! in variants) { + if (!(variant in variants)) { throw new Error(`Worker variant ${variant} not found`); } } From e76dbf3074493be591df44a0d1c1d1faf091750f Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Mon, 2 Mar 2026 19:21:30 -0300 Subject: [PATCH 17/18] same same --- packages/chain/src/core/environments/sovereign/worker.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/chain/src/core/environments/sovereign/worker.config.ts b/packages/chain/src/core/environments/sovereign/worker.config.ts index efe30c2..748c4c2 100644 --- a/packages/chain/src/core/environments/sovereign/worker.config.ts +++ b/packages/chain/src/core/environments/sovereign/worker.config.ts @@ -71,7 +71,7 @@ export default async (args: Arguments): Promise => { preset: "sovereign", overrides: { redisDb: 1 }, }), - ...variantConfigs[variant], + LocalTaskWorkerModule: variantConfigs[variant], }, }); From 24915001d90d8c6a06f7fd6a3b655dc09a923bc7 Mon Sep 17 00:00:00 2001 From: Raphael Panic Date: Mon, 2 Mar 2026 23:05:54 -0300 Subject: [PATCH 18/18] Added missing WorkerRegistrationTask to worker --- .../chain/src/core/environments/sovereign/worker.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/chain/src/core/environments/sovereign/worker.config.ts b/packages/chain/src/core/environments/sovereign/worker.config.ts index 748c4c2..9aaf4b2 100644 --- a/packages/chain/src/core/environments/sovereign/worker.config.ts +++ b/packages/chain/src/core/environments/sovereign/worker.config.ts @@ -7,6 +7,7 @@ import { VanillaTaskWorkerModules, SettlementProvingTask, SettlementCompileTask, + WorkerRegistrationTask, } from "@proto-kit/sequencer"; import { BullQueue } from "@proto-kit/deployment"; import runtime from "../../../runtime"; @@ -24,6 +25,7 @@ const variants = { l1: { SettlementProvingTask, SettlementCompileTask, + WorkerRegistrationTask, }, }; @@ -33,6 +35,7 @@ const variantConfigs = { l1: { SettlementProvingTask: {}, SettlementCompileTask: {}, + WorkerRegistrationTask: {}, } satisfies ModulesConfig<(typeof variants)["l1"]>, };