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

Error: could not coalesce error (error={ "code": -32000, "data": { "hash": #6319

Open
MehdiAbidri opened this issue Dec 2, 2023 Discussed in #5828 · 4 comments
Open

Error: could not coalesce error (error={ "code": -32000, "data": { "hash": #6319

MehdiAbidri opened this issue Dec 2, 2023 Discussed in #5828 · 4 comments

Comments

@MehdiAbidri
Copy link

Lesson 05 :

I got this error while running deploy.js

Deploying, please wait ... 
error Error: could not coalesce error (error={ "code": -32000, "data": { "hash": "0xc808a9e63502b13ee9b18c03bab1d42073b4f84cfe0b2e50d1f4053ddd14d69c", "message": "invalid opcode", "programCounter": 82, "reason": null, "result": "0xc808a9e63502b13ee9b18c03bab1d42073b4f84cfe0b2e50d1f4053ddd14d69c" }, "message": "VM Exception while processing transaction: invalid opcode", "name": "RuntimeError", "stack": "RuntimeError: VM Exception while processing transaction: invalid opcode\n    at EIP1559FeeMarketTransaction.fillFromResult (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:12745)\n    at Miner.<anonymous> (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:36703)\n    at async Miner.<anonymous> (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:35116)\n    at async Miner.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:39680)\n    at async Blockchain.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:60063)\n    at async Promise.all (index 0)\n    at async TransactionPool.emit (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\node_modules\\emittery\\index.js:303:3)" }, payload={ "id": 9, "jsonrpc": "2.0", "method": "eth_sendRawTransaction", "params": [ "0x02f90e998205390a8504a817c8008504a817c800836691b78080b90e3c60806040526040518060400160405280600281526020016040518060400160405280600781526020017f736f6d656f6e650000000000000000000000000000000000000000000000000081525081525060015f820151815f01556020820151816001019081620000709190620002ea565b5050503480156200007f575f80fd5b50620003ce565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200010257607f821691505b602082108103620001185762000117620000bd565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026200017c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200013f565b6200018886836200013f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620001d2620001cc620001c684620001a0565b620001a9565b620001a0565b9050919050565b5f819050919050565b620001ed83620001b2565b62000205620001fc82620001d9565b8484546200014b565b825550505050565b5f90565b6200021b6200020d565b62000228818484620001e2565b505050565b5b818110156200024f57620002435f8262000211565b6001810190506200022e565b5050565b601f8211156200029e5762000268816200011e565b620002738462000130565b8101602085101562000283578190505b6200029b620002928562000130565b8301826200022d565b50505b505050565b5f82821c905092915050565b5f620002c05f1984600802620002a3565b1980831691505092915050565b5f620002da8383620002af565b9150826002028217905092915050565b620002f58262000086565b67ffffffffffffffff81111562000311576200031062000090565b5b6200031d8254620000ea565b6200032a82828562000253565b5f60209050601f83116001811462000360575f84156200034b578287015190505b620003578582620002cd565b865550620003c6565b601f19841662000370866200011e565b5f5b82811015620003995784890151825560018201915060208501945060208101905062000372565b86831015620003b95784890151620003b5601f891682620002af565b8355505b6001600288020188555050505b505050505050565b610a6080620003dc5f395ff3fe608060405234801561000f575f80fd5b506004361061007b575f3560e01c80636f760f41116100595780636f760f41146100d757806377ec2b55146100f35780638bab8dd5146101125780639e7a13ad146101425761007b565b80632e64cec11461007f5780634f2be91f1461009d5780636057361d146100bb575b5f80fd5b610087610173565b60405161009491906103ad565b60405180910390f35b6100a561017b565b6040516100b291906103ad565b60405180910390f35b6100d560048036038101906100d09190610401565b610183565b005b6100f160048036038101906100ec9190610568565b610198565b005b6100fb61021c565b60405161010992919061063c565b60405180910390f35b61012c6004803603810190610127919061066a565b6102b3565b60405161013991906103ad565b60405180910390f35b61015c60048036038101906101579190610401565b6102e0565b60405161016a92919061063c565b60405180910390f35b5f8054905090565b5f6004905090565b60018161019091906106de565b5f8190555050565b6003604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f015560208201518160010190816101f2919061090b565b505050806004836040516102069190610a14565b9081526020016040518091039020819055505050565b6001805f0154908060010180546102329061073e565b80601f016020809104026020016040519081016040528092919081815260200182805461025e9061073e565b80156102a95780601f10610280576101008083540402835291602001916102a9565b820191905f5260205f20905b81548152906001019060200180831161028c57829003601f168201915b5050505050905082565b6004818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600381815481106102ef575f80fd5b905f5260205f2090600202015f91509050805f0154908060010180546103149061073e565b80601f01602080910402602001604051908101604052809291908181526020018280546103409061073e565b801561038b5780601f106103625761010080835404028352916020019161038b565b820191905f5260205f20905b81548152906001019060200180831161036e57829003601f168201915b5050505050905082565b5f819050919050565b6103a781610395565b82525050565b5f6020820190506103c05f83018461039e565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6103e081610395565b81146103ea575f80fd5b50565b5f813590506103fb816103d7565b92915050565b5f60208284031215610416576104156103cf565b5b5f610423848285016103ed565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61047a82610434565b810181811067ffffffffffffffff8211171561049957610498610444565b5b80604052505050565b5f6104ab6103c6565b90506104b78282610471565b919050565b5f67ffffffffffffffff8211156104d6576104d5610444565b5b6104df82610434565b9050602081019050919050565b828183375f83830152505050565b5f61050c610507846104bc565b6104a2565b90508281526020810184848401111561052857610527610430565b5b6105338482856104ec565b509392505050565b5f82601f83011261054f5761054e61042c565b5b813561055f8482602086016104fa565b91505092915050565b5f806040838503121561057e5761057d6103cf565b5b5f83013567ffffffffffffffff81111561059b5761059a6103d3565b5b6105a78582860161053b565b92505060206105b8858286016103ed565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156105f95780820151818401526020810190506105de565b5f8484015250505050565b5f61060e826105c2565b61061881856105cc565b93506106288185602086016105dc565b61063181610434565b840191505092915050565b5f60408201905061064f5f83018561039e565b81810360208301526106618184610604565b90509392505050565b5f6020828403121561067f5761067e6103cf565b5b5f82013567ffffffffffffffff81111561069c5761069b6103d3565b5b6106a88482850161053b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6106e882610395565b91506106f383610395565b925082820190508082111561070b5761070a6106b1565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061075557607f821691505b60208210810361076857610767610711565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026107ca7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261078f565b6107d4868361078f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f61080f61080a61080584610395565b6107ec565b610395565b9050919050565b5f819050919050565b610828836107f5565b61083c61083482610816565b84845461079b565b825550505050565b5f90565b610850610844565b61085b81848461081f565b505050565b5b8181101561087e576108735f82610848565b600181019050610861565b5050565b601f8211156108c3576108948161076e565b61089d84610780565b810160208510156108ac578190505b6108c06108b885610780565b830182610860565b50505b505050565b5f82821c905092915050565b5f6108e35f19846008026108c8565b1980831691505092915050565b5f6108fb83836108d4565b9150826002028217905092915050565b610914826105c2565b67ffffffffffffffff81111561092d5761092c610444565b5b610937825461073e565b610942828285610882565b5f60209050601f831160018114610973575f8415610961578287015190505b61096b85826108f0565b8655506109d2565b601f1984166109818661076e565b5f5b828110156109a857848901518255600182019150602085019450602081019050610983565b868310156109c557848901516109c1601f8916826108d4565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f6109ee826105c2565b6109f881856109da565b9350610a088185602086016105dc565b80840191505092915050565b5f610a1f82846109e4565b91508190509291505056fea2646970667358221220d6af563004c83daa3fbd3ba3eb5e0359bcef45a416dc30f4e4aeb68f176fe8dc64736f6c63430008170033c001a01872c33684b922ab852fafc20f076a10d611f24b6a77d565dcb7588b9299c42aa0197b3cf70d6abf251eeb9856c51d28147fe37c04d355d6b3d7f64269faa08748" ] }, code=UNKNOWN_ERROR, version=6.9.0)
    at makeError (/home/user/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/utils/errors.js:129:21)
    at JsonRpcProvider.getRpcError (/home/user/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:683:41)
    at /home/user/hh-fcc/ethers-simple-storage/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:269:45
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'UNKNOWN_ERROR',
  error: {
    message: 'VM Exception while processing transaction: invalid opcode',
    stack: 'RuntimeError: VM Exception while processing transaction: invalid opcode\n' +
      '    at EIP1559FeeMarketTransaction.fillFromResult (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:12745)\n' +
      '    at Miner.<anonymous> (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:36703)\n' +
      '    at async Miner.<anonymous> (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:35116)\n' +
      '    at async Miner.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:39680)\n' +
      '    at async Blockchain.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:60063)\n' +
      '    at async Promise.all (index 0)\n' +
      '    at async TransactionPool.emit (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\node_modules\\emittery\\index.js:303:3)',
    code: -32000,
    name: 'RuntimeError',
    data: {
      hash: '0xc808a9e63502b13ee9b18c03bab1d42073b4f84cfe0b2e50d1f4053ddd14d69c',
      programCounter: 82,
      result: '0xc808a9e63502b13ee9b18c03bab1d42073b4f84cfe0b2e50d1f4053ddd14d69c',
      reason: null,
      message: 'invalid opcode'
    }
  },
  payload: {
    method: 'eth_sendRawTransaction',
    params: [
      '0x02f90e998205390a8504a817c8008504a817c800836691b78080b90e3c60806040526040518060400160405280600281526020016040518060400160405280600781526020017f736f6d656f6e650000000000000000000000000000000000000000000000000081525081525060015f820151815f01556020820151816001019081620000709190620002ea565b5050503480156200007f575f80fd5b50620003ce565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806200010257607f821691505b602082108103620001185762000117620000bd565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026200017c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200013f565b6200018886836200013f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f620001d2620001cc620001c684620001a0565b620001a9565b620001a0565b9050919050565b5f819050919050565b620001ed83620001b2565b62000205620001fc82620001d9565b8484546200014b565b825550505050565b5f90565b6200021b6200020d565b62000228818484620001e2565b505050565b5b818110156200024f57620002435f8262000211565b6001810190506200022e565b5050565b601f8211156200029e5762000268816200011e565b620002738462000130565b8101602085101562000283578190505b6200029b620002928562000130565b8301826200022d565b50505b505050565b5f82821c905092915050565b5f620002c05f1984600802620002a3565b1980831691505092915050565b5f620002da8383620002af565b9150826002028217905092915050565b620002f58262000086565b67ffffffffffffffff81111562000311576200031062000090565b5b6200031d8254620000ea565b6200032a82828562000253565b5f60209050601f83116001811462000360575f84156200034b578287015190505b620003578582620002cd565b865550620003c6565b601f19841662000370866200011e565b5f5b82811015620003995784890151825560018201915060208501945060208101905062000372565b86831015620003b95784890151620003b5601f891682620002af565b8355505b6001600288020188555050505b505050505050565b610a6080620003dc5f395ff3fe608060405234801561000f575f80fd5b506004361061007b575f3560e01c80636f760f41116100595780636f760f41146100d757806377ec2b55146100f35780638bab8dd5146101125780639e7a13ad146101425761007b565b80632e64cec11461007f5780634f2be91f1461009d5780636057361d146100bb575b5f80fd5b610087610173565b60405161009491906103ad565b60405180910390f35b6100a561017b565b6040516100b291906103ad565b60405180910390f35b6100d560048036038101906100d09190610401565b610183565b005b6100f160048036038101906100ec9190610568565b610198565b005b6100fb61021c565b60405161010992919061063c565b60405180910390f35b61012c6004803603810190610127919061066a565b6102b3565b60405161013991906103ad565b60405180910390f35b61015c60048036038101906101579190610401565b6102e0565b60405161016a92919061063c565b60405180910390f35b5f8054905090565b5f6004905090565b60018161019091906106de565b5f8190555050565b6003604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f015560208201518160010190816101f2919061090b565b505050806004836040516102069190610a14565b9081526020016040518091039020819055505050565b6001805f0154908060010180546102329061073e565b80601f016020809104026020016040519081016040528092919081815260200182805461025e9061073e565b80156102a95780601f10610280576101008083540402835291602001916102a9565b820191905f5260205f20905b81548152906001019060200180831161028c57829003601f168201915b5050505050905082565b6004818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600381815481106102ef575f80fd5b905f5260205f2090600202015f91509050805f0154908060010180546103149061073e565b80601f01602080910402602001604051908101604052809291908181526020018280546103409061073e565b801561038b5780601f106103625761010080835404028352916020019161038b565b820191905f5260205f20905b81548152906001019060200180831161036e57829003601f168201915b5050505050905082565b5f819050919050565b6103a781610395565b82525050565b5f6020820190506103c05f83018461039e565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6103e081610395565b81146103ea575f80fd5b50565b5f813590506103fb816103d7565b92915050565b5f60208284031215610416576104156103cf565b5b5f610423848285016103ed565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61047a82610434565b810181811067ffffffffffffffff8211171561049957610498610444565b5b80604052505050565b5f6104ab6103c6565b90506104b78282610471565b919050565b5f67ffffffffffffffff8211156104d6576104d5610444565b5b6104df82610434565b9050602081019050919050565b828183375f83830152505050565b5f61050c610507846104bc565b6104a2565b90508281526020810184848401111561052857610527610430565b5b6105338482856104ec565b509392505050565b5f82601f83011261054f5761054e61042c565b5b813561055f8482602086016104fa565b91505092915050565b5f806040838503121561057e5761057d6103cf565b5b5f83013567ffffffffffffffff81111561059b5761059a6103d3565b5b6105a78582860161053b565b92505060206105b8858286016103ed565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156105f95780820151818401526020810190506105de565b5f8484015250505050565b5f61060e826105c2565b61061881856105cc565b93506106288185602086016105dc565b61063181610434565b840191505092915050565b5f60408201905061064f5f83018561039e565b81810360208301526106618184610604565b90509392505050565b5f6020828403121561067f5761067e6103cf565b5b5f82013567ffffffffffffffff81111561069c5761069b6103d3565b5b6106a88482850161053b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6106e882610395565b91506106f383610395565b925082820190508082111561070b5761070a6106b1565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061075557607f821691505b60208210810361076857610767610711565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026107ca7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8261078f565b6107d4868361078f565b95508019841693508086168417925050509392505050565b5f819050919050565b5f61080f61080a61080584610395565b6107ec565b610395565b9050919050565b5f819050919050565b610828836107f5565b61083c61083482610816565b84845461079b565b825550505050565b5f90565b610850610844565b61085b81848461081f565b505050565b5b8181101561087e576108735f82610848565b600181019050610861565b5050565b601f8211156108c3576108948161076e565b61089d84610780565b810160208510156108ac578190505b6108c06108b885610780565b830182610860565b50505b505050565b5f82821c905092915050565b5f6108e35f19846008026108c8565b1980831691505092915050565b5f6108fb83836108d4565b9150826002028217905092915050565b610914826105c2565b67ffffffffffffffff81111561092d5761092c610444565b5b610937825461073e565b610942828285610882565b5f60209050601f831160018114610973575f8415610961578287015190505b61096b85826108f0565b8655506109d2565b601f1984166109818661076e565b5f5b828110156109a857848901518255600182019150602085019450602081019050610983565b868310156109c557848901516109c1601f8916826108d4565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f6109ee826105c2565b6109f881856109da565b9350610a088185602086016105dc565b80840191505092915050565b5f610a1f82846109e4565b91508190509291505056fea2646970667358221220d6af563004c83daa3fbd3ba3eb5e0359bcef45a416dc30f4e4aeb68f176fe8dc64736f6c63430008170033c001a01872c33684b922ab852fafc20f076a10d611f24b6a77d565dcb7588b9299c42aa0197b3cf70d6abf251eeb9856c51d28147fe37c04d355d6b3d7f64269faa08748'
    ],
    id: 9,
    jsonrpc: '2.0'
  },
  shortMessage: 'could not coalesce error'
}

here is the code i'am runing :

`const ethers = require("ethers");
const fs = require("fs-extra"); // to read from other files

async function main() {
// http://192.168.1.73:8545
// the way to connect to our local blockchai

const overrides = {
gasLimit: 6721975, // Adjust the gas limit as needed
gasPrice: ethers.parseUnits("20000000000", "wei"), // Adjust the gas price as needed
};

const provider = new ethers.JsonRpcProvider("http://192.168.1.73:7545");

const wallet = new ethers.Wallet(
"0x--------------------------------------------------------------------------------------", // private key hidden !
provider
);

const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");

const binary = fs.readFileSync(
"./SimpleStorage_sol_SimpleStorage.bin",
"utf8"
);

const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
console.log("----------- contract factory -----------------------");
console.log("Deploying, please wait ... ");

const contract = await contractFactory.deploy(overrides);
await contract.deploymentTransaction.wait(1);

const currentFavoriteNumber = await contract.retrieve();
console.log(currentFavoriteNumber);
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.log("error", error);
process.exit(1);
});
`
### Remark :
the deployment transaction is sent correctly and i can see it in Ganache.
But i got this error in the console of VSC.

Does anyone have an idea how to fix this issue ?

@UmitRock
Copy link

i want fix it too more then 2 days stuck on this section :(

@Gambit42
Copy link

Any update regarding this? Currently stuck with this issue.

@UmitRock
Copy link

UmitRock commented Feb 27, 2024

Any update regarding this? Currently stuck with this issue.

Dear leave this section level 5 or take this section level 5 only for take rules go to next section level 6 hardhat but change endpoint api of blockchain I think alchemy no longer use for free must purchase try other services and about codes are little change it exp: simpleStorage.address no longer use it try change to simpleStorage.target and deployed wait(1) are change it too

@dshinde96
Copy link

dshinde96 commented Apr 24, 2024

As solidity 0.8.20 introduced PUSH0 opcode which is supported by Ethereum mainnet only. So better, use solidity version 0.8.7 and solac@0.8.7 and the error will resolved. (Use older version of solidity as well as solac)

Reference: https://www.zaryabs.com/push0-opcode/

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

No branches or pull requests

4 participants