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

Epic: EIP-3770 prefixes #3015

Merged
merged 19 commits into from
Dec 1, 2021
Merged

Epic: EIP-3770 prefixes #3015

merged 19 commits into from
Dec 1, 2021

Conversation

DiogoSoaress
Copy link
Member

@DiogoSoaress DiogoSoaress commented Nov 16, 2021

What it solves

Resolves #2842

How this PR fixes it

This allows the optional EIP-3770 chain prefixes across the application and to accept the chain prefixes in the Input components.

How to test it

Refer to #2896 and #2954 to test this PR

DiogoSoaress and others added 2 commits November 16, 2021 09:41
* Create hook to return the prefixed address as per settings

* Apply appearence settings on Sidebar header

* Bump @gnosis.pm/safe-react-components to use latest EthHashInfo

* Add EthHashInfo wrapper component for shortName settings

* Use PrefixedEthHashInfo component in the Appearance settings page

* Replace EthHashInfo for the wrapper in the Safe owner management options

* Replace EthHashInfo for the wrapper in the Balances modal's send screens

* Replace EthHashInfo for its wrapper in the Advanced Settings and Spending Limit options

* Replace EthHashInfo for its wrapper PrefixedEthHashInfo

* Remove unnecessarily introduced hook

* Implement InlineEthHashInfo from the EthHashInfo wrapper

* Use lib component props and avoid duplication

* Add test for PrefixedEthHashInfo component

* Fix "<p> cannot appear as a descendant of <p>" warning

* Unset font-weight in PrefixedEthHashInfo when it is inline.

* Rename PrefixedEthHashInfo inline styled component in TxList

* Do not display chain shortName in AddressBook addresses

* Use PrefixedEthHashInfo displaying addresses for the sake of consistency

* Pass chainName prop to the EthHashInfo in the SafeListSideBar

* Remove temporarly condition to not toggle prefixed addresses in PROD
* Added network prefix to the AddressInput Component

* Added network prefix to BaseAddressBookInput

* reduced the complexity in AddressInput component

* Added AddressInput unit tests

* Added a extra test in AddressInput component

* Added AddressBookInput unit tests

* Added unit tests to getNetworkPrefix and getAddressWithoutNetworkPrefix utils fn

* Minor changes in comments th the AddressInput unit tests

* Addresses without a network prefix are set by default to the current network

* added improvements in AddressInput and validators

* Added Unsupported network prefix error in the checkNetworkPrefix validator

Co-authored-by: Diogo Soares <diogo.soares@gnosis.pm>
@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Nov 16, 2021

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 7 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@github-actions
Copy link

@coveralls
Copy link

coveralls commented Nov 16, 2021

@github-actions
Copy link

github-actions bot commented Nov 16, 2021

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

Failed tests:

  • ❌ Address book Address book
  • ❌ Safe Apps List Safe Apps List
  • ❌ Read-only transaction creation and review Create and review a Send Funds transaction

@katspaugh
Copy link
Member

Please check the e2e tests @DiogoSoaress

@francovenica
Copy link
Contributor

francovenica commented Nov 22, 2021

I checked in the same places as I listed in this comment:
#2896 (comment)

Checked with and without prefix enabled
Checked the copy button with and without prefix
I checked that the network introduced is validated (xdai: will be considered invalid in rinkeby for example)
Checked the QR code with/without prefix for safe

Issue:
The QR code is not being treated properly when it has the prefix.
It seems that is the the QR code has the prefix and when is pasted the system is adding the prefix again

Steps:
-Load a safe
-In the sidebar open the QR code modal
-Check the checkbox of "Copy address with prefix", so the QR changes to that
-Use a screenshot tool to copy that QR code and make it a PNG that you can pick from your folder explorer (I'll attach the PNG of a rinkeby safe I have, you can copy this one if you don't have a screenshot tool, the address should be rin:0x9913B9180C20C6b0F21B6480c84422F6ebc4B808)
image
-Open "Send collectibles" modal
-Use the QR code option to pick the PNG of the safe

Expected:
The QR code is converted to the safe address (with or without the prefix, depending on the Appearance setting current configuration)

Result:
The prefix is added twice
image

@DiogoSoaress
Copy link
Member Author

Regarding the failing E2E tests

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

Failed tests:

  • ❌ Add an existing safe Add an existing safe
  • ❌ Address book Address book
  • ❌ Safe Apps List Safe Apps List

Problem:
When we are developing a new feature in safe-react, we are running the E2E tests against the PR and the E2E tests will fail if the new feature impacts the existing tests.

The issue is that I can't update/fix the E2E tests before the safe-react feature is merged into dev.

What I propose as solution is: we first QA and merge the safe-react branch into dev. Then the following task will be update the E2E tests. Is this valid? @katspaugh @DaniSomoza

* Strip network prefix from the Address when calling EthHashInfo

* Do not use chain prefix for TxHash and SafeTxHash in the Tx List
@katspaugh katspaugh changed the title Feature/eip 3770 prefixes Epic: EIP-3770 prefixes Nov 24, 2021
@github-actions
Copy link

Deployment links

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

DiogoSoaress and others added 6 commits November 24, 2021 11:50
* Strip the scanned address from the chain prefix

* Replace duplicated prefix removal by util method
* Revert prefixed input (#2954)

* Add parsePrefixedAddress and isValidPrefix

* Add tests

* Restore Dani's tests

* Display prefix but pass unprefixed address

* Accept initial input thru a hidden input

* Remove magic again
@JagoFigueroa
Copy link

Hi all! Quick comment from my end as I have been checking this branch to do some testing on the apps side.

I've noticed that the styling for the 2 fields in 'add custom app' pop up is completely gone
Screenshot 2021-11-26 at 14 21 18

Please let me know if you would need me to open a ticket about this. Cheers!

@katspaugh
Copy link
Member

@francovenica I've fixed the QR code validation in Send Collectible.

@francovenica
Copy link
Contributor

Yes, the validation for the Send collectibles form is working, but now has the same issue that Send funds has: The error is shown, but the input is empty:
image

@katspaugh
Copy link
Member

I know, it's the same behavior this input has always had when the QR code is an invalid address.

We should fix it by significantly refactoring the inputs which I don't think we should do in this PR.

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

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 7 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@katspaugh katspaugh merged commit f266e0c into dev Dec 1, 2021
@katspaugh katspaugh deleted the feature/eip-3770-prefixes branch December 1, 2021 15:14
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2021
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.

[Epic] Show a chain prefix everywhere where we display an address
6 participants