Skip to content
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

Arbitrum: chose matrix server from PFS #3069

Merged
merged 3 commits into from
Mar 7, 2022
Merged

Arbitrum: chose matrix server from PFS #3069

merged 3 commits into from
Mar 7, 2022

Conversation

andrevmatos
Copy link
Contributor

Fixes #

Short description
This is an enhancement to some situations seen while testing with Arbitrum. When not explicitly specified (e.g. through cli's --matrix-server command line parameter), transport on auto mode will download the list of servers from RSB's github (this list for testnets), and there's a high probability of those servers being incompatible with the current network (this is the case with arbitrum-rinkeby test PFS, which runs with its own matrix server).

The motivation of this change is that PFSs are either passed explicitly or picked from the chosen contracts (through ServicesRegistry), and therefore should always have a compatible matrix server, exposed in /api/v1/info endpoint. Therefore, preferring the server from the PFS will mostly ensure it's compatible with the current network and PFS, and only as a fallback we download the list from the matrixServerLookup URL.

Tests included.
This doesn't work only for Arbitrum, could work also for master, but since this touches test code which was already changed on arbitrum (#3034), it was easier to target that base, and most new features are already going to it anyway.

Definition of Done

  • Steps to manually test the change have been documented
  • Acceptance criteria are met
  • Change has been manually tested by the reviewer (dApp)

Steps to manually test the change (dApp)

Also, allow it to not only emit first best PFS, but instead prefer to
emit all of them sorted, so caller can take `first` only if desired.
This is intended in order to use this functions in other places of the
code, like the matrix server choice in transport.
When matrixServer isn't set, we are in `auto` mode. Previously, we'd
fetch the list from `matrixServerLookup`, but is easy to have this list
mismatched with current network/deployment. This change prefers the same
matrixServer from the PFSs, scanning first `config.additionalServices`
and then services fetched from ServicesRegistry, which are expected to
always be compatible with current deployment.
@andrevmatos andrevmatos added enhancement New feature or request optimization ⚡ Optimizations for the implementation or protocol feature labels Mar 5, 2022
@andrevmatos andrevmatos self-assigned this Mar 5, 2022
@andrevmatos andrevmatos changed the title Arbitrum: choose matrix server from PFS Arbitrum: chose matrix server from PFS Mar 5, 2022
Copy link
Contributor

@weilbith weilbith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very useful. 👏🏾

mergeMap(({ pfsMode, additionalServices }) => {
if (pfsByAction) return of(pfsByAction);
else if (pfsMode === PfsMode.onlyAdditional) {
let firstError: Error;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for using full variable names without abbreviations. 🤗

@andrevmatos andrevmatos merged commit 145a3be into arbitrum Mar 7, 2022
@andrevmatos andrevmatos deleted the matrix_server branch March 7, 2022 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature optimization ⚡ Optimizations for the implementation or protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants