mojtaba-eshghie / HighGuard

The runtime monitoring tool for smart contracts high-level properties.
https://arxiv.org/abs/2305.08254
MIT License
5 stars 2 forks source link

line "node monitor/monitor.test.js" not generating the expected output #77

Closed AisXiaolin closed 1 month ago

AisXiaolin commented 1 month ago

It pops up some error complaining about the result when running the line in the title.

liu@n177-p152 HighGuard % node monitor/monitor.test.js
An error occurred: TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'WebsocketProvider'
    |     property '_events' -> object with constructor 'Events'
    |     property 'data' -> object with constructor 'EE'
    --- property 'context' closes the circle
    at JSON.stringify (<anonymous>)
    at /Users/liu/HighGuard/monitor/monitor.test.js:29:34
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
AisXiaolin commented 1 month ago

Here are some more error messages.

liu@n177-p152 HighGuard % anvil --version
anvil 0.2.0 (c2233ec 2024-03-22T00:20:19.690262000Z)
liu@n177-p152 HighGuard % node monitor/monitor.test.js
Error deploying the contract: Error: No "from" address specified in neither the given options, nor the default options.
    at Object.ContractNoFromAddressDefinedError (/Users/liu/HighGuard/node_modules/web3-core-helpers/lib/errors.js:128:16)
    at Object._executeMethod (/Users/liu/HighGuard/node_modules/web3-eth-contract/lib/index.js:831:48)
    at deployContract (/Users/liu/HighGuard/lib/web3/deploy.js:119:104)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async prepareContract (/Users/liu/HighGuard/monitor/monitor.test.js:24:28)
    at async /Users/liu/HighGuard/monitor/monitor.test.js:32:28
An error occurred: Error: No "from" address specified in neither the given options, nor the default options.
    at Object.ContractNoFromAddressDefinedError (/Users/liu/HighGuard/node_modules/web3-core-helpers/lib/errors.js:128:16)
    at Object._executeMethod (/Users/liu/HighGuard/node_modules/web3-eth-contract/lib/index.js:831:48)
    at deployContract (/Users/liu/HighGuard/lib/web3/deploy.js:119:104)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async prepareContract (/Users/liu/HighGuard/monitor/monitor.test.js:24:28)
    at async /Users/liu/HighGuard/monitor/monitor.test.js:32:28
mojtaba-eshghie commented 1 month ago

This is probably a bug in the regex used to parse the output anvil command.
Thanks @Puisque

hansstammler commented 1 month ago

I had the same error:

$ node monitor/monitor.test.js
Error deploying the contract: Error: No "from" address specified in neither the given options, nor the default options.
    at Object.ContractNoFromAddressDefinedError (E:\GitHub\HighGuard\node_modules\web3-core-helpers\lib\errors.js:128:16
)
    at Object._executeMethod (E:\GitHub\HighGuard\node_modules\web3-eth-contract\lib\index.js:831:48)
    at deployContract (E:\GitHub\HighGuard\lib\web3\deploy.js:119:104)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async prepareContract (E:\GitHub\HighGuard\monitor\monitor.test.js:24:28)
    at async E:\GitHub\HighGuard\monitor\monitor.test.js:32:28
An error occurred: Error: No "from" address specified in neither the given options, nor the default options.
    at Object.ContractNoFromAddressDefinedError (E:\GitHub\HighGuard\node_modules\web3-core-helpers\lib\errors.js:128:16
)
    at Object._executeMethod (E:\GitHub\HighGuard\node_modules\web3-eth-contract\lib\index.js:831:48)
    at deployContract (E:\GitHub\HighGuard\lib\web3\deploy.js:119:104)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async prepareContract (E:\GitHub\HighGuard\monitor\monitor.test.js:24:28)
    at async E:\GitHub\HighGuard\monitor\monitor.test.js:32:28
AisXiaolin commented 1 month ago

I have pulled the most current file but the program is still not working as expected... Here is what I have got. I am on the most updated branch.

liu@n150-p125 HighGuard % git add .

liu@n150-p125 HighGuard % git status 
On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   lib/web3/deploy.js
    new file:   logs/2024-03-22/session-logs.log
    new file:   logs/2024-03-25/session-logs.log
    modified:   monitor/monitor.test.js

liu@n150-p125 HighGuard % os  
zsh: command not found: os
liu@n150-p125 HighGuard % ls
CI          client          lib         node_modules        server
LICENSE         config.yml      logs            package-lock.json
README.md       contracts       monitor         package.json
liu@n150-p125 HighGuard % cd package.json 
cd: not a directory: package.json
liu@n150-p125 HighGuard % npm install

up to date, audited 614 packages in 6s

71 packages are looking for funding
  run `npm fund` for details

19 vulnerabilities (1 low, 14 moderate, 4 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
liu@n150-p125 HighGuard % node --version 
v16.20.2
liu@n150-p125 HighGuard % node monitor/monitor.test.js 
An error occurred: TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'WebsocketProvider'
    |     property '_events' -> object with constructor 'Events'
    |     property 'data' -> object with constructor 'EE'
    --- property 'context' closes the circle
    at JSON.stringify (<anonymous>)
    at /Users/liu/HighGuard/monitor/monitor.test.js:29:34
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
mojtaba-eshghie commented 1 month ago

Hi @Puisque Thank you for submitting the issue.

It seems a different issue rather than the persistence of the previous one. Therefore, I will close this issue. Please create a new issue with the contents of referenced lines in error (perhaps in your local not the upstream).

Thanks again @hansstammler for resolving this issue.

AisXiaolin commented 1 month ago

Hi @mojtaba-eshghie Thanks for the reply. It works on my end now. Thank you for fixing the bug @hansstammler! Appreciate it!