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

Create SafeWebAuthnSignerProxy #370

Merged
merged 53 commits into from
Apr 23, 2024
Merged

Create SafeWebAuthnSignerProxy #370

merged 53 commits into from
Apr 23, 2024

Conversation

akshay-ap
Copy link
Member

@akshay-ap akshay-ap commented Apr 8, 2024

Fixes #312

Changes in PR:

  • Create SafeWebAuthnSignerSingleton. This contract has no storage, no immutables, and no constants.

  • Create SafeWebAuthnSignerProxy and corresponding proxy factory i.e. SafeWebAuthnSignerProxyFactory

  • Create immutable singleton contract when deploying proxy factory

  • SafeWebAuthnSignerProxyFactory.isValidSignatureForSigner(...) forwards to singleton contract instead directly calling WebAuthn library

  • SafeWebAuthnSignerProxy uses no storage to avoid 4337 storage access restriction violation.

  • Add unit test to verify that SafeWebAuthnSignerProxy forwards every call to singleton address

  • Report gas usage metrics

  • Update github workflow to execute benchmarking tests separately. (This is required to get accurate gas usage numbers)

  • Update documentation

  • Replace SafeWebAuthnSigner with SafeWebAuthnSignerProxy, same for factory contract

  • Update all tests to use SafeWebAuthnSignerProxy. Hence, the large diff in this PR.

Benchmark number from this PR:

Gas Benchmarking Proxy [@bench]
    SafeWebAuthnSignerProxy
      ⛽ deployment: 164012
      ✔ Benchmark signer deployment cost (10[38](https://github.com/safe-global/safe-modules/actions/runs/8739938588/job/23982409583?pr=370#step:4:39)ms)
      ⛽ verification (FreshCryptoLib): 216248
      ✔ Benchmark signer verification cost with FreshCryptoLib verifier (201ms)
      ⛽ verification (daimo-eth): 346151
      ✔ Benchmark signer verification cost with daimo-eth verifier (186ms)
      ⛽ verification (Dummy): 14[40](https://github.com/safe-global/safe-modules/actions/runs/8739938588/job/23982409583?pr=370#step:4:41)2
      ✔ Benchmark signer verification cost with Dummy verifier

Benchmark number from main:

  Gas Benchmarking [@bench]
    SafeWebAuthnSigner
      ⛽ deployment: 491288
      ✔ Benchmark signer deployment cost (654ms)
      ⛽ verification (FreshCryptoLib): 209630
      ✔ Benchmark signer verification cost with FreshCryptoLib verifier (138ms)
      ⛽ verification (daimo-eth): 336881
      ✔ Benchmark signer verification cost with daimo-eth verifier (108ms)
      ⛽ verification (Dummy): 11266
      ✔ Benchmark signer verification cost with Dummy verifier

@akshay-ap akshay-ap self-assigned this Apr 8, 2024
@akshay-ap akshay-ap requested a review from a team as a code owner April 8, 2024 12:15
@akshay-ap akshay-ap requested review from nlordell, mmv08 and remedcu and removed request for a team April 8, 2024 12:15
@akshay-ap akshay-ap marked this pull request as draft April 8, 2024 12:15
@coveralls
Copy link

coveralls commented Apr 8, 2024

Pull Request Test Coverage Report for Build 8784802120

Details

  • 16 of 16 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-13.3%) to 86.747%

Totals Coverage Status
Change from base Build 8783507331: -13.3%
Covered Lines: 111
Relevant Lines: 118

💛 - Coveralls

@akshay-ap akshay-ap force-pushed the feature-312-webAuthn-proxy branch 4 times, most recently from d986d03 to 9f257b6 Compare April 9, 2024 13:13
@akshay-ap akshay-ap requested a review from nlordell April 9, 2024 13:18
@akshay-ap akshay-ap force-pushed the feature-312-webAuthn-proxy branch 2 times, most recently from cc1b1ef to c762ed0 Compare April 10, 2024 15:06
@akshay-ap akshay-ap force-pushed the feature-312-webAuthn-proxy branch 4 times, most recently from b6446de to a016b8a Compare April 11, 2024 12:28
@akshay-ap akshay-ap marked this pull request as ready for review April 11, 2024 14:53
@akshay-ap akshay-ap requested a review from nlordell April 11, 2024 14:53
@nlordell
Copy link
Collaborator

@akshay-ap - can you rebase the PR, it would help with the review process.

@akshay-ap akshay-ap force-pushed the feature-312-webAuthn-proxy branch 2 times, most recently from c3c73b5 to 4a2fc48 Compare April 18, 2024 14:10
Copy link
Collaborator

@nlordell nlordell left a comment

Choose a reason for hiding this comment

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

I noticed when running locally that there are compiler warning that can be resolved.

@akshay-ap akshay-ap merged commit fbce8f1 into main Apr 23, 2024
10 checks passed
@akshay-ap akshay-ap deleted the feature-312-webAuthn-proxy branch April 23, 2024 11:58
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate Overhead Of Deploying WebAuthn Logic In Signer
4 participants