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

Adding support for converting swarm hash to STOP and toggling disasse… #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

computerality
Copy link
Contributor

…mbling with offsets

@@ -65,10 +67,24 @@ def main():
if buf_set <= hex_set: # subset
buf = binascii.unhexlify(buf)

# replace all swarm hashes with \x00
if args.no_swarmhash:
while True: #detect multiple swarm hashes, about 700 contracts do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify it by using re.sub (regex replace). Example:

In [9]: re.sub(b'\x12..', b'\x00'*4, b'\x1234 abc \x1233 \x1234')
Out[9]: b'\x00\x00\x00\x00 abc \x00\x00\x00\x00 \x00\x00\x00\x00'

So here it should probably be (pls check this):

buf = re.sub(b'\xa1ebzzr0X .{34}', b'\x00'*43, buf)

Copy link
Contributor

@disconnect3d disconnect3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

insns = list(disassemble_all(buf))
for i in insns:
args.output.write("%08x: %s\n" % (i.pc, str(i)))
if args.no_offsets:
args.output.write("%s\n" % (str(i),))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the (,) is redundant so it could be % str(i) but I understand it might be better to leave it s it is.
We could also use "{}\n".format(i)

@CLAassistant
Copy link

CLAassistant commented Jul 30, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

3 participants