-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix signing method bugs #8833
Fix signing method bugs #8833
Conversation
Builds ready [b09a391]
Page Load Metrics (589 ± 27 ms)
|
b09a391
to
2c2a21e
Compare
@@ -75,6 +75,7 @@ export const SAFE_METHODS = [ | |||
'eth_sendTransaction', | |||
'eth_sign', | |||
'personal_sign', | |||
'personal_ecRecover', |
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.
We'd forgotten to add it, so it wasn't working!
let loggerMiddlewareMock | ||
const initializeMockMiddlewareLog = () => { | ||
loggerMiddlewareMock = { | ||
requests: [], | ||
responses: [], | ||
} | ||
} | ||
const tearDownMockMiddlewareLog = () => { | ||
loggerMiddlewareMock = undefined | ||
} | ||
|
||
const createLoggerMiddlewareMock = () => (req, res, next) => { | ||
if (loggerMiddlewareMock) { | ||
loggerMiddlewareMock.requests.push(req) | ||
next((cb) => { | ||
loggerMiddlewareMock.responses.push(res) | ||
cb() | ||
}) | ||
} else { | ||
next() | ||
} | ||
} | ||
|
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 mock was added to get around a new test failure.
We were relying on the lack of validation in eth-json-rpc-middleware
to test middleware behavior by means of a bogus transaction. Bogus transactions are now rejected by the middleware, so that no longer works.
This mock allows us to arbitrarily inspect RPC requests sent during tests. I'm open to moving it elsewhere, but couldn't think of a better solution.
Nit: |
Builds ready [f80a3a6]
Page Load Metrics (839 ± 95 ms)
|
Builds ready [4063984]
Page Load Metrics (691 ± 37 ms)
|
Actually, after looking at this further, it would probably make more sense for this validation to be in |
Builds ready [00d7807]
Page Load Metrics (1201 ± 86 ms)
|
00d7807
to
3635190
Compare
3635190
to
a194919
Compare
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.
LGTM!
Builds ready [a194919]
Page Load Metrics (671 ± 42 ms)
|
* origin/develop: Fix signing method bugs (#8833) replace icons with Checkbox component (#8830) Use [email protected] (#8845) Use [email protected] (#8844) Call getMethodDataAsync when knownMethodData[fourBytePrefix] object is empty (#8836) Update connected status popover content (#8834) Use @metamask/[email protected] (#8832) ParseInt nextworkNextNonce correction (#8827) Fix first time onboarding popup position (#8829) fix overflowing contract names and origins (#8823) Hide 'Expand view' button in fullscreen (#8826)
This PR fixes a number of bugs related to our signing methods. Most of them are fixed by updating
eth-json-rpc-middleware
.Summary of Changes
[email protected]
personal_ecRecover
to permissions safe methodsfrom
addressChanges in Detail
[email protected]
4.1.1
of this package, but5.0.0
did not change the parts that they consume.personal_ecRecover
to permissions safe methodsfrom
addressfrom
address is already normalized by the time it hitsaddUnapprovedTransaction
, and thetx-state-manager
does not lowercase addresses. Thus, it's useless.to
address is still lowercased byaddUnapprovedTransacation