Skip to content

Commit

Permalink
Disable participation rewards after July 23, 2024 (#376)
Browse files Browse the repository at this point in the history
This PR enforces CIP-48 by removing participation rewards starting with
the accounting week of July 23 - July 30.
  • Loading branch information
harisang authored Jul 29, 2024
1 parent a9f52b4 commit 7215ba7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
16 changes: 14 additions & 2 deletions queries/orderbook/barn_batch_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,28 @@ reward_per_auction as (
participation_data as (
SELECT
tx_hash,
block_deadline,
unnest(participating_solvers) as participant
FROM
reward_per_auction
),
participation_data_intermediate as (
SELECT
tx_hash,
CASE
WHEN block_deadline <= 20365510 THEN 1 -- final block deadline of accounting week of July 16 - July 23, 2024
ELSE 0
END as count_participation,
participant
FROM
participation_data
),
participation_counts as (
SELECT
participant as solver,
count(*) as num_participating_batches
sum(count_participation) as num_participating_batches
FROM
participation_data
participation_data_intermediate
GROUP BY
participant
),
Expand Down
16 changes: 14 additions & 2 deletions queries/orderbook/prod_batch_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,28 @@ reward_per_auction as (
participation_data as (
SELECT
tx_hash,
block_deadline,
unnest(participating_solvers) as participant
FROM
reward_per_auction
),
participation_data_intermediate as (
SELECT
tx_hash,
CASE
WHEN block_deadline <= 20365510 THEN 1 -- final block deadline of accounting week of July 16 - July 23, 2024
ELSE 0
END as count_participation,
participant
FROM
participation_data
),
participation_counts as (
SELECT
participant as solver,
count(*) as num_participating_batches
sum(count_participation) as num_participating_batches
FROM
participation_data
participation_data_intermediate
GROUP BY
participant
),
Expand Down
5 changes: 5 additions & 0 deletions src/fetch/payouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ def extend_payment_df(pdf: DataFrame, converter: TokenConversion) -> DataFrame:
0,
)
participation_total = pdf["num_participating_batches"].sum()
if participation_total == 0:
# Due to CIP-48 we will stop counting participation. This workaround avoids
# division by zero as the num_participation_batches is set to zero for all
# solvers after CIP-48.
participation_total = 1
pdf["secondary_reward_cow"] = (
secondary_allocation * pdf["num_participating_batches"] / participation_total
)
Expand Down

0 comments on commit 7215ba7

Please sign in to comment.