You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
At this moment some of our queries are fragile to the fact that, technically, multiple settlements could happen in a single block. For example, the recent query for fetching orders by transaction hash (introduced in #1194) whose raw SQL query assumes block number is unique per settlement.
We have included a todo with a rough sketch of how to handle this which I will also paste here.
with target_block_number as (
SELECT block_number from settlements where tx_hash = $1
),
with next_log_index as (
SELECT log_index from settlements
WHERE block_number > target_block_number
ORDER BY block_number ascLIMIT1
)
"SELECT ", ORDERS_SELECT,
"FROM ", ORDERS_FROM,
"JOIN trades t \ ON t.order_uid = o.uid \ JOIN settlements s \ ON s.block_number = t.block_number \ WHERE s.tx_hash = $1 "ANDt.log_index BETWEEN s.log_indexAND next_log_index,
Up until this moment, we do not yet have a single instance of multiple settlements in a single block (cf Settlements Table) so this issue is not of immediate concern. However, with the introduction of multiple solver accounts (#1010) we may see this sooner than expected.
The text was updated successfully, but these errors were encountered:
Seems like a reasonable alternative. The only reason we we didn't include it before is because it was considered redundant (which is no longer the case). I'm surprised the same order were included in two separate settlements... were they partially fillable orders?
It will be a bit of a task to populate all the existing records with their corresponding transaction hash, but at least we already have the values!
I'm surprised the same order were included in two separate settlements... were they partially fillable orders?
Orders weren't included in different settlements, there were just two settlements on the same block which caused the query to return incorrect data (i.e. the same list of orders for two separate transactions).
At this moment some of our queries are fragile to the fact that, technically, multiple settlements could happen in a single block. For example, the recent query for fetching orders by transaction hash (introduced in #1194) whose raw SQL query assumes block number is unique per settlement.
We have included a todo with a rough sketch of how to handle this which I will also paste here.
Up until this moment, we do not yet have a single instance of multiple settlements in a single block (cf Settlements Table) so this issue is not of immediate concern. However, with the introduction of multiple solver accounts (#1010) we may see this sooner than expected.
The text was updated successfully, but these errors were encountered: