Skip to content

Spending UTxOs containing a plutus V3 script fails with Ogmios backend #381

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

Closed
nullhashpixel opened this issue Oct 9, 2024 · 1 comment · Fixed by #383
Closed

Spending UTxOs containing a plutus V3 script fails with Ogmios backend #381

nullhashpixel opened this issue Oct 9, 2024 · 1 comment · Fixed by #383

Comments

@nullhashpixel
Copy link
Contributor

Describe the bug

Spending UTxOs containing a plutus V3 script fails with Ogmios backend

https://github.com/Python-Cardano/pycardano/blob/main/pycardano/backend/ogmios_v6.py#L264-L266

To Reproduce
Steps to reproduce the behavior. e.g. A python script.

Logs

  File "/home/.local/lib/python3.8/site-packages/pycardano/txbuilder.py", line 1489, in build_and_sign
    tx_body = self.build(
  File "/home/.local/lib/python3.8/site-packages/pycardano/logging.py", line 37, in wrapper
    raise e
  File "/home/.local/lib/python3.8/site-packages/pycardano/logging.py", line 28, in wrapper
    output = func(obj, *args, **kwargs)
  File "/home/.local/lib/python3.8/site-packages/pycardano/txbuilder.py", line 1220, in build
    for utxo in self.context.utxos(address):
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/base.py", line 155, in utxos
    return self._utxos(str(address))
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/ogmios_v6.py", line 230, in _utxos
    utxos = self._utxos_ogmios(OgmiosAddress(address=address))
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/ogmios_v6.py", line 253, in _utxos_ogmios
    utxos.append(self._utxo_from_ogmios_result(result))
  File "/home/.local/lib/python3.8/site-packages/pycardano/backend/ogmios_v6.py", line 267, in _utxo_from_ogmios_result
    if script["language"] == "plutus:v2":
TypeError: byte indices must be integers or slices, not str

Additional context

fix:

            if script["language"] == "plutus:v3":
                script = PlutusV3Script(bytes.fromhex(script["cbor"]))
            if script["language"] == "plutus:v2":

==>

            if script["language"] == "plutus:v3":
                script = PlutusV3Script(bytes.fromhex(script["cbor"]))
            elif script["language"] == "plutus:v2":
@nielstron
Copy link
Contributor

Thanks, this looks like a valid fix! Proposed a change in #383

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

Successfully merging a pull request may close this issue.

2 participants