Skip to content

feat(forge): Cheatcode to receive public key of private key #4790

@pmerkleplant

Description

@pmerkleplant

Component

Forge

Describe the feature you would like

Forge provides a cheatcode to receive the address of a private key, see forge-std/Vm.sol::addr(uint)(address).

It would be great if we could get a cheatcode to receive the public key too. The public key should be returned in affine coordinates, e.g. vm.pubKey(uint privkey)(uint xCoordinate, unit yCoordinate).

To receive the public key of a private key, you currently either have to implement an ecMul function in solidity, quickly leading to out-of-gas errors or use ffi, leading to big overhead and long-running testsuites.

Additional context

Issue initially opened in forge-std repo: foundry-rs/forge-std#356

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions