Skip to content

Commit 5c2eb3a

Browse files
committed
chore(protocol-contracts): add revert tests
1 parent d955673 commit 5c2eb3a

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

protocol-contracts/staking/test/OperatorStaking.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ describe('OperatorStaking', function () {
165165
depositWithPermitTx,
166166
permitValue: value,
167167
delegatorNoApproval: delegatorNoApproval,
168+
permitDeadline: deadline,
169+
v: sig.v,
170+
r: sig.r,
171+
s: sig.s,
168172
});
169173
});
170174

@@ -185,6 +189,22 @@ describe('OperatorStaking', function () {
185189
.to.emit(this.token, 'Transfer')
186190
.withArgs(this.delegatorNoApproval, this.mock, this.permitValue);
187191
});
192+
193+
it('should revert if signature is invalid', async function () {
194+
await expect(
195+
this.mock
196+
.connect(this.delegatorNoApproval)
197+
.depositWithPermit(this.permitValue, this.delegatorNoApproval, this.permitDeadline, 0, this.r, this.s),
198+
).to.be.revertedWithCustomError(this.token, 'ECDSAInvalidSignature');
199+
});
200+
201+
it('should revert if signer is invalid', async function () {
202+
await expect(
203+
this.mock
204+
.connect(this.delegator1)
205+
.depositWithPermit(this.permitValue, this.delegator1, this.permitDeadline, this.v, this.r, this.s),
206+
).to.be.revertedWithCustomError(this.token, 'ERC2612InvalidSigner');
207+
});
188208
});
189209

190210
describe('redeem', async function () {

0 commit comments

Comments
 (0)