stack-orchestrator/app/data/stacks/mobymask-v2/demo.md

4.7 KiB

Demo

  • Get the root invite link URL for mobymask-app:

    docker logs -f $(docker ps -aq --filter name="mobymask-1")
    

    The invite link is seen at the end of the logs. Example log:

    http://127.0.0.1:3004/#/members?invitation=%7B%22v%22%3A1%2C%22signedDelegations%22%3A%5B%7B%22signature%22%3A%220x7559bd412f02677d60820e38243acf61547f79339395a34f7d4e1630e645aeb30535fc219f79b6fbd3af0ce3bd05132ad46d2b274a9fbc4c36bc71edd09850891b%22%2C%22delegation%22%3A%7B%22delegate%22%3A%220xc0838c92B2b71756E0eAD5B3C1e1F186baeEAAac%22%2C%22authority%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%2C%22caveats%22%3A%5B%7B%22enforcer%22%3A%220x558024C7d593B840E1BfD83E9B287a5CDad4db15%22%2C%22terms%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%7D%5D%7D%7D%5D%2C%22key%22%3A%220x98da9805821f1802196443e578fd32af567bababa0a249c07c82df01ecaa7d8d%22%7D
    
  • Open the invite link in a browser to use the mobymask-app.

    NOTE: Before opening the invite link, clear the browser cache (local storage) for http://127.0.0.1:3004 to remove old invitations

  • In the debug panel, check if it is connected to the p2p network (it should be connected to at least one other peer for pubsub to work).

  • Create an invite link in the app by clicking on Create new invite link button in the My invitees section.

  • Switch to the MESSAGES tab in debug panel for viewing incoming messages later.

  • Open the invite link in a new browser with different profile (to simulate remote browser)

    • Check that it is connected to a peer in the network.
  • In the Pending reports section, enter multiple phisher records and click on the Submit batch to p2p network button. This broadcasts signed invocations to the connected peers.

  • In the MESSAGES tab of other browsers, a message can be seen with the signed invocations.

  • In a terminal, check logs from the watcher peer container:

    docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
    
  • It should have received the message, sent transaction to L2 chain and received a transaction receipt for an invoke message with block details.

    Example log:

    2023-03-23T10:25:19.771Z vulcanize:peer-listener [10:25:19] Received a message on mobymask P2P network from peer: 12D3KooWAVNswtcrX12iDYukEoxdQwD34kJyRWcQTfZ4unGg2xjd
    2023-03-23T10:25:24.143Z laconic:libp2p-utils Transaction receipt for invoke message {
      to: '0x558024C7d593B840E1BfD83E9B287a5CDad4db15',
      blockNumber: 1996,
      blockHash: '0xebef19c21269654804b2ef2d4bb5cb6c88743b37ed77e82222dc5671debf3afb',
      transactionHash: '0xf8c5a093a93f793012196073a7d0cb3ed6fbd2846126c066cb31c72100960cb1',
      effectiveGasPrice: '1500000007',
      gasUsed: '250000'
    }
    
  • Check the phisher in watcher GQL: http://localhost:3001/graphql

    • Use the blockHash from transaction receipt details or query for latest block:

      query {
        latestBlock {
          hash
          number
        }
      }
      
    • Get the deployed contract address:

      docker exec -it $(docker ps -aq --filter name="lxdao-mobymask-app") cat /config/config.yml
      

      The value of address field is the deployed contract address

    • Check for phisher value

      query {
        isPhisher(
          blockHash: "TX_OR_LATEST_BLOCK_HASH",
          contractAddress: "CONTRACT_ADDRESS",
          # If reported phisher name was "test" then key0 value is "TWT:test"
          key0: "TWT:PHISHER_NAME"
        ) {
          value
        }
      }
      

      It should return true for reported phisher names.

    • Watcher internally is using L2 chain eth_getStorageAt method.

  • Check the phisher name in mobymask app in Check Phisher Status section.

    • Watcher GQL API is used for checking phisher.
  • Manage invitations in the Outstanding invitations (p2p network) tab in My Invitations section.

    • Revoke the created invitation by clicking on the Revoke button.
  • Revocation messages can be seen in the debug panel MESSAGES tab of other browsers.

  • Also, check the watcher peer logs. It should receive a message and log the transaction receipt for a revoke message.

  • Try reporting a phisher from the revoked invitee's browser.

    • The invocation message for reporting phisher would be broadcasted to all peers.

    • Check the watcher peer logs. A transaction failed error should be logged.

    • Check the reported phisher in watcher GQL

      query {
        isPhisher(
          blockHash: "LATEST_BLOCK_HASH",
          contractAddress: "CONTRACT_ADDRESS",
          key0: "TWT:PHISHER_NAME"
        ) {
          value
        }
      }
      

      It should return false as the invitation/delegation used for reporting phishers has been revoked.