Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Fix legacy redirection of legacy mainnet links #3298

Merged
merged 3 commits into from
Jan 14, 2022

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Jan 13, 2022

What it solves

Broken legacy redirection of mainnet.

How this PR fixes it

By loading chains from backend, the config is not immediately present for the redirection logic to reference. The default shortName now corresponds to the default network.

How to test it

  1. Attempt to navigate to a legacy route, i.e. {{PR}}/app/#/safes/0xfF501B324DC6d78dC9F983f140B9211c3EdB4dc7/balances
  2. Observe the correct redirection to {{PR}}/app/eth:0xfF501B324DC6d78dC9F983f140B9211c3EdB4dc7/balances because the PR has no subdomain from the map.

@iamacook iamacook self-assigned this Jan 13, 2022
@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Jan 13, 2022

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@coveralls
Copy link

coveralls commented Jan 13, 2022

Pull Request Test Coverage Report for Build 1693422458

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.008%) to 32.44%

Totals Coverage Status
Change from base Build 1692167562: -0.008%
Covered Lines: 3123
Relevant Lines: 8571

💛 - Coveralls

@github-actions
Copy link

Deployment links

🟠 Safe Rinkeby Safe Mainnet 🟣 Safe Polygon 🟡 Safe BSC Safe Arbitrum 🟢 Safe xDai

@github-actions
Copy link

github-actions bot commented Jan 13, 2022

E2E Tests Failed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1693454065

Failed tests:

  • ❌ Safe Apps List Safe Apps List
  • ❌ Read-only transaction creation and review Read-only transaction creation and review

rinkeby: 'rin',
volta: 'vt',
xdai: 'xdai',
}
Copy link
Member

@katspaugh katspaugh Jan 13, 2022

Choose a reason for hiding this comment

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

Please remove that as this redirect will be done on the server side.

const chain = getChains().find((chain) => sameString(chain.chainName, chainLabel)) || getChainInfo()
const subdomain = window.location.hostname.split('.')[0]

const DEFAULT_SHORT_NAME = DEFAULT_CHAIN_ID === CHAIN_ID.RINKEBY ? LEGACY_ROUTE_SHORT_NAMES.rinkeby : 'eth'
Copy link
Member

@katspaugh katspaugh Jan 13, 2022

Choose a reason for hiding this comment

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

Please put rin and eth into an enum.
AFAIU, we need to hardcode them in this instance because the chains aren't loaded yet.

Or maybe they are already present in the codebase or in the Gateway SDK?

@francovenica
Copy link
Contributor

Question. The only redirection always goes to "rin:". I assume because this is a PR, and in prod, when the URL is something like "https://xdai.gnosis-safe.io/app/#/" it will redirect to the proper xdai: network. Is this correct?

If this is the case then the ticket is good to be merged

@iamacook
Copy link
Member Author

iamacook commented Jan 14, 2022

Question. The only redirection always goes to "rin:". I assume because this is a PR, and in prod, when the URL is something like "https://xdai.gnosis-safe.io/app/#/" it will redirect to the proper xdai: network. Is this correct?

Yes, the redirection that already exists on the old subdomains redirects correctly but because of the dynamic loading of configs from the CGW and renaming of Mainnet to Ethereum, it is causing problems with finding the shortName for what was Mainnet. The fallback for this was included as follows so that's why it falls back to Rinkeby on the PR:

DEFAULT_CHAIN_ID === CHAIN_ID.RINKEBY ? SHORT_NAME.RINKEBY : SHORT_NAME.MAINNET

I will merge this now.

@iamacook iamacook merged commit d8a7409 into dev Jan 14, 2022
@iamacook iamacook deleted the fix-mainnet-legacy-redirect branch January 14, 2022 08:11
@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants