cosmjs
cosmjs copied to clipboard
Out of gas
I've been using stargateSigningClient.simulate method for gas estimation. This estimated gas from this method is never sufficient. Especially for osmosis, there is huge gap in estimation.
const sendMsg: MsgSendEncodeObject = { typeUrl: '/cosmos.bank.v1beta1.MsgSend', value: { fromAddress: senderAddress, toAddress: address, amount: [ { denom, amount, }, ], }, }; const simulation = await signingClient.simulate(senderAddress, [sendMsg], '');
This is expected. You need to add a multiplier to the result of simulate. 1.3 (i.e. +30%) used to be a good choice for a long time. Due to some changes in the SDK it is often not enough anymore and we now used 1.4 by default.
But for osmosis chain, the gap is huge, its like 10x
For osmosis this has now been fixed if the ful node your interacting with is v21.1.0
or higher in version. (v21.1.2
recommended)
The problem was, there has always been a buggy code path in the SDK + Osmosis for gas simulation, and that buggy code path had more gas in it. This fix correctly makes that code path get gas tracked.
Can you suggest any updated rpc node ?