Skip to content

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

Description

@4Ykw

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions