OpenZeppelin / OpenZeppelin/openzeppelin-contracts
Provide helper to split a short signature's `vs`
Nobody has claimed this yet.
- Dominant language
- Solidity
- Stars
- 27.2k
- Forks
- 12.4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 33
Description
We have a function tryRecover(hash, r, vs) to support short signatures, but sometimes you want to receive a short signature and split it into a long signature without doing the recover operation.
For example a function that uses permit could look like this:
function doThingWithPermit(..., uint256 value, uint256 deadline, bytes32 r, bytes32 vs) {
(uint8 v, bytes32 s) = ECDSA.splitShort(vs);
try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
doThing(..., value);
}
token.permit expects v, r, s, but doThingWithPermit can be much more calldata efficient if it receives vs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the existing ECDSA.tryRecover(hash, r, vs) implementation and its ECDSA entry point. Add the requested splitShort(vs) helper so callers can obtain v and s for token.permit, then add or update tests to verify the returned components and confirm the permit use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100