Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

fixes #80 #81

Merged
merged 1 commit into from
Dec 21, 2017
Merged

Conversation

benjamincburns
Copy link
Contributor

@benjamincburns benjamincburns commented Nov 28, 2017

Fixes #80 - Don't produce hash collisions on FakeTransaction for different senders

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6fedafe on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

fake.js Outdated
let items
if (includeSignature) {
items = this.raw
items += this.getSenderAddress();
Copy link
Member

Choose a reason for hiding this comment

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

I think instead of duplicating, fakeTransaction should change .raw in the constructor to include the signature (a fake one perhaps). The hash method then is inherited unchanged from the normal implementation.

This is a lot of code duplication otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@axic I think I can accommodate that easily enough. However, does that mean that instead of overriding hash we'll need to override sign?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also thanks for the fast response!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@axic see latest changes. I'm not sure that I like this however, as I feel sign should probably be overridden as well to avoid cases where the fake signature is overwritten.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6326eb9 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d550ed8 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling e6a795f on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 00a47d8 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling de8e066 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

Copy link
Contributor

@tcoulter tcoulter left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@jwasinger jwasinger left a comment

Choose a reason for hiding this comment

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

I don't think the new test case is actually ran (and when it is, it fails)

@benjamincburns
Copy link
Contributor Author

benjamincburns commented Dec 21, 2017

@jwasinger well that's embarrassing! Pushing the fix now.

Lesson learned: when testing with tape, import new tests into test/index.js -- I'm so used to mocha just grabbing them all...

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f808209 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 25e0256 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 0aeba44 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@benjamincburns
Copy link
Contributor Author

And a half hour later I've found the right mixture of whitespace to avoid offending standard 😒

@jwasinger
Copy link
Contributor

lol isn't that always fun :D can you squash some of the commits to clean up the history? then I will merge.

@benjamincburns
Copy link
Contributor Author

squashed.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b603bb2 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

jwasinger
jwasinger previously approved these changes Dec 21, 2017
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 7f24cf9 on benjamincburns:issue80-hash-collisions into ** on ethereumjs:master**.

@jwasinger jwasinger merged commit 1caa1bb into ethereumjs:master Dec 21, 2017
@benjamincburns
Copy link
Contributor Author

Thanks, @jwasinger!

@kumavis
Copy link
Member

kumavis commented Dec 21, 2017

@benjamincburns protip: standard --fix

@benjamincburns
Copy link
Contributor Author

benjamincburns commented Dec 21, 2017

Thanks, @kumavis - maybe I have a shitty old version installed, but it never seems to do anything for me -- it also wasn't showing the same errors locally as in CI.

FabijanC pushed a commit to Shard-Labs/celo-ethereumjs-tx that referenced this pull request Aug 4, 2021
FabijanC pushed a commit to Shard-Labs/celo-ethereumjs-tx that referenced this pull request Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants