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

Add Gelato API Module #839

Merged
merged 2 commits into from
Nov 28, 2022
Merged

Add Gelato API Module #839

merged 2 commits into from
Nov 28, 2022

Conversation

nlordell
Copy link
Contributor

Follow up to #599

I previously experimented with a Gelato relay service submitter in #599. The idea is to allow a separate relay service to execute settlement transactions on behalf of solvers so that they don't have to worry about execution details.

This PR is the first in a stack of 3 for enabling Gelato submission support. I am basically just breaking down the existing #599 into smaller pieces to make them easier to review and "self-contained".

In the following PRs I will:

  1. Introduce the Solver trampoline contract and settlement signing.
  2. Implement a Gelato submitter using the API introduced in this PR executed over the solver trampoline.

Test Plan

Added a manual test for executing a transaction over the Gelato relay. Requires a 1Balance account with an API key.

% cargo test -p shared -- --ignored --nocapture gelato_api
   Compiling shared v0.1.0 (/Users/nlordell/Developer/cowprotocol/services/crates/shared)
    Finished test [unoptimized + debuginfo] target(s) in 14.19s
     Running unittests src/lib.rs (target/debug/deps/shared-b80690e295f197ca)

running 1 test
executing task 0xf75fd1215ac82c0b77b58bf0f51537184f621bba41db847cc7ba2a7920e4cca1
task is CheckPending...
task is CheckPending...
task is CheckPending...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task is WaitingForConfirmation...
task executed 0x00f1e1ebeff7df0cf7bd1b27b478085d842b7e0af99478a939b2a68ed6ba9c23
test gelato_api::tests::execute_transaction ... ok

Check the executed transaction on Görli: https://goerli.etherscan.io/tx/0x00f1e1ebeff7df0cf7bd1b27b478085d842b7e0af99478a939b2a68ed6ba9c23.

@nlordell nlordell requested a review from a team as a code owner November 23, 2022 11:26
@vkgnosis
Copy link
Contributor

Is it useful to add this when we currently can't use Gelato because require knowing the submitting account and nonce to associate auctions with their tx hashes?
There are some ideas on how to work around that but I don't think this is usable until then.

@nlordell
Copy link
Contributor Author

nlordell commented Nov 23, 2022

There are some ideas on how to work around that but I don't think this is usable until then.

We plan on experimenting with it on test-nets and layer 2s where solver rewards aren't needed. Until the, the autopilot should classify it as a "foreign settlement transaction" which is fine.

For the submitter - I can add a assert!(chain_id != 1) check to prevent from accidental misuse.

@nlordell
Copy link
Contributor Author

For the submitter - I can add a assert!(chain_id != 1) check to prevent from accidental misuse.

Actually, this isn't needed because the SolverTrampoline contract isn't available on any other network at the moment (and needs to be an allow-listed solver anyway). Without this contract, relayed settlements don't work.

Copy link
Contributor

@sunce86 sunce86 left a comment

Choose a reason for hiding this comment

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

I've noticed there is no gas price in the request sent to API.
After reading the docs, saw that there is a gas price oracle we are not using, and also we don't define a cap on maximum cost we are willing to pay for a transaction.

Code LG overall. I think we can address this concerns in the follow up PR (if needed)

crates/shared/src/gelato_api.rs Outdated Show resolved Hide resolved
Nicholas Rodrigues Lordello added 2 commits November 28, 2022 18:09
@nlordell nlordell enabled auto-merge (squash) November 28, 2022 17:13
@nlordell nlordell merged commit ea625f2 into main Nov 28, 2022
@nlordell nlordell deleted the gelato-api branch November 28, 2022 17:14
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2022
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.

5 participants