From b533bea733a2fe84efe63e5fe36e821c1d0accd7 Mon Sep 17 00:00:00 2001 From: Nick Paterno <43416138+nicholasjpaterno@users.noreply.github.com> Date: Wed, 12 Feb 2020 13:01:40 -0500 Subject: [PATCH] Remove VRS values from receipt. Match JSONRPC spec (#549) * Remove VRS values from receipt. Match JSONRPC spec * Add tests to ensure vrs feilds are not in receipts --- lib/subproviders/geth_api_double.js | 4 ++++ test/requests.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/subproviders/geth_api_double.js b/lib/subproviders/geth_api_double.js index f8a4582e0e..364d2cd2b2 100644 --- a/lib/subproviders/geth_api_double.js +++ b/lib/subproviders/geth_api_double.js @@ -11,6 +11,7 @@ const { BlockOutOfRangeError } = require("../utils/errorhelper"); var Subprovider = require("web3-provider-engine/subproviders/subprovider.js"); const maxSafeInt = "0x" + Number.MAX_SAFE_INTEGER.toString(16); +const vrs = ["v", "r", "s"]; inherits(GethApiDouble, Subprovider); @@ -220,6 +221,9 @@ GethApiDouble.prototype.eth_getTransactionReceipt = function(hash, callback) { if (receipt && receipt.block) { result = receipt.toJSON(); + vrs.forEach((element) => { + delete result[element]; + }); } callback(null, result); }); diff --git a/test/requests.js b/test/requests.js index 8b19c24df3..226e22d6db 100644 --- a/test/requests.js +++ b/test/requests.js @@ -1280,9 +1280,9 @@ const tests = function(web3) { assert.notStrictEqual(receipt, null, "Transaction receipt shouldn't be null"); assert.notStrictEqual(contractAddress, null, "Transaction did not create a contract"); - assert.strictEqual(hasOwnProperty.call(receipt, "v"), true, "Transaction includes v signature parameter"); - assert.strictEqual(hasOwnProperty.call(receipt, "r"), true, "Transaction includes r signature parameter"); - assert.strictEqual(hasOwnProperty.call(receipt, "s"), true, "Transaction includes s signature parameter"); + assert.strictEqual(hasOwnProperty.call(receipt, "v"), false, "Transaction includes v signature parameter"); + assert.strictEqual(hasOwnProperty.call(receipt, "r"), false, "Transaction includes r signature parameter"); + assert.strictEqual(hasOwnProperty.call(receipt, "s"), false, "Transaction includes s signature parameter"); }); it("should verify the transaction immediately (eth_getTransactionByHash)", async function() {