Skip to content

fix: make start_ledger optional and mutually exclusive with cursor #1032

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

Merged
merged 7 commits into from
Apr 11, 2025

Conversation

aolieman
Copy link
Contributor

@aolieman aolieman commented Apr 10, 2025

Fix for #1031
The start_ledger argument needs to be optional on RPC methods that support pagination. I've added model validation that enforces the mutual exclusivity with the cursor argument. This helps the SDK user see the error faster than if they'd get it from the RPC response.

@overcat
Copy link
Member

overcat commented Apr 10, 2025

Hi @aolieman, please remember to update the CHANGELOG.md

@aolieman
Copy link
Contributor Author

I've updated the changelog. This might be complete. What do you think?

@overcat
Copy link
Member

overcat commented Apr 10, 2025

I've updated the changelog. This might be complete. What do you think?

Hi @aolieman, it's late here, so I need to wait until tomorrow to review it.

@overcat
Copy link
Member

overcat commented Apr 10, 2025

I think you need to run pre-commit run --all-files.

https://pre-commit.com/

@aolieman
Copy link
Contributor Author

Alright, I understand. I'll have a look at the CI output in the meantime.

Depending on which type checker I use, I still get warnings for optional arguments that don't have the None type:

        # pyright warns about all these default values
        start_ledger: int = None,
        filters: Sequence[EventFilter] = None,
        cursor: str = None,
        limit: int = None,

Is this intentional? I can change it if you want, but it's not new and I don't think it's a big issue for anyone.

Copy link

codecov bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.28%. Comparing base (08622be) to head (8db5c6e).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1032   +/-   ##
=======================================
  Coverage   98.27%   98.28%           
=======================================
  Files         262      262           
  Lines       14250    14308   +58     
=======================================
+ Hits        14004    14062   +58     
  Misses        246      246           
Flag Coverage Δ
unittests 98.28% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
stellar_sdk/soroban_rpc.py 100.00% <100.00%> (ø)
stellar_sdk/soroban_server.py 97.27% <ø> (ø)
stellar_sdk/soroban_server_async.py 97.27% <ø> (ø)
tests/test_soroban_server_async.py 100.00% <100.00%> (ø)
tests/test_soroban_server_sync.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@overcat
Copy link
Member

overcat commented Apr 10, 2025

Alright, I understand. I'll have a look at the CI output in the meantime.

Depending on which type checker I use, I still get warnings for optional arguments that don't have the None type:

        # pyright warns about all these default values
        start_ledger: int = None,
        filters: Sequence[EventFilter] = None,
        cursor: str = None,
        limit: int = None,

Is this intentional? I can change it if you want, but it's not new and I don't think it's a big issue for anyone.

I don't think this is a problem; let's keep it as it is in this PR.

@aolieman aolieman requested a review from overcat April 10, 2025 18:27
@overcat
Copy link
Member

overcat commented Apr 11, 2025

👍 The other parts look good; we just need to fix the issue that it cannot run on py 3.8 to py 3.10 before we can merge it.

@aolieman aolieman requested a review from overcat April 11, 2025 12:20
Copy link
Member

@overcat overcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thank you for your contribution.

@overcat overcat merged commit a88e369 into StellarCN:main Apr 11, 2025
29 checks passed
@aolieman
Copy link
Contributor Author

It was a pleasure working with you!

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.

2 participants