Skip to content

feat: add E2E tests for EIP-7951 (secp256r1 P-256 verify precompile)#10

Merged
libotony merged 5 commits intomainfrom
feat/eip7951-p256verify
Apr 15, 2026
Merged

feat: add E2E tests for EIP-7951 (secp256r1 P-256 verify precompile)#10
libotony merged 5 commits intomainfrom
feat/eip7951-p256verify

Conversation

@libotony
Copy link
Copy Markdown
Member

Summary

  • Add tests/eip7951 package with 5 E2E tests covering the secp256r1 (P-256) signature verification precompile added at the INTERSTELLAR fork (implement eip-7951: add secp256r1 verify precompile thor#1602)
  • Tests cover pre/post-fork behavior, gas cost, wrong-length guard, and a full on-chain contract call path

Tests Added

  • TestEIP7951_ValidSignature — direct call to 0x0100 with valid P-256 sig; pre-fork: empty output, post-fork: returns 32-byte 1
  • TestEIP7951_InvalidSignature — corrupted s value; post-fork: empty output, no revert
  • TestEIP7951_GasCost — verifies P256VerifyGas = 6900 post-fork, 0 pre-fork
  • TestEIP7951_WrongInputLength — 100-byte input (not 160); post-fork: empty output, no revert
  • TestEIP7951_ContractCall — deploys a minimal EVM proxy contract that calls the precompile via staticcall; valid sig → returns 1, invalid sig → returns 0

Test Plan

  • All 5 tests pass via make test
  • Pre-fork cases return empty output as expected
  • Post-fork valid sig returns 32-byte big-endian 1
  • Gas assertion = 6900
  • Contract proxy deployment and call both verified on-chain
  • go vet passes

Copy link
Copy Markdown
Collaborator

@BenderVeChain BenderVeChain left a comment

Choose a reason for hiding this comment

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

LGTM. Bytecode verified, all five test cases are correct, and the updated WrongInputLength test now covers both too-short (100 bytes) and too-long (192 bytes) inputs with explicit gas assertions (GasUsed=6900). No outstanding issues.

@libotony libotony merged commit 725dac1 into main Apr 15, 2026
5 checks passed
@libotony libotony deleted the feat/eip7951-p256verify branch April 15, 2026 08:23
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.

2 participants