Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brockelmore/solvm
evm inception: the evm inside the evm via yul and solidity
https://github.com/brockelmore/solvm
Last synced: 29 days ago
JSON representation
evm inception: the evm inside the evm via yul and solidity
- Host: GitHub
- URL: https://github.com/brockelmore/solvm
- Owner: brockelmore
- Created: 2022-04-01T22:47:30.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T22:46:30.000Z (over 1 year ago)
- Last Synced: 2024-11-07T13:32:38.996Z (about 1 month ago)
- Language: Solidity
- Homepage:
- Size: 60.5 KB
- Stars: 228
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- Library-of-Ethereum - SolVM - A (slightly) stripped down version of the EVM implemented on top of the EVM using yul and solidity. (EVM / Cairo)
- awesome-web3-tools-and-dapps - Solvm - A simplified version of Ethereum Virtual Machine created with Yul and Solidity. (dApps directory / EVM Tools)
README
# solvm: The EVM inside the EVM
## WTF?
A (slightly) stripped down version of the EVM implemented on top of the EVM using yul and solidity.## Why?
idk, for fun. Its a fun memory-management challenge. Also I've always wanted scripting in solidity and this is a step in that direction.## How?
A dynamic in-memory array is used as a jump table for ops. A dynamic in-memory array is used for the simulated EVM's stack variables. The simulated EVM's memory is held at a moveable offset and can move if needed (unlikely unless stack is forced to move).## Limits
Currently no context switching opcodes (all flavors of `call`). We can simulate a lot of these in memory if want though, just haven't gotten around to it.Also bugs. Probably many bugs.
And gas. There are large one-time gas costs, that get amortized with more ops (but not a ton).
## Example
```soliditycontract EvmTest is DSTest {
function testMul() public {
Evm evm;
// pass in raw bytecode and it evaluates it
// does 1 * 3 and returns it
(bool succ, bytes memory ret) = evm.evaluate(hex"600160030260205260206000F3");
(uint256 r) = abi.decode(ret, (uint256));
assertTrue(succ);
assertEq(r, 3);
}
}
```