Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make tx receipt root field nullable #308

Merged
merged 2 commits into from
Nov 5, 2024
Merged
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
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;
Comment on lines +39 to +40
Copy link
Member

Choose a reason for hiding this comment

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

Maybe makes sense leaving a comment that this field is only relevant on L1 pre byzantium fork (EIP658), but was present in ZKsync API before, so it cannot be just dropped.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea, done.


@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`);
vasyl-ivanchuk marked this conversation as resolved.
Show resolved Hide resolved
}
}
Loading