near / near-cli

General purpose command line tools for interacting with NEAR Protocol
https://docs.near.org
MIT License
193 stars 93 forks source link

Error: The account wouldn't have enough balance to cover storage #646

Closed alianse777 closed 2 years ago

alianse777 commented 3 years ago

I'm trying to deploy status message contract on testnet (this happens with other contracts too). I'm getting the following error:

$ near deploy --wasmFile /opt/rust/cargo/target/wasm32-unknown-unknown/release/test_contract.wasm --accountId test_7555.testnet --verbose

Using options: {
  wasmFile: '/opt/rust/cargo/target/wasm32-unknown-unknown/release/test_contract.wasm',
  accountId: 'test_7555.testnet',
  contractName: 'test_7555.testnet',
  verbose: true,
  v: true,
  networkId: 'default',
  nodeUrl: 'https://rpc.testnet.near.org',
  walletUrl: 'https://wallet.testnet.near.org',
  helperUrl: 'https://helper.testnet.near.org',
  helperAccount: 'testnet',
  explorerUrl: 'https://explorer.testnet.near.org',
  useLedgerKey: "44'/397'/0'/0'/1'",
  seedPath: "m/44'/397'/0'",
  initGas: 100000000000000,
  initDeposit: '0',
  initialBalance: null
}
Starting deployment. Account id: test_7555.testnet, node: https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: /opt/rust/cargo/target/wasm32-unknown-unknown/release/test_contract.wasm
Receipt: 
        Failure [test_7555.testnet]: Error: The account test_7555.testnet wouldn't have enough balance to cover storage, required to have 4017705250600314400000000
An error occured
ServerTransactionError: The account test_7555.testnet wouldn't have enough balance to cover storage, required to have 4017705250600314400000000
    at Object.parseResultError (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/rpc_errors.js:35:29)
    at Account.signAndSendTransaction (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:147:36)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at async exports.deploy (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/index.js:57:20)
    at async Object.handler (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/utils/exit-on-error.js:39:9) {
  [stack]: "Error: The account test_7555.testnet wouldn't have enough balance to cover storage, required to have 4017705250600314400000000\n" +
    '    at Object.parseResultError (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/rpc_errors.js:35:29)\n' +
    '    at Account.signAndSendTransaction (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:147:36)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:93:5)\n' +
    '    at async exports.deploy (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/index.js:57:20)\n' +
    '    at async Object.handler (/home/user/.nvm/versions/node/v15.4.0/lib/node_modules/near-cli/utils/exit-on-error.js:39:9)',
  type: 'LackBalanceForState',
  context: undefined,
  index: null,
  amount: '4017705250600314400000000',
  signer_id: undefined,
  account_id: 'test_7555.testnet',
  kind: {
    account_id: 'test_7555.testnet',
    amount: '4017705250600314400000000'
  },
  message: "The account test_7555.testnet wouldn't have enough balance to cover storage, required to have 4017705250600314400000000",
  transaction_outcome: {
    proof: [
      {
        hash: 'DzFoZVqpWRufiWGZWV3Z2NNfGvWrRhZVYshwnHskGuXJ',
        direction: 'Right'
      },
      [length]: 1
    ],
    block_hash: '9STCPgReTpegQ1UzhFtTHwbYca7r4PocqPffi6jtUsVJ',
    id: 'cRa9ajbjkdacXZPuRxerHDbxNhto8LmjrjGAHgiNAaL',
    outcome: {
      logs: [ [length]: 0 ],
      receipt_ids: [ '8HwpXTNyL8G93AYePR1tVEhGLiGzTgiWEkk8pdx8Z4sk', [length]: 1 ],
      gas_burnt: 12118174866296,
      tokens_burnt: '1211817486629600000000',
      executor_id: 'test_7555.testnet',
      status: {
        SuccessReceiptId: '8HwpXTNyL8G93AYePR1tVEhGLiGzTgiWEkk8pdx8Z4sk'
      }
    }
  }
}

