Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fe09020
added PendingL1TransactionStorage for persisting mina transactions in…
Raunaque97 Nov 24, 2025
8f8f768
implementing PendingL1TransactionStorage
Raunaque97 Nov 24, 2025
b129ea7
implementing L1TransactionRetryStrategy
Raunaque97 Nov 24, 2025
1dd9d5e
added MinaSigner interface
Raunaque97 Nov 24, 2025
def1b44
updated MinaTransactionSender to use L1TransactionRetryStrategy and P…
Raunaque97 Nov 24, 2025
3e90a3a
fixing tests
Raunaque97 Nov 24, 2025
dd86edc
refactoring, removed feeStrategy dependencies from bridgingModule, se…
Raunaque97 Nov 25, 2025
e5d8922
using SettlementSigner, and removing LocalMinaSigner
Raunaque97 Dec 16, 2025
1f2f51a
storing transaction obj in PendingL1TransactionRecord instead of json…
Raunaque97 Dec 16, 2025
2068f62
making MinaTransactionSender closeable
Raunaque97 Dec 18, 2025
235e41e
Refactor PendingL1Transaction and Settlement models to use transactio…
Raunaque97 Dec 18, 2025
919fdf9
added a queued wait status in MinaTransactionSender
Raunaque97 Dec 19, 2025
2617552
adding foreign key relation between Settlement and PendingL1Transaction
Raunaque97 Dec 19, 2025
14f8827
fixing lint errors
Raunaque97 Dec 19, 2025
dfe29e7
created the migration file
Raunaque97 Dec 22, 2025
0bac257
refactoring, renaming mappers
Raunaque97 Dec 22, 2025
197fbeb
lint fix
Raunaque97 Dec 22, 2025
b81ca92
Add hash field to PendingL1Transaction model and added txn status pol…
Raunaque97 Jan 6, 2026
debc765
added minaTransactionSender tests
Raunaque97 Jan 7, 2026
9c6b506
updating PendingL1Transaction schema to include nextActionAt and queu…
Raunaque97 Jan 12, 2026
f3f2085
refactoring MinaTransactionSender.
Raunaque97 Jan 12, 2026
0ceb431
fixing build errors after rebase
Raunaque97 Jan 12, 2026
a967a16
moved transactionDispatcher to MinaBaseLayer
Raunaque97 Jan 14, 2026
43a4c49
using signProveAndSendTransaction in place of proveAndSendTransaction
Raunaque97 Jan 14, 2026
eb8c39c
adjusted DI for TxStatusWaiter
Raunaque97 Jan 15, 2026
ccc3fdd
updating the indexer schema
Raunaque97 Jan 15, 2026
ce7a958
Merge remote-tracking branch 'origin/develop' into raun/retryMinaTran…
Raunaque97 Jan 15, 2026
abc396e
fixing errors
Raunaque97 Jan 15, 2026
c03336b
Refactored DI for L1TransactionDispatcher, MinaTransactionSender
Raunaque97 Jan 19, 2026
090ac91
using o1js nightly build,
Raunaque97 Jan 19, 2026
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
4 changes: 2 additions & 2 deletions console-jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import console from "console";
import "reflect-metadata";

global.console = console;
globalThis.console = console;
30 changes: 10 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"ts-jest": "^29.0.5",
"typedoc": "^0.26.11",
"typedoc-plugin-frontmatter": "1.0.0",
"typedoc-plugin-inline-sources": "1.2.0",
"typedoc-plugin-inline-sources": "^1.2.0",
"typedoc-plugin-markdown": "4.2.10",
"typescript": "5.1"
},
Expand All @@ -75,6 +75,7 @@
]
},
"dependencies": {
"o1js": "https://pkg.pr.new/o1-labs/o1js@c6af2a2",
"react-json-view-lite": "^1.4.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Warnings:

- You are about to drop the column `settlementTransactionHash` on the `Batch` table. All the data in the column will be lost.
- You are about to drop the column `blockStateTransitions` on the `BlockResult` table. All the data in the column will be lost.
- The primary key for the `Settlement` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `transactionHash` on the `Settlement` table. All the data in the column will be lost.
- Added the required column `afterBlockStateTransitions` to the `BlockResult` table without a default value. This is not possible if the table is not empty.
- Added the required column `transactionId` to the `Settlement` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE "Batch" DROP CONSTRAINT "Batch_settlementTransactionHash_fkey";

-- AlterTable
ALTER TABLE "Batch" DROP COLUMN "settlementTransactionHash",
ADD COLUMN "settlementTransactionId" TEXT;

-- AlterTable
ALTER TABLE "BlockResult" DROP COLUMN "blockStateTransitions",
ADD COLUMN "afterBlockStateTransitions" JSON NOT NULL,
ADD COLUMN "witnessedRoots" TEXT[];

-- AlterTable
ALTER TABLE "Settlement" DROP CONSTRAINT "Settlement_pkey",
DROP COLUMN "transactionHash",
ADD COLUMN "transactionId" TEXT NOT NULL,
ADD CONSTRAINT "Settlement_pkey" PRIMARY KEY ("transactionId");

-- AddForeignKey
ALTER TABLE "Batch" ADD CONSTRAINT "Batch_settlementTransactionId_fkey" FOREIGN KEY ("settlementTransactionId") REFERENCES "Settlement"("transactionId") ON DELETE SET NULL ON UPDATE CASCADE;
7 changes: 3 additions & 4 deletions packages/indexer/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ model Batch {

blocks Block[]

settlementTransactionHash String?
settlement Settlement? @relation(fields: [settlementTransactionHash], references: [transactionHash])
settlementTransactionId String?
settlement Settlement? @relation(fields: [settlementTransactionId], references: [transactionId])
}

model BlockResult {
Expand All @@ -114,8 +114,7 @@ model BlockResult {
}

model Settlement {
// transaction String
transactionHash String @id
transactionId String @id
promisedMessagesHash String

batches Batch[]
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/src/IndexerNotifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class IndexerNotifier extends SequencerModule<Record<never, never>> {
this.sequencer.events.on("settlement-submitted", async (settlement) => {
log.debug(
"Notifiying the indexer about settlement",
settlement.transactionHash
settlement.transactionId
);
try {
const settlementQueue = await this.taskQueue.getQueue(
Expand All @@ -129,7 +129,7 @@ export class IndexerNotifier extends SequencerModule<Record<never, never>> {
await settlementQueue.addTask(task);
} catch (err) {
log.error(
`Failed to add index settlement: ${settlement.transactionHash} ${err}`
`Failed to add index settlement: ${settlement.transactionId} ${err}`
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class GeneratedResolverFactoryGraphqlModule extends ResolverFactoryGraphq
public async initializePrismaClient() {
// setup the prisma client and feed it to the server,
// since this is necessary for the returned resolvers to work

const prismaClient = new PrismaClient({
// datasourceUrl: 'postgresql://admin:password@localhost:5433/protokit-indexer?schema=public'
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Warnings:

- You are about to drop the column `settlementTransactionHash` on the `Batch` table. All the data in the column will be lost.
- The primary key for the `Settlement` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `transactionHash` on the `Settlement` table. All the data in the column will be lost.
- Added the required column `transactionId` to the `Settlement` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE "Batch" DROP CONSTRAINT "Batch_settlementTransactionHash_fkey";

-- AlterTable
ALTER TABLE "Batch" DROP COLUMN "settlementTransactionHash",
ADD COLUMN "settlementTransactionId" TEXT;

-- AlterTable
ALTER TABLE "Settlement" DROP CONSTRAINT "Settlement_pkey",
DROP COLUMN "transactionHash",
ADD COLUMN "transactionId" TEXT NOT NULL,
ADD CONSTRAINT "Settlement_pkey" PRIMARY KEY ("transactionId");

-- CreateTable
CREATE TABLE "PendingL1Transaction" (
"id" TEXT NOT NULL,
"sender" TEXT NOT NULL,
"nonce" INTEGER NOT NULL,
"attempts" INTEGER NOT NULL,
"status" VARCHAR(32) NOT NULL,
"transaction" JSON NOT NULL,
"lastError" TEXT,
"sentAt" TIMESTAMP(3),

CONSTRAINT "PendingL1Transaction_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "PendingL1Transaction_sender_nonce_key" ON "PendingL1Transaction"("sender", "nonce");

-- AddForeignKey
ALTER TABLE "Batch" ADD CONSTRAINT "Batch_settlementTransactionId_fkey" FOREIGN KEY ("settlementTransactionId") REFERENCES "Settlement"("transactionId") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Settlement" ADD CONSTRAINT "Settlement_transactionId_fkey" FOREIGN KEY ("transactionId") REFERENCES "PendingL1Transaction"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
27 changes: 22 additions & 5 deletions packages/persistance/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ model Batch {

blocks Block[]

settlementTransactionHash String?
settlement Settlement? @relation(fields: [settlementTransactionHash], references: [transactionHash])
settlementTransactionId String?
settlement Settlement? @relation(fields: [settlementTransactionId], references: [transactionId])
}

model BlockResult {
Expand All @@ -123,11 +123,11 @@ model BlockResult {
}

model Settlement {
// transaction String
transactionHash String @id
transactionId String @id
promisedMessagesHash String

batches Batch[]
batches Batch[]
pendingL1Transaction PendingL1Transaction? @relation(fields: [transactionId], references: [id])
}

model IncomingMessageBatchTransaction {
Expand All @@ -148,3 +148,20 @@ model IncomingMessageBatch {

messages IncomingMessageBatchTransaction[]
}

model PendingL1Transaction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to create a migration for this new schema change - do this by cd-ing into the persistence pkg, then run prisma migrate dev and it'll you for a name and migrate

id String @id @default(cuid())
sender String
nonce Int
attempts Int
status String @db.VarChar(32)
transaction Json @db.Json
lastError String?
sentAt DateTime?
queuedAt DateTime?
nextActionAt DateTime?

settlement Settlement?

@@unique([sender, nonce])
}
5 changes: 5 additions & 0 deletions packages/persistance/src/PrismaDatabaseConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { PrismaBlockStorage } from "./services/prisma/PrismaBlockStorage";
import { PrismaSettlementStorage } from "./services/prisma/PrismaSettlementStorage";
import { PrismaMessageStorage } from "./services/prisma/PrismaMessageStorage";
import { PrismaTransactionStorage } from "./services/prisma/PrismaTransactionStorage";
import { PrismaPendingL1TransactionStorage } from "./services/prisma/PrismaPendingL1TransactionStorage";

export interface PrismaDatabaseConfig {
// Either object-based config or connection string
Expand Down Expand Up @@ -82,6 +83,9 @@ export class PrismaDatabaseConnection
transactionStorage: {
useClass: PrismaTransactionStorage,
},
pendingL1TransactionStorage: {
useClass: PrismaPendingL1TransactionStorage,
},
};
}

Expand All @@ -97,6 +101,7 @@ export class PrismaDatabaseConnection
"IncomingMessageBatch",
"IncomingMessageBatchTransaction",
"LinkedLeaf",
"PendingL1Transaction",
];

await this.prismaClient.$transaction(
Expand Down
1 change: 1 addition & 0 deletions packages/persistance/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from "./services/prisma/PrismaBatchStore";
export * from "./services/prisma/PrismaSettlementStorage";
export * from "./services/prisma/PrismaMessageStorage";
export * from "./services/prisma/PrismaTransactionStorage";
export * from "./services/prisma/PrismaPendingL1TransactionStorage";
export * from "./services/prisma/mappers/BatchMapper";
export * from "./services/prisma/mappers/BlockMapper";
export * from "./services/prisma/mappers/FieldMapper";
Expand Down
Loading
Loading