Skip to content

P256.sol: ECDSA P-256 signature verification fails in Solidity assembly #223

@KitHat

Description

@KitHat

ECDSA P-256 Signature Verification Fails in Solidity Assembly with Polkadot-SDK's Precompile

The ECDSA P-256 signature verification within Solidity assembly is failing when executed on the current Polkadot-SDK implementation, specifically utilizing the P-256 precompile. A valid signature is incorrectly returning false.


Root Problem

Despite the P-256 precompile being merged in PR #10267, a key test case designed to validate this functionality is currently failing.

Failing Component Details

  • Failing Test: openzeppelin-contracts P256 verification test at P256.test.js#L46
  • Assembly Code: The failure occurs during the execution of the low-level Solidity assembly function (which interacts directly with the precompile) found here: P256.sol#L116.
  • Observed Behavior: The assembly call returns false when provided with a known valid P-256 signature.

Environment Details

  • Node Used: revive-dev-node (built from the master branch of polkadot-sdk).
  • External Library Version: OpenZeppelin Contracts v5.4.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions