Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

JSONDecodeError in broadcast when sending an erroneous transaction #7

Open
sh0oki opened this issue Nov 3, 2020 · 1 comment
Open

Comments

@sh0oki
Copy link

sh0oki commented Nov 3, 2020

  • Jigu version: 0.1.4
  • Python version: 3.8.5
  • Operating System: Ubuntu 20.04.1 LTS

Description

Hey,
Trying to follow the getting started instructions and send some Lunas across Tequila-0004.
When trying to send a transaction that encounters an error, it is not parsed properly, yielding a json.decoder.JSONDecodeError.

In jigu/client/lcd/api/tx.py:120 (json.loads(res["raw_log"])), the assumption, that raw_log is a valid JSON does not hold true. These two examples show what res contained for two different errors, in which the raw_log isn't a valid JSON.

I'm not sure whether this is a jigu issue, or a bad response returned by the server-side.

This happens for two errors I was able to generate:

  1. Out of gas:
    {'height': '0', 'txhash': 'A1D2D6DA98C0192A2F559BA51E40F2CA90F4E8354AFD6C96B4F2E919B388D6B1', 'codespace': 'sdk', 'code': 11, 'raw_log': 'out of gas: out of gas in location: WriteFlat; gasWanted: 50000, gasUsed: 51899', 'gas_wanted': '50000', 'gas_used': '51899'}
  2. Insufficient Fees
    {'height': '0', 'txhash': '150ABCFB784A5E2F68B5316AC1AD5AC490E16D3C952D90D6F172E45497E4A77D', 'codespace': 'sdk', 'code': 13, 'raw_log': 'insufficient fee: insufficient fees; got: "7500uluna", required: "9258600ukrw,7800uluna,22444547umnt,5294usdr,7800uusd" = "9258600ukrw,7800uluna,22444547umnt,5294usdr,7800uusd"(gas) +""(stability)', 'gas_wanted': '52000', 'gas_used': '1054'}

What I Did

Use the following snippet to reproduce:

jg = Terra("tequila-0004", "https://tequila-lcd.terra.dev")
wallet_a = jg.wallet(MnemonicKey.generate())
wallet_b = jg.wallet(MnemonicKey.generate())
send = MsgSend(
    from_address=wallet_a.address,
    to_address=wallet_b.address,
    amount=Coins(uluna=20000000)
)

fee = StdFee.make(55000, uluna=7800)  # include a small fee..

tx = wallet_a.create_and_sign_tx(send, memo="memo", fee=fee)
res = wallet_a.broadcast(tx)

Thanks!

@akc2267
Copy link

akc2267 commented Dec 17, 2020

@ouiliame @etienne-napoleone, I'm running into the same issue at res = wallet_a.broadcast(tx):
JSONDecodeError("Expecting value", s, err.value) from None

I 100xed the gas and fees, so I'm pretty sure I'm not running into an "Out of gas" or "insuffecient fees" issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants