Skip to content

Commit a541583

Browse files
authored
fix: Strip leading zeros in signature v and s values coming from the mirror node, in tests. (#3241)
* fix: Strip leading zeros in signature v and s values. Signed-off-by: Eric Badiere <[email protected]> * fix: Added comments. Signed-off-by: Eric Badiere <[email protected]> --------- Signed-off-by: Eric Badiere <[email protected]>
1 parent db4e6e0 commit a541583

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/ws-server/tests/acceptance/getTransactionByHash.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ describe('@web-socket-batch-2 eth_getTransactionByHash', async function () {
117117
expect(txReceipt.to).to.be.eq(accounts[1].address.toLowerCase());
118118
expect(txReceipt.blockHash).to.be.eq(expectedTxReceipt.block_hash.slice(0, 66));
119119
expect(txReceipt.hash).to.be.eq(expectedTxReceipt.hash);
120-
expect(txReceipt.r).to.be.eq(expectedTxReceipt.r);
121-
expect(txReceipt.s).to.be.eq(expectedTxReceipt.s);
120+
// Must convert to quantity to compare and remove leading zeros
121+
expect(txReceipt.r).to.be.eq(ethers.toQuantity(expectedTxReceipt.r));
122+
expect(txReceipt.s).to.be.eq(ethers.toQuantity(expectedTxReceipt.s));
122123
expect(Number(txReceipt.v)).to.be.eq(expectedTxReceipt.v);
123124
});
124125
});
@@ -136,8 +137,9 @@ describe('@web-socket-batch-2 eth_getTransactionByHash', async function () {
136137
expect(txReceipt.to).to.be.eq(accounts[1].address.toLowerCase());
137138
expect(txReceipt.blockHash).to.be.eq(expectedTxReceipt.block_hash.slice(0, 66));
138139
expect(txReceipt.hash).to.be.eq(expectedTxReceipt.hash);
139-
expect(txReceipt.r).to.be.eq(expectedTxReceipt.r);
140-
expect(txReceipt.s).to.be.eq(expectedTxReceipt.s);
140+
// Must convert to quantity to compare and remove leading zeros
141+
expect(txReceipt.r).to.be.eq(ethers.toQuantity(expectedTxReceipt.r));
142+
expect(txReceipt.s).to.be.eq(ethers.toQuantity(expectedTxReceipt.s));
141143
expect(Number(txReceipt.v)).to.be.eq(expectedTxReceipt.v);
142144
});
143145
});

0 commit comments

Comments
 (0)