unionlabs / union

The trust-minimized, zero-knowledge bridging protocol, designed for censorship resistance, extremely high security, and usage in decentralized finance.
https://union.build
Apache License 2.0
60 stars 11 forks source link

Traces for v0.packets #2721

Closed cor closed 2 weeks ago

cor commented 1 month ago

For hubble, we've gotten requests from quite a few integration partners to have a packets view on the app that shows all packets (filterable by chain/channel/port), with a trace for that packet.

Currently, traces are a transfers-specific concept. We should expand this to also apply to packets.

qlp commented 1 month ago

Add traces relation in hubble-blue:

request:

query TraceForPacketWithHash($source_transaction_hash: String!) @cached(ttl: 1) {
  v0_packets(where: {source_transaction_hash: {_eq: $source_transaction_hash}}) {
    traces(order_by: {timestamp: asc}) {
      timestamp
      chain {
        chain_id
      }
      type
      transaction_hash
      height
    }
  }
}

variables

{
  "source_transaction_hash": "E1E4FD2A31DA1D1694D9B026B4846A72FE05347B14F90839CC81FD4FBCFF3715"
}

output:

{
  "data": {
    "v0_packets": [
      {
        "traces": [
          {
            "timestamp": "2024-08-12T11:33:41.658004+00:00",
            "chain": {
              "chain_id": "stride-internal-1"
            },
            "type": "SEND_PACKET",
            "transaction_hash": "E1E4FD2A31DA1D1694D9B026B4846A72FE05347B14F90839CC81FD4FBCFF3715",
            "height": 7435175
          },
          {
            "timestamp": "2024-08-12T11:34:05.694662+00:00",
            "chain": {
              "chain_id": "union-testnet-8"
            },
            "type": "LIGHTCLIENT_UPDATE",
            "transaction_hash": "829E328B0A00ED57A3899DD4100741A8145A286A291E9CF7D0CD6AEB5349B1A3",
            "height": 2342426
          },
          {
            "timestamp": "2024-08-12T11:34:14.25837+00:00",
            "chain": {
              "chain_id": "union-testnet-8"
            },
            "type": "RECEIVE_PACKET",
            "transaction_hash": "62E34E61A07ABF083016A05FE323FA8A63BE896D05BF31B725CC8868B610BA70",
            "height": 2342430
          },
          {
            "timestamp": "2024-08-12T11:34:55.205794+00:00",
            "chain": {
              "chain_id": "stride-internal-1"
            },
            "type": "ACKNOWLEDGE_PACKET",
            "transaction_hash": "13FF6F366AC15573F4C0237B9BD6E45DF02A8502C2FB81F6A305C4B44378B8B7",
            "height": 7435247
          }
        ]
      }
    ]
  }
}
qlp commented 1 month ago

waiting for feedback here