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

[SmartContracts.js] Line needs to be evaluated for null before calling 'Object.keys' #150

Open
4Ykw opened this issue Jul 18, 2022 · 1 comment

Comments

@4Ykw
Copy link

4Ykw commented Jul 18, 2022

Object.keys(vm.vm._context).filter(key => key !== 'VMError' && key !== 'Buffer' && key !== 'api').forEach((key) => {

Not yet known, but in some conditions, the VM is null and the following error could appear on the log:

2022-07-18 03:52:57 error: [Blockchain] ERROR DURING CONTRACT EXECUTION:  TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Function.getJSVM (/home/user/steemsmartcontracts/libs/SmartContracts.js:543:14)
    at /home/user/steemsmartcontracts/libs/SmartContracts.js:558:33
    at new Promise (<anonymous>)
    at Function.runContractCode (/home/user/steemsmartcontracts/libs/SmartContracts.js:557:12)
    at Function.executeSmartContract (/home/user/steemsmartcontracts/libs/SmartContracts.js:493:42)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Block.processTransaction (/home/user/steemsmartcontracts/libs/Block.js:263:19)
    at async Block.produceBlock (/home/user/steemsmartcontracts/libs/Block.js:132:7)
    at async /home/user/steemsmartcontracts/plugins/Blockchain.js:92:9
 
2022-07-18 03:52:57 error: [Blockchain] {
  refHiveBlockNumber: 66190261,
  transactionId: '64471f5b09ac71815bdc6a601282df22f83df6a2',
  sender: 'ricksens85',
  contract: 'market',
  action: 'sell',
  payload: '{"symbol":"SPS","quantity":"274.29500000","price":"0.11095121","isSignedWithActiveKey":true}',
  executedCodeHash: '5e327ab66bc4bc780892b2c80856b3b595b792ac31ab0c0c4eb1498e51550e08815ad74975ef2099fb0d332f42eb5503e27c52c78002f3d408fb0ca67bc37edb',
  hash: '413868a1198a7b8074da6aa4400c8245a341da0c8c63feafd56629ea626dceaf',
  databaseHash: 'c542f6f0b54578e6a316a5af915d161a7f974293b4269a04f8266bd5d752e10f',
  logs: '{"events":[{"contract":"tokens","event":"transferToContract","data":{"from":"ricksens85","to":"market","symbol":"SPS","quantity":"274.29500000"}}]}'
}
 
2022-07-18 03:52:57 error: [Blockchain] Transaction {
  refHiveBlockNumber: 66190261,
  transactionId: '64471f5b09ac71815bdc6a601282df22f83df6a2',
  sender: 'ricksens85',
  contract: 'market',
  action: 'sell',
  payload: '{"symbol":"SPS","quantity":"274.29500000","price":"0.11095121","isSignedWithActiveKey":true}',
  executedCodeHash: '',
  hash: '383bc011e2f8e4e21ee16918f17dbc29715add27286db07b12515a0f3486270c',
  databaseHash: '7ad7fddacff80400efee6f04b4b6fbb71b00d10447d748fd75d2001c386992f5',
  logs: '{"errors":["TypeError: Cannot convert undefined or null to object"]}'
}
 
2022-07-18 03:52:57 error: [Blockchain] Error: tx hash mismatch with api
    at Block.produceBlock (/home/user/steemsmartcontracts/libs/Block.js:140:17)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /home/user/steemsmartcontracts/plugins/Blockchain.js:92:9
    at async producePendingTransactions (/home/user/steemsmartcontracts/plugins/Blockchain.js:91:7)
    at async produceNewBlockSync (/home/user/steemsmartcontracts/plugins/Blockchain.js:144:5)
 
2022-07-18 03:52:57 error: [Blockchain] (node:3040128) UnhandledPromiseRejectionWarning: Error: tx hash mismatch with api
    at Block.produceBlock (/home/user/steemsmartcontracts/libs/Block.js:140:17)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /home/user/steemsmartcontracts/plugins/Blockchain.js:92:9
    at async producePendingTransactions (/home/user/steemsmartcontracts/plugins/Blockchain.js:91:7)
    at async produceNewBlockSync (/home/user/steemsmartcontracts/plugins/Blockchain.js:144:5)
@4Ykw 4Ykw changed the title Line needs to be evaluated for null before calling 'Object.keys' [SmartContracts.js] Line needs to be evaluated for null before calling 'Object.keys' Jul 18, 2022
@Rishi556
Copy link

Rishi556 commented Sep 6, 2022

This happens with higher versions of vm2.

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

2 participants