Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing collateral #662

Open
pablosymc opened this issue Aug 1, 2023 · 1 comment
Open

Missing collateral #662

pablosymc opened this issue Aug 1, 2023 · 1 comment

Comments

@pablosymc
Copy link

pablosymc commented Aug 1, 2023

Given the following config:

[source]
type = "N2C"
address = ["Unix", "/opt/cardano/cnode/sockets/node0.socket"]
magic = "mainnet"

[source.intersect]
type = "Origin"

[cursor]
type = "File"
path = "./cursor"

[source.mapper]
include_transaction_details = true

[[filters]]
type = "Fingerprint"

[[filters]]
type = "Selection"

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

[sink]
type = "Kafka"
brokers = ["localhost:9092"]
topic = "cardano"
paritioning = "ByBlock"

And the following 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": "......" (omitted)
    }
  ],
  "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
}

Another transaction:

{
  "hash": "08a7e98294857cf2500f421943ec005f0ed4825c96504ab0cefe1fbb60018df8",
  "fee": 450000,
  "ttl": 49580478,
  "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": 2650000,
  "metadata": null,
  "inputs": [
    {
      "tx_id": "944cb825a06993865dcf5d8e80354ed5afa1bcfb2f17b179c139a5bae23594cd",
      "index": 1
    }
  ],
  "outputs": [
    {
      "address": "addr1vxk5cxgnfqkgzh25ztf6zj5p3h9pnk2mxp3xwe2pzh72rtg0nf5cs",
      "amount": 2650000,
      "assets": [],
      "datum_hash": null,
      "inline_datum": null
    }
  ],
  "collateral_inputs": null,
  "collateral_output": null,
  "mint": null,
  "vkey_witnesses": [
    {
      "vkey_hex": "92c5efea5bf9a8fa1f1eaf2e97e7cf425122c034f360abaf44ea9fb56622e919",
      "signature_hex": "0b4bcf57af84c89a7b5599a78d2644978a1b63e3dcd8d5a73ee785686b102b9e89896adcde393b20064aa57d50542dd443f5b31752d217a1c4cfd2f8b41b2605"
    }
  ],
  "native_witnesses": [],
  "plutus_witnesses": [
    {
      "script_hash": "15b95fdaceeb507073a1bd198803373beeafbd82560fbf8abe9073ff",
     "script_hex": "......" (omitted)
    }
  ],
  "plutus_redeemers": [
    {
      "purpose": "spend",
      "ex_units_mem": 720000,
      "ex_units_steps": 320000000,
      "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": 4995
}

It look's like both of these transaction's https://cardanoscan.io/transaction/f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234 and https://cardanoscan.io/transaction/08a7e98294857cf2500f421943ec005f0ed4825c96504ab0cefe1fbb60018df8 do indeed have collateral set.

I should note however, it does appear that this transaction failed, https://cardanoscan.io/transaction/f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234 and collateral was taken from the wallet.

Am I doing something wrong with my config, or is there an issue with getting collateral? I'm expecting that the collateral_inputs should not be null for a successful or failed transaction, and collateral_output should be null for a failed transaction. If i'm understanding this correctly.

I would also expect that collateral_input_count and has_collateral_output be correct as well.

Any assistance or feedback would be appreciated!

Note: I'm assuming that collateral_inputs and collateral_outputs would assist me in determining whether a transaction has failed? Please let me know if there is another way to detect a failed transaction.

@pablosymc
Copy link
Author

After investigating further it looks like the transaction I was referencing https://cardanoscan.io/transaction/f9ed2fef27cdcf60c863ba03f27d0e38f39c5047cf73ffdf2428b48edbe83234 is from the Alonzo Era.

This PR #495 to add collateral data support seems to be only for the Babbage Era?

I guess my question still stands. How do we detect transaction failures prior to Babbage, if I don't have access to the collateral data in each transaction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant