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 test for and fix arbitrage swap execution output amount #4287

Merged
merged 5 commits into from
May 1, 2024

Conversation

zbuc
Copy link
Member

@zbuc zbuc commented Apr 29, 2024

Describe your changes

This extends the existing arbitrage test to ensure that the created SwapExecution has the expected trace and input/output values, as well as fixes the bug described in #3790 where SwapExecutions were created with incorrect Output values.

Issue ticket number and link

#3790

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label.

Additional Follow-up

This will require a migration to update the existing SwapExecution structures. The migration should be as simple as adding the input to the output for each of them.

@zbuc zbuc added the consensus-breaking breaking change to execution of on-chain data label Apr 29, 2024
@zbuc zbuc force-pushed the 3790_arbitrage_fix branch from 419051f to 0a6c792 Compare April 29, 2024 20:15
@zbuc zbuc force-pushed the 3790_arbitrage_fix branch from f3f2cd3 to 67ecb83 Compare April 29, 2024 21:50
@zbuc zbuc force-pushed the 3790_arbitrage_fix branch from 67ecb83 to af80b38 Compare April 29, 2024 22:56
@erwanor erwanor added state-breaking breaking change to on-chain data A-dex Area: Relates to the dex labels Apr 30, 2024
crates/bin/pd/src/migrate/testnet74.rs Outdated Show resolved Hide resolved
crates/bin/pd/src/migrate/testnet74.rs Show resolved Hide resolved
crates/bin/pd/src/migrate/testnet74.rs Outdated Show resolved Hide resolved
new_key = ?EscapedByteSlice(&new_key),
?old_key,
"updated liquidity index"
);
Copy link
Member

Choose a reason for hiding this comment

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

ACK, read through the code and it look correct to me, we:

  1. Create a (K, V) stream
  2. Pull the aggregate amount from the key @ 32 + 7..32 + 7 + 16
  3. Compute the complement, encode it as big endian
  4. Delete the old key
  5. Insert the new key

@zbuc zbuc force-pushed the 3790_arbitrage_fix branch from b006f0c to d6565ba Compare May 1, 2024 13:53
@zbuc zbuc force-pushed the 3790_arbitrage_fix branch from d6565ba to 55ecee6 Compare May 1, 2024 14:04
@zbuc zbuc temporarily deployed to smoke-test May 1, 2024 14:04 — with GitHub Actions Inactive
@zbuc zbuc merged commit 73c214d into main May 1, 2024
13 checks passed
@zbuc zbuc deleted the 3790_arbitrage_fix branch May 1, 2024 14:52
@cratelyn cratelyn added this to the Sprint 5 milestone May 1, 2024
@erwanor erwanor added the migration A pull request that contains a migration label May 7, 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 consensus-breaking breaking change to execution of on-chain data migration A pull request that contains a migration state-breaking breaking change to on-chain data
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants