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

Batch transaction succeeding despite returning timeout error #16

Open
SpencerMiller23 opened this issue Aug 3, 2022 · 0 comments
Open

Comments

@SpencerMiller23
Copy link
Contributor

SpencerMiller23 commented Aug 3, 2022

  • secret_sdk version: 1.0
  • Python version: 3.10.4
  • Operating System: Windows

Description

I am submitting batch transactions to the counter contract from the Secret Network docs. As the number of messages included in the transaction increases, there is an increasing chance of encountering the following LCDResponseError: Status 500 - timed out waiting for tx to be included in a block. I assumed this meant that the transaction was not successful, however after querying the contract, it seems that the value was in fact increased.

What I Did

mk = MnemonicKey(mnemonic=my_mnemonic)
secret = LCDClient('http://testnet.securesecrets.org:1317', 'pulsar-2')
wallet = secret.wallet(mk)

COUNTER_ADDR = 'secret13uj6x7npak42gm9x8lqgsj4mjq6fpwphtwsp6f'

msg = {
    "increment": {}
}

fee = StdFee(gas=3_000_000, amount=Coins.from_data([{"amount": 250_000, "denom": "uscrt"}]))

def batch_tx():
    try:
        execute_msg = secret.wasm.contract_execute_msg(
            wallet.key.acc_address,
            COUNTER_ADDR,
            msg,
            None
        )

        msg_list = [execute_msg for _ in range(150)]

        signed_tx = wallet.create_and_sign_tx(
            msg_list,
            fee=fee,
            memo=''
        )

        tx = secret.tx.broadcast(signed_tx)
        print(tx)
    except Exception as e:
        print(f'Error: {e}')

if __name__ == '__main__':
    batch_tx()

count value before running the script: :100068200

Script output: Error: Status 500 - timed out waiting for tx to be included in a block

count value after running the script: 100068350

@SpencerMiller23 SpencerMiller23 changed the title Batch transaction succeeding despite being returned timeout error Batch transaction succeeding despite returning timeout error Aug 3, 2022
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

No branches or pull requests

1 participant