research: precompile call evm in the same session
- Dominant language
- Go
- Stars
- 164
- Forks
- 213
- Avg merge
- 3d 58m
- Merged PRs (30d)
- 12
Description
To achieve true interoperability between native code(precompiles) and EVM, native code should be able to call EVM in the same EVM instance.
Precompiles can call the four variant of `evm.Call*` method to call evm contracts with the current evm instance, but there are a few issues to beware of:
* Context passing. Precompile should pass the current calling context down the stream.
* to do that, precompiles needs to receive the correct calling contexts first (https://github.com/cosmos/go-ethereum/pull/10).
* jumpDests cache need to be passed as well.
* Precompile implementations should deal with re-entrant calls.
Anything else? or is there projects that had did this before that we can take as reference?
## Use Cases
Any non-trivial precompile contract will need to be able to call back into EVM world back and force, for example a native DEX that works with ERC20 contracts.
Contributor guide
Research direction
Start by reviewing the four evm.Call* variants and the context-passing concerns described in the issue, including jumpDests cache handling and the referenced PR. Examine how precompile implementations would handle re-entrant calls. Done means documenting the remaining requirements, relevant prior projects, and a clear implementation direction for same-instance calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100