-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: transfers from Bootloader to an operator address (#87)
# What ❔ Fix for transfers from Bootloader to an operator address. ## Why ❔ Not all transfers from Bootloader are _Refunds_. In blocks with no transactions transfers from Bootloader to an operator address are _Transfers_ and have to be saved accordingly. ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [X] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [X] Tests for the changes have been added / updated.
- Loading branch information
1 parent
2e252da
commit c080938
Showing
6 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ tests/e2e/artifacts/ | |
|
||
# Logs | ||
logs | ||
!/packages/worker/test/logs/ | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
|
22 changes: 22 additions & 0 deletions
22
packages/worker/src/migrations/1699955766418-SetTransferTypeForEmptyBlockTransfers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class SetTransferTypeForEmptyBlockTransfers1699955766418 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
WITH "updatedTransferNumbers" AS | ||
( | ||
UPDATE transfers | ||
SET "type" = 'transfer', "isFeeOrRefund" = false, "isInternal" = true | ||
WHERE "transactionHash" IS NULL | ||
RETURNING number | ||
) | ||
UPDATE "addressTransfers" | ||
SET "isFeeOrRefund" = false, "isInternal" = true | ||
FROM "updatedTransferNumbers" | ||
WHERE "transferNumber" = "updatedTransferNumbers"."number" | ||
`); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
public async down(): Promise<void> {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
{ | ||
"blockNumber": 6711853, | ||
"blockHash": "0xe9b0940095e6e708deebd75fa0320cad868ec5029f92cf8cc8fb464314f5141e", | ||
"transactionIndex": 0, | ||
"removed": false, | ||
"address": "0x000000000000000000000000000000000000800A", | ||
"data": "0x00000000000000000000000000000000000000000000000000f22ec29c9c4980", | ||
"topics": [ | ||
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", | ||
"0x0000000000000000000000000000000000000000000000000000000000008001", | ||
"0x000000000000000000000000a9232040bf0e0aea2578a5b2243f2916dbfc0a69" | ||
], | ||
"transactionHash": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"logIndex": 0, | ||
"l1BatchNumber": 76725 | ||
} | ||
] |