-
Notifications
You must be signed in to change notification settings - Fork 38
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
fix: [spearbit-54] use salt in eip-712 domain separator #38
Conversation
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.
Awesome, thanks for removing the EIP712 dependency!
Thoughts on adding in another minor fix to the plugin within isValidSignature
? Would love to optimize this:
-bytes memory messageData = encodeMessageData(msg.sender, abi.encode(digest));
-bytes32 messageHash = keccak256(messageData);
+bytes32 messageHash = getMessageHash(msg.sender, abi.encode(digest));
Not sure if there's a more appropriate issue to file this under.
@@ -134,8 +140,7 @@ contract MultiOwnerPlugin is BasePlugin, IMultiOwnerPlugin, IERC1271, EIP712 { | |||
/// an "Ethereum Signed Message" envelope before checking the signature in | |||
/// the EOA-owner case. | |||
function isValidSignature(bytes32 digest, bytes memory signature) public view override returns (bytes4) { | |||
bytes memory messageData = encodeMessageData(msg.sender, abi.encode(digest)); | |||
bytes32 messageHash = keccak256(messageData); | |||
bytes32 messageHash = getMessageHash(msg.sender, abi.encode(digest)); |
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.
doublecheck: this is one keccak256()
less than the previous version of the code, is this as intended?
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.
Definitely not. They should be the same.
Previously:
bytes32 messageHash
= keccak256(messageData)
= keccak256(encodeMessageData(msg.sender, abi.encode(digest)))
After change:
bytes32 messageHash
= getMessageHash(msg.sender, abi.encode(digest))
= keccak256(encodeMessageData(msg.sender, abi.encode(digest)))
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.
looks good after all
https://github.com/spearbit-audits/alchemy-nov-review/issues/54