Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
528 changes: 58 additions & 470 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"@proto-kit/module": "*",
"@proto-kit/protocol": "*",
"@proto-kit/sequencer": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"@proto-kit/sequencer": "*",
"@proto-kit/stack": "*",
"@proto-kit/indexer": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"typescript-memoize": "^1.1.1"
},
"peerDependencies": {
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions packages/common/src/cache/ProxyCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export class ProxyCache implements O1Cache {

debug = false;

cacheDirectory = this.realCache.cacheDirectory;

public read(header: CacheHeader): Uint8Array | undefined {
return this.realCache.read(header);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/deployment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"@proto-kit/sdk": "*",
"@proto-kit/sequencer": "*",
"bullmq": "^4.18.3",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"@proto-kit/sdk": "*",
"@proto-kit/sequencer": "*",
"koa": "^2.14.2",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0",
"type-graphql": "2.0.0-rc.2",
"typegraphql-prisma": "0.28"
Expand Down
3 changes: 2 additions & 1 deletion packages/library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@proto-kit/module": "*",
"@proto-kit/protocol": "*",
"@proto-kit/sequencer": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"peerDependencies": {
"@proto-kit/common": "*",
"@proto-kit/protocol": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"gitHead": "8a7eca319272a15162dc4ad04bdc134b1017716d"
Expand Down
3 changes: 2 additions & 1 deletion packages/persistance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"@proto-kit/module": "*",
"@proto-kit/protocol": "*",
"@proto-kit/sequencer": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"@proto-kit/protocol": "*",
"@proto-kit/sdk": "*",
"@proto-kit/sequencer": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0",
"type-graphql": "2.0.0-rc.2",
"typegraphql-prisma": "^0.28"
Expand Down
3 changes: 2 additions & 1 deletion packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
},
"peerDependencies": {
"@proto-kit/common": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"ts-pattern": "^4.3.0",
"tsyringe": "^4.10.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"@proto-kit/module": "*",
"@proto-kit/protocol": "*",
"@proto-kit/sequencer": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/sdk/src/query/BlockStorageNetworkStateModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class BlockStorageNetworkStateModule
}

public async getUnprovenNetworkState(): Promise<NetworkState | undefined> {
const latestBlock = await this.unprovenStorage.getLatestBlock();
const latestBlock = await this.unprovenQueue.getLatestBlockAndResult();
return latestBlock?.block.networkState.during;
}

Expand All @@ -47,6 +47,8 @@ export class BlockStorageNetworkStateModule
* with afterBundle() hooks executed
*/
public async getStagedNetworkState(): Promise<NetworkState | undefined> {
// TODO Result could be null here, add method that specifically looks for the
// last block with a result
const result = await this.unprovenStorage.getLatestBlock();
return result?.result.afterNetworkState;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/sequencer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"@proto-kit/common": "*",
"@proto-kit/module": "*",
"@proto-kit/protocol": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sequencer/src/logging/ConsoleTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type StoreType = Record<string, { duration: number }[]>;
@closeable()
export class ConsoleTracer implements Tracer {
// Hard-code this for the moment. Needs to be configured.
timeInterval: number = 60000;
timeInterval: number = 180000;

store: StoreType = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ export class BlockProducerModule extends SequencerModule<BlockConfig> {

@ensureNotBusy()
public async tryProduceBlock(): Promise<Block | undefined> {
// Check if previous result has been computed, and if not, compute it
await this.blockResultCompleteCheck();

const block = await this.produceBlock();

if (block === undefined) {
Expand Down Expand Up @@ -239,19 +242,23 @@ export class BlockProducerModule extends SequencerModule<BlockConfig> {
return blockResult?.block;
}

public async blockResultCompleteCheck() {
public async blockResultCompleteCheck(): Promise<
"genesis" | "existent" | "generated"
> {
// Check if metadata height is behind block production.
// This can happen when the sequencer crashes after a block has been produced
// but before the metadata generation has finished
const latestBlock = await this.blockQueue.getLatestBlockAndResult();
// eslint-disable-next-line sonarjs/no-collapsible-if
if (latestBlock !== undefined) {
if (latestBlock.result === undefined) {
await this.generateMetadata(latestBlock.block);
return "generated";
}
// Here, the metadata has been computed already
return "existent";
}
// If we reach here, its a genesis startup, no blocks exist yet
return "genesis";
}

public async start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ACTIONS_EMPTY_HASH } from "@proto-kit/protocol";

import { SettlementStorage } from "../../storage/repositories/SettlementStorage";
import { MessageStorage } from "../../storage/repositories/MessageStorage";
import { BlockStorage } from "../../storage/repositories/BlockStorage";
import { BlockQueue } from "../../storage/repositories/BlockStorage";
import { PendingTransaction } from "../../mempool/PendingTransaction";
import type { BridgingModule } from "../BridgingModule";

Expand All @@ -18,8 +18,8 @@ export class IncomingMessagesService {
private readonly messageStorage: MessageStorage,
@inject("IncomingMessageAdapter")
private readonly messagesAdapter: IncomingMessageAdapter,
@inject("BlockStorage")
private readonly blockStorage: BlockStorage,
@inject("BlockQueue")
private readonly blockStorage: BlockQueue,
@inject("BridgingModule")
private readonly bridgingModule: BridgingModule
) {}
Expand Down Expand Up @@ -102,7 +102,7 @@ export class IncomingMessagesService {

public async getPendingMessages() {
const latestSettlement = await this.settlementStorage.getLatestSettlement();
const latestBlock = await this.blockStorage.getLatestBlock();
const latestBlock = await this.blockStorage.getLatestBlockAndResult();

const messagesHashCursor =
latestBlock?.block?.toMessagesHash?.toString() ??
Expand Down
4 changes: 4 additions & 0 deletions packages/sequencer/test-integration/workers/worker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "reflect-metadata";

import { setBackend } from "o1js";
// eslint-disable-next-line import/no-extraneous-dependencies
import { BullQueue } from "@proto-kit/deployment";
import { container } from "tsyringe";
Expand All @@ -19,6 +21,8 @@ import {
} from "./modules";
import { MinimumWorkerModules } from "./WorkerModules";

setBackend("native");

/* eslint-disable no-console */
async function main() {
const proofsEnabled = process.env.PROOFS_ENABLED === "true";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ChildProcessWorker } from "./ChildProcessWorker";
const timeout = 300000;

// true
const proofsEnabled = false;
const proofsEnabled = true;

const numWorkers = 1;

Expand Down
4 changes: 3 additions & 1 deletion packages/sequencer/test-proven/Proven.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "@proto-kit/protocol";
import { VanillaProtocolModules } from "@proto-kit/library";
import { container } from "tsyringe";
import { PrivateKey, Provable, UInt64, VerificationKey } from "o1js";
import { PrivateKey, UInt64, setBackend } from "o1js";

import { testingSequencerModules } from "../test/TestingSequencer";
import {
Expand All @@ -35,6 +35,8 @@ import { ProvenBalance } from "../test/integration/mocks/ProvenBalance";

const timeout = 300000;

setBackend("native");

describe("Proven", () => {
let test: BlockTestService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("atomic block production", () => {
* the second block production can succeed
*/
it("should recover from non-generated metadata", async () => {
expect.assertions(6);
expect.assertions(5);

const module =
appchain.sequencer.dependencyContainer.resolve(BlockResultService);
Expand All @@ -102,9 +102,6 @@ describe("atomic block production", () => {

await expect(() => trigger.produceBlock()).rejects.toThrow();

// This checks that it correctly throws when producing a block with no previous result existing
await expect(() => trigger.produceBlock()).rejects.toThrow();

await appchain.sequencer
.resolve("BlockProducerModule")
.blockResultCompleteCheck();
Expand Down
2 changes: 1 addition & 1 deletion packages/sequencer/test/settlement/Settlement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe.each(["mock-proofs", "signed"] as const)(
},
};

describe("Default token", () => {
describe.only("Default token", () => {
settlementTestFn(type, network);
});

Expand Down
3 changes: 2 additions & 1 deletion packages/stack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"@proto-kit/protocol": "*",
"@proto-kit/sdk": "*",
"@proto-kit/sequencer": "*",
"o1js": "^2.10.0",
"o1js": "2.10.0-dev.6d3a3",
"@o1js/native": "2.10.0-dev.6d3a3",
"tsyringe": "^4.10.0"
},
"devDependencies": {
Expand Down
Loading