-
Notifications
You must be signed in to change notification settings - Fork 88
Feature/lit 4041 Support Eip1271 #735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/lit 4041 Support Eip1271 #735
Conversation
| ); | ||
| try { | ||
| const isValid = await contract.isValidSignature(hash, siweSignature); | ||
| if (isValid === '0x1626ba7e') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (isValid === '0x1626ba7e') { | |
| if (isValid !== '0xffffffff') { |
The error message indicates this is the correct condition. However, as EIP-1271 only strictly defines the magic value for a valid signature, I would say the check should always have to be over that one. I think the real correction is to change the error message to something like Expected isValidSignature to not be 0x1626ba7e (valid signature)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I think the whole point of comparing the exact value is that it is very specific 0x1626ba7e, and its use follows an unofficial yet widely accepted convention for implementing EIP-1271. Removing it would reduce the specificity and clarity for this "standard"
| ); | ||
| try { | ||
| const isValid = await contract.isValidSignature(hash, siweSignature); | ||
| if (isValid === '0x1626ba7e') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (isValid === '0x1626ba7e') { | |
| if (isValid !== '0xffffffff') { |
Same as above
Description
Tests for supporting EIP1271 AuthSig (not SessionSig). The required node PR has already been merged and deployed to Datil-dev: https://github.com/LIT-Protocol/lit-assets/pull/1629.
Test Suite
Two Tinny tests which test calling the EIP1271 isValidSignature() deployed on Yellowstone:
tempOwner. Anyone can set thetempOwnerand this is allowed since there is no guarantee which wallet is used when executing the tests.deployerAddress, is set as thetempOwnerto demonstrate the failure case i.e. when theisValidSignature()function returns0xffffffff.validation error: Authsig failed for contract ${contractAddress}. Return value was ffffffff.tempOwner.signMessage()orsignDigest()depending on whether it's signing a Keccak hash or SHA256 one.siweMessageHashandsignatureto ensure that theisVerifySignature()returns theMAGICVALUE = 0x1626ba7e.'Decrypted from EIP1271 AuthSig'.Access Control Condition
(EIP1271) AuthSig
Test Cases
ethers.utils.signMessage()function and pass it withderivedVia: EIP1271derivedVia: EIP1271_SHA256Checklist: