---
# System prepended metadata

title: オペレーターノードのproof生成に関するテスト設計
tags: [テスト設計]

---

# オペレーターノードのproof生成に関するテスト設計
###### tags: `テスト設計`

## zkEVMのState Proofの回路のテスト
- State読み出しのオペコードが正しく処理できる
- State書き込みのオペコードが正しく処理できる

```javascript=
describe("zkEVM(state)", () => {
    // 初期状態のメモリに対して、SLOADしてもエラーを起こさない。
    it("should read by SLOAD in init", () => {});
    
    // 初期状態のメモリに対して、SSTOREすると書き込める。
    it("should write by SSTORE in init", () => {});
    
    // データがある状態のメモリに対して、SLOADするとデータが読み取れる
    it("should read by SLOAD in having data", () => {});
    
    // データがある状態のメモリに対して、SSTOREするとデータがアップデートされる
    it("should update by SSTORE in having data", () => {});
});

```



## zkEVMのExecutionの回路のテスト
- EVMに実装されているオペコード各種ごとにテストケースを追加し、それぞれが正しく処理できる
- EVMに実装されていないオペコードが入力された場合はエラーを返す

```javascript=
describe("zkEVM Execution Proof", () => {
    // 参考
    // https://github.com/crytic/evm-opcodes
    describe("STOP", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("ADD", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("MUL", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SUB", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("DIV", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SDIV", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("MOD", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SMOD", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("ADDMOD", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("MULMOD", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("EXP", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SIGNEXTEND", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("LT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("GT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SLT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SGT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("EQ", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("ISZERO", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("AND", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("OR", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("XOR", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("NOT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("BYTE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SHL", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SHR", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("KECCAK256", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("ADDRESS", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    

    describe("BALANCE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("ORIGIN", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("CALLER", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CALLVALUE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CALLDATALOAD	", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CALLDATASIZE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CALLDATACOPY", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CODESIZE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CODECOPY", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("GASPRICE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("EXTCODESIZE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("EXTCODECOPY", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("RETURNDATASIZE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("RETURNDATACOPY", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("EXTCODEHASH", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("BLOCKHASH", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("COINBASE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("TIMESTAMP", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("NUMBER", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DIFFICULTY", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("GASLIMIT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CHAINID", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("BASEFEE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("POP", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("MLOAD", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("MSTORE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("MSTORE8", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SLOAD", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SSTORE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("JUMP", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("JUMPI", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("GETPC", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("MSIZE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("GAS", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("JUMPDEST", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH1", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH2", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH3", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH4", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH5", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH6", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH7", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH8", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH9", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH10", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH11", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH12", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH13", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH14", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH15", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH16", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("PUSH17", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH18", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH19", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH20", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH21", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH22", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH23", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH24", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH25", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH26", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH27", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH28", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH29", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH30", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH31", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("PUSH32", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })

    describe("DUP1", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP2", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP3", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP4", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP5", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP6", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP7", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP8", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP9", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP10", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP11", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP12", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP13", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP14", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP15", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DUP16", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    
    describe("SWAP1", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP2", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP3", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP4", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP5", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP6", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP7", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP8", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP9", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP10", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP11", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP12", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP13", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP14", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP15", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SWAP16", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
        
    
    describe("LOG1", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("LOG2", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("LOG3", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("LOG4", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    

    describe("CREATE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CALL", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CALLCODE", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("RETURN", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("DELEGATECALL", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("CREATE2", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("STATICCALL", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("REVERT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("INVALID", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
    describe("SELFDESTRUCT", () => {
        it("should success", () => {})
        it("should faild", () => {})
    })
})
```




## zkEVMのStateとExecutionの回路をRecursiveで圧縮する回路
- txの数 == State Proofの数 == Execution Proofの数になっていなかった場合にProveが通らない
- 全部同じ数でそれぞれが対応するProofだった場合にProveできる

```javascript=
describe("zkEVM Recursive", () => {
    
    // txの数 == State Proofの数 == Execution Proofの数になっていなかった場合にProveが通らない
    it("should be equal txs.length == StateProofs.length == ExecutionProofs.length", () => {});
    

    // 全部同じ数でそれぞれが対応するProofだった場合にProveできる
    it("should prove same length proof", () => {});
    
    // proofの順番を入れ替えるとProveできない
    it("shold not prove changing proof order", () => {});

});

```


