RelayProvider default filter using only active relay servers with status ready
Opened this issue · 0 comments
Is your feature request related to a problem? Please describe.
When using RelayProvider
and not providing a list of preferredRelays
in the config
property, it looks up for any active relay server and selects one of them to be used. The problem is its selecting relay servers that are not actually running, i.e. with status Ready, and if that is the case the RelayProvider will end up returning an error.
Describe the solution you'd like
Add a default filter to the RelayProvider
to retrieve only active relay servers with status Ready. This way some errors related to selecting an "invalid" relay server will be resolved.
Describe alternatives you've considered
Add a new property to the config
object that activates this filter, like useOnlyActiveRelayServers: boolean
.
Additional context
Example:
Using "@opengsn/provider": "3.0.0-beta.10",
When calling newWeb3Provider
from RelayProvider
, using polygon mainnet at the moment of testing, theres only one available active relay server with status Ready, meaning its the only one that should work, and instead from the logs I can see that it tried to use other relay servers, ending up in error.
Code snippet:
import { RelayProvider } from '@opengsn/provider';
const gsnProvider = await RelayProvider.newWeb3Provider({
provider,
config: {
performDryRunViewRelayCall: false,
loggerConfiguration: { logLevel: 'debug' },
paymasterAddress,
},
}).catch((err: any) => {
throw new Error(err);
});
Current active relay servers from Polygon mainnet (https://relays.opengsn.org/):