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

FIX simulate_transaction add parameters from new RPC API #389

Closed
wants to merge 2 commits into from

Conversation

pyz4
Copy link
Contributor

@pyz4 pyz4 commented Jan 15, 2024

Incorporate new parameters from RPC API (https://docs.solana.com/api/http#simulatetransaction): replace_recent_blockhash, min_context_slot, and accounts.

@michaelhly
Copy link
Owner

@pyz4 would you mind taking a look at the broken integration test?

@Morgandri1
Copy link

The check issues are from a TypeError in test_send_transaction_and_get_balance:

# transfer_tx needs to be a VersionedTransaction. 
transfer_tx = Transaction().add(
     sp.transfer(sp.TransferParams(from_pubkey=stubbed_sender.pubkey(), to_pubkey=stubbed_receiver, lamports=1000))
)
sim_resp = test_http_client.simulate_transaction(transfer_tx)

the test_send_raw_transaction_and_get_balance test in integration/test_http_client.py. The returned balance is 9999994000, but the assertion is against 9999988000. May be that your change is using less gas?

Same thing in test_send_raw_transaction_and_get_balance_using_latest_blockheight. Balance is slightly higher than it should be. Would love to get @michaelhly 's opinion on if gas is likely the culprit.

@michaelhly
Copy link
Owner

michaelhly commented Mar 5, 2024

The check issues are from a TypeError in test_send_transaction_and_get_balance:

# transfer_tx needs to be a VersionedTransaction. 
transfer_tx = Transaction().add(
     sp.transfer(sp.TransferParams(from_pubkey=stubbed_sender.pubkey(), to_pubkey=stubbed_receiver, lamports=1000))
)
sim_resp = test_http_client.simulate_transaction(transfer_tx)

the test_send_raw_transaction_and_get_balance test in integration/test_http_client.py. The returned balance is 9999994000, but the assertion is against 9999988000. May be that your change is using less gas?

Same thing in test_send_raw_transaction_and_get_balance_using_latest_blockheight. Balance is slightly higher than it should be. Would love to get @michaelhly 's opinion on if gas is likely the culprit.

Yeah. We can change the hard-coded balance amounts but I think we still need to fix the TypeError:

FAILED tests/integration/test_http_client.py::test_send_transaction_and_get_balance - TypeError: argument 'tx': 'Transaction' object cannot be converted to 'VersionedTransaction'

@pyz4 pyz4 closed this May 10, 2024
@pyz4 pyz4 deleted the fix-simulate-transaction branch May 10, 2024 02:06
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.

3 participants