Skip to content

Commit

Permalink
fix: Ignore zkSync fields on the right method (#929)
Browse files Browse the repository at this point in the history
The previous change incorrectly targeted the wrong rpc method.
  • Loading branch information
pxrl authored Sep 7, 2023
1 parent d0209ff commit 8032a01
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/utils/ProviderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ function compareRpcResults(method: string, rpcResultA: any, rpcResultB: any): bo
if (method === "eth_getBlockByNumber") {
// We've seen RPC's disagree on the miner field, for example when Polygon nodes updated software that
// led alchemy and quicknode to disagree on the the miner field's value.
return compareResultsAndFilterIgnoredKeys(["miner"], rpcResultA, rpcResultB);
} else if (method === "eth_getLogs") {
// We've seen some RPC's like QuickNode add in transactionLogIndex which isn't in the
// JSON RPC spec: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges
// Additional reference: https://github.com/ethers-io/ethers.js/issues/1721
// 2023-08-31 Added blockHash because of upstream zkSync provider disagreements. Consider removing later.
return compareResultsAndFilterIgnoredKeys(
[
"miner", // polygon (sometimes)
"l1BatchNumber", // zkSync
"l1BatchTimestamp", // zkSync
"transactionLogIndex",
],
rpcResultA,
rpcResultB
);
} else if (method === "eth_getLogs") {
// We've seen some RPC's like QuickNode add in transactionLogIndex which isn't in the
// JSON RPC spec: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges
// Additional reference: https://github.com/ethers-io/ethers.js/issues/1721
// 2023-08-31 Added blockHash because of upstream zkSync provider disagreements. Consider removing later.
return compareResultsAndFilterIgnoredKeys(["transactionLogIndex"], rpcResultA, rpcResultB);
} else {
return lodash.isEqual(rpcResultA, rpcResultB);
}
Expand Down

0 comments on commit 8032a01

Please sign in to comment.