Add rewards CSV verification script with tests - #626
Conversation
Introduces a CLI tool that cross-checks a solver-rewards transfers CSV against the corresponding Dune export before signing. How it works For each solver in the Dune CSV (sorted by address), the script expects up to three transfers in the transfers CSV in order: A COW quote rewaget (if above --cow-threshold) A native token tor solver address (if above --native-threshold). A COW solve reward above --cow-threshold) Any mismatch (wrong amount) is reported as an error with the expected vs. actual values. Usage python3 compare_output_files.py DUNE_CSV TRANSFERS_CSV --network arbitrum Networks: arbitrum, base, gnosis, mainnet. (todo add rest of the networks) Key flags: --tolerance (default 0.0001), --cow-threshold (default 1.0), --native-threshold (default 0.001). Tests python3 -m unittest
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
Removed unused COW token addresses for networks.
Corrected wording for clarity in documentation.
| "Required when --cow-safe-csv is used." | ||
| ), | ||
| ) | ||
| parser.add_argument( |
There was a problem hiding this comment.
This might need a bit of reworking now. In the sense that we know COW rewards are always distributed on mainnet wallets, and so it seems one should always select "mainnet" as a network.
Maybe in this first iteration of the automation, this parameter can be removed completely?
There was a problem hiding this comment.
Made it default to mainnet, and required to False
| native_threshold: float = DEFAULT_NATIVE_THRESHOLD, | ||
| tolerance: float = DEFAULT_TOLERANCE, | ||
| ) -> ComparisonReport: | ||
| """Order-dependent comparison of Dune rewards against a combined transfers list.""" |
There was a problem hiding this comment.
I am still not sure about this, tbh. Does this assume a specific ordering in the transfers? By doing a bit more testing, it seems to me it is indeed the case. If so, this should be lifted as i don't see any reason we should have this constraint.
We essentially have 2 reports, Dune and transfers, and we just want to make sure that they match. No assumption on the ordering in any of the 2 should be made.
| "mainnet": "0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab", | ||
| } | ||
|
|
||
| DEFAULT_COW_THRESHOLD = 1.0 # Don't expect a transfer for COW rewards below this. |
There was a problem hiding this comment.
The min native and COW transfers are configured per chain here
Line 349 in 2c213d6
So we should just pull them from there
harisang
left a comment
There was a problem hiding this comment.
This should be addressed
https://github.com/cowprotocol/solver-rewards/pull/626/changes#r3653818556
After some brief discussion, we decided to proceed as is and move the discussion to a separate issue to be decided before the next version of the verification script |
Introduces a CLI tool that cross-checks a solver-rewards transfers CSV against the corresponding Dune export before signing.
How it works
For each solver in the Dune CSV (sorted by address), the script expects up to three transfers in the transfers CSV in order:
A COW quote rewaget (if above
--cow-threshold)
A native token tor solver address (if above --native-threshold). A COW solve reward above --cow-threshold) Any mismatch (wrong amount) is reported as an error with the expected vs. actual values.
Usage
python3 compare_output_files.py DUNE_CSV TRANSFERS_CSV --network arbitrum
Networks: arbitrum, base, gnosis, mainnet. (todo add rest of the networks)
Key flags: --tolerance (default 0.0001), --cow-threshold (default 1.0), --native-threshold (default 0.001).
Tests
python3 -m unittest