Skip to content
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: gas optimizations and minor improvements #294

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/libraries/SsoStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,15 @@ library SsoStorage {
bytes32 private constant SSO_STORAGE_SLOT = 0x996e49e905bb2c30d677a2ad554e4b964a479b19a0509deafafca5126b88ba23;

struct Layout {
// ┌───────────────────┐
// │ Ownership Data │
// Ownership Data
EnumerableSet.AddressSet k1Owners;
uint256[50] __gap_0;
// └───────────────────┘

// ┌───────────────────┐
// │ Validation │
// Validation
EnumerableSet.AddressSet moduleValidators;
uint256[50] __gap_2;
// └───────────────────┘

// ┌───────────────────┐
// │ Hooks │
// Hooks
EnumerableSet.AddressSet validationHooks;
EnumerableSet.AddressSet executionHooks;
uint256[50] __gap_4;
// └───────────────────┘
// Storage slots reserved for future upgrades
uint256[256] __RESERVED;
}

function layout() internal pure returns (Layout storage l) {
Expand Down
2 changes: 1 addition & 1 deletion src/validators/SessionKeyValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ contract SessionKeyValidator is IModuleValidator {
}

/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId) external view override returns (bool) {
function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {
return
interfaceId == type(IERC165).interfaceId ||
interfaceId == type(IModuleValidator).interfaceId ||
Expand Down
4 changes: 2 additions & 2 deletions src/validators/WebAuthValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ contract WebAuthValidator is VerifierCaller, IModuleValidator {
/// @param signedHash The hash of the signed message
/// @param signature The signature to validate
/// @return true if the signature is valid
function validateSignature(bytes32 signedHash, bytes memory signature) external view returns (bool) {
function validateSignature(bytes32 signedHash, bytes calldata signature) external view returns (bool) {
return webAuthVerify(signedHash, signature);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ contract WebAuthValidator is VerifierCaller, IModuleValidator {
);

// prevent signature replay https://yondon.blog/2019/01/01/how-not-to-use-ecdsa/
if (rs[0] <= 0 || rs[0] > HIGH_R_MAX || rs[1] <= 0 || rs[1] > LOW_S_MAX) {
if (rs[0] == 0 || rs[0] > HIGH_R_MAX || rs[1] == 0 || rs[1] > LOW_S_MAX) {
ly0va marked this conversation as resolved.
Show resolved Hide resolved
return false;
}

Expand Down