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

pcli q dex simulate reports unclaimed arbs #4299

Closed
hdevalence opened this issue May 1, 2024 · 4 comments
Closed

pcli q dex simulate reports unclaimed arbs #4299

hdevalence opened this issue May 1, 2024 · 4 comments
Assignees
Labels
A-client Area: Design and implementation for client functionality A-dex Area: Relates to the dex C-bug Category: a bug _P-high High priority _P-V1 Priority: slated for V1 release
Milestone

Comments

@hdevalence
Copy link
Member

Describe the bug
Running pcli q dex simulate gave the following output:

~ $ pcli q dex simulate 1000gm --into gn
Scanning blocks from last sync height 86484 to latest height 86484
[0s] ██████████████████████████████████████████████████       0/0       0/s ETA: 0s
507.771569gm => 506.96109gn via:
    Trace                                                                    Subprice
    183.161906gm =>                                            183.070325gn  1.000501gm/1gn
    200.100051gm =>                                            200gn         1.000501gm/1gn
    2.019324gm =>    6.441643penumbra =>                       2.013013gn    1.003136gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    551.244mgm =>    548.487mgn =>        1.755158penumbra =>  548.486mgn    1.005029gm/1gn
    551.244mgm =>    548.487mgn =>        1.755158penumbra =>  548.486mgn    1.005029gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
    2.02313gm =>     2.013014gn =>        6.441643penumbra =>  2.013013gn    1.005026gm/1gn
~ $

There is one thing wrong here and one thing that's suspicious.

  1. This is reproducible (at least at the moment), implying that an arb involving the penumbra token persists across block boundaries, which shouldn't happen.
  2. The exact same values appear over and over again, so either there are many of the exact same position (unlikely) or something is wrong with the execution (could this be dex: fix frontier cache incoherence #4283 @erwanor ?)

Can we check the log entries for this block height to see if the arb is erroring out and cancelling @conorsch ?

@github-project-automation github-project-automation bot moved this to Backlog in Penumbra May 1, 2024
@github-actions github-actions bot added the needs-refinement unclear, incomplete, or stub issue that needs work label May 1, 2024
@cratelyn cratelyn added C-bug Category: a bug A-dex Area: Relates to the dex labels May 1, 2024
@erwanor
Copy link
Member

erwanor commented May 1, 2024

We hit the price limit for that block a little bit later:

DEBUG abci:EndBlock{height=86484}:end_block{height=86484}:dex:arbitrage:route_and_fill:path_search{max_hops=6}: penumbra_dex::component::router::path_search: found path price=1 spill_price=1.0126984126984127 src=passet1984fctenw8m2fpl8a9wzguzp7j34d7vravryuhft808nyt9fdggqxmanqm nodes=[]

...

DEBUG abci:EndBlock{height=86484}:end_block{height=86484}:dex:arbitrage:route_and_fill:path_search{max_hops=6}: penumbra_dex::component::router::path_search: path too expensive price=1 price_limit=1

@cratelyn cratelyn added the A-client Area: Design and implementation for client functionality label May 6, 2024
@aubrika aubrika added _P-V1 Priority: slated for V1 release _P-high High priority and removed needs-refinement unclear, incomplete, or stub issue that needs work labels May 8, 2024
@aubrika aubrika added this to the Sprint 7 milestone May 14, 2024
@zbuc zbuc self-assigned this May 28, 2024
@zbuc
Copy link
Contributor

zbuc commented May 28, 2024

It seems kind of odd to ever perform this routing, since you lose gn in the process:

2.013014gn => 6.441643penumbra => 2.013013gn

@hdevalence
Copy link
Member Author

It seems like this could have been caused by #4283 ?

@aubrika aubrika moved this from Backlog to In progress in Penumbra May 29, 2024
@zbuc zbuc mentioned this issue May 30, 2024
1 task
@aubrika aubrika modified the milestones: Sprint 7, Sprint 8 Jun 3, 2024
@zbuc
Copy link
Contributor

zbuc commented Jun 12, 2024

This doesn't seem to be a bug involving unclaimed arb and is a side effect of the design of our routing algorithm. @erwanor is working on implementing some changes to speed up routing and additional dex metrics will provide observability into dex routing performance. I don't think there are any changes that need to happen specific to this issue.

@zbuc zbuc closed this as completed Jun 12, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Penumbra Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-client Area: Design and implementation for client functionality A-dex Area: Relates to the dex C-bug Category: a bug _P-high High priority _P-V1 Priority: slated for V1 release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants