# オペレータノード同士の通信に関するテスト設計 ###### tags: `テスト設計` [オペレータ間についてのYP](https://hackmd.io/NmU2aM8-SeGJrIVhGQUqnQ) # 同期通信 通信に関するテストなので`docker-compose` でSRUのノードと疑似L1ETHを構築し、test tx 用のコードを実行する。シナリオテストのようなものを想定する。 リーダノードとして立ち上がっているものとそうでないものについてテストノードを立ち上げてそれぞれチェックする。 ## Intiialzie ```javascript= describe("Intiialize", () => { // Fetch latest datum. // 1. 正常系について、取得した最新に近い root が L1 に commit されている root と一致する。 // 2. そうでない場合、別のノードを探索する。 it("Fetch latest datum", () => {}); // 指定したノードと接続できる。 it("Be able to connect a target node", () => {}); }); ``` ## Received Tx ユーザトランザクションのテストについては[ユーザトランザクションテスト](https://hackmd.io/FJbK9vsMRGy7L1sKQwvuFQ)参照 ```javascript= describe("Received transactions", () => { // 1. トランザクションをリーダーに送る。 // 2. リーダーに問い合わせて、送信したトランザクションが確かに受け取られていることを確認する。 it("Check confrimed txs", () => {}); }); ``` ## Pre Commit ```javascript= describe("Optimistic commit", () => { // リーダーでなかった場合、失敗することを検証する。 it("If this node is not leader, failed commit", () => {}); // Optimistic commit を broadcast した後に // 他の全ての正常なノードが送った commit を受け取っていることを検証する。 it("After broadcast, received optimistic commits", () => {}); // 不正な Optimistic commit を broadcast した後に // 閾値署名が集まらないことを検証する。 it("After invalid broadcast, not received threshold signatures", () => {}); // 有効な Optimistic commit を broadcast した後に // 閾値署名が十分な数以上集まることを検証する。 it("After valid broadcast, received threshold signatures", () => {}); // Optimistic commit に必要な要件を満たしていない時、失敗することを検証する。 // 1. ブロックの tx の zkVerify が通る。 // 2. 上位ノード1/2以上の閾値署名が存在する。 // 3. 分散ストレージにステートがアップロードされている。 it("If not enough to require optmistic commit, failed commit", () => {}); // L1 ETH に十分な deposit が供託がない場合、失敗することを検証する。 it("If L1 not enough to ETH, failed commit", () => {}); // 成功した optimistic commit が L1 ETH に刻まれていることを検証する。 it("If success, optimistic commit exists L1 ETH", () => {}); }); ``` ## L1 Main Commit ```javascript= describe("L1 Commit", () => { // L1 commit を broadcast した後に // 他の全ての正常なノードが送った commit を受け取っていることを検証する。 it("After broadcast, received optimistic commits", () => {}); // L1 commit に必要な要件を満たしていない時、失敗することを検証する。 // 1. ブロックの tx の zkVerify が通る。 // 2. Optimistic commit されたブロックの列が内包されていることを検証する。 // 3. 分散ストレージにステートがアップロードされている。 it("If not enough to require L1 commit, failed commit", () => {}); // 成功した L1 commit が L1 ETH に刻まれていることを検証する。 it("After success, L1 commit exists L1 ETH", () => {}); }); ``` ## Leader Selection ビットコインノードのフルノードがある前提でテストを行う。 ```javascript= describe("Leader selection", () => { // L1 selection 他の全ての正常なノードが送った commit を受け取っていることを検証する。 it("After broadcast, received optimistic commits", () => {}); // L1 commit に必要な要件を満たしていない時、失敗することを検証する。 // 1. ブロックの tx の zkVerify が通る。 // 2. Optimistic commit されたブロックの列が内包されていることを検証する。 // 3. 分散ストレージにステートがアップロードされている。 it("If not enough to require L1 commit, failed commit", () => {}); // 成功した L1 commit が L1 ETH に刻まれていることを検証する。 it("After success, L1 commit exists L1 ETH", () => {}); // Add node. // 1. 自身をノードとして追加する署名付きブロードキャストを行う // 2. グラフを生成して自身が孤立ノードとして存在することを確認する。 it("After add SRU node, the node exsits in grpah", () => {}); // 重複してノードが追加されないことを検証する。 it("After add SRU node, it is not duplicate.", () => {}); // Add edge. // 1. open channel tx の inclusion proof のブロードキャストを行う // 2. グラフを生成してその辺が追加されていることを確認する。 it("After add edge, the edge exsits in graph", () => {}); // 重複して辺が追加されないことを検証する。 it("After add edge, it is not duplicate.", () => {}); // Remove edge. // 1. close channel tx(Chanel fianlzed) の inclusion proof のブロードキャストを行う // 2. グラフを生成してその辺が削除されていることを確認する。 it("After add edge, the edge exsits in graph", () => {}); // 重複して辺が削除されないことを検証する。 it("After remove edge, it is not duplicate.", () => {}); // ランダムテスト // 各正常なノードについて、選出されたリーダ順列が常に等しいことを検証する。 it("Random test, each nodes select same leaders", () => {}); }); ```