Skip to content

fix: allow only v=0 or v=1#1293

Merged
ivokub merged 2 commits into
masterfrom
fix/audit-la-f-ecrecover
Oct 10, 2024
Merged

fix: allow only v=0 or v=1#1293
ivokub merged 2 commits into
masterfrom
fix/audit-la-f-ecrecover

Conversation

@ivokub
Copy link
Copy Markdown
Collaborator

@ivokub ivokub commented Oct 8, 2024

Description

We followed the implementation of libsecp256k1 where v was allowed to be {0,1,2,3}. However, EVM specification has restricted allowed v to be only 0 or 1 for both transactions and precompiles.

From Linea arithmetization POV shouldn't have been an issue as the arithmetization already constrains v to be 0 or 1 and doesn't pass inputs to gnark circuit when v is something else:
image

Resolves LA audit issue F.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Existing tests pass.

Added:

  • TestLargeV - should fail when v not 0 or 1. Tested for v=2 and v=3.

How has this been benchmarked?

Not benchmarked, but should reduce a few constraints due to one less select and boolean check.

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

ivokub added 2 commits October 8, 2024 08:20
We followed the implementation of libsecp256k1 where v was allowed to be
{0,1,2,3}. However, EVM specification has restricted allowed v to be
only 0 or 1 for both transactions and precompiles.

Resolves LA audit issue F.
@ivokub ivokub self-assigned this Oct 8, 2024
@ivokub ivokub added the type: bug Something isn't working label Oct 8, 2024
@ivokub ivokub marked this pull request as ready for review October 8, 2024 11:17
@ivokub ivokub merged commit 4902cfb into master Oct 10, 2024
@ivokub ivokub deleted the fix/audit-la-f-ecrecover branch October 10, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants