txpipe / oura

The tail of Cardano
https://txpipe.github.io/oura
Apache License 2.0
260 stars 72 forks source link

Collateral Input not included in failed transaction details #741

Closed biofreeze closed 9 months ago

biofreeze commented 10 months ago

My Oura config looks like this

[source]
type = "N2C"
address = ["Unix", "/opt/cardano/ipc/socket"]
magic = "mainnet"

[source.intersect]
type = "Origin"

[cursor]
type = "File"
path = "/var/oura/cursor"

[source.mapper]
include_transaction_details = true

[[filters]]
type = "Selection"

[filters.check]
predicate = "variant_in"
argument = ["RollBack", "Transaction"]

[sink]
type = "Kafka"
brokers = ["redpanda:9092"]
topic = "cardano-events"

I've come across a transaction as follows:

{
  "context": {
    "block_hash": "faaeda2a014e0ad176e06837978c2f663ab0fab5f5874b079b886398099b97be",
    "block_number": 6703641,
    "slot": 49503576,
    "timestamp": 1641069867,
    "tx_idx": 3,
    "tx_hash": "f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234",
    "input_idx": null,
    "output_idx": null,
    "output_address": null,
    "certificate_idx": null
  },
  "transaction": {
    "hash": "f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234",
    "fee": 373665,
    "ttl": 49503712,
    "validity_interval_start": null,
    "network_id": null,
    "input_count": 1,
    "collateral_input_count": 0,
    "has_collateral_output": false,
    "output_count": 1,
    "mint_count": 0,
    "total_output": 2726335,
    "metadata": null,
    "inputs": [
      {
        "tx_id": "944cb825a06993865dcf5d8e80354ed5afa1bcfb2f17b179c139a5bae23594cd",
        "index": 1
      }
    ],
    "outputs": [
      {
        "address": "addr1vxk5cxgnfqkgzh25ztf6zj5p3h9pnk2mxp3xwe2pzh72rtg0nf5cs",
        "amount": 2726335,
        "assets": [],
        "datum_hash": null,
        "inline_datum": null
      }
    ],
    "collateral_inputs": null,
    "collateral_output": null,
    "mint": null,
    "vkey_witnesses": [
      {
        "vkey_hex": "92c5efea5bf9a8fa1f1eaf2e97e7cf425122c034f360abaf44ea9fb56622e919",
        "signature_hex": "9f858a30c5a53f2aba8955e6c33126e818f6701cd21137b017f972b4dc31c42e9e229d3e02c4cfad443e3e4f034caf1681f94bc6a2b3cc83c6aa9dc3ef4e6001"
      }
    ],
    "native_witnesses": [],
    "plutus_witnesses": [
      {
        "script_hash": "15b95fdaceeb507073a1bd198803373beeafbd82560fbf8abe9073ff",
        "script_hex": "5911ea010000332333222332233223322332232323332223233322232333333332222222232333222323333222232323322323332223233322232323322332232323333322222332233223322332233223322223223223232533530333330083333573466e1cd55cea8032400046460a000264646464646666ae68cdc39aab9d5004480008cccc8888cccc16c01000c008004dd71aba15004375c6ae85400cdd71aba15002375a6ae84d5d1280111a8279a982819ab9c491035054310005149926135744a00226ae8940044d55cf280089baa001357426aae79401c8d4124d4c128cd5ce2481035054310004b499263333573466e1d40112002205323333573466e1d40152000205523504a35304b335738921035054310004c49926498cccd5cd19b8735573aa004900011980599191919191919191919191999ab9a3370e6aae754029200023333333333019335027232323333573466e1cd55cea8012400046603e60746ae854008c0b0d5d09aba2500223505935305a3357389201035054310005b49926135573ca00226ea8004d5d0a80519a8138141aba150093335502e75ca05a6ae854020ccd540b9d728169aba1500733502704335742a00c66a04e66aa0a8098eb4d5d0a8029919191999ab9a3370e6aae754009200023350213232323333573466e1cd55cea80124000466a05266a084eb4d5d0a80118239aba135744a00446a0ba6a60bc66ae712401035054310005f49926135573ca00226ea8004d5d0a8011919191999ab9a3370e6aae7540092000233502733504275a6ae854008c11cd5d09aba2500223505d35305e3357389201035054310005f49926135573ca00226ea8004d5d09aba2500223505935305a3357389201035054310005b49926135573ca00226ea8004d5d0a80219a813bae35742a00666a04e66aa0a8eb88004d5d0a801181c9aba135744a00446a0aa6a60ac66ae71241035054310005749926135744a00226ae8940044d5d1280089aba25001135744a00226ae8940044d5d1280089aba25001135573ca00226ea8004d5d0a8011919191999ab9a3370ea00290031180f181d9aba135573ca00646666ae68cdc3a801240084603a608a6ae84d55cf280211999ab9a3370ea00690011180e98181aba135573ca00a46666ae68cdc3a80224000460406eb8d5d09aab9e50062350503530513357389201035054310005249926499264984d55cea80089baa001357426ae8940088d4124d4c128cd5ce249035054310004b49926104a1350483530493357389201035054350004a4984d55cf280089baa001135573a6ea80044dd50009109198008018011000911111111109199999999980080580500480400380300280200180110009109198008018011000891091980080180109000891091980080180109000891091980080180109000909111180200290911118018029091111801002909111180080290008919118011bac0013200135503b2233335573e0024a01c466a01a60086ae84008c00cd5d100101991919191999ab9a3370e6aae75400d200023330073232323333573466e1cd55cea8012400046601a60626ae854008cd404c0b4d5d09aba25002235036353037335738921035054310003849926135573ca00226ea8004d5d0a801999aa805bae500a35742a00466a01eeb8d5d09aba25002235032353033335738921035054310003449926135744a00226aae7940044dd50009110919980080200180110009109198008018011000899aa800bae75a224464460046eac004c8004d540d488c8cccd55cf80112804919a80419aa81898031aab9d5002300535573ca00460086ae8800c0b84d5d08008891001091091198008020018900089119191999ab9a3370ea002900011a80418029aba135573ca00646666ae68cdc3a801240044a01046a0526a605466ae712401035054310002b499264984d55cea80089baa001121223002003112200112001232323333573466e1cd55cea8012400046600c600e6ae854008dd69aba135744a00446a0466a604866ae71241035054310002549926135573ca00226ea80048848cc00400c00880048c8cccd5cd19b8735573aa002900011bae357426aae7940088d407cd4c080cd5ce24810350543100021499261375400224464646666ae68cdc3a800a40084a00e46666ae68cdc3a8012400446a014600c6ae84d55cf280211999ab9a3370ea00690001280511a8111a981199ab9c490103505431000244992649926135573aa00226ea8004484888c00c0104488800844888004480048c8cccd5cd19b8750014800880188cccd5cd19b8750024800080188d4068d4c06ccd5ce249035054310001c499264984d55ce9baa0011220021220012001232323232323333573466e1d4005200c200b23333573466e1d4009200a200d23333573466e1d400d200823300b375c6ae854014dd69aba135744a00a46666ae68cdc3a8022400c46601a6eb8d5d0a8039bae357426ae89401c8cccd5cd19b875005480108cc048c050d5d0a8049bae357426ae8940248cccd5cd19b875006480088c050c054d5d09aab9e500b23333573466e1d401d2000230133016357426aae7940308d407cd4c080cd5ce2481035054310002149926499264992649926135573aa00826aae79400c4d55cf280109aab9e500113754002424444444600e01044244444446600c012010424444444600a010244444440082444444400644244444446600401201044244444446600201201040024646464646666ae68cdc3a800a400446660106eb4d5d0a8021bad35742a0066eb4d5d09aba2500323333573466e1d400920002300a300b357426aae7940188d4040d4c044cd5ce2490350543100012499264984d55cea80189aba25001135573ca00226ea80048488c00800c888488ccc00401401000c80048c8c8cccd5cd19b875001480088c018dd71aba135573ca00646666ae68cdc3a80124000460106eb8d5d09aab9e500423500a35300b3357389201035054310000c499264984d55cea80089baa001212230020032122300100320011122232323333573466e1cd55cea80124000466aa016600c6ae854008c014d5d09aba25002235007353008335738921035054310000949926135573ca00226ea8004498480048004448848cc00400c008448004848c0040088004888848cccc00401401000c00880044880084880048004448c8c00400488cc00cc008008004c8ccc888c8c8cc88cc88ccc888c8c8c8c8cc88c8c8cc88c8cccc8888c8c8c8c8c8c8c8c8ccc888c8ccc888ccc888cccccccc88888888cc88ccccc88888cccc8888cc88cc88cc88ccc888cc88cc88cc88cc88cc88c8c8c8cc88c8c8c8c8c8c8cc88c8c8c8c8c8c8cc888c888c8c94cd4c1240104cc0352401297369676e617475726520646f6573206e6f74206d617463682063726561746f7220696e20646174756d0033223530200022222222222533535032333553068120015027253353079333573466e3c0300041ec1e84d40d4004540d000c841ec41e54008c04540144cc054cc03524012f65787065637465642063726561746f7220746f2067657420616c6c206f66207768617420736865206f72646572656400330153350133335500e305c12001504f350481223335501b2253353070333505006353353502a3235302900122335304c0022350300012502f300e00221001132635300b335738920117696e76616c6964207075626c6963206b657920686173680000c498c05540244cc010c0340080044004004c8d4c08400488888888880254010ccd41354138c1894014c04920c08db7013350133335500e305c12001504f350481223335501b22533530703005002133004335506500d30100020011001001300d5004333504d504e30625005333504d504e533535026301a00321300a300d0011630124830236dc04cc0352401276f6e6c79206d617463686573206f66207061697273206f66206f726465727320616c6c6f77656400533535063350481223335501b225335307030050021330040020011001001300d50041306a162215335350650011306c16221533535067001107222130701623253353502732353024001222001500121333504e223530280022235302a0032232335304e0052335304f004253353077333573466e3c0080041e41e05400c41e081e08cd4c13c01081e094cd4c1dcccd5cd19b8f002001079078150031078153353502e0032153353502f00221335304c0022335304d002233530510022335305200223306d002001207b23353052002207b23306d00200122207b222335304f004207b2225335307c333573466e1c01800c1f81f454cd4c1f0ccd5cd19b8700500207e07d1333573466e1c0100041f81f441f441f441d854cd4d40b8004841d841d8c03140094cd4d40a0c07001484cd54190034c03c0045841b84c0300044d4c068004880084d4c02800480044800480048d4c0680048880088d4c06400488800c8d4c05000488888888880288d4c05400488004894cd4c184004418c4cd5ce001031089119aa8011a82600090009091800801100091a982c0009111002119a82999aa82b245003350533355056489000015054505412233355304b120013500550032353550560012233355304e120013500850062353550590012233353550490012330614800000488cc1880080048cc184005200000133040002001133500400105a22533530590021001105a123350492233353500400322002002001353500200122001122123300100300212001112232001320013550582253353504e00110032213300600230040012353003001223530070022222222222533335302600b21501b21501b21501b2133355305012001500f2353015001225335306353353063333573466e3cd4c0bc00888008d4c0bc010880081941904ccd5cd19b8735302f0022200135302f00422001065064106413501f0031501e00b13350432253353500d002210031001500c2212330010030022001222222222212333333333300100b00a009008007006005004003002200122123300100300220012221233300100400300220012212330010030022001121223002003112200112001122123300100300212001122123300100300212001122123300100300212001121222300300411222002112220011200121222230040052122223003005212222300200521222230010052001221233001003002200121222222230070082212222222330060090082122222223005008122222220041222222200322122222223300200900822122222223300100900820012122300200322212233300100500400320012122300200321223001003200112335001501d501e1220021220012001120011200113002012133500b2233300301300200150162223355300e1200123535501a00122335501d002335530111200123535501d001223355020002333535500d00123300a4800000488cc02c0080048cc028005200000133004002001223355300c1200123535501800122335501b00233353550080012335530101200123535501c00122335501f00235500f001001223335550080150020012335530101200123535501c00122335501f00235500d0010013335550030100020011112223335530041200150153355300c1200123535501800122335501b00235500b0013335530041200122353550190022253353021333553011120013500d33500f22533530230021025100102223535501c001223300a0020050061003133501900400350160013355300c120012353550180012232335501c00330010053200135502322533535019001135500b0032213535501e00222533530263300c00200813355010007001130060030023200135501c221122253353501500110022213300500233355300712001005004001112122230030041122122233002005004112122230010041120011233500722333535004003220020020013535002001220011221233001003002120013200135501422112253353500c0011500e22133500f3004002335530061200100400132001355013221122253353500c00113535006003220012213335350080052200230040023335530071200100500400112212330010030021200122333573466e3c00800404404088cdc000100088911801000919991119a80319aa80480199a80319aa804801000a803a8039a980380091110019a980380091110011a98038009111000889100109109119800802001890008891091980080180108900091110919998008028020018011000900211199ab9a3371000400200800a244004244002400222464600200244660066004004003"
      }
    ],
    "plutus_redeemers": [
      {
        "purpose": "spend",
        "ex_units_mem": 0,
        "ex_units_steps": 0,
        "input_idx": 0,
        "plutus_data": {
          "constructor": 0,
          "fields": []
        }
      }
    ],
    "plutus_data": [
      {
        "datum_hash": "2c14cb7463238191c1786dfdcc37012c2fa8534f87f22b75d8f5dc3ecf4f4d74",
        "plutus_data": {
          "constructor": 0,
          "fields": [
            {
              "constructor": 0,
              "fields": [
                {
                  "bytes": "ad4c1913482c815d5412d3a14a818dca19d95b306267654115fca1ad"
                },
                {
                  "bytes": "a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235"
                },
                {
                  "bytes": "484f534b59"
                },
                {
                  "int": 1000000
                }
              ]
            }
          ]
        }
      }
    ],
    "withdrawals": null,
    "size": 4957
  },
  "fingerprint": null
}

If you go to the transaction on CardanoScan page for this transaction however https://cardanoscan.io/transaction/f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234?tab=collateral, you'll notice that the transaction does indeed have a Collateral Input, yet the data above says:

collateral_input_count: 0

and

collateral_inputs: null

Is there any specific reason for this? This is a failed transaction, which took the collateral from the user. I figured this would be reflected in the transaction data, however it's not.

scarmuega commented 10 months ago

@biofreeze thanks for reporting. I managed to reproduce. This is a bug on how we build the json output for transaction details for pre-babbage blocks. The end result, as you noticed, is a transaction record with missing collateral info.

We're working to release a patch for v1 versions ASAP.

scarmuega commented 10 months ago

We've merged the fixed. This is what the json output looks like for the same tx:

{
  "context": {
    "block_hash": "faaeda2a014e0ad176e06837978c2f663ab0fab5f5874b079b886398099b97be",
    "block_number": 6703641,
    "certificate_idx": null,
    "input_idx": null,
    "output_address": null,
    "output_idx": null,
    "slot": 49503576,
    "timestamp": 1641069867,
    "tx_hash": "f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234",
    "tx_idx": 3
  },
  "fingerprint": null,
  "transaction": {
    "collateral_input_count": 1,
    "collateral_inputs": [
      {
        "index": 0,
        "tx_id": "9a2dbf8fa8ca07b43f5592cd00e7fa5d12d4fdf7bc511a15f05e9657a598e5b4"
      }
    ],
    "collateral_output": null,
    "fee": 373665,
    "has_collateral_output": false,
    "hash": "f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234",
    "input_count": 1,
    "inputs": [
      {
        "index": 1,
        "tx_id": "944cb825a06993865dcf5d8e80354ed5afa1bcfb2f17b179c139a5bae23594cd"
      }
    ],
    "metadata": null,
    "mint": null,
    "mint_count": 0,
    "native_witnesses": [],
    "network_id": null,
    "output_count": 1,
    "outputs": [
      {
        "address": "addr1vxk5cxgnfqkgzh25ztf6zj5p3h9pnk2mxp3xwe2pzh72rtg0nf5cs",
        "amount": 2726335,
        "assets": [],
        "datum_hash": null,
        "inline_datum": null
      }
    ],
    "plutus_data": [
      {
        "datum_hash": "2c14cb7463238191c1786dfdcc37012c2fa8534f87f22b75d8f5dc3ecf4f4d74",
        "plutus_data": {
          "constructor": 0,
          "fields": [
            {
              "constructor": 0,
              "fields": [
                {
                  "bytes": "ad4c1913482c815d5412d3a14a818dca19d95b306267654115fca1ad"
                },
                {
                  "bytes": "a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235"
                },
                {
                  "bytes": "484f534b59"
                },
                {
                  "int": 1000000
                }
              ]
            }
          ]
        }
      }
    ],
    "plutus_redeemers": [
      {
        "ex_units_mem": 0,
        "ex_units_steps": 0,
        "input_idx": 0,
        "plutus_data": {
          "constructor": 0,
          "fields": []
        },
        "purpose": "spend"
      }
    ],
    "plutus_witnesses": [
      {
        "script_hash": "15b95fdaceeb507073a1bd198803373beeafbd82560fbf8abe9073ff",
        "script_hex": <redacted>
      }
    ],
    "size": 4957,
    "total_output": 2726335,
    "ttl": 49503712,
    "validity_interval_start": null,
    "vkey_witnesses": [
      {
        "signature_hex": "9f858a30c5a53f2aba8955e6c33126e818f6701cd21137b017f972b4dc31c42e9e229d3e02c4cfad443e3e4f034caf1681f94bc6a2b3cc83c6aa9dc3ef4e6001",
        "vkey_hex": "92c5efea5bf9a8fa1f1eaf2e97e7cf425122c034f360abaf44ea9fb56622e919"
      }
    ],
    "withdrawals": null
  }
}