This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: iterator on deeply nested cache contexts is extremely slow #617
Problem: iterator on deeply nested cache contexts is extremely slow #617
Changes from 1 commit
997c987
1cc099f
12fdf65
9f4d618
c96abc2
d6e6d38
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a unit test for this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this relate to
k.CommitCachedContexts()
? why is this called here instead of inside the!res.Failed
condition? I need more context to understand the rationale of this changeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more context, we discovered a bug in our testnet which make the network to halt.
Some uniswap call triggers a lot of internal call. And trying to replay the tx will end up in an infinite loop there
https://github.com/tharsis/ethermint/blob/main/x/evm/keeper/keeper.go#L181
https://github.com/cosmos/cosmos-sdk/blob/master/store/cachekv/mergeiterator.go#L206
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change here doesn't provide context on the following questions:
CommitCachedContexts()
if the changes are being committed regardless if it fails or not? Can this logic commit an invalid result or affect the revert logic as well?Since the underlying issue is from the SDK, you should open an issue there to get it fixed in the long term
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add relevant comments and tests based on the questions above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeper, ApplyTransaction,
logs := k.GetTxLogsTransient(txHash)
iter := store.Iterator(txHash.Bytes(), end) <- exact point
defer iter.Close()
blocking point
it hangs forever here,
Commit is recursive function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in this pr, before calling Commit, calls cached contexts Commit first linearly.