Skip to content
/ evmstar Public

WIP: stand-alone EVM implementation with Ethereum mainnet configuration

License

Notifications You must be signed in to change notification settings

0xys/evmstar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EVM star

Toy Example

let host = TransientHost::new();
let mut executor = Executor::new(Box::new(host));
let mut builder = Code::builder();

let code = builder
    .append(OpCode::PUSH1)  // OpCode
    .append("02")           // hex character
    .append(OpCode::PUSH1)
    .append(0x03)           // u8
    .append(OpCode::ADD)
    .append(OpCode::PUSH1)
    .append("00")
    .append(OpCode::MSTORE)
    .append("60206000")     // hex string
    .append(OpCode::RETURN);

let output = executor.execute_raw(&code);

let data = decode("0000000000000000000000000000000000000000000000000000000000000005").unwrap();

assert_eq!(StatusCode::Success, output.status_code);
assert_eq!(Bytes::from(data), output.data);
assert_eq!(24, i64::max() - output.gas_left);

Progress

  • push,pop,dup
  • arithmetic opcodes
  • memory opcode (mload, mstore, mstore8)
  • return
  • storage opcode (sload, sstore)
  • context opcode
  • call (in progress)
  • revert
  • delegatecall, staticcall, callcode
  • create
  • create2
  • selfdestruct
  • sha3, precompiles

About

WIP: stand-alone EVM implementation with Ethereum mainnet configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages