Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Epic] Solver Auction CIP #27

Open
4 of 6 tasks
bh2smith opened this issue Feb 15, 2023 · 1 comment
Open
4 of 6 tasks

[Epic] Solver Auction CIP #27

bh2smith opened this issue Feb 15, 2023 · 1 comment

Comments

@bh2smith
Copy link
Contributor

bh2smith commented Feb 15, 2023

Solvers are changing their reward structure (yet again) and we will need to adapt what information is synced.

@bh2smith
Copy link
Contributor Author

Since I don't think its very appropriate to create even a draft PR in an external repo before we are prepared to utilize it, I will prepare the "spell" code here for later use.

{{ config(alias='batch_rewards',
        post_hook='{{ expose_spells_hide_trino(\'["ethereum"]\',
                                    "project",
                                    "cow_protocol",
                                    \'["bh2smith"]\') }}'
)}}

-- PoC Query here - <PROVIDE QUERY URL>
select
    distinct tx_hash,
    block_number,
    solver,
    data.reward_eth as unbound_reward,
    data.execution_cost,
    data.participants
from {{ source('cowswap', 'raw_batch_rewards') }}

From this we would write a parameterized query to dynamically impose reward capping as follows

select 
    tx_hash, 
    solver, 
    min(max(-{{EPSILON}}, unbound_reward), {{EPSILON}} + execution_cost) 
from batch_rewards

For participation distribution we would build another query that "unnests" or "explodes" the participants array and transposes.

with expanded_participation as (
    select 
        block_number,
        tx_hash,
        explode(participants) as participant
    from batch_rewards
)

select 
    participant, 
    count(*) as num_solutions 
from expanded_participation

bh2smith added a commit that referenced this issue Feb 23, 2023
As part of #27 we implement the Raw Orderbook query that will be used to extract the data to be synced with Dune. The follow up to this PR will implement the python script executing this that is also responsible for transforming it into the JSON files being uploaded to Dune's AWS bucket.

Solvers are expected to change their rewards to the following

reward(txHash) = observedQuality - referenceScore

where observedQuality = Surplus + Fee

Furthermore, the reward per batch is planned to be capped by [-E, E + executionCosts]  (E = 0.01 ETH)

This query joins several tables in order to provide all terms required to evaluate the reward (namely surplus, fee, execution_cost, reference_score). winning_score is included too which is not really necessary but more for transparency.

Furthermore, it is expected that if the total allocated rewards for each accounting period are not reached, then we are to distribute the remaining funds according to the solver participation (found also as a field returned by this query).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant