WebOfTrust / keripy

Key Event Receipt Infrastructure - the spec and implementation of the KERI protocol
https://keripy.readthedocs.io/en/latest/
Apache License 2.0
56 stars 53 forks source link

Keri agent crashes when one or more witness receipts are missing #313

Closed psteniusubi closed 10 months ago

psteniusubi commented 1 year ago

Steps to reproduce

  1. Reset
  2. Do not start witness
  3. Start Keri agent
  4. Run boot, unlock, incept
  5. Running GET /oobi/alias causes Keri agent to crash

This also happens if I start only two witness nodes (eg. only was and wel witnesses). Or if witness nodes are "slow" and GET /oobi/alias happens before receipts are received.

keripy is at revision ed016a06c56a1faaff26f2cca24b8b9e385ffc54

$ rm -rf ~/.keri

$ kli agent vlei & 

$ curl -s -X POST "http://localhost:5620/boot" -H "accept: */*" -H "Content-Type: application/json" -d "{\"name\":\"alias1\",\"passcode\":\"DoB2-6Fj4x-9Lbo-AFWJr-a17O\",\"salt\":\"0ACDEyMzQ1Njc4OWxtbm9aBc\"}" | jq

$ curl -s -X PUT "http://localhost:5620/boot" -H "accept: */*" -H "Content-Type: application/json" -d "{\"name\":\"alias1\",\"passcode\":\"DoB2-6Fj4x-9Lbo-AFWJr-a17O\"}" | jq

$ sleep 3

$ curl -s -X POST "http://localhost:5620/ids/alias1" -H "accept: */*" -H "Content-Type: application/json" -d "{\"transferable\":true,\"wits\":[\"BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha\",\"BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM\",\"BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX\"],\"toad\":2,\"icount\":1,\"ncount\":1,\"isith\":1,\"nsith\":1}" | jq

$ curl -i -s "http://localhost:5620/oobi/alias1?role=witness" -H "accept: */*"

Keri agent quits, output and stack trace is

$ kli agent vlei

******* Starting Agents for vLEI scenairo testing on ports:

    RootGARs:  5620, 5621
    ExtGARs:   5622, 5623
    IntGARs:   5624, 5625
    QARs:      5626, 5627
    LARs:      5628, 5629
    Person:    5630

*******

ERR: 'http'
Traceback (most recent call last):
  File "/home/uroot/.local/bin/kli", line 33, in <module>
    sys.exit(load_entry_point('keri', 'console_scripts', 'kli')())
  File "/home/uroot/keripy/src/keri/app/cli/kli.py", line 27, in main
    raise ex
  File "/home/uroot/keripy/src/keri/app/cli/kli.py", line 22, in main
    directing.runController(doers=doers, expire=0.0)
  File "/home/uroot/keripy/src/keri/app/directing.py", line 728, in runController
    doist.do(doers=doers)
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 156, in do
    self.recur()  # increments .tyme runs recur context
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 275, in recur
    tock = dog.send(self.tyme)  # yielded tock == 0.0 means re-run asap
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 922, in do
    self.done = self.recur(tyme=tyme)  # equv of doist.recur
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 1026, in recur
    tock = dog.send(tyme)  # yielded tock == 0.0 means re-run asap
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 922, in do
    self.done = self.recur(tyme=tyme)  # equv of doist.recur
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 1026, in recur
    tock = dog.send(tyme)  # yielded tock == 0.0 means re-run asap
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 922, in do
    self.done = self.recur(tyme=tyme)  # equv of doist.recur
  File "/home/uroot/.local/lib/python3.10/site-packages/hio/base/doing.py", line 1026, in recur
    tock = dog.send(tyme)  # yielded tock == 0.0 means re-run asap
  File "/home/uroot/keripy/src/keri/app/indirecting.py", line 786, in eventDo
    client, clientDoer = agenting.httpClient(self.hab, self.witness)
  File "/home/uroot/keripy/src/keri/app/agenting.py", line 598, in httpClient
    up = urlparse(urls[kering.Schemes.http])
KeyError: 'http'

Suggestion

GET /oobi/alias should return oobi uri list with those witnesses whose receipts have been received. List may initially be empty or shorter than configured number of witnesses.

pfeairheller commented 10 months ago

Agent removed from KERIpy for WebOfTrust/KERIA