-
Notifications
You must be signed in to change notification settings - Fork 13
28 add initial forge test for webauthn verification #52
28 add initial forge test for webauthn verification #52
Conversation
f2814d5
to
d314bc5
Compare
d314bc5
to
8a2fca9
Compare
@jzaki reviewed and happy with the following commits: |
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.
A few minor comments but this LGTM!
@@ -0,0 +1,82 @@ | |||
// SPDX-License-Identifier: MIT |
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.
hmm I'm inclined to think we may want to put these tests into their own folder. Maybe a unit
test folder. Or forge-tests
. I don't have a strong opinion but I wonder if we should be more explicit these are different then the other tests
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.
Agreed. I'm actually leaning towards your second suggestion in your PR. Will update to that:
test/hardhat
test/hardhat/integration
test/forge
@@ -0,0 +1,45 @@ | |||
// SPDX-License-Identifier: MIT |
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.
Will the WebAuthn.sol
file eventually live in the primitives
directory? I feel like this could be a good fit for that
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.
Yeah I think so good shout. Issue to do that - #55
]; | ||
} | ||
|
||
function getUserOpSignature() |
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.
Is this function specific to a userOp that is using a webAuthN signature? It may be worth updating the name to reflect that for clarity
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.
Agree, updated in follow up
); | ||
} | ||
|
||
function getPublicKey() |
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.
Same here, if this is a WebAuthN public key it may be worth reflecting that in the name, since we will eventually have different types of public keys
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.
Agree, updated in follow up
import {SafeWebAuthnPlugin} from "../../src/SafeWebAuthnPlugin.sol"; | ||
|
||
/** Helper contract to expose internal functions for testing */ | ||
contract SafeWebAuthnPluginHarness is SafeWebAuthnPlugin { |
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.
💯
This PR:
Webauthn.sol
SafeWebAuthnPlugin.sol
TestHelper.sol
contract to provide helper functions and abstract common logicSafeWebAuthnPluginHarness.sol
to expose internal functions for testing. This is the recommended way to test internal functions from the foundry docs.This PR is dependent on #48Merged