diff --git a/packages/worker/src/entities/transactionReceipt.entity.ts b/packages/worker/src/entities/transactionReceipt.entity.ts index ea35a4e25..dd3bc03a5 100644 --- a/packages/worker/src/entities/transactionReceipt.entity.ts +++ b/packages/worker/src/entities/transactionReceipt.entity.ts @@ -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; diff --git a/packages/worker/src/migrations/1730806000905-TxReceiptRootColumnNullable.ts b/packages/worker/src/migrations/1730806000905-TxReceiptRootColumnNullable.ts new file mode 100644 index 000000000..8031526c6 --- /dev/null +++ b/packages/worker/src/migrations/1730806000905-TxReceiptRootColumnNullable.ts @@ -0,0 +1,13 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class TxReceiptRootColumnNullable1730806000905 implements MigrationInterface { + name = "TxReceiptRootColumnNullable1730806000905"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "transactionReceipts" ALTER COLUMN "root" DROP NOT NULL`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "transactionReceipts" ALTER COLUMN "root" SET NOT NULL`); + } +}