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

chore: Helpful error logs for quotes failing verification #2317

Closed
MartinquaXD opened this issue Jan 23, 2024 · 4 comments
Closed

chore: Helpful error logs for quotes failing verification #2317

MartinquaXD opened this issue Jan 23, 2024 · 4 comments
Labels
E:3.2 Verified Quotes See https://github.com/cowprotocol/pm/issues/15 for details

Comments

@MartinquaXD
Copy link
Contributor

Background

Because the trader does not execute their trade on their own verifying quotes as accurately as possible is quite tricky.
We need to use simulations and state overrides which are notoriously tricky to get any useful information out.

Details

We need to make sure that quotes that get discarded because they failed the verification at least report a reasonable indicator why they did so without making the on-call engineer go through the process of recreating the complex simulation using tenderly.

The easiest way to do it is probably to adjust the solidity code used for the simulation to rigorously check pre- and post-conditions of calls and revert early with a helpful message.
Then we should print this revert message so we can easily recover it from the logs.

Testing this exhaustively is probably too complex to be worth it but we should probably have at least 1 e2e test that shows that quotes correctly get discarded when they fail the verification.

@MartinquaXD MartinquaXD added the E:3.2 Verified Quotes See https://github.com/cowprotocol/pm/issues/15 for details label Jan 23, 2024
@fleupold
Copy link
Contributor

Maybe we could also print a tenderly link containing all relevant state overrides making it one click to load the failed simulation?

@MartinquaXD
Copy link
Contributor Author

Simply logging a tenderly link will likely not work.
In the old solver we already logged tenderly links which only contained the calldata of the settlement and this link was already too long to copy and open in browsers (at least in firefox).
I always had to copy everything but the calldata and then manually paste the calldata in the UI. The same thing will be horrible for state overrides.
What we could alternatively try out is logging a curl command that you can copy and run in your terminal. I assume this would not run into the same limitations.

@fleupold
Copy link
Contributor

Your are right. Nick also found a way to use the tenderly API to create those simulations in our workspace and then only share the simulation ID (not sure if this is something we can do at scale though).

But at the end of the day I think it's fine to log a json or some other content and we can write a script in the infra devcontainer to turn it into a human digestible simulation.

@MartinquaXD
Copy link
Contributor Author

Since #2391 and friends were merged debugging verified quotes became very easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E:3.2 Verified Quotes See https://github.com/cowprotocol/pm/issues/15 for details
Projects
None yet
Development

No branches or pull requests

2 participants