Skip to content

Batch transaction succeeding despite returning timeout error #16

@SpencerMiller23

Description

@SpencerMiller23
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions