This repository has been archived by the owner on Apr 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #80, don't produce hash collisions on FakeTransaction for diffe…
…rent senders
- Loading branch information
1 parent
5ad3f05
commit 7f24cf9
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const tape = require('tape') | ||
const utils = require('ethereumjs-util') | ||
const FakeTransaction = require('../fake.js') | ||
tape('[FakeTransaction]: Basic functions', function (t) { | ||
t.test('should not produce hash collsions for different senders', function (st) { | ||
st.plan(1) | ||
var baseTxData = { | ||
data: '0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005', | ||
gasLimit: '0x15f90', | ||
gasPrice: '0x1', | ||
nonce: '0x01', | ||
to: '0xd9024df085d09398ec76fbed18cac0e1149f50dc', | ||
value: '0x0', | ||
from: '0x1111111111111111111111111111111111111111' | ||
} | ||
var modifiedFromFieldTxData = Object.assign({}, baseTxData, { from: '0x2222222222222222222222222222222222222222' }) | ||
var baseTx = new FakeTransaction(baseTxData) | ||
var modifiedFromFieldTx = new FakeTransaction(modifiedFromFieldTxData) | ||
var baseTxHash = utils.bufferToHex(baseTx.hash(true)) | ||
var modifiedFromFieldTxHash = utils.bufferToHex(modifiedFromFieldTx.hash(true)) | ||
st.notEqual(baseTxHash, modifiedFromFieldTxHash, 'FakeTransactions with different `from` addresses but otherwise identical data should have different hashes') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
require('./fake.js') | ||
require('./api.js') | ||
require('./transactionRunner.js') |