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

[evm] performance: since we only create a cacheCtx whenever a precompile is called, then reverting a precompile call can just get rid of the cacheCtx and reset the writeToCommitCtxFromCacheCtx function to nil. That would be a cleaner way to revert a PrecompileCalled journal entry rather than deep copy the multistore and save it in a snapshot, but I'd have to test that implementation out. #2099

Closed
Unique-Divine opened this issue Oct 29, 2024 · 1 comment

Comments

@Unique-Divine
Copy link
Member

Unique-Divine commented Oct 29, 2024

Note to future self: since we only create a cacheCtx whenever a precompile is called, then reverting a precompile call can just get rid of the cacheCtx and reset the writeToCommitCtxFromCacheCtx function to nil. That would be a cleaner way to revert a PrecompileCalled journal entry rather than deep copy the multistore and save it in a snapshot, but I'd have to test that implementation out.

Originally posted by @k-yang in #2094 (comment)

@github-project-automation github-project-automation bot moved this to ⚡ Building 🧱 in ⚛️ Nibiru (Hougyoku) Oct 29, 2024
@github-actions github-actions bot added the S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5 label Oct 29, 2024
@k-yang
Copy link
Member

k-yang commented Jan 3, 2025

I thought about this more and I don't think it works in the case of multiple precompile calls. If a transaction does Precompile Call A and Precompile Call B, but reverts Precompile Call B, you still want to restore the snapshot to before Precompile Call B and after Precompile Call A, so you'd need to keep a deep copy of the multistore after Precompile Call A in the journal.

Simply destroying the cacheCtx won't work because that only gets rid of the Precompile Call B changes, but doesn't restore the changes from Precompile Call A.

@k-yang k-yang closed this as completed Jan 3, 2025
@github-project-automation github-project-automation bot moved this from ⚡ Building 🧱 to ✅ Completed in ⚛️ Nibiru (Hougyoku) Jan 3, 2025
@k-yang k-yang removed the S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5 label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Completed
Development

No branches or pull requests

2 participants