Skip to content

Commit

Permalink
fix: make tx receipt root field nullable (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk authored Nov 5, 2024
1 parent 25606ec commit 947bc5d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/worker/src/entities/transactionReceipt.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ export class TransactionReceipt extends CountableEntity {
@Column({ type: "int" })
public readonly type: number;

@Column({ type: "bytea", transformer: hexTransformer })
public readonly root: string;
// this field is only relevant on L1 pre byzantium fork (EIP658),
// but was present in ZKsync API before, so it cannot be just dropped.
@Column({ type: "bytea", transformer: hexTransformer, nullable: true })
public readonly root?: string;

@Column({ type: "varchar", length: 128 })
public readonly gasUsed: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class TxReceiptRootColumnNullable1730806000905 implements MigrationInterface {
name = "TxReceiptRootColumnNullable1730806000905";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "transactionReceipts" ALTER COLUMN "root" DROP NOT NULL`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "transactionReceipts" ALTER COLUMN "root" SET NOT NULL`);
}
}

0 comments on commit 947bc5d

Please sign in to comment.