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

Price limit error “not enough funds to cover gas costs” for getter calls #1927

Closed
atanmarko opened this issue Sep 21, 2023 · 2 comments · Fixed by #1949
Closed

Price limit error “not enough funds to cover gas costs” for getter calls #1927

atanmarko opened this issue Sep 21, 2023 · 2 comments · Fixed by #1949
Assignees
Labels
in the pipeline Logged into our issue tracking pipeline

Comments

@atanmarko
Copy link
Member

Simple non state changing call errors with “not enough funds to cover gas costs” when --price-limit is above 0

Description

Account without tokens (balance is 0) could not perform simple smart contract getter call (non changing state call should not require any gas).
Seems like the problem is in function func (t *Transition) subGasLimitPrice(msg *types.Transaction) error which gets executed even for non state change client calls.

Your environment

  • OS and version:
    Ubuntu 22.04
  • The version of the Polygon Edge.
    Built from commit
f2b24e7 2023-09-14 11:17 +0200 Dusan Nosovic          o [HEAD] {origin/v1.2.0-rc1} Introduce `ErrNonceUintOverflow` as error for nonce overflow (#1905)
  • Locally or Cloud hosted (which provider).
    Locally

Steps to reproduce

Smart contract and scripts used are here:
smart_contract_and_scripts.zip

Used origin/v1.2.0-rc1 branch

Generate keys, create a genesis file and run a network:

$ polygon-edge secrets init --insecure --data-dir test-chain-1
$ polygon-edge genesis --consensus ibft --ibft-validators-prefix-path test-chain- --bootnode /ip4/127.0.0.1/tcp/10001/p2p/16Uiu2HAmCwvnmjdsSyjJJJTbesHf6C9JvVp4RahqnvAfGnmfCNcV --premine 0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac:0x123123123123123

Run network with price limit 100
$ polygon-edge server --data-dir ./test-chain-1 --chain genesis.json  --price-limit=100

// Premined account is 0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac with private key 0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133

// Deploy simple TestContract2 smart contract provided (using ethers.js)

$ ts-node ./deploy-test-contract2.ts http://127.0.0.1:8545

In my case contract TestContact2 is deployed to address 0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3

Now run very simple script, that would only perform view getter call (getUintValue()), with the account that has 0 tokens on its balance (used account 0x5283ac54A7B9669F6415168DC7a5FcEe05019E45 private key 0x11eddfae7abe45531b3f18342c8062969323a7131d3043f1a33c40df74803cc7

$ ts-node check.ts http://127.0.0.1:8545 0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3 0x11eddfae7abe45531b3f18342c8062969323a7131d3043f1a33c40df74803cc7 


Simple call fails with error "not enough funds to cover gas costs","error":{"code":-32600}. That is a non state changing call, so it should be executed.


Runnin a script with a account that has premined tokens succeeds:

$ ts-node check.ts http://127.0.0.1:8545 0xc01Ee7f10EA4aF4673cFff62710E1D7792aBa8f3 0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133 

Retrieved uint `a` value is= BigNumber { _hex: '0x13', _isBigNumber: true }

Expected behavior

  • Simple smart getter call should be executed when account without tokens performs the call
  • Error:
"not enough funds to cover gas costs","error":{"code":-32600}

Proposed solution

This seems like a serious issue, should be addressed immediately.

@begmaroman begmaroman self-assigned this Sep 22, 2023
@begmaroman begmaroman added the in the pipeline Logged into our issue tracking pipeline label Sep 22, 2023
@begmaroman begmaroman linked a pull request Oct 2, 2023 that will close this issue
11 tasks
@Solidityghost998
Copy link

Screenshot from 2023-10-03 11-50-47
i am facing the same issue , i am also working with one node .

@begmaroman
Copy link
Contributor

@Solidityghost998 just liked a PR to this issue - #1949

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in the pipeline Logged into our issue tracking pipeline
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants