-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat: use FallbackProvider in the DTL #1393
Conversation
🦋 Changeset detectedLatest commit: e0be02e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/data-transport-layer/src/services/l1-ingestion/service.ts
Outdated
Show resolved
Hide resolved
packages/data-transport-layer/src/services/l1-ingestion/service.ts
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
7fb268f
to
6d9ca23
Compare
CI is generally failing here, need to investigate as to why |
79f8a4c
to
078a041
Compare
cc @smartcontracts this is ready for review again |
packages/core-utils/src/provider.ts
Outdated
const provider = new ethers.providers.StaticJsonRpcProvider(url) | ||
providers.push(provider) | ||
} | ||
return new ethers.providers.FallbackProvider(providers) |
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.
looks good - note here that we can further parameterize things like weights of different providers by providing an array of FallbackProviderConfig
instead.
FallbackProviderConfig. If a Provider is provided, the defaults are a priority of 1 and a weight of 1.
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.
The existing implementation will randomize which is used. We could set the priority based on the order of URLs passed in
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.
Does this do quorum by default?
Allow the DTL to sync from multiple web3 backends using the `ethers.providers.FallbackProvider`. Multiple URLs can be passed through as a comma delimited string to configure multiple providers. A helper function is added to `core-utils` to allow easy configuration between services. This PR only introduces the usage of the fallback provider into the DTL. In the future, it should be added to other services that query L1 as well.
078a041
to
e0be02e
Compare
import { Provider } from '@ethersproject/providers' | ||
|
||
// Copied from @ethersproject/providers since it is not | ||
// currently exported |
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.
PR to export the interface here: ethers-io/ethers.js#2121
Description
Replaces
StaticJsonRpcProvider
withFallbackProvider
so we can run multiple nodes and get a consensus of results from each.