Meanwhile near dev-deploy works. The testnet account balance is 169 N and I can send tokens from it.

stunney commented 3 years ago

Hitting this too while running

yarn test

in GitHub Actions. Is there a step missing?

Flora258 commented 3 years ago

I'm also having the same issue while trying to work with the "token-printer" frontend. Yesterday I got an error after running yarn start and the localhost came up, it said Unhandled Rejection (Error): {"index":0} ▶ 4 stack frames were collapsed. Not sure what that was about. But today, the error is the same as yours. Maybe this is something Near needs to fix?

volovyks commented 3 years ago

@alianse777, @stunney, @Flora258 I can not reproduce it. What is your NEAR CLI version? Is it reproducible on other versions?

HuynhTanTan commented 2 years ago

Did you have solution to fix, I have same issue?

volovyks commented 2 years ago

Tested several times with mentioned contract on 2 machines. Everything worked fine. @BenKurrek can you please elaborate, since you put thumbs up on this issue? :)

near deploy --wasmFile target/wasm32-unknown-unknown/release/status_message.wasm --accountId serhii.testnet                                                                                                                                                                    20:27:24
This account already has a deployed contract [ Cz8EMV7cDgoy1vMyZq6SZgEN2iiknP9Qrncg5yJyVpUM ]. Do you want to proceed? (y/n) y
Starting deployment. Account id: serhii.testnet, node: https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: target/wasm32-unknown-unknown/release/status_message.wasm
Transaction Id 7Nz51sJVZ3t94tLRejoPKUAA6VXjYYApNuQruLj2DAom
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/7Nz51sJVZ3t94tLRejoPKUAA6VXjYYApNuQruLj2DAom
Done deploying to serhii.testnet
BenKurrek commented 2 years ago

@volovyk-s If i remember correctly (this was from a really long time ago), we were trying to run tests using Github actions and were running through Matt Lockyer's old jest tests. We wanted to run tests anytime we had PRs for our contracts. We ended up scrapping the actions since we couldn't figure out the problem. I don't have anymore information other than that.

This was way back when I knew barely anything about NEAR. Haven't run into any issues since then.

volovyks commented 2 years ago

Ok, thanks @BenKurrek ! Looks like people are having this problem here and there. Most likely it's because they do not have enough balance on their accs.

@HuynhTanTan and other participants of s dialog. If you will ever encounter such an issue, feel free to reopen it with steps to reproduce.

vietnt11 commented 2 years ago

Hi @volovyk-s , I have same problem.

Starting deployment. Account id: hellocontract.nastmuratest.testnet, node: https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: target/wasm32-unknown-unknown/release/key_value_storage.wasm
Receipt: 
    Failure [hellocontract.nastmuratest.testnet]: Error: The account hellocontract.nastmuratest.testnet wouldn't have enough balance to cover storage, required to have 8065739611052772000000000 yoctoNEAR more
An error occured
Error: The account hellocontract.nastmuratest.testnet wouldn't have enough balance to cover storage, required to have 8065739611052772000000000 yoctoNEAR more
    at Object.parseResultError (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/rpc_errors.js:31:29)
    at Account.signAndSendTransactionV2 (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:160:36)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async exports.deploy (/usr/local/lib/node_modules/near-cli/index.js:77:24)
    at async Object.handler (/usr/local/lib/node_modules/near-cli/utils/exit-on-error.js:52:9)
ServerTransactionError: The account hellocontract.nastmuratest.testnet wouldn't have enough balance to cover storage, required to have 8065739611052772000000000 yoctoNEAR more
    at Object.parseResultError (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/rpc_errors.js:31:29)
    at Account.signAndSendTransactionV2 (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:160:36)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async exports.deploy (/usr/local/lib/node_modules/near-cli/index.js:77:24)
    at async Object.handler (/usr/local/lib/node_modules/near-cli/utils/exit-on-error.js:52:9) {
  type: 'LackBalanceForState',