Skip to content

Conversation

@computerality
Copy link
Contributor

…mbling with offsets


# 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

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
All committers have signed the CLA.

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.

4 participants