raiden-network / raiden

Raiden Network

Home Page:https://developer.raiden.network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scenarios fail with "bad secret request message from target"

karlb opened this issue · comments

The following scenarios fail with "bad secret request message from target":

  • ms1
  • ms2
  • ms3
  • ms4
  • bf2
  • bf6
  • bf7

The error seems to be reproducible and happened for the last two nights in every of the above scenarios.

Looking at the logs from the ms1 failure:

The secret is revealed by the initiator:

karl@t480karl:~/Downloads/node_logs/node_4843_000$ zcat run-4843.log.gz | grep 'SendSecretReveal' |  jq .
{
  "node": "0x902d30D58415E574806d2251513EB21505d07f94",
  "raiden_events": [
    {
      "message_identifier": "932121031856588731",
      "secret": "<redacted>",
      "secrethash": "0x435bf252b2c08a4b83291d5061d564578e2c74b8d32559f28a5488e03a78b163",
      "recipient": "0xf259899d7d5029468b2ebe2bd326713ddcc11bfd",
      "canonical_identifier": {
        "channel_identifier": "0",
        "token_network_address": "0x0000000000000000000000000000000000000000",
        "chain_identifier": "0",
        "_type": "raiden.transfer.identifiers.CanonicalIdentifier"
      },
      "recipient_metadata": null,
      "_type": "raiden.transfer.mediated_transfer.events.SendSecretReveal"
    }
  ],
  "event": "Raiden events",
  "logger": "raiden.raiden_service",
  "level": "debug",
  "greenlet_name": "GMatrixClient.message_worker user_id:@0x902d30d58415e574806d2251513eb21505d07f94:transport.transport01.raiden.network",
  "timestamp": "2021-05-13 19:41:08.660065"
}

The target does not see the SecretReveal at all. It looks like the initiator fails to send the message because it is missing the matrix user id:

{
  "current_user": "@0x902d30d58415e574806d2251513eb21505d07f94:transport.transport01.raiden.network",
  "node": "0x902d30D58415E574806d2251513EB21505d07f94",
  "transport_uuid": "f4e63eba-d807-4817-8bf9-e0d634667ddc",
  "receiver": "0xF259899d7d5029468b2eBe2bd326713DDCc11BfD",
  "send_medium": "toDevice",
  "data": "{\"signature\": \"0x6a75cee73f5b4c017c8222e33694c352fbdfe491e537de8d58512b696538510e2c7ac5588816373a6be4c72ac826b57b0ae18edfe81c63ac8956c5737ace75c91b\", \"secret\": \"0xf5e150aafac77d1573dec38ae82bad312aca727a481a722f571bf3a0fe51c924\", \"message_identifier\": \"932121031856588731\", \"type\": \"RevealSecret\"}",
  "event": "Cannot send raw message without address metadata.",
  "logger": "raiden.network.transport.matrix.transport",
  "level": "debug",
  "greenlet_name": "RetryQueue node:0x902d30D58415E574806d2251513EB21505d07f94 recipient:0xF259899d7d5029468b2eBe2bd326713DDCc11BfD",
  "timestamp": "2021-05-13 19:53:24.172291"
}

Looks related to 4b1e107

When adding debugging output to https://github.com/karlb/raiden/blob/36e9ce28088cb6a3dfbdc49c87ec775dcdef5380/raiden/transfer/mediated_transfer/initiator.py#L413-L416 , I only see the initiators route metadata in nitiator_state.route.address_to_metadata, not the target's

{
  "recipient": "b'W\\x15\\xf6\\xdd{\\xc7\\x1b\\xa9\\xdf%\\x82%n\\xb8r\\xc5Xil~'",
  "address_to_metadata": "dict_items([(b'\\xd4\\xe77\\x97>\\x8dZp\\x9fx\\xc3\\x99\\x9f\\x1eL\\xad\\xd6F\\x11Y', {'user_id': '@0xd4e737973e8d5a709f78c3999f1e4cadd6461159:transport.transport01.raiden.network', 'capabilities': 'mxc://raiden.network/cap?Receive=1&Mediate=1&Delivery=1&webRTC=0&toDevice=1', 'displayname': '0x80abfbe91a3218c1d6aaa67b52304919ae0a1fe620fd6ca759f30039f2ad5b270fb225470fcb81cd37c9f5c598b25a611dcaac5fa551370dd35c1c7de7ee00601b'})])",
  "greenlet_name": "GMatrixClient.message_worker user_id:@0xd4e737973e8d5a709f78c3999f1e4cadd6461159:transport.transport01.raiden.network",
}

the failure should be fixed with #7049 and raiden-network/raiden-services#1008

When adding debugging output to https://github.com/karlb/raiden/blob/36e9ce28088cb6a3dfbdc49c87ec775dcdef5380/raiden/transfer/mediated_transfer/initiator.py#L413-L416 , I only see the initiators route metadata in nitiator_state.route.address_to_metadata, not the target's

This looks like it could be a different bug. It seems like the invalid metadata is stripped from the states completely after the LockedTransfer is sent out. I would expect that if the metadata is initially used and included to the states (invalid or not) it should also stay in the states for sending the SecretReveal.

At least I think it is worth investigating what is happening here, since the explicit "stripping" of metadata should only be done for sending out metadata to other nodes (validation in the messages.metadata.RouteMetadata). This should not be relevant for the initiators state, since he should not consider any metadata received from messages but rather use the initially retrieved ones.