Skip to content

Conversation

@ltp456
Copy link
Contributor

@ltp456 ltp456 commented Mar 25, 2025

Description

In the current implementation, the ECDSA signature only provides a Verify method, which uses api.AssertIsEqual to verify the signature. If the signature is invalid, it returns an error.

However, in some environments, we need to determine whether the signature is valid and proceed accordingly based on the result.

To address this, we need a new method, IsVerified, which returns 1 if the signature is valid and 0 otherwise.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • ecdsa_test.go TestEcdsaPublicKeyIsVerifiedOK
  • ecdsa_test.go TestEcdsaPublicKeyIsVerifiedNegative

How has this been benchmarked?

  • Benchmark A, on Macbook pro M1, 32GB RAM
  • Benchmark B, on x86 Intel xxx, 16GB RAM

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Collaborator

@ivokub ivokub left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I rewrited the method names and extended tests, but otherwise looked good!

@ivokub ivokub merged commit f38a6ec into Consensys:master Jul 4, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants