bcgov / von-network

A portable development level Indy Node network.
Apache License 2.0
163 stars 188 forks source link

Fix error in ledger transaction #233

Closed ianco closed 2 years ago

ianco commented 2 years ago

Signed-off-by: Ian Costanzo ian@anon-solutions.ca

This fixes the exception when caching transactions, however the ATTRIB transaction on the ledger looks kind of weird, so not sure if the fix is required in aca-py.

The ledger ATTRIB transaction looks like:

  "txn": {
    "data": {
      "dest": "Vkd321e6ZXRspry48uzpH3",
      "raw": "{\"endpoint\":{\"endpoint\":{\"endpoint\":\"http://host.docker.internal:8020\",\"routingKeys\":[]}}}"
    },
...
  },
ianco commented 2 years ago

PS the exception that we see in the von-network logs (before this fix) is:

webserver_1  | 2022-08-30 23:54:37,491|DEBUG|ledger.py|submit_request: <<< res: '{"op":"REPLY","result":{"identifier":"V4SGRU86Z58d6TV7PBUe6f","reqId":1661903677477333700,"type":"3","data":{"reqSignature":{"type":"ED25519","values":[{"from":"3VnXJ8xnqeRX36Goux7kKi","value":"3z6wWMEPCDkTpDpJXmWiawuPv81fjRLWVN7S5VDSyN4PBXiR2iBphUrt1UFEHufojPHgnZvqLhFppmGgtuq395Ra"}]},"txn":{"data":{"dest":"3VnXJ8xnqeRX36Goux7kKi","raw":"{\\"endpoint\\":{\\"endpoint\\":{\\"endpoint\\":\\"https:\\/\\/6c68-70-66-161-1.ngrok.io\\",\\"routingKeys\\":[]}}}"},"metadata":{"digest":"89bcfd5dc6e1754dc5829fa0df06475c17095e5077f11301ee53fbc7675d9f4e","from":"3VnXJ8xnqeRX36Goux7kKi","payloadDigest":"4d1d692670f72e245ab26d8b9459ddce65463687be21b7b448c98897431fd185","reqId":1661903619848273200},"protocolVersion":2,"type":"100"},"txnMetadata":{"seqNo":7,"txnId":"3VnXJ8xnqeRX36Goux7kKi:1:b6bf7bc8d96f3ea9d132c83b3da8e7760e420138485657372db4d6a981d3fd9e","txnTime":1661903619},"ver":"1","rootHash":"3eyVhf4fycgNK2X3YFba6XGCTQ2z2fNAYPF8DsndmYTc","auditPath":["GGn85Xp8FaVdvQXKBWiJzQrBinNf9iZLugTA9bZGeRFM","D52hsZf4iH4Kp4x4eEp18FicbPNdirG9TL2cvat1eKvL"],"ledgerSize":7},"state_proof":{"multi_signature":{"signature":"RBgTTEdtmSWDbFgFETbPKt5STr3SQez1HD1ZEKXLZksYGDNgSUhcPT7jhi1hnLrDwBs1o64MRoowUq3Z6vyxXPyfbce9qgMSLQJgVzR6W5wKHz4GtpPmZn7qCRR7R6qzGHjmU6eAWtXJNoYYkLvmwyUNZzL57cW1SdondYjP69f38K","participants":["Node1","Node4","Node3"],"value":{"ledger_id":1,"pool_state_root_hash":"H1o85bNBQbvp7hSvqFsnKCwW2oWnzMWDHSdD7wVjaAQd","state_root_hash":"AG3jnT7yzNTtssLZ56fiyuYuxExTBZKLSoXYZF2zwUZj","timestamp":1661903619,"txn_root_hash":"3eyVhf4fycgNK2X3YFba6XGCTQ2z2fNAYPF8DsndmYTc"}}},"seqNo":7}}'
webserver_1  | 2022-08-30 23:54:37,491|DEBUG|core.py|executing functools.partial(<built-in method execute of sqlite3.Connection object at 0x7fa792d09490>, 'INSERT INTO terms (txnid, sender, ident, alias) VALUES (?, ?, ?, ?)', ('3VnXJ8xnqeRX36Goux7kKi:1:b6bf7bc8d96f3ea9d132c83b3da8e7760e420138485657372db4d6a981d3fd9e', '3VnXJ8xnqeRX36Goux7kKi', '3VnXJ8xnqeRX36Goux7kKi', {'endpoint': 'https://6c68-70-66-161-1.ngrok.io', 'routingKeys': []}))
webserver_1  | 2022-08-30 23:54:37,492|ERROR|core.py|returning exception Error binding parameter 3 - probably unsupported type.
webserver_1  | Traceback (most recent call last):
webserver_1  |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiosqlite/core.py", line 153, in run
webserver_1  |     result = function()
webserver_1  | sqlite3.InterfaceError: Error binding parameter 3 - probably unsupported type.
webserver_1  | 2022-08-30 23:54:37,499|ERROR|base_events.py|Task exception was never retrieved
webserver_1  | future: <Task finished coro=<AnchorHandle.maintain_cache() done, defined at /home/indy/server/anchor.py:529> exception=InterfaceError('Error binding parameter 3 - probably unsupported type.',)>
webserver_1  | Traceback (most recent call last):
webserver_1  |   File "/home/indy/server/anchor.py", line 532, in maintain_cache
webserver_1  |     done = await self.update_ledger_cache(ledger_type)
webserver_1  |   File "/home/indy/server/anchor.py", line 538, in update_ledger_cache
webserver_1  |     await self.sync_ledger_cache(ledger_type)
webserver_1  |   File "/home/indy/server/anchor.py", line 583, in sync_ledger_cache
webserver_1  |     row = await self.fetch_tail_txn(ledger_type)
webserver_1  |   File "/home/indy/server/anchor.py", line 367, in fetch_tail_txn
webserver_1  |     return await self.get_txn(ledger_type, latest, True, True)
webserver_1  |   File "/home/indy/server/anchor.py", line 463, in get_txn
webserver_1  |     ledger_type, ident, txn_id, added, body_json, latest
webserver_1  |   File "/home/indy/server/anchor.py", line 911, in add_txn
webserver_1  |     terms_id = await self.insert(upd, tuple(terms[k] for k in term_names))
webserver_1  |   File "/home/indy/server/anchor.py", line 765, in insert
webserver_1  |     async with await self.query(sql, args) as cursor:
webserver_1  |   File "/home/indy/server/anchor.py", line 751, in query
webserver_1  |     result = await self.db.execute(sql, args)
webserver_1  |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiosqlite/core.py", line 209, in execute
webserver_1  |     cursor = await self._execute(self._conn.execute, sql, parameters)
webserver_1  |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiosqlite/core.py", line 167, in _execute
webserver_1  |     return await future
webserver_1  |   File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/aiosqlite/core.py", line 153, in run
webserver_1  |     result = function()
webserver_1  | sqlite3.InterfaceError: Error binding parameter 3 - probably unsupported type.

Possible caused by aca-py PR https://github.com/hyperledger/aries-cloudagent-python/pull/1899 ?

@cjhowland @dbhume

dbluhm commented 2 years ago

The endpoint does indeed look off; one layer too deep of values labelled endpoint. We'll take a look! cc @cjhowland