Skip to content

FallbackProvider picks broadcastTransaction results incorrectly #4297

@staltz

Description

@staltz

Ethers Version

6.6.2

Search Terms

FallbackProvider

Describe the Problem

We use FallbackProvider to submit a "broadcastTransaction" request to many providers. Some of them fail, some of them succeed. They all have the same "weight" value, which can cause one of the failures to be picked as the main result.

When FallbackProvider (src.ts/providers/provider-fallback.ts) performs a broadcastTransaction request, it uses a try-catch and converts network errors to "normalized result" objects. Then, it uses getAnyResult to pick the main result. getAnyResult in turn uses checkQuorum to get the first (or heaviest weight) result that passes the quorum value.

Expected: if there is one success with weight 2 (quorum 2) and one error with weight 2 (quorum 2), then the success should always be chosen by checkQuorum.

Actual: if there is one success with weight 2 (quorum 2) and one error with weight 2 (quorum 2), then depending on the order of the results in the array, the first one will be picked, which may be the error result.

Code Snippet

No response

Contract ABI

No response

Errors

No response

Environment

Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer), Browser (Chrome, Safari, etc), React Native/Expo/JavaScriptCore

Environment (Other)

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvement.fixed/completeThis Bug is fixed or Enhancement is complete and published.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions