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

feat(x/protorev): Use Transient store to store swap backruns #7665

Merged
merged 6 commits into from
Mar 7, 2024

Conversation

mattverse
Copy link
Member

Closes: #7551

What is the purpose of the change

Uses Transient stores to store swap backruns instead of using kvstores. This is possible since we're setting store and deleting them on every post handler run !

Testing and Verifying

Existing tests passes

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

@mattverse mattverse added the V:state/breaking State machine breaking PR label Mar 6, 2024
@mattverse mattverse requested a review from ValarDragon March 6, 2024 01:49
@github-actions github-actions bot added C:app-wiring Changes to the app folder C:x/twap Changes to the twap module labels Mar 6, 2024
@@ -11,14 +11,14 @@
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
Copy link
Member Author

Choose a reason for hiding this comment

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

drive by change, true has been deprecated and has been replaced to explicit

Comment on lines 68 to 71
// // Delete swaps to backrun for next transaction without consuming gas
// // from the current transaction's gas meter, but instead from a new gas meter with 50mil gas.
// // 50 mil gas was chosen as an arbitrary large number to ensure deletion does not run out of gas.
// protoRevDec.ProtoRevKeeper.DeleteSwapsToBackrun(ctx.WithGasMeter(sdk.NewGasMeter(sdk.Gas(50_000_000))))
Copy link
Member

Choose a reason for hiding this comment

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

Don't we still need this? Just on the transient store?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we? I thought the purpose of Transient stores was that it drops all states anyways so thought we wouldn't need to delete them 🤔

Copy link
Member

Choose a reason for hiding this comment

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

It does drop all state, but at the end of the block not the end of each tx

Copy link
Member

Choose a reason for hiding this comment

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

(notably these need to get deleted end of each tx, in order to not cause excess backruns next block)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh gotcha, confused myself with this logic being in endblocker. Fixed in 4690908 this commit!

Copy link
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

Wow nice, this became quite simple haha

Copy link
Contributor

@NotJeremyLiu NotJeremyLiu left a comment

Choose a reason for hiding this comment

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

lgtm

@ValarDragon ValarDragon merged commit f1d010c into main Mar 7, 2024
1 check passed
@ValarDragon ValarDragon deleted the mattverse/transient branch March 7, 2024 16:22
@github-actions github-actions bot mentioned this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder C:x/twap Changes to the twap module V:state/breaking State machine breaking PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Protorev: Change swaps to backrun to use the Transient Store
3 participants