-
Notifications
You must be signed in to change notification settings - Fork 272
Enforce hex prefixing for address strings #241
Conversation
This pull request introduces 1 alert when merging 5670bdd into 3bbc948 - view on LGTM.com new alerts:
|
5670bdd
to
ed7eb36
Compare
src/account.ts
Outdated
if (!ethjsUtil.isHexString(input)) { | ||
throw new Error(msg) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using isHexString
instead of isHexPrefixed
here because the latter throws its own error if given a non-string input.
303668a
to
cf60742
Compare
cf60742
to
11fc1c1
Compare
11fc1c1
to
78626a4
Compare
@cgewecke Great, thanks for picking this up! 😄 Did I mention that you should really question what's written up in the API Change Table and give this also your own thoughts respectively reflect if you see these as useful/adequate API changes. I've written this up quite some time ago and there actually was not yet much discussion around this yet, so I would encourage all others to give this some thought as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks all good, will merge here as well.
isValidAddress('x2f015c60e0be116b1f0cd534704db9c92118fb6a') | ||
}) | ||
assert.throws(function() { | ||
isValidAddress('0X52908400098527886E0F7030069857D2E4169EE7') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. 👍
Part of #172 Breaking API Changes
The proposal to make hex param checking more strict in #172 comes out of review discussions in #170. There @holger suggested:
PR adds logic to enforce hex-prefixing for all address string inputs. Affected methods are:
isPrecompile
is excluded because it's targeted for removal in #242.