nevillegrech / MadMax

Ethereum Static Vulnerability Detector for Gas-Focussed Vulnerabilities
BSD 3-Clause "New" or "Revised" License
130 stars 16 forks source link

How to get the graphs of the paper. #4

Closed crx934080895 closed 3 years ago

crx934080895 commented 3 years ago

I see these graph in your paper. Can I generate these graph by this repository's code or other way? Look forward to your reply. QQ截图20201111191748 QQ截图20201111191756

nevillegrech commented 3 years ago

The graphing code is not part of the repo. I used matplotlib's venn3, on the processed dataset derived from the output relations. Here's a code snippet I found (for the lower-left diagram):

subscript_iter = list(product('01', '01', '01'))[1:]
sets = [len(results[(results.InStructuredLoop == int(a)) & (results.ArrayIdToStorageIndex == int(b)) & (results.PossibleArrayIterator == int(c))]) for a,b,c in subscript_iter]
sets_size = [1, 1, 1, 1, 1, 1, 3]

v=venn3(subsets = sets_size, set_labels = ('Has Loops', 'Has Arrays', 'Has Array Iterators'))
c=venn3_circles(subsets = sets_size, linestyle = 'dotted')
c[2].set_lw(1.0)
c[2].set_ls('solid')
for label, subscript in zip(sets, subscript_iter):
    #patch = v.get_label_by_id("{0:03b}".format(7-i))
    patch = v.get_label_by_id(''.join(subscript))
    if patch:
        patch.set_text(label if label else '')

#plt.title("Insights",fontsize=30)

plt.show()
crx934080895 commented 3 years ago

Thanks for your reply. It 's my fault to express my question by mistake. I mean, how to get the data of these graphs rather than generating these graphs. I want to analysis my contracts to generate the graphs likes above.

nevillegrech commented 3 years ago

The data will be in results.json, if you use the bulk analyzer.

nevillegrech commented 3 years ago

We updated instructions