-
Notifications
You must be signed in to change notification settings - Fork 682
fix(forking): fix snapshots for forking #627
Conversation
Ganache currently accepts non-standard input as a "feature". For instance, you can pass in a Buffer in place of a hex address in many RPC methods and ganache will happily go about using it. The This also causes other interesting changes, for example, passing something like Also note that in any case where I'm leaning towards reverting the broad |
The whole reason to doing the I can do what's only necessary then which is at the function level rather than at the interface level and only do it for the forked storage/code/account functions |
Sounds good! |
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.
I like the approach where the storage trie isn't directly block-number aware. Hopefully any issues I've highlighted won't necessitate bringing the blockNumber
back here.
I had some questions and possible changes, but other than these, things are looking good!
@davidmurdoch jk, i still need to fix the |
alright @davidmurdoch, I think this is ready to review now |
@davidmurdoch since this one hasn't been finished merging, i pushed a small commit (and accompanying test) that fixes an issue where I also need to check if the key exists on the trie. I wouldn't quite say it was a regression for the case I was solving, but it could be a regression for some past-block lookups |
I'll check into why these 2 forking tests are now failing, but this should still be good to review |
This reverts commit 5d97074.
f46d3af
to
301872f
Compare
alright @davidmurdoch, tests pass locally for me with the latest commit. i didnt need to rearchitect anything; I just changed |
Thank you! |
@wysenynja I'll keep you up to date in this thread (and in the individual issue threads) when a release goes out with these fixes (probably a beta release) |
This was released in https://github.com/trufflesuite/ganache-core/releases/tag/v2.12.2-beta.0 |
@davidmurdoch is it possible that this PR re-broke #571 and caused #797. |
FWIW forking (especially in it's current state) is a beast, so I wouldn't be surprised if this PR caused more issues. However, I don't think it rebroke #571 as I believe I implemented specific test scenarios to pinpoint the causes of that issue (and others with similar symptoms). It's likely a different issue with the same symptom. It's very possible that @0xTimepunk's issue is even another |
This issue fixes #624 and fixes #611 with the following approach:
popBlock
inForkedBlockchain
to forget that we touched respective keys in that blockA couple of side effects:
ForkedStorageBaseTrie
no longer overloadsget
with a block number (we usethis.blockchain.blocks.last()
to get the current block now)ForkedBlockchain.prototype.getAccount
works #623. I can separate this into another PR if you want