Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Remove VRS values from receipt. Match JSONRPC spec (#549)
Browse files Browse the repository at this point in the history
* Remove VRS values from receipt. Match JSONRPC spec

* Add tests to ensure vrs feilds are not in receipts
  • Loading branch information
nicholasjpaterno committed Feb 12, 2020
1 parent 9d50099 commit b533bea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/subproviders/geth_api_double.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
});
Expand Down
6 changes: 3 additions & 3 deletions test/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit b533bea

Please sign in to comment.