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

Conversation

@katspaugh
Copy link
Member

@katspaugh katspaugh commented Dec 6, 2021

What it solves

Resolves #3121 #3118

How this PR fixes it

Store both chain features and Safe version features in the enabledFeatures.
When checking if a feature is enabled, always use hasFeature which takes an optional Safe version param.

How to test it

  • Test optional safeTxGas for 1.3.0 Safes and that it's obligatory for 1.1.1
  • Test maxFeePerGas vs gasLimit on mainnet (maxFeePerGas) vs Polygon (gasLimit)

@katspaugh katspaugh requested a review from iamacook December 6, 2021 12:01
@github-actions
Copy link

github-actions bot commented Dec 6, 2021

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Dec 6, 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 6 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link
Contributor

@iamacook iamacook left a comment

Choose a reason for hiding this comment

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

SAFE_TX_GAS_OPTIONAL does not exist on the FEATURES enum because I was lead to believe it was a Safe feature and therefore not chain related. Do we want to now add it?

FEATURES.SAFE_APPS,
FEATURES.CONTRACT_INTERACTION,
SAFE_FEATURES.SAFE_TX_GAS_OPTIONAL,
FEATURES.SAFE_TX_GAS_OPTIONAL,
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this was a safe-specific feature? Hence, it wasn't included in the FEATURES enum in the gateway types.

Copy link
Member Author

@katspaugh katspaugh Dec 6, 2021

Choose a reason for hiding this comment

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

That's correct but I see no harm in it being in either the enum or the store.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can use this prior PR then.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, reopened + added EIP1559.

@coveralls
Copy link

coveralls commented Dec 6, 2021

Pull Request Test Coverage Report for Build 1545378361

  • 12 of 16 (75.0%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+1.4%) to 32.372%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/logic/safe/transactions/gas.ts 1 2 50.0%
src/components/AppLayout/Sidebar/useSidebarItems.tsx 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
src/config/index.ts 1 60.78%
Totals Coverage Status
Change from base Build 1545283506: 1.4%
Covered Lines: 3080
Relevant Lines: 8460

💛 - Coveralls

@github-actions
Copy link

github-actions bot commented Dec 6, 2021

Deployment links

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

@github-actions
Copy link

github-actions bot commented Dec 6, 2021

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

Failed tests:

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

Comment on lines +12 to +14
const FEATURES_BY_VERSION: Record<string, string> = {
[FEATURES.ERC1155]: '>=1.1.1',
[FEATURES.SAFE_TX_GAS_OPTIONAL]: '>=1.3.0',
Copy link
Member Author

Choose a reason for hiding this comment

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

FEATURES_BY_VERSION is now a map of features to versions.

}
return featureConfig.validVersion ? semverSatisfies(version, featureConfig.validVersion) : true
const isEnabledByVersion = (feature: FEATURES, version: string): boolean => {
if (!(feature in FEATURES_BY_VERSION)) return true
Copy link
Member Author

Choose a reason for hiding this comment

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

If the feature is in the chain features, but not in the versioned map, then we assume it's enabled for all Safe versions.

Copy link
Contributor

@iamacook iamacook left a comment

Choose a reason for hiding this comment

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

Do you think the hasFeature function should move to /src/config?

@katspaugh
Copy link
Member Author

But it depends on the Safe version.

@francovenica
Copy link
Contributor

I'm not sure what "Test maxFeePerGas vs gasLimit on mainnet (maxFeePerGas) vs Polygon (gasLimit)" means. I tried tx in both networks and the MM popUp and the modals in the gnosis app looks the same in both networks

Issue:
Safes 1.0.0 still show collectibles.
Safe rinkeby 1.0.0: 0x5A7140f5DEabc7e211Da114081d9b0Fc4bf4cAf2
12-06-2021_x(3625)

Question: Collectibles were enabled by safes 1.0.0 a while ago on purpose. Has something change that we have to disable the option for those users?

@katspaugh
Copy link
Member Author

katspaugh commented Dec 7, 2021

@francovenica you can see the difference between maxFeePerGas and gasLimit if you edit the gas price in MM. When using gasLimit, Max Base Fee and Max Priority Fee will (incorrectly) hold the same value.

Question: Collectibles were enabled by safes 1.0.0 a while ago on purpose. Has something change that we have to disable the option for those users?

Really? In the code it looked like Collectibles were deactivated for Safes prior to 1.1.1. If it's not the case on prod, we can get rid of that check entirely and enable Collectibles unconditionally for all Safes.

@katspaugh katspaugh merged commit a2cd631 into dev Dec 7, 2021
@katspaugh katspaugh deleted the features branch December 7, 2021 10:05
@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2021
@katspaugh
Copy link
Member Author

@francovenica has clarified that collectibles should indeed be activated for all versions.

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.

Add a EIP-1559 feature flag

5 participants