Skip to content

Commit

Permalink
Update preprod test data
Browse files Browse the repository at this point in the history
update query
  • Loading branch information
seanmcgary committed Dec 12, 2024
1 parent 54734c8 commit a2dce49
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 45 deletions.
2 changes: 1 addition & 1 deletion internal/tests/testdata/combinedRewards/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ select
duration,
block_number as block_number
from dbt_preprod_holesky_rewards.rewards_combined
where block_time < '2024-12-10'
where block_time < '2024-12-13'
```
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ FROM transaction_logs t
LEFT JOIN blocks b ON t.block_sequence_id = b.id
WHERE t.address = '0x141d6995556135d4997b2ff72eb443be300353bc'
AND t.event_name = 'OperatorAVSRegistrationStatusUpdated'
AND date_trunc('day', b.block_time) < TIMESTAMP '2024-12-10'
AND date_trunc('day', b.block_time) < TIMESTAMP '2024-12-13'
)
select
operator,
Expand Down
44 changes: 26 additions & 18 deletions internal/tests/testdata/operatorDirectedRewardSubmissions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,36 @@

```sql
WITH strategies AS (
SELECT
tl.*,
output_data->'operatorDirectedRewardsSubmission'->>'token' as token,
SELECT
tl.*,
lower(arguments #>> '{2, Value}') as reward_hash,
output_data->'operatorDirectedRewardsSubmission'->>'token' as token,
output_data->'operatorDirectedRewardsSubmission'->>'duration' as duration,
output_data->'operatorDirectedRewardsSubmission'->>'startTimestamp' as start_timestamp,
strategy_data,
strategy_idx - 1 as strategy_idx -- Subtract 1 for 0-based indexing
FROM transaction_logs as tl,
jsonb_array_elements(output_data->'operatorDirectedRewardsSubmission'->'strategiesAndMultipliers')
WITH ORDINALITY AS t(strategy_data, strategy_idx)
where
FROM transaction_logs as tl,
jsonb_array_elements(output_data->'operatorDirectedRewardsSubmission'->'strategiesAndMultipliers')
WITH ORDINALITY AS t(strategy_data, strategy_idx)
where
address = '0xb22ef643e1e067c994019a4c19e403253c05c2b0'
and event_name = 'OperatorDirectedAVSRewardsSubmissionCreated'
),
operators AS (
SELECT
and event_name = 'OperatorDirectedAVSRewardsSubmissionCreated'
),
operators AS (
SELECT
lower(arguments #>> '{2, Value}') as reward_hash,
operator_data,
operator_data->>'operator' as operator,
output_data->'operatorDirectedRewardsSubmission' as rewards_submission,
operator_idx - 1 as operator_idx -- Subtract 1 to make it 0-based indexing
FROM transaction_logs,
jsonb_array_elements(output_data->'operatorDirectedRewardsSubmission'->'operatorRewards')
WITH ORDINALITY AS t(operator_data, operator_idx)
where
FROM transaction_logs,
jsonb_array_elements(output_data->'operatorDirectedRewardsSubmission'->'operatorRewards')
WITH ORDINALITY AS t(operator_data, operator_idx)
where
address = '0xb22ef643e1e067c994019a4c19e403253c05c2b0'
and event_name = 'OperatorDirectedAVSRewardsSubmissionCreated'
)
and event_name = 'OperatorDirectedAVSRewardsSubmissionCreated'
),
joined_data as (
SELECT
lower(arguments #>> '{1, Value}') as avs,
lower(arguments #>> '{2, Value}') as reward_hash,
Expand All @@ -45,5 +49,9 @@ SELECT
transaction_hash,
log_index
FROM strategies
CROSS JOIN operators;
inner join operators on(
strategies.reward_hash = operators.reward_hash
)
)
select * from joined_data
```
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ select
avs_directory_address
from operator_restaked_strategies
where avs_directory_address = '0x141d6995556135d4997b2ff72eb443be300353bc'
and block_time < '2024-12-10'
and block_time < '2024-12-13'
```

## Expected results
Expand Down
2 changes: 1 addition & 1 deletion internal/tests/testdata/operatorShareSnapshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ preprod-rewardsV2
select
*
from dbt_preprod_holesky_rewards.operator_shares
where block_time < '2024-12-10'
where block_time < '2024-12-13'
```

## Expected results
Expand Down
4 changes: 2 additions & 2 deletions internal/tests/testdata/operatorShares/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ SELECT
FROM (
SELECT operator, strategy, shares, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_testnet_holesky_rewards.operator_share_increases
where block_date < '2024-12-10'
where block_date < '2024-12-13'

UNION ALL

SELECT operator, strategy, shares * -1 AS shares, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_testnet_holesky_rewards.operator_share_decreases
where block_date < '2024-12-10'
where block_date < '2024-12-13'
) combined_shares
```
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ FROM (
UNION ALL
SELECT *, 'delegations' AS src FROM dbt_preprod_holesky_rewards.staker_delegations
) as delegations_combined
where block_time < '2024-12-10'
where block_time < '2024-12-13'
```


Expand Down
2 changes: 1 addition & 1 deletion internal/tests/testdata/stakerShareSnapshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ select
block_date,
block_number
from dbt_preprod_holesky_rewards.staker_shares
where block_time < '2024-12-10'
where block_time < '2024-12-13'
```

## Expected results
Expand Down
36 changes: 18 additions & 18 deletions internal/tests/testdata/stakerShares/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,28 @@ SELECT
block_date,
block_number
FROM (
SELECT staker, strategy, shares, 0 as strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_mainnet_ethereum_rewards.staker_deposits
where block_date < '2024-08-20'
SELECT staker, strategy, shares, 0 as strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_preprod_holesky_rewards.staker_deposits
where block_date < '2024-12-13'

UNION ALL
UNION ALL

-- Subtract m1 & m2 withdrawals
SELECT staker, strategy, shares * -1, 0 as strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_mainnet_ethereum_rewards.m1_staker_withdrawals
where block_date < '2024-08-20'
-- Subtract m1 & m2 withdrawals
SELECT staker, strategy, shares * -1, 0 as strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_preprod_holesky_rewards.m1_staker_withdrawals
where block_date < '2024-12-13'

UNION ALL
UNION ALL

SELECT staker, strategy, shares * -1, strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_mainnet_ethereum_rewards.m2_staker_withdrawals
where block_date < '2024-08-20'
SELECT staker, strategy, shares * -1, strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_preprod_holesky_rewards.m2_staker_withdrawals
where block_date < '2024-12-13'

UNION all
UNION all

-- Shares in eigenpod are positive or negative, so no need to multiply by -1
SELECT staker, '0xbeac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac0' as strategy, shares, 0 as strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_mainnet_ethereum_rewards.eigenpod_shares
where block_date < '2024-08-20'
) combined_staker_shares
-- Shares in eigenpod are positive or negative, so no need to multiply by -1
SELECT staker, '0xbeac0eeeeeeeeeeeeeeeeeeeeeeeeeeeeeebeac0' as strategy, shares, 0 as strategy_index, transaction_hash, log_index, block_time, block_date, block_number
FROM dbt_preprod_holesky_rewards.eigenpod_shares
where block_date < '2024-12-13'
) combined_staker_shares
```
2 changes: 1 addition & 1 deletion pkg/rewards/rewardsV2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func Test_RewardsV2(t *testing.T) {
t.Log("Hydrated tables")

snapshotDates := []string{
"2024-12-12",
"2024-12-14",
}

fmt.Printf("Hydration duration: %v\n", time.Since(testStart))
Expand Down

0 comments on commit a2dce49

Please sign in to comment.