Skip to content

Commit

Permalink
Remove unneeded types
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMinkov committed Apr 24, 2023
1 parent 59b2c27 commit b833fa7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
15 changes: 6 additions & 9 deletions src/db/archive-node-adapter/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ function fullChainCTE(db_client: postgres.Sql) {
RECURSIVE pending_chain AS (
(
SELECT
id, state_hash, parent_hash, parent_id, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, last_vrf_output, min_window_density, sub_window_densities
id, state_hash, parent_hash, parent_id, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, last_vrf_output
FROM
blocks b
WHERE
height = (SELECT max(height) FROM blocks)
)
UNION ALL
SELECT
b.id, b.state_hash, b.parent_hash, b.parent_id, b.height, b.global_slot_since_genesis, b.global_slot_since_hard_fork, b.timestamp, b.chain_status, b.ledger_hash, b.last_vrf_output, b.min_window_density, b.sub_window_densities
b.id, b.state_hash, b.parent_hash, b.parent_id, b.height, b.global_slot_since_genesis, b.global_slot_since_hard_fork, b.timestamp, b.chain_status, b.ledger_hash, b.last_vrf_output
FROM
blocks b
INNER JOIN pending_chain ON b.id = pending_chain.parent_id
Expand All @@ -25,16 +24,16 @@ function fullChainCTE(db_client: postgres.Sql) {
),
full_chain AS (
SELECT
DISTINCT id, state_hash, parent_id, parent_hash, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, (SELECT max(height) FROM blocks) - height AS distance_from_max_block_height, last_vrf_output, min_window_density, sub_window_densities
DISTINCT id, state_hash, parent_id, parent_hash, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, (SELECT max(height) FROM blocks) - height AS distance_from_max_block_height, last_vrf_output
FROM
(
SELECT
id, state_hash, parent_id, parent_hash, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, last_vrf_output, min_window_density, sub_window_densities
id, state_hash, parent_id, parent_hash, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, last_vrf_output
FROM
pending_chain
UNION ALL
SELECT
id, state_hash, parent_id, parent_hash, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, last_vrf_output, min_window_density, sub_window_densities
id, state_hash, parent_id, parent_hash, height, global_slot_since_genesis, global_slot_since_hard_fork, timestamp, chain_status, ledger_hash, last_vrf_output
FROM
blocks b
WHERE
Expand Down Expand Up @@ -86,9 +85,7 @@ function blocksAccessedCTE(
chain_status,
ledger_hash,
distance_from_max_block_height,
last_vrf_output,
min_window_density,
sub_window_densities
last_vrf_output
FROM
account_identifier ai
INNER JOIN accounts_accessed aa ON ai.requesting_zkapp_account_identifier_id = aa.account_identifier_id
Expand Down
4 changes: 0 additions & 4 deletions src/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export type BlockInfo = {
globalSlotSinceGenesis: number;
distanceFromMaxBlockHeight: number;
lastVrfOutput: string;
minWindowDensity: string;
subWindowDensities: string[];
};

export type TransactionInfo = {
Expand Down Expand Up @@ -97,8 +95,6 @@ export type ArchiveNodeDatabaseRow = {
zkapp_event_element_ids: number[];
zkapp_event_array_id: number;
last_vrf_output: string;
min_window_density: string;
sub_window_densities: string[];
action_state_value1?: string;
action_state_value2?: string;
action_state_value3?: string;
Expand Down
2 changes: 0 additions & 2 deletions src/models/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export function createBlockInfo(row: ArchiveNodeDatabaseRow) {
globalSlotSinceGenesis: Number(row.global_slot_since_genesis),
distanceFromMaxBlockHeight: Number(row.distance_from_max_block_height),
lastVrfOutput: row.last_vrf_output,
minWindowDensity: row.min_window_density,
subWindowDensities: row.sub_window_densities,
} as BlockInfo;
}

Expand Down

0 comments on commit b833fa7

Please sign in to comment.