solana-py icon indicating copy to clipboard operation
solana-py copied to clipboard

FIX simulate_transaction add parameters from new RPC API

Open pyz4 opened this issue 1 year ago • 3 comments

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

pyz4 avatar Jan 15 '24 02:01 pyz4

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

michaelhly avatar Jan 22 '24 04:01 michaelhly

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.

Morgandri1 avatar Feb 26 '24 22:02 Morgandri1

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'

michaelhly avatar Mar 05 '24 22:03 michaelhly