-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Foundry] Investigate HTS "embedding" in Foundry #118
Comments
Analysis (wip)Storage dependencies are marked in orange in the attached diagrams.
The EVM-related storage slots should not be necessary for running this script since no interaction with actual smart contracts occurs at any stage. Looks like the Proccessor is not using EVM emulation then.
5. Ensure that HTS behavior related classes do not depend on Besu EVM. Besu shouldn't be needed because HTS does not run EVM bytecode, only Java code. Since we are extending Besu classes (in the code crucial for us) we can not drop it entirely. For precompile-specific operations (e.g., those directed to |
(I amended the description to clarify what I meant) For already existing tokens, I'm guessing that would be the case (HTS state is self-contained in the Java realm). However, the case for |
Conclusions from Tuesday's meeting (November 21, 2024) with @lukelee-sl and @acuarica:
|
The MirrorNode team implemented a solution to process calls and estimate gas in a way that avoids changing the state of the hashgraph. They used 'temporary' states within the scope of individual transactions to simulate the call behaviour without altering the actual state of the network. It could be useful for us if we choose to keep the node running throughout the entire testing process instead of shutting it down. However, this approach doesn't fully address our primary challenge—feeding the local state with data from the forked network. Unlike our situation, the MirrorNode operates on a state that is already fully synced with the network it pulls data from. |
But this scenario would require some sort of
As you mentioned, if we could replace the 'temporary' states with the state needed from the remote network, that would be a win, right? |
Just for future reference, in case we actually need it, we can evaluate building native images of services |
Investigation Progress: Submitting a transaction through the local node:
Reverting transactions / rolling back to a specific point in time on our node:
|
Current progress update Added functionality to:
Current Challenges:
|
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
…118) Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
HTS emulation as currently implemented posses two main issues
An alternative to HTS "emulation" could be HTS "embedding”. The idea is to somehow, embed
hedera-services
behavior into Foundry or Hardhat. Given this approach would be tailored to each dev environment, we will probably end up writing one “adapter” for each dev env we want to provide forking support for.Possible solution for Foundry
Foundry allows users to call an arbitrary executable through their
ffi
cheatcode. We could, in principle, build a customhedera-services
executable that only contains HTS System Contract related behavior. This can be an application that takes thecalldata
in the command line and returns the appropriate value.There are some issues that we need to solve in order to implement this approach
Tasks
PoC
Tasks
Related Issues & Discussions
Related Work
Just for reference, Arbitrum also uses “precompiles” or System Contracts to provide additional functionality https://docs.arbitrum.io/build-decentralized-apps/precompiles/reference. And it also suffers from the same problem as us regarding forking https://docs.arbitrum.io/for-devs/troubleshooting-building#why-does-my-transaction-revert-with-invalidfeopcode-when-using-foundry
Foundry
Arbitrum users have similar issues regarding forking, for example foundry-rs/foundry#5085.
It seems
zskSync
opts for custom Foundry support foundry-rs/foundry#7624. We may want to implement a solution similar to https://github.com/matter-labs/foundry-zksync.There is an ongoing effort in Foundry to support precompiles (in the context of EVM-compatible networks with additional functionality)
However, it does not look like allows external code to injected yet foundry-rs/foundry#7589. Only available when using Anvil as a library.
Hardhat
Similar discussions to support EVM-compatible networks with additional semantics also happen in Hardhat NomicFoundation/hardhat#1902.
The text was updated successfully, but these errors were encountered: