tokamak-network / solEVM

Partial implementation of the Ethereum runtime in Solidity (PoC)
Mozilla Public License 2.0
1 stars 1 forks source link

CP challenge for Tokamak

Discord

Implementation Status

Support Storage

Verification of external code in offchain

Verification of ERC20 token method

Support Stateful

Support CALL like OPCODES

Support State Transition Function

Optimization

Integration with Clients

Misc

Setup

$ git clone https://github.com/Onther-Tech/solEVM.git ./
$ npm install

Test

You can run the tests of verification game :

$ ./scripts/test_geth.sh test/contracts/[Test File].js

If you want to look into more details or debug for development you can do like this :

$ DEBUG=vgame-test ./scripts/test_geth.sh test/contracts/[Test File].js

You can run the test of offchain stepper(Offchain VM) :

$ node test/utils/testStepper.js

You can run the test of offchain stepper when to execute CALL(Offchain VM) :

$ npm run test:utils:call

You can compile all contracts :

$ npm run compile:contracts

Usage

describe('Fixture for Dispute/Verifier Logic #1', function () {    

    const code = ['runtime bytecode'];
    const data = ['callData'];
    const tStorage = ['0x + hex'];

    let steps;
    let copy;
    let merkle;
    const runtime = new HydratedRuntime();

    beforeEach(async () => {
      steps = await runtime.run({ code, data, pc: 0, tStorage: tStorage });
      copy = JSON.stringify(steps);
      merkle = new Merkelizer().run(steps, code, data, tStorage);
    });

Input

Test Status

Test Files Case Pass / Fail / Not Yet
dispute.storage.js OPCODE SLOAD, SSTORE Support Pass
dispute.log.js OPCODE LOG Support Pass
dispute.balanceOf.js ERC20 balanceOf Verification Pass
dispute.transfer.js ERC20 transfer Verification Pass
- OPCODE CALL, DELEGATECALL, STATICCALL Support Not Yet
- OPCODE CREATE, CREATE2 Support Not Yet

Test Case

Case

both have the same result, solver wins challenger has an output error somewhere solver has an output error somewhere challenger first step missing solver first step missing challenger last step gone solver last step gone challenger wrong memory output solver wrong memory output challenger wrong stack output solver wrong stack output challenger wrong opcode solver wrong opcode only two steps, both wrong but doesn\'t end with OP.REVERT or RETURN = challenger wins solver misses steps in between solver with one invalid step challenger with one invalid step solver with one invalid step against LOG challenger with one invalid step against LOG