Skip to content

Commit

Permalink
minor gas optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Mar 12, 2021
1 parent 3cef7f3 commit b9e0195
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/utils/cryptography/ECDSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ library ECDSA {
// currently is to use assembly.
// solhint-disable-next-line no-inline-assembly
assembly {
let vs := mload(add(signature, 0x40))
r := mload(add(signature, 0x20))
s := and(mload(add(signature, 0x40)), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(7, byte(0, mload(add(signature, 0x40)))), 27)
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(7, byte(0, vs)), 27)
}
} else {
revert("ECDSA: invalid signature length");
Expand Down

0 comments on commit b9e0195

Please sign in to comment.