-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve(LineaFinalizer): Force RPC calls through custom provider (#1931)
* improve(LineaFinalizer): Force RPC calls through custom provider The functions that we use in the Linea SDK make event queries from block 0 to "latest" by default which means that some of our RPC's can't be used with the Finalizer. Additionally, we're missing out our custom provider retry and caching logic. This PR removes all instances of making RPC calls via the Linea SDK's provider and replace with making the same call through our custom Provider. The latest [Linea SDK](https://github.com/Consensys/linea-monorepo/blob/3fbe660683a318b6fa1b63ec518f948791536352/sdk/src/sdk/LineaSDK.ts#L56) code looks like it'll support injecting custom providers but its not released yet on NPM. So this code should be removed eventually once a later SDK version is released. * Refactor * fix * fix * Update common.ts * Update l2ToL1.ts * Update l2ToL1.ts * Update arbStack.ts * Update arbStack.ts * Add fix for getFinalizationMessagingInfo * Floor arbStack calc * Use .connect(provider) syntax for brevity * Move all imports to single file * Update l1ToL2.ts * Infer lookback dynamically
- Loading branch information
1 parent
79c6f70
commit 92775a0
Showing
5 changed files
with
353 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Normally we avoid importing directly from a node_modules' /dist package but we need access to some | ||
// of the internal classes and functions in order to replicate SDK logic so that we can by pass hardcoded | ||
// ethers.Provider instances and use our own custom provider instead. | ||
import { L1MessageServiceContract, L2MessageServiceContract } from "@consensys/linea-sdk/dist/lib/contracts"; | ||
import { L1ClaimingService } from "@consensys/linea-sdk/dist/lib/sdk/claiming/L1ClaimingService"; | ||
import { MessageSentEvent } from "@consensys/linea-sdk/dist/typechain/L2MessageService"; | ||
import { SparseMerkleTreeFactory } from "@consensys/linea-sdk/dist/lib/sdk/merkleTree/MerkleTreeFactory"; | ||
import { | ||
DEFAULT_L2_MESSAGE_TREE_DEPTH, | ||
L2_MERKLE_TREE_ADDED_EVENT_SIGNATURE, | ||
L2_MESSAGING_BLOCK_ANCHORED_EVENT_SIGNATURE, | ||
} from "@consensys/linea-sdk/dist/lib/utils/constants"; | ||
|
||
export { | ||
L1ClaimingService, | ||
L1MessageServiceContract, | ||
L2MessageServiceContract, | ||
MessageSentEvent, | ||
SparseMerkleTreeFactory, | ||
DEFAULT_L2_MESSAGE_TREE_DEPTH, | ||
L2_MERKLE_TREE_ADDED_EVENT_SIGNATURE, | ||
L2_MESSAGING_BLOCK_ANCHORED_EVENT_SIGNATURE, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.