Appears who is the signer has no effect
thanpolas opened this issue · 1 comments
thanpolas commented
Hello there,
I am a bit confused as to the validity of a signer. On synthetix v3 implementation of EIP2612 I authored a test that permit()
should reject a non-owner signed digest.
However, that's not the case, and I needed your assistance on this.
Using hardhat, I setup the following test case:
let holder, spender;
before('identify signers', async () => {
[holder, spender] = await ethers.getSigners();
});
And then use the "spender", who is not the "owner", to sign a digest on the owner's behalf. A case that should throw:
it('Should reject non owner signature', async () => {
const { deadline, v, r, s } = await signERC2612Permit(
spender,
ERC20.address,
holder.address,
spender.address,
value
);
await assertRevert(
ERC20.permit(holder.address, spender.address, value, deadline, v, r, s),
'INVALID_PERMIT_SIGNATURE'
);
});
However, the contract accepts the signed "v, r, s" and the test fails.
Am I missing something obvious here?
Thank you