-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add block_number to order_execution (#2339)
# Description Adds `block_number` column to db table `order_execution`. This is to make the table reorg friendly, meaning, whenever reorg happens, event updater will also delete all entries in this table that are from reorged block. This enables us to remove the delay of 64 blocks in the `OnSettlementEventUpdater` component. Removal will be implemented in a separate PR so that it can be easily reverted if need be.
- Loading branch information
Showing
6 changed files
with
30 additions
and
7 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
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
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,11 @@ | ||
ALTER TABLE order_execution | ||
ADD COLUMN block_number bigint NOT NULL DEFAULT 0; | ||
|
||
-- Populate block_number for existing records | ||
UPDATE order_execution | ||
SET block_number = settlements.block_number | ||
FROM settlements | ||
WHERE order_execution.auction_id = settlements.auction_id; | ||
|
||
ALTER TABLE order_execution | ||
ALTER COLUMN block_number DROP DEFAULT; |