@@ -44,6 +44,7 @@ describe('ECDSA', function () {
4444
4545 // Recover the signer address from the generated message and signature.
4646 expect ( await this . mock . $recover ( ethers . hashMessage ( TEST_MESSAGE ) , signature ) ) . to . equal ( this . signer ) ;
47+ expect ( await this . mock . $recoverCalldata ( ethers . hashMessage ( TEST_MESSAGE ) , signature ) ) . to . equal ( this . signer ) ;
4748 } ) ;
4849
4950 it ( 'returns signer address with correct signature for arbitrary length message' , async function ( ) {
@@ -52,11 +53,13 @@ describe('ECDSA', function () {
5253
5354 // Recover the signer address from the generated message and signature.
5455 expect ( await this . mock . $recover ( ethers . hashMessage ( NON_HASH_MESSAGE ) , signature ) ) . to . equal ( this . signer ) ;
56+ expect ( await this . mock . $recoverCalldata ( ethers . hashMessage ( NON_HASH_MESSAGE ) , signature ) ) . to . equal ( this . signer ) ;
5557 } ) ;
5658
5759 it ( 'returns a different address' , async function ( ) {
5860 const signature = await this . signer . signMessage ( TEST_MESSAGE ) ;
5961 expect ( await this . mock . $recover ( WRONG_MESSAGE , signature ) ) . to . not . be . equal ( this . signer ) ;
62+ expect ( await this . mock . $recoverCalldata ( WRONG_MESSAGE , signature ) ) . to . not . be . equal ( this . signer ) ;
6063 } ) ;
6164
6265 it ( 'reverts with invalid signature' , async function ( ) {
@@ -66,6 +69,10 @@ describe('ECDSA', function () {
6669 this . mock ,
6770 'ECDSAInvalidSignature' ,
6871 ) ;
72+ await expect ( this . mock . $recoverCalldata ( TEST_MESSAGE , signature ) ) . to . be . revertedWithCustomError (
73+ this . mock ,
74+ 'ECDSAInvalidSignature' ,
75+ ) ;
6976 } ) ;
7077 } ) ;
7178
@@ -79,6 +86,7 @@ describe('ECDSA', function () {
7986 const v = '0x1b' ; // 27 = 1b.
8087 const signature = ethers . concat ( [ signatureWithoutV , v ] ) ;
8188 expect ( await this . mock . $recover ( TEST_MESSAGE , signature ) ) . to . equal ( signer ) ;
89+ expect ( await this . mock . $recoverCalldata ( TEST_MESSAGE , signature ) ) . to . equal ( signer ) ;
8290
8391 const { r, s, yParityAndS : vs } = ethers . Signature . from ( signature ) ;
8492 expect ( await this . mock . getFunction ( '$recover(bytes32,uint8,bytes32,bytes32)' ) ( TEST_MESSAGE , v , r , s ) ) . to . equal (
@@ -92,6 +100,7 @@ describe('ECDSA', function () {
92100 const v = '0x1c' ; // 28 = 1c.
93101 const signature = ethers . concat ( [ signatureWithoutV , v ] ) ;
94102 expect ( await this . mock . $recover ( TEST_MESSAGE , signature ) ) . to . not . equal ( signer ) ;
103+ expect ( await this . mock . $recoverCalldata ( TEST_MESSAGE , signature ) ) . to . not . equal ( signer ) ;
95104
96105 const { r, s, yParityAndS : vs } = ethers . Signature . from ( signature ) ;
97106 expect (
@@ -110,6 +119,10 @@ describe('ECDSA', function () {
110119 this . mock ,
111120 'ECDSAInvalidSignature' ,
112121 ) ;
122+ await expect ( this . mock . $recoverCalldata ( TEST_MESSAGE , signature ) ) . to . be . revertedWithCustomError (
123+ this . mock ,
124+ 'ECDSAInvalidSignature' ,
125+ ) ;
113126
114127 const { r, s } = ethers . Signature . from ( signature ) ;
115128 await expect (
@@ -126,6 +139,9 @@ describe('ECDSA', function () {
126139 await expect ( this . mock . $recover ( TEST_MESSAGE , compactSerialized ) )
127140 . to . be . revertedWithCustomError ( this . mock , 'ECDSAInvalidSignatureLength' )
128141 . withArgs ( 64 ) ;
142+ await expect ( this . mock . $recoverCalldata ( TEST_MESSAGE , compactSerialized ) )
143+ . to . be . revertedWithCustomError ( this . mock , 'ECDSAInvalidSignatureLength' )
144+ . withArgs ( 64 ) ;
129145 } ) ;
130146 } ) ;
131147
@@ -139,6 +155,7 @@ describe('ECDSA', function () {
139155 const v = '0x1c' ; // 28 = 1c.
140156 const signature = ethers . concat ( [ signatureWithoutV , v ] ) ;
141157 expect ( await this . mock . $recover ( TEST_MESSAGE , signature ) ) . to . equal ( signer ) ;
158+ expect ( await this . mock . $recoverCalldata ( TEST_MESSAGE , signature ) ) . to . equal ( signer ) ;
142159
143160 const { r, s, yParityAndS : vs } = ethers . Signature . from ( signature ) ;
144161 expect ( await this . mock . getFunction ( '$recover(bytes32,uint8,bytes32,bytes32)' ) ( TEST_MESSAGE , v , r , s ) ) . to . equal (
@@ -152,6 +169,7 @@ describe('ECDSA', function () {
152169 const v = '0x1b' ; // 27 = 1b.
153170 const signature = ethers . concat ( [ signatureWithoutV , v ] ) ;
154171 expect ( await this . mock . $recover ( TEST_MESSAGE , signature ) ) . to . not . equal ( signer ) ;
172+ expect ( await this . mock . $recoverCalldata ( TEST_MESSAGE , signature ) ) . to . not . equal ( signer ) ;
155173
156174 const { r, s, yParityAndS : vs } = ethers . Signature . from ( signature ) ;
157175 expect (
@@ -170,6 +188,10 @@ describe('ECDSA', function () {
170188 this . mock ,
171189 'ECDSAInvalidSignature' ,
172190 ) ;
191+ await expect ( this . mock . $recoverCalldata ( TEST_MESSAGE , signature ) ) . to . be . revertedWithCustomError (
192+ this . mock ,
193+ 'ECDSAInvalidSignature' ,
194+ ) ;
173195
174196 const { r, s } = ethers . Signature . from ( signature ) ;
175197 await expect (
@@ -186,6 +208,9 @@ describe('ECDSA', function () {
186208 await expect ( this . mock . $recover ( TEST_MESSAGE , compactSerialized ) )
187209 . to . be . revertedWithCustomError ( this . mock , 'ECDSAInvalidSignatureLength' )
188210 . withArgs ( 64 ) ;
211+ await expect ( this . mock . $recoverCalldata ( TEST_MESSAGE , compactSerialized ) )
212+ . to . be . revertedWithCustomError ( this . mock , 'ECDSAInvalidSignatureLength' )
213+ . withArgs ( 64 ) ;
189214 } ) ;
190215 } ) ;
191216
@@ -202,6 +227,9 @@ describe('ECDSA', function () {
202227 await expect ( this . mock . $recover ( message , highSSignature ) )
203228 . to . be . revertedWithCustomError ( this . mock , 'ECDSAInvalidSignatureS' )
204229 . withArgs ( s ) ;
230+ await expect ( this . mock . $recoverCalldata ( message , highSSignature ) )
231+ . to . be . revertedWithCustomError ( this . mock , 'ECDSAInvalidSignatureS' )
232+ . withArgs ( s ) ;
205233 await expect ( this . mock . getFunction ( '$recover(bytes32,uint8,bytes32,bytes32)' ) ( TEST_MESSAGE , v , r , s ) )
206234 . to . be . revertedWithCustomError ( this . mock , 'ECDSAInvalidSignatureS' )
207235 . withArgs ( s ) ;
0 commit comments