Consensys / mythx-models

MythX Python domain models
3 stars 9 forks source link

Missing group_id field (staging) #16

Closed s0b0lev closed 5 years ago

s0b0lev commented 5 years ago

Description

Trying to submit an analysis payload (caused on staging) via pythx. Looks like a field should be added to mythx-models package.

What I Did

Traceback (most recent call last):
  File "./client-cli", line 5, in <module>
    main()
  File "/client/client/interfaces/cli.py", line 68, in main
    client_cli(args)
  File "/client/client/interfaces/cli.py", line 42, in client_cli
    elapsed_time, testcases_output = plugin.runner(dataset)
  File "/client/client/core/runner.py", line 102, in queue_runner
    analyzer_output = mythx_queue_runner(plugin, dataset)
  File "/client/client/core/runner.py", line 87, in mythx_queue_runner
    queue.enqueue(enqueue_sample(plugin, sample))
  File "/client/client/core/runner.py", line 77, in enqueue_sample
    sample["analysis_status"] = plugin.send_dataset(sample)
  File "/client/client/plugins/mythx.py", line 60, in send_dataset
    return self.client.analyze_with_retry(self.processing_input(sample))
  File "/client/client/interfaces/mythx.py", line 119, in analyze_with_retry
    result = self.submit_analysis(payload)
  File "/client/client/interfaces/mythx.py", line 114, in submit_analysis
    result = self.client().analyze(**payload)
  File "/usr/local/lib/python3.6/site-packages/pythx/api/client.py", line 238, in analyze
    return self._assemble_send_parse(req, respmodels.AnalysisSubmissionResponse)
  File "/usr/local/lib/python3.6/site-packages/pythx/api/client.py", line 89, in _assemble_send_parse
    return self.handler.parse_response(resp, resp_model)
  File "/usr/local/lib/python3.6/site-packages/pythx/api/handler.py", line 164, in parse_response
    m = model.from_json(resp)
  File "/usr/local/lib/python3.6/site-packages/mythx_models/base.py", line 29, in from_json
    return cls.from_dict(parsed)
  File "/usr/local/lib/python3.6/site-packages/mythx_models/response/analysis_submission.py", line 28, in from_dict
    return cls(analysis=Analysis.from_dict(d))
  File "/usr/local/lib/python3.6/site-packages/mythx_models/response/analysis.py", line 66, in from_dict
    return cls(**d)
TypeError: __init__() got an unexpected keyword argument 'group_id'
dmuhs commented 5 years ago

Fixed in 1.5.0 - bump in PythX required

dmuhs commented 5 years ago

Made the library more robust against crashes by adding dynamic params to the trouble-making function. If there are leftover arguments, a warning is logged, but nothing is going to crash anymore. With the latest contribution to PythX, this issue will be fixed with the next release