@@ -2,6 +2,8 @@ const { ethers } = require('hardhat');
2
2
const { expect } = require ( 'chai' ) ;
3
3
const { loadFixture } = require ( '@nomicfoundation/hardhat-network-helpers' ) ;
4
4
5
+ const precompile = require ( '../../helpers/precompiles' ) ;
6
+
5
7
const TEST_MESSAGE = ethers . id ( 'OpenZeppelin' ) ;
6
8
const TEST_MESSAGE_HASH = ethers . hashMessage ( TEST_MESSAGE ) ;
7
9
@@ -25,35 +27,47 @@ describe('SignatureChecker (ERC1271)', function () {
25
27
26
28
describe ( 'EOA account' , function ( ) {
27
29
it ( 'with matching signer and signature' , async function ( ) {
28
- expect ( await this . mock . $isValidSignatureNow ( this . signer , TEST_MESSAGE_HASH , this . signature ) ) . to . be . true ;
30
+ await expect ( this . mock . $isValidSignatureNow ( this . signer , TEST_MESSAGE_HASH , this . signature ) ) . to . eventually . be
31
+ . true ;
29
32
} ) ;
30
33
31
34
it ( 'with invalid signer' , async function ( ) {
32
- expect ( await this . mock . $isValidSignatureNow ( this . other , TEST_MESSAGE_HASH , this . signature ) ) . to . be . false ;
35
+ await expect ( this . mock . $isValidSignatureNow ( this . other , TEST_MESSAGE_HASH , this . signature ) ) . to . eventually . be
36
+ . false ;
33
37
} ) ;
34
38
35
39
it ( 'with invalid signature' , async function ( ) {
36
- expect ( await this . mock . $isValidSignatureNow ( this . signer , WRONG_MESSAGE_HASH , this . signature ) ) . to . be . false ;
40
+ await expect ( this . mock . $isValidSignatureNow ( this . signer , WRONG_MESSAGE_HASH , this . signature ) ) . to . eventually . be
41
+ . false ;
37
42
} ) ;
38
43
} ) ;
39
44
40
45
describe ( 'ERC1271 wallet' , function ( ) {
41
46
for ( const fn of [ 'isValidERC1271SignatureNow' , 'isValidSignatureNow' ] ) {
42
47
describe ( fn , function ( ) {
43
48
it ( 'with matching signer and signature' , async function ( ) {
44
- expect ( await this . mock . getFunction ( `$${ fn } ` ) ( this . wallet , TEST_MESSAGE_HASH , this . signature ) ) . to . be . true ;
49
+ await expect ( this . mock . getFunction ( `$${ fn } ` ) ( this . wallet , TEST_MESSAGE_HASH , this . signature ) ) . to . eventually . be
50
+ . true ;
45
51
} ) ;
46
52
47
53
it ( 'with invalid signer' , async function ( ) {
48
- expect ( await this . mock . getFunction ( `$${ fn } ` ) ( this . mock , TEST_MESSAGE_HASH , this . signature ) ) . to . be . false ;
54
+ await expect ( this . mock . getFunction ( `$${ fn } ` ) ( this . mock , TEST_MESSAGE_HASH , this . signature ) ) . to . eventually . be
55
+ . false ;
56
+ } ) ;
57
+
58
+ it ( 'with identity precompile' , async function ( ) {
59
+ await expect ( this . mock . getFunction ( `$${ fn } ` ) ( precompile . identity , TEST_MESSAGE_HASH , this . signature ) ) . to
60
+ . eventually . be . false ;
49
61
} ) ;
50
62
51
63
it ( 'with invalid signature' , async function ( ) {
52
- expect ( await this . mock . getFunction ( `$${ fn } ` ) ( this . wallet , WRONG_MESSAGE_HASH , this . signature ) ) . to . be . false ;
64
+ await expect ( this . mock . getFunction ( `$${ fn } ` ) ( this . wallet , WRONG_MESSAGE_HASH , this . signature ) ) . to . eventually
65
+ . be . false ;
53
66
} ) ;
54
67
55
68
it ( 'with malicious wallet' , async function ( ) {
56
- expect ( await this . mock . getFunction ( `$${ fn } ` ) ( this . malicious , TEST_MESSAGE_HASH , this . signature ) ) . to . be . false ;
69
+ await expect ( this . mock . getFunction ( `$${ fn } ` ) ( this . malicious , TEST_MESSAGE_HASH , this . signature ) ) . to . eventually
70
+ . be . false ;
57
71
} ) ;
58
72
} ) ;
59
73
}
0 commit comments