@@ -31,59 +31,59 @@ SELECT
3131 validator_index,
3232 balance_start
3333FROM _final_validator_dashboard_data_epoch
34- WHERE epoch = GREATEST(
34+ WHERE epoch_timestamp = {genesis_epoch_ts:DateTime} + ( GREATEST(
3535 0 ,
3636 CEIL(
3737 (
3838 toStartOfHour({fork_epoch_ts:DateTime})::DateTime - {genesis_epoch_ts:DateTime}
3939 ) / {epoch_duration:Int64}
4040 )
41- )
41+ ) * {epoch_duration:Int64})
4242UNION ALL
4343SELECT
4444 epoch,
4545 toStartOfDay({fork_epoch_ts:DateTime}) as t,
4646 validator_index,
4747 balance_start
4848FROM _final_validator_dashboard_data_epoch
49- WHERE epoch = GREATEST(
49+ WHERE epoch_timestamp = {genesis_epoch_ts:DateTime} + ( GREATEST(
5050 0 ,
5151 CEIL(
5252 (
5353 toStartOfDay({fork_epoch_ts:DateTime})::DateTime - {genesis_epoch_ts:DateTime}
5454 ) / {epoch_duration:Int64}
5555 )
56- )
56+ ) * {epoch_duration:Int64})
5757UNION ALL
5858SELECT
5959 epoch,
6060 toMonday({fork_epoch_ts:DateTime}) as t,
6161 validator_index,
6262 balance_start
6363FROM _final_validator_dashboard_data_epoch
64- WHERE epoch = GREATEST(
64+ WHERE epoch_timestamp = {genesis_epoch_ts:DateTime} + ( GREATEST(
6565 0 ,
6666 CEIL(
6767 (
6868 toMonday({fork_epoch_ts:DateTime})::DateTime - {genesis_epoch_ts:DateTime}
6969 ) / {epoch_duration:Int64}
7070 )
71- )
71+ ) * {epoch_duration:Int64})
7272UNION ALL
7373SELECT
7474 epoch,
7575 toStartOfMonth({fork_epoch_ts:DateTime}) as t,
7676 validator_index,
7777 balance_start
7878FROM _final_validator_dashboard_data_epoch
79- WHERE epoch = GREATEST(
79+ WHERE epoch_timestamp = {genesis_epoch_ts:DateTime} + ( GREATEST(
8080 0 ,
8181 CEIL(
8282 (
8383 toStartOfMonth({fork_epoch_ts:DateTime})::DateTime - {genesis_epoch_ts:DateTime}
8484 ) / {epoch_duration:Int64}
8585 )
86- )
86+ ) * {epoch_duration:Int64})
8787-- +goose StatementEnd
8888-- +goose StatementBegin
8989SYSTEM SYNC REPLICA _tmp_fix_epoch_balance_start LIGHTWEIGHT;
0 commit comments