ethereumjs / ethereumjs-tx

Project is in active development and has been moved to the EthereumJS VM monorepo.
https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/tx
Mozilla Public License 2.0
781 stars 237 forks source link

FakeTransaction causes hash collisions in ganache-cli #80

Closed benjamincburns closed 6 years ago

benjamincburns commented 6 years ago

Ganache/TestRPC experiences transaction hash collisions when the only thing differentiating two transactions is the sender, for example, when two brand new accounts send identical transactions to the same contract.

Example:

I'd expect that in the below code, tx1.hash() would not be the same as tx2.hash().

    var tx1 = new FakeTransaction({
        data:"0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005",
        gasLimit:"0x15f90",
        gasPrice:"0x1",
        nonce:"0x01",
        to:"0xd9024df085d09398ec76fbed18cac0e1149f50dc",
        value:"0x0",
        from: "0xf492dd75de5acfe13ef9bae89a0f51767be3dae5"
    });

    var tx2 = new FakeTransaction({
        data:"0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005",
        gasLimit:"0x15f90",
        gasPrice:"0x1",
        nonce:"0x01",
        to:"0xd9024df085d09398ec76fbed18cac0e1149f50dc",
        value:"0x0",
        from: "0x161b4555e40f6d42ae93591f3d9f35f6e765c6b9"
    });

    // fails
    assert.notEqual(tx1.hash(), tx2.hash());
holgerd77 commented 6 years ago

This is now REALLY fixed/closed by a new minor release v1.3.4 on npm, sorry that it took so long.