Skip to content
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

Update eth-json-rpc-middleware to v9.0.1 #16096

Merged
merged 1 commit into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 8 additions & 107 deletions app/scripts/controllers/network/provider-api-tests/shared-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,6 @@ export function testsForRpcMethodSupportingBlockParam(
),
response: { result: mockResults[0] },
});
// Note that the block-ref middleware will still allow the original
// request to go through.
comms.mockInfuraRpcCall({
request: requests[0],
response: { result: mockResults[0] },
});

const results = await withInfuraClient(({ makeRpcCallsInSeries }) =>
makeRpcCallsInSeries(requests),
Expand Down Expand Up @@ -713,31 +707,15 @@ export function testsForRpcMethodSupportingBlockParam(
),
response: { result: mockResults[0] },
});
// Note that the block-ref middleware will still allow the original
// request to go through.
comms.mockInfuraRpcCall({
request: requests[0],
response: { result: mockResults[0] },
});
comms.mockNextBlockTrackerRequest({ blockNumber: '0x200' });
comms.mockInfuraRpcCall({
request: requests[1],
response: { result: mockResults[1] },
});
// The previous two requests will happen again, with a different block
// number, in the same order.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
requests[0],
requests[1],
blockParamIndex,
'0x200',
),
response: { result: mockResults[1] },
});
comms.mockInfuraRpcCall({
request: requests[0],
response: { result: mockResults[1] },
});

const results = await withInfuraClient(async (client) => {
const firstResult = await client.makeRpcCall(requests[0]);
Expand Down Expand Up @@ -780,25 +758,14 @@ export function testsForRpcMethodSupportingBlockParam(
),
response: { result: mockResults[0] },
});
// Note that the block-ref middleware will still allow the original
// request to go through.
comms.mockInfuraRpcCall({
request: requests[0],
response: { result: mockResults[0] },
});
// The previous two requests will happen again, in the same order.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
requests[0],
requests[1],
blockParamIndex,
'0x100',
),
response: { result: mockResults[1] },
});
comms.mockInfuraRpcCall({
request: requests[0],
response: { result: mockResults[1] },
});

const results = await withInfuraClient(({ makeRpcCallsInSeries }) =>
makeRpcCallsInSeries(requests),
Expand All @@ -823,22 +790,16 @@ export function testsForRpcMethodSupportingBlockParam(
comms.mockNextBlockTrackerRequest({ blockNumber: '0x100' });
// The block-ref middleware will make the request as specified
// except that the block param is replaced with the latest block
// number.
// number, and we delay it.
comms.mockInfuraRpcCall({
delay: 100,
Gudahtt marked this conversation as resolved.
Show resolved Hide resolved
request: buildRequestWithReplacedBlockParam(
requests[0],
blockParamIndex,
'0x100',
),
response: { result: mockResults[0] },
});
// This is the original request as below, which the block-ref
// middleware will allow through, except that we delay it.
comms.mockInfuraRpcCall({
request: requests[0],
response: { result: mockResults[0] },
delay: 100,
});
// The previous two requests will happen again, in the same order.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
Expand All @@ -848,10 +809,6 @@ export function testsForRpcMethodSupportingBlockParam(
),
response: { result: mockResults[1] },
});
comms.mockInfuraRpcCall({
request: requests[1],
response: { result: mockResults[1] },
});
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
requests[2],
Expand All @@ -860,10 +817,6 @@ export function testsForRpcMethodSupportingBlockParam(
),
response: { result: mockResults[2] },
});
comms.mockInfuraRpcCall({
request: requests[2],
response: { result: mockResults[2] },
});

const results = await withInfuraClient(async (client) => {
const resultPromises = [
Expand Down Expand Up @@ -902,10 +855,6 @@ export function testsForRpcMethodSupportingBlockParam(
// The block-ref middleware will make the request as specified
// except that the block param is replaced with the latest block
// number.
//
// Note, however, that the block-ref middleware doesn't run the
// original request, as it fails before it gets to that point, so
// there is no need to mock the request again.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
request,
Expand Down Expand Up @@ -940,10 +889,6 @@ export function testsForRpcMethodSupportingBlockParam(
// The block-ref middleware will make the request as specified
// except that the block param is replaced with the latest block
// number.
//
// Note, however, that the block-ref middleware doesn't run the
// original request, as it fails before it gets to that point, so
// there is no need to mock the request again.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
request,
Expand Down Expand Up @@ -978,10 +923,6 @@ export function testsForRpcMethodSupportingBlockParam(
// The block-ref middleware will make the request as specified
// except that the block param is replaced with the latest block
// number.
//
// Note, however, that the block-ref middleware doesn't run the
// original request, as it fails before it gets to that point, so
// there is no need to mock the request again.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
request,
Expand Down Expand Up @@ -1046,15 +987,6 @@ export function testsForRpcMethodSupportingBlockParam(
httpStatus: 200,
},
});
// Note that the block-ref middleware will still allow the original
// request to go through.
comms.mockInfuraRpcCall({
request,
response: {
result: 'the result',
httpStatus: 200,
},
});
const result = await withInfuraClient(
async ({ makeRpcCall, clock }) => {
return await waitForPromiseToBeFulfilledAfterRunningAllTimers(
Expand Down Expand Up @@ -1082,10 +1014,6 @@ export function testsForRpcMethodSupportingBlockParam(
// The block-ref middleware will make the request as specified
// except that the block param is replaced with the latest block
// number.
//
// Note, however, that the block-ref middleware doesn't run the
// original request, as it fails before it gets to that point, so
// there is no need to mock the request again.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
request,
Expand Down Expand Up @@ -1153,15 +1081,6 @@ export function testsForRpcMethodSupportingBlockParam(
httpStatus: 200,
},
});
// Note that the block-ref middleware will still allow the
// original request to go through.
comms.mockInfuraRpcCall({
request,
response: {
result: 'the result',
httpStatus: 200,
},
});
const result = await withInfuraClient(
async ({ makeRpcCall, clock }) => {
return await waitForPromiseToBeFulfilledAfterRunningAllTimers(
Expand Down Expand Up @@ -1189,10 +1108,6 @@ export function testsForRpcMethodSupportingBlockParam(
// The block-ref middleware will make the request as specified
// except that the block param is replaced with the latest block
// number.
//
// Note, however, that the block-ref middleware doesn't run the
// original request, as it fails before it gets to that point, so
// there is no need to mock the request again.
comms.mockInfuraRpcCall({
request: buildRequestWithReplacedBlockParam(
request,
Expand Down Expand Up @@ -1408,23 +1323,16 @@ export function testsForRpcMethodSupportingBlockParam(
// also happens within the retry-on-empty middleware (although the
// latest block is cached by now).
comms.mockNextBlockTrackerRequest({ blockNumber: '0x100' });
// The retry-on-empty middleware will make an explicit request.
comms.mockInfuraRpcCall({
request,
response: { result: 'this result gets overwritten' },
});
// Note that the retry-on-empty middleware will still allow the
// original request to go through.
comms.mockInfuraRpcCall({
request,
response: { result: 'the actual result' },
response: { result: 'the result' },
});

const result = await withInfuraClient(({ makeRpcCall }) =>
makeRpcCall(request),
);

expect(result).toStrictEqual('the actual result');
expect(result).toStrictEqual('the result');
});
});

Expand All @@ -1440,23 +1348,16 @@ export function testsForRpcMethodSupportingBlockParam(
// also happens within the retry-on-empty middleware (although the
// latest block is cached by now).
comms.mockNextBlockTrackerRequest({ blockNumber: '0x100' });
// The retry-on-empty middleware will make an explicit request.
comms.mockInfuraRpcCall({
request,
response: { result: 'this result gets overwritten' },
});
// Note that the retry-on-empty middleware will still allow the
// original request to go through.
comms.mockInfuraRpcCall({
request,
response: { result: 'the actual result' },
response: { result: 'the result' },
});

const result = await withInfuraClient(({ makeRpcCall }) =>
makeRpcCall(request),
);

expect(result).toStrictEqual('the actual result');
expect(result).toStrictEqual('the result');
});
});
}
Expand Down
47 changes: 17 additions & 30 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4551,7 +4551,7 @@
"packages": {
"browserify>browser-resolve": true,
"eth-block-tracker>@metamask/utils": true,
"eth-json-rpc-middleware>eth-sig-util": true,
"eth-json-rpc-middleware>@metamask/eth-sig-util": true,
"eth-json-rpc-middleware>pify": true,
"eth-rpc-errors": true,
"json-rpc-engine": true,
Expand All @@ -4560,45 +4560,32 @@
"vinyl>clone": true
}
},
"eth-json-rpc-middleware>eth-sig-util": {
"eth-json-rpc-middleware>@metamask/eth-sig-util": {
"packages": {
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-abi": true,
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-util": true
}
},
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-abi": {
"packages": {
"bn.js": true,
"3box>tweetnacl": true,
"3box>tweetnacl-util": true,
"browserify>buffer": true,
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-abi>ethereumjs-util": true
"eth-json-rpc-middleware>@metamask/eth-sig-util>bn.js": true,
"eth-json-rpc-middleware>@metamask/eth-sig-util>ethereum-cryptography": true,
"eth-json-rpc-middleware>@metamask/eth-sig-util>ethjs-util": true,
"eth-lattice-keyring>@ethereumjs/util": true
}
},
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-abi>ethereumjs-util": {
"eth-json-rpc-middleware>@metamask/eth-sig-util>bn.js": {
"packages": {
"3box>ethers>elliptic": true,
"bn.js": true,
"browserify>assert": true,
"browserify>buffer": true,
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-util>ethjs-util": true,
"ethereumjs-util>create-hash": true,
"ethereumjs-util>ethereum-cryptography": true,
"ethereumjs-util>rlp": true
"browserify>browser-resolve": true
}
},
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-util": {
"eth-json-rpc-middleware>@metamask/eth-sig-util>ethereum-cryptography": {
"globals": {
"TextDecoder": true,
"crypto": true
},
"packages": {
"3box>ethers>elliptic": true,
"bn.js": true,
"browserify>assert": true,
"browserify>buffer": true,
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-util>ethjs-util": true,
"ethereumjs-util>create-hash": true,
"ethereumjs-util>ethereum-cryptography": true,
"ethereumjs-util>rlp": true,
"ethereumjs-wallet>safe-buffer": true
"@metamask/rpc-methods>@metamask/key-tree>@noble/hashes": true
}
},
"eth-json-rpc-middleware>eth-sig-util>ethereumjs-util>ethjs-util": {
"eth-json-rpc-middleware>@metamask/eth-sig-util>ethjs-util": {
"packages": {
"browserify>buffer": true,
"ethjs>ethjs-util>is-hex-prefixed": true,
Expand Down
Loading