michaelhly / solana-py

Solana Python SDK
https://michaelhly.github.io/solana-py
MIT License
979 stars 252 forks source link

Upgrade httpx version support to 0.27.0 #405

Closed gildastone closed 5 months ago

gildastone commented 6 months ago

Problem

Why is the current httpx supported version only >0.23.0, <0.24.0? Current stable httpx version is 0.27.0. Is there any blockers to upgrading it? I'm using another package which is using httpx=0.27.0 httpcore=1.0.4 which is conflicting.

Is it safe to use httpx=0.27.0 alongside solana=0.31.0? How could I check?

Compatibility tests with httpx=0.27.0

So I clone and ran the repository test suite with current 0.23.0 version as well as by setting httpx = "^0.27.0" from httpx = "^0.23.0" in the pyproject.toml file (and re-generating the poetry.lock).

Test resulst httpx = 0.23.0

============= short test summary info =============
FAILED tests/integration/test_http_client.py::test_request_air_drop - assert 19986894600 == 10000000000
FAILED tests/integration/test_http_client.py::test_send_transaction_and_get_balance - solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction simulation failed: Transaction results in an account (1) without insufficient funds for rent", data: RpcSimulateTransactionResult(RpcS...
FAILED tests/integration/test_http_client.py::test_send_raw_transaction_and_get_balance - solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction simulation failed: Transaction results in an account (1) without insufficient funds for rent", data: RpcSimulateTransactionResult(RpcS...
FAILED tests/integration/test_http_client.py::test_send_raw_transaction_and_get_balance_using_latest_blockheight - solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction simulation failed: Transaction results in an account (1) without insufficient funds for rent", data: RpcSimulateTransactionResult(RpcS...
FAILED tests/integration/test_websockets.py::test_multiple_subscriptions - assert 49986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_new_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_new_associated_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_get_account_info - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_get_mint_info - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_mint_to - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_transfer - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_burn - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_mint_to_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_transfer_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_burn_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_get_accounts - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_approve - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_revoke - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_approve_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_freeze_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_thaw_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_close_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_create_multisig - assert 39986884600 == 10000000000
============= 5 failed, 264 passed, 18 errors in 234.12s (0:03:54) =============
make: *** [tests] Error 1

Test resulst httpx = 0.27.0

============= short test summary info =============
FAILED tests/integration/test_http_client.py::test_request_air_drop - assert 19986894600 == 10000000000
FAILED tests/integration/test_http_client.py::test_send_transaction_and_get_balance - solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction simulation failed: Transaction results in an account (1) without insufficient funds for rent", data: RpcSimulateTransactionResult(RpcS...
FAILED tests/integration/test_http_client.py::test_send_transaction_cached_blockhash - assert 2 == 1
FAILED tests/integration/test_http_client.py::test_send_raw_transaction_and_get_balance - solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction simulation failed: Transaction results in an account (1) without insufficient funds for rent", data: RpcSimulateTransactionResult(RpcS...
FAILED tests/integration/test_http_client.py::test_send_raw_transaction_and_get_balance_using_latest_blockheight - solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction simulation failed: Transaction results in an account (1) without insufficient funds for rent", data: RpcSimulateTransactionResult(RpcS...
FAILED tests/integration/test_websockets.py::test_multiple_subscriptions - assert 49986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_new_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_new_associated_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_get_account_info - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_get_mint_info - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_mint_to - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_transfer - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_burn - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_mint_to_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_transfer_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_burn_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_get_accounts - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_approve - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_revoke - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_approve_checked - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_freeze_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_thaw_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_close_account - assert 39986884600 == 10000000000
ERROR tests/integration/test_token_client.py::test_create_multisig - assert 39986884600 == 10000000000
============= 6 failed, 263 passed, 18 errors in 231.87s (0:03:51) =============
make: *** [tests] Error 1

Comparaison httpx 0.23.0 vs 0.27.0 results

In both scenarios there are 18 errors due to asserts.

As we can definitely see above, no errors are raised due to the httpx package. Errors raised are due to:

Therefore I do not see any objections as to upgrade the httpx package to version 0.27.0.

If so I will raise a PR with the change.

michaelhly commented 5 months ago

Feel free to raise a PR!

gildastone commented 5 months ago

@michaelhly Got access denied when trying to push the branch in order to raise the PR.

ERROR: Permission to michaelhly/solana-py.git denied to perezmunoz.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
michaelhly commented 5 months ago

@perezmunoz you need to fork