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

dex: integration debugging #2459

Merged
merged 2 commits into from
May 4, 2023
Merged

dex: integration debugging #2459

merged 2 commits into from
May 4, 2023

Conversation

hdevalence
Copy link
Member

Something's still wrong here, because we're doing pessimal routing:

cargo run --release --bin pcli -- -n http://localhost:8080 tx position order sell 200penumbra@1.3gm
cargo run --release --bin pcli -- -n http://localhost:8080 tx position order sell 20penumbra@1.2gm
cargo run --release --bin pcli -- -n http://localhost:8080 tx position order sell 10penumbra@1.1gm
cargo run --release --bin pcli -- -n http://localhost:8080 q dex liquidity-positions
 ID                                                                Trading Pair    State   Reserves  Trading Function
 plpid1drwgws98rry6xqcax9dtavfh3s4j7u6sr2mdd43qsm775ultm3pql8rleg  (gm, penumbra)  opened  (0, 10)   fee: 0bps, p/q: 1.100000, q/p: 0.909091
 plpid1rzrcq2rm6pgdtv2ffxfry92zaxek0z4vjwl423r3j5vduyz0mveq4k4yjm  (gm, penumbra)  opened  (0, 200)  fee: 0bps, p/q: 1.300000, q/p: 0.769231
 plpid1vzkrgpshpnchlfyvncpku6kzqvze2d8f4ydk0jjqlruy3z7tx4qstxr79j  (gm, penumbra)  opened  (0, 20)   fee: 0bps, p/q: 1.200000, q/p: 0.833333
     Running `target/release/pcli -n 'http://localhost:8080' tx swap 80gm --into penumbra`
2023-05-03T17:44:08.032733Z  INFO pcli::opt: using local view service path=/Users/hdevalence/Library/Application Support/zone.penumbra.pcli/pcli-view.sqlite
2023-05-03T17:44:08.062440Z  INFO penumbra_view::worker: starting client sync
Scanning blocks from last sync height 45 to latest height 45
[0s] ██████████████████████████████████████████████████       0/0       0/s ETA: 0s
building transaction...
finished proving in 1.991 seconds [3 actions, 2 proofs, 2361 bytes]
broadcasting transaction and awaiting confirmation...
transaction confirmed and detected: a1e1706e1f0720646e30c473e3862df8d5f090c2f33a6cb71e232f57fd0e2527
Swap submitted and batch confirmed!
You will receive outputs of 0ugm and 104penumbra. Claiming now...
building transaction...
finished proving in 0.001 seconds [1 actions, 0 proofs, 3162 bytes]
broadcasting transaction and awaiting confirmation...

But 104/80 = 1.3:

 ID                                                                Trading Pair    State   Reserves  Trading Function
 plpid1drwgws98rry6xqcax9dtavfh3s4j7u6sr2mdd43qsm775ultm3pql8rleg  (gm, penumbra)  opened  (0, 10)   fee: 0bps, p/q: 1.100000, q/p: 0.909091
 plpid1rzrcq2rm6pgdtv2ffxfry92zaxek0z4vjwl423r3j5vduyz0mveq4k4yjm  (gm, penumbra)  opened  (80, 96)  fee: 0bps, p/q: 1.300000, q/p: 0.769231
 plpid1vzkrgpshpnchlfyvncpku6kzqvze2d8f4ydk0jjqlruy3z7tx4qstxr79j  (gm, penumbra)  opened  (0, 20)   fee: 0bps, p/q: 1.200000, q/p: 0.833333

hdevalence and others added 2 commits May 3, 2023 17:49
Co-Authored-By: Chris Czub <chris@penumbralabs.xyz>
@hdevalence hdevalence force-pushed the fix-swap-rounding branch from 6c114b0 to bcbd3f6 Compare May 4, 2023 01:10
@hdevalence hdevalence temporarily deployed to smoke-test May 4, 2023 01:10 — with GitHub Actions Inactive
@hdevalence
Copy link
Member Author

The p and q were swapped, causing the prices to be inverted from what the user intended.

@hdevalence hdevalence merged commit ba0552f into main May 4, 2023
@hdevalence hdevalence deleted the fix-swap-rounding branch May 4, 2023 01:22
@cratelyn cratelyn added the A-dex Area: Relates to the dex label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dex Area: Relates to the dex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants