-
Notifications
You must be signed in to change notification settings - Fork 16
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
refactor: Clean up the majority of the stack trace port implementation #614
Conversation
|
To better match the name from the solc artifacts and to match what other libraries use as well.
The `contract` field in ContractFunction is only used for the debug printing anyway.
bb21830
to
c43c940
Compare
I broke the ref cycle and now the memory leaks should be gone, see the OP. The only thing that's left for now is adding more documentation. |
c43c940
to
9ca5997
Compare
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.
Another large change that looks to be steering the code is the right direction. Awesome work!
At a high-level, I think the change to break the circular dependency makes sense. For future work, I can't help but wonder whether we can get away with an arena at the top level and Arc
s and Weak
for the actual data, instead of requiring a hashmap lookup.
I have some questions to better understand and one concern that I wanted to discuss.
In terms of individual changes, they are too many for me able to look at every line of code in-depth. Are there any parts that require more scrutiny? In that case, would it make sense to have a call to discuss those changes?
@alcuadrado implemented those optimizations in a Hardhat branch that was never merged/released. I used that branch as the starting point in my aborted migration attempt. But I think what you did (keeping the 1-1 port from main) is fine, since we know it works and we have proper benchmarks. |
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 tested this with several real repositories and everything worked fine.
This reverts commit 9ca5997.
I have reverted the patch like in #545, so this only contains the updated logic but does not exercise it locally when running tests, however the CI was green with the patch applied, so this should be good to go and @fvictorio tested this as well using some real-life repositories. The next step will be to update Hardhat (9ca5997 is a good starting point) to use this new logic once we release EDR with these changes. Thanks everyone for the reviews! 🎉 |
The current base has already ported the JS code 1:1. This PR aims to reduce the exported N-API surface and simplify some JSisms.
Summary
ClassInstance
/Reference
and thus also ourClassInstanceRef
helpersRc<RefCell<...>>
for nowClassInstanceRef::borrow(_mut)
are just replaced with the actualRefCell
methodsnapi-rs
OpCode
fromrevm
rather than the previously ported/hand-rolledOpcode
from JSedr_solidity
crateRadixTree
if we find that API/impl better (sorry @fvictorio, PTAL as you authored that code IIRC?)new VmTraceDecoder()
now does not accept any arguments and internally already constructs a ContractsIdentifier.Caveats/future work
We will need to bump the base to use the Hardhat v2.22.9 soon.I left the
MessageTrace
and theSolidityStackTrace
types as these are still carried across the FFI boundary and I didn't want to change the architecture/interfacing points for now. EDIT: This is out of the scope for now.Ownership changes
Introduced in 3b551a0.