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

Add an OgmiosV6 backend based on ogmios-python #368

Closed
wants to merge 12 commits into from

Conversation

nielstron
Copy link
Contributor

This requires bumping the python version to 3.10+, because ogmios-python requires this. I also refactored the chain backend to not have built-in kupo support but just provide it as an extension using kupo-wrappers. This way, both OgmiosV5 and OgmiosV6 directly have support for kupo.

This requires bumping the python version to 3.10+, because ogmios-python requires this.
I also refactored the chain backend to not have built-in kupo support but just provide it as an extension using kupo-wrappers.
This way, both OgmiosV5 and OgmiosV6 directly have support for kupo.
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 36.17747% with 187 lines in your changes missing coverage. Please review.

Project coverage is 81.41%. Comparing base (68108ad) to head (b0eb69c).

Files with missing lines Patch % Lines
pycardano/backend/ogmios_v6.py 32.00% 119 Missing ⚠️
pycardano/backend/kupo.py 37.38% 66 Missing and 1 partial ⚠️
pycardano/backend/ogmios_v5.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #368      +/-   ##
==========================================
- Coverage   83.97%   81.41%   -2.57%     
==========================================
  Files          29       31       +2     
  Lines        3732     3954     +222     
  Branches      940      984      +44     
==========================================
+ Hits         3134     3219      +85     
- Misses        433      571     +138     
+ Partials      165      164       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nielstron
Copy link
Contributor Author

This error occurs in mypy, not sure where it comes from

error: --install-types failed (no mypy cache directory)

@cffls
Copy link
Collaborator

cffls commented Aug 22, 2024

Wow nice! Thanks a lot for adding this support. Will take a look at the error.
Regarding the min version bump, is it because of the dependency on ogmios = "^1.1.1"?

@nielstron
Copy link
Contributor Author

Yes unfortunately Ogmios does not support python 3.8 and 3.9

@cffls
Copy link
Collaborator

cffls commented Aug 26, 2024

I had to bump the python version of mypy to "3.10" for this to run.

Here are few errors:

pycardano/backend/kupo.py:186: error: "KupoChainContextExtension" has no attribute "_extract_asset_info"  [attr-defined]
pycardano/backend/ogmios_v6.py:152: error: Argument "decentralization_param" to "ProtocolParameters" has incompatible type "None"; expected "Fraction"  [arg-type]
pycardano/backend/ogmios_v6.py:156: error: Argument "min_utxo" to "ProtocolParameters" has incompatible type "None"; expected "int"  [arg-type]
pycardano/backend/ogmios_v6.py:359: error: Argument 2 to "OgmiosV6ChainContext" has incompatible type "Network"; expected "int"  [arg-type]
Found 4 errors in 2 files (checked 31 source files)
make: *** [qa] Error 1

@pcjordan
Copy link

pcjordan commented Aug 27, 2024

fyi, I tried to work with this branch and here's another error I encountered:

File ".../pycardano/backend/ogmios_v6.py", line 288, in _utxo_from_ogmios_result
Address.from_primitive(utxo.address),
AttributeError: type object 'Address' has no attribute 'from_primitive'

I guess in (at least) the following two places the pycardano.Address should be used instead of ogmios.datatypes.Address:

Address.from_primitive(utxo.address),

Address.from_primitive(utxo.address),

@nielstron
Copy link
Contributor Author

Thanks for your support @cffls @pcjordan. Filed some issue at python-ogmios to achieve full 3.8/3.9 support again and then lets see about the unit tests (should ideally also add some unit tests for ogmios v6 and documentation here, maybe @cffls can help me out there?)

@wrmarchetto
Copy link

When this is ready to merge, I'll release the compatible version of ogmios-python (currently in the main branch).

@nielstron
Copy link
Contributor Author

nielstron commented Sep 2, 2024

Thanks @wrmarchetto !

@cffls
Copy link
Collaborator

cffls commented Sep 2, 2024

Thanks for fixing issues! FYI, I merged this branch (feat/add_v6_backend) to chang, and all tests are passing. I think it might be a good idea to push changes to chang branch going forward. wdyt?

@nielstron
Copy link
Contributor Author

Sounds good.

@nielstron nielstron closed this Sep 2, 2024
@nielstron nielstron mentioned this pull request Sep 2, 2024
5 tasks
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 this pull request may close these issues.

4 participants