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

improve: more effectively estimate suggested fees quote #887

Merged
merged 4 commits into from
Oct 27, 2023

Conversation

james-a-morris
Copy link
Contributor

@james-a-morris james-a-morris commented Oct 27, 2023

We discovered a short circuit in the Vercel API's estimation of fee quotes.

This was causing a quote of roughly 80K gas units to make a fill.

The original recipient address being used on the FE is 0xBb23Cd0210F878Ea4CcA50e9dC307fb0Ed65Cf6B, which will incur a storage cost during the initial ERC20 transfer of 145,000 gas units. Properly passing recipientAddress in the suggested-fees endpoint on prod will incur 120,000 gas units.

In either case, we now default our recipient address to incur the storage cost of the ERC20 initializing a user's balance in the token.

Thus, the cost calculation will be preserved regardless of recipientAddress being provided and using the Across UI will produce a more accurate gas estimation making it the cheaper alternative over aggregators.

Closes: ACX-1643

@james-a-morris james-a-morris requested a review from pxrl October 27, 2023 14:29
@vercel
Copy link

vercel bot commented Oct 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frontend-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 27, 2023 4:38pm
goerli-frontend-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 27, 2023 4:38pm

Copy link
Member

@nicholaspai nicholaspai left a comment

Choose a reason for hiding this comment

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

Why?

@james-a-morris
Copy link
Contributor Author

james-a-morris commented Oct 27, 2023

Why?

I've further explained in the PR

@james-a-morris james-a-morris marked this pull request as draft October 27, 2023 14:39
@linear
Copy link

linear bot commented Oct 27, 2023

ACX-1643 API/SDK: Reports of underpriced deposits

After changes deployed to the API yesterday, community relayers reported a sharp uptick in the number of unprofitable deposits. The RL relayer is filling most of these at (small) loss, per reporting from mydefi.

Investigation indicates that the gas cost of the fill is being under-estimated by about 30k gas.

Update: resolved - see comments for conclusions.

image.png

@james-a-morris james-a-morris marked this pull request as ready for review October 27, 2023 16:11
@james-a-morris james-a-morris changed the title improve: use valued lp percent improve: estimate gas costs with smarter recipient address Oct 27, 2023
@james-a-morris james-a-morris changed the title improve: estimate gas costs with smarter recipient address improve: more effectively estimate suggested fees quote Oct 27, 2023
Copy link
Contributor

@pxrl pxrl left a comment

Choose a reason for hiding this comment

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

OK pending one query on the speed-up 👍

@james-a-morris
Copy link
Contributor Author

james-a-morris commented Oct 27, 2023

OK pending one query on the speed-up 👍

Whoops did not push the latest commit. Good eye.

Note: all A/B testing was done with recipientAddr rather than depositAddr

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

Successfully merging this pull request may close these issues.

3 participants