Skip to content

Implement contract signature verification #238

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

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

bitbeckers
Copy link
Collaborator

To support filecoin we need to bypass the SafeSDK to verify Safe signatures. The SafeSignatureVerifier class was updated to support different strategies based on chain ID. A SignatureVerifierFactory was implemented to either execute a contract call or use the Safe SDK depending on the provided chain ID.

To support filecoin we need to bypass the SafeSDK to verify Safe
signatures. The SafeSignatureVerifier class was updated to support
different strategies based on chain ID. A SignatureVerifierFactory was
implemented to either execute a contract call or use the Safe SDK
depending on the provided chain ID.
@bitbeckers bitbeckers added bug Something isn't working enhancement New feature or request labels Feb 3, 2025
@bitbeckers bitbeckers requested a review from pheuberger February 3, 2025 23:17
@bitbeckers bitbeckers self-assigned this Feb 3, 2025
Copy link

github-actions bot commented Feb 3, 2025

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 25.35% (🎯 25%) 1097 / 4327
🟢 Statements 25.35% (🎯 25%) 1097 / 4327
🟢 Functions 61.05% (🎯 61%) 58 / 95
🟢 Branches 72.28% (🎯 72%) 180 / 249
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/safe/signature-verification/SafeSignatureVerifier.ts 84.37% 100% 75% 84.37% 39-43
src/lib/safe/signature-verification/SignatureVerifierStrategy.ts 12.5% 0% 0% 12.5% 17-27, 32-51, 55-83
Generated in workflow #47 for commit 29eb878 by the Vitest Coverage Report Action

@bitbeckers bitbeckers merged commit 4d28567 into develop Feb 3, 2025
1 check passed
@bitbeckers bitbeckers deleted the feat/signature_verifier_strategies branch February 3, 2025 23:46
}

export class SignatureVerifierStrategyFactory {
static getStrategy(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since choosing the strategy isn't influenced by the hash of the typed data, I feel like it shouldn't be here. It also doesn't necessarily need to be on the constructor if the other fields aren't either. From the viewpoint of the individual classes you can't necessarily say that the hash is a value that you would want to keep across multiple invocations, so the actual call to verify() seems like it's lacking this value.

It's absolutely fine the way it is, but would probably be something that I'd refactor given I have the time and am working on something that's touching this code :)

@bitbeckers bitbeckers linked an issue Feb 6, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Add SafeSignatureVerifier that directly reads from the Safe contract
2 participants