Skip to content

Add rewards CSV verification script with tests - #626

Merged
harisang merged 11 commits into
mainfrom
payouts-verification-script
Jul 27, 2026
Merged

Add rewards CSV verification script with tests#626
harisang merged 11 commits into
mainfrom
payouts-verification-script

Conversation

@tamir-cow

Copy link
Copy Markdown
Contributor

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

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
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@tamir-cow

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jun 23, 2026
Comment thread src/verification/compare_output_files.py
Comment thread src/verification/compare_output_files.py Outdated
"Required when --cow-safe-csv is used."
),
)
parser.add_argument(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it default to mainnet, and required to False

Comment thread src/verification/compare_output_files.py
@tamir-cow
tamir-cow requested a review from harisang July 21, 2026 15:25
native_threshold: float = DEFAULT_NATIVE_THRESHOLD,
tolerance: float = DEFAULT_TOLERANCE,
) -> ComparisonReport:
"""Order-dependent comparison of Dune rewards against a combined transfers list."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The min native and COW transfers are configured per chain here

min_native_token_transfer = 10**6

So we should just pull them from there

@harisang harisang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harisang

Copy link
Copy Markdown
Contributor

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
#630

@harisang
harisang merged commit ec8e7c9 into main Jul 27, 2026
5 checks passed
@harisang
harisang deleted the payouts-verification-script branch July 27, 2026 11:20
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants