ilblackdragon / contracts

My contracts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: Too many zeros in the gas

evgenykuzyakov opened this issue · comments

Seems you're using 5_000 Tgas instead of 5 Tgas, so it underflows there

const CREATE_CALL_GAS: u64 = 5_000_000_000_000_000;

With overflow-checks true it probably fails there.

Re: near/NEPs#137

That's not an issue, because it fails on new, not on create:
https://explorer.testnet.near.org/transactions/6WfjWm6cjraYQMfoua89HhZhVTxiq3HX5WcdDBYYGiKh

But you are right that it's mostly in serialization, here is new without storing operation failing with out of gas as well:
https://explorer.testnet.near.org/transactions/BtHxvE8n1mPF2YzqMyPQz6kFTNUbF1dLUji2559tYKJZ

Switching to Borsh for arguments - it's 46Tg for just passing over the arguments (without storing to storage): https://explorer.testnet.near.org/transactions/AhgH5rMSDFxoHpEqpQXNunSotnyTryB1rzEz4fEM9RLQ

With storing 58Tg: https://explorer.testnet.near.org/transactions/7kogLhcE8rBJZfYp2hfXKhQRN3hh9AoK63DExoYy899T

Still pretty high compared to pure contract deployment.

Also upgrade call 66Tg: https://explorer.testnet.near.org/transactions/Ub9dRdfTnZJfPVULyNvJCXAs82tXGZnKbuCnfPHCgUu
which is weird that it's higher, because this doesn't have account creation / transfer actions but only passes code and saves it to store.