Display a clearer error message when the private key passed to the addr
cheatcode is greater than the secp256k1 curve order
#2158
Labels
T-feature
Type: feature
Component
Forge
Describe the feature you would like
The order of the secp256k1 curve is a little bit smaller than
2^256
, which means that not alluint256
values can be used as private keys. The order has this value:Currently, when we pass a value greater than this to the
vm.addr
cheatcode, we got the following error:It would be nice to display a clearer, more specific error, to let users that what happened is that the private key is greater than what is permitted by secp256k1.
Additional context
It is quite easy for a user to end up passing a value greater than the curve order:
uint256
argument in a test functionvm.addr
cheatcode to generate an address from the fuzzed private keyThe text was updated successfully, but these errors were encountered: