Skip to content

Commit

Permalink
Nikos/5071/investigate signtransaction testcases (#5377)
Browse files Browse the repository at this point in the history
* Fix testcases

* Update tests to check for v,r,s

Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com>
  • Loading branch information
nikoulai and jdevcs committed Sep 6, 2022
1 parent f07bae2 commit a6ebb2a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/eth.accounts.signTransaction.js
Expand Up @@ -133,8 +133,9 @@ var tests = [
common: common
},
// expected r and s values from signature
r: "0x22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd9",
s: "0x83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20",
r: "0x74dcecc6b8ad09ca09882ac1088eac145e799f56ea3f5b5fe8fcb52bbd3ea4f7",
s: "0x3d49e02af9c239b1b8aea8a7ac9162862dec03207f9f59bc38a4f2b9e42077a9",
v: "0x26",
// signature from eth_signTransaction
oldSignature: "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20",
rawTransaction: "0xf85f8001827c6d94f0109fc8df283027b6285cc889f5aa624eac1f55808026a074dcecc6b8ad09ca09882ac1088eac145e799f56ea3f5b5fe8fcb52bbd3ea4f7a03d49e02af9c239b1b8aea8a7ac9162862dec03207f9f59bc38a4f2b9e42077a9",
Expand All @@ -159,6 +160,7 @@ var tests = [
// expected r and s values from signature
r: "0x9ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9c",
s: "0x440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428",
v: "0x25",
// signature from eth_signTransaction
rawTransaction: "0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428",
oldSignature: "0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428",
Expand All @@ -181,8 +183,9 @@ var tests = [
common: common
},
// expected r and s values from signature
r: "0x22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd9",
s: "0x83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20",
r: "0x3cbfff5b8ef4588b930ecbf9b85388795875edf814dfc6c71884f99b6d7555cc",
s: "0x57142e729c1c83bfccb2785e629fc32dffb2e613df565e78e119aa4694cb1df9",
v: "0x25",
// signature from eth_signTransaction
oldSignature: "0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20",
rawTransaction: "0xf85f800a827c6d94f0109fc8df283027b6285cc889f5aa624eac1f55808025a03cbfff5b8ef4588b930ecbf9b85388795875edf814dfc6c71884f99b6d7555cca057142e729c1c83bfccb2785e629fc32dffb2e613df565e78e119aa4694cb1df9",
Expand Down Expand Up @@ -827,6 +830,12 @@ describe("eth", function () {
assert.equal(tx.messageHash, test.messageHash, "message hash failed");
assert.equal(tx.transactionHash, test.transactionHash, "tx hash failed");
assert.equal(tx.rawTransaction, test.rawTransaction, "rawtx failed");

if(test.r && test.s && test.v){
assert.equal(tx.v, test.v, "v property of signature failed");
assert.equal(tx.s, test.s, "s property of signature failed");
assert.equal(tx.r, test.r, "r property of signature failed");
}
done();
})
.catch(e => {
Expand Down

0 comments on commit a6ebb2a

Please sign in to comment.