This repository was archived by the owner on Dec 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,11 @@ reward_data AS (
361
361
end as fee,
362
362
-- scores
363
363
winning_score,
364
+ case
365
+ when block_number is not null
366
+ and block_number <= block_deadline then winning_score
367
+ else 0
368
+ end as observed_score,
364
369
reference_score,
365
370
-- auction_participation
366
371
participating_solvers,
@@ -390,12 +395,12 @@ reward_per_auction as (
390
395
surplus,
391
396
protocol_fee, -- the protocol fee
392
397
fee - network_fee_correction as network_fee, -- the network fee
393
- surplus + protocol_fee - reference_score as uncapped_payment,
398
+ observed_score - reference_score as uncapped_payment,
394
399
-- Capped Reward = CLAMP_[-E, E + exec_cost](uncapped_reward_eth)
395
400
LEAST(
396
401
GREATEST(
397
402
- {{EPSILON_LOWER}},
398
- surplus + protocol_fee - reference_score
403
+ observed_score - reference_score
399
404
),
400
405
{{EPSILON_UPPER}}
401
406
) as capped_payment,
Original file line number Diff line number Diff line change @@ -361,6 +361,11 @@ reward_data AS (
361
361
end as fee,
362
362
-- scores
363
363
winning_score,
364
+ case
365
+ when block_number is not null
366
+ and block_number <= block_deadline then winning_score
367
+ else 0
368
+ end as observed_score,
364
369
reference_score,
365
370
-- auction_participation
366
371
participating_solvers,
@@ -390,12 +395,12 @@ reward_per_auction as (
390
395
surplus,
391
396
protocol_fee, -- the protocol fee
392
397
fee - network_fee_correction as network_fee, -- the network fee
393
- surplus + protocol_fee - reference_score as uncapped_payment,
398
+ observed_score - reference_score as uncapped_payment,
394
399
-- Capped Reward = CLAMP_[-E, E + exec_cost](uncapped_reward_eth)
395
400
LEAST(
396
401
GREATEST(
397
402
- {{EPSILON_LOWER}},
398
- surplus + protocol_fee - reference_score
403
+ observed_score - reference_score
399
404
),
400
405
{{EPSILON_UPPER}}
401
406
) as capped_payment,
Original file line number Diff line number Diff line change @@ -252,22 +252,22 @@ def test_get_batch_rewards(self):
252
252
"8912931423922369" ,
253
253
],
254
254
"uncapped_payment_eth" : [
255
- "405658669881356 " ,
255
+ "405658366132340 " ,
256
256
"292618683544035" ,
257
257
"-13360904627424245" ,
258
258
"-12938581202699558" ,
259
259
"2823075137791897" ,
260
260
"9345865552057182" ,
261
- "1607086130097916 " ,
261
+ "1607086130097915 " ,
262
262
],
263
263
"capped_payment" : [
264
- "405658669881356 " ,
264
+ "405658366132340 " ,
265
265
"292618683544035" ,
266
266
"-10000000000000000" ,
267
267
"-10000000000000000" ,
268
268
"2823075137791897" ,
269
269
"9345865552057182" ,
270
- "1607086130097916 " ,
270
+ "1607086130097915 " ,
271
271
],
272
272
"winning_score" : [
273
273
"11327955072945657" ,
You can’t perform that action at this time.
0 commit comments