Skip to content

Fix #60

どら edited this page May 27, 2019 · 26 revisions

Basic policy

  • Make a module of echo.rs in interledger-service-util crate
  • Insert the service into node.rs

Must-learn Specs

Brief Spec

Outline

  1. A sender sends a Prepare packet (type Pa) to a destination
  2. The destination node changes the destination to the sender, and routes the Prepare packet (type Pb) appropriately towards the sender
  3. The Prepare packet finally reaches the sender
  4. If the sender can confirm that the packet is issued by itself, the sender responds with a Fulfill packet
  5. The sender receives the Fulfill packet at last

Detail

  • The packets should be handled before any other actual core services that make funds on-hold
    • Should they? have to check the implementation
  • The packet data of the Prepare ILP packets is like below:
    • Pa type
      • amount arbitrary
      • executionCondition arbitrary
      • expiresAt arbitrary
      • destination the address of the node that the sender wants to confirm to reach
      • data
        • ECHOECHOECHOECHO(16 bytes) + 0 + VarOctetString(source address)
    • Pb type
      • amount the same as the received packet
      • executionCondition the same as the received packet
      • expiresAt arbitrary (tipically the expires of the packet - 1000 (minMessageWindow))
      • destination source address that can be extracted from the received packet
      • data
        • ECHOECHOECHOECHO(16 bytes) + 1
  • The receiver (who is destined by packet Pa)
    • sends a Pb type packet appropriately
      • changing the destination to the address of the sender, extrating from data section of the Pa packet
    • throws error when the data size of ILP packet is less than 17 bytes
      • 17 bytes = ECHOECHOECHOECHO + type(0)
    • throws error when the data does not start with ECHOECHOECHOECHO
    • these errors should be handled as ILP reject packets
      • F01_INVALID_PACKET

Question

  • How to pass prepare-packet from IncomingService?
  • Structure of routing and outgoing services(account)?
  • What happens if a sender sends echo packets to a terminal receiver that does not implement echo server (not a connector)?

ILP Packet handling in ilp-connector

  • index.ts
    • creates App and listen
  • app.ts
    • createApp loads accounts from env or config, and adds it to Accounts
    • listen
      • adminApi.listen()
      • backend.connect()
      • middlewareManager.setup()
      • accounts.loadIlpAddress()
      • accounts.connect()
      • middlewareManager.startup()
  • middleware-manager.ts
    • constructor adds BUILTIN_MIDDLEWARES
      • error-handler, throughput, etc...
      • error-handler is inserted first, and called first covering all the exceptions
    • setup adds plug-ins for each account, and sets up Pipelines
    • startup calls startup handlers of each account

memo

  • warning
  • PrepareBuilder accepts &[u8; 32] while Prepare::execution_condition() returns &[u8]
Clone this wiki locally