-
Notifications
You must be signed in to change notification settings - Fork 361
Refactor: chain features and versioned features #3120
Conversation
|
CLA Assistant Lite All Contributors have signed the CLA. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
There was a problem hiding this 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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Pull Request Test Coverage Report for Build 1545378361
💛 - Coveralls |
Deployment links
|
|
E2E Tests Failed Failed tests:
|
| const FEATURES_BY_VERSION: Record<string, string> = { | ||
| [FEATURES.ERC1155]: '>=1.1.1', | ||
| [FEATURES.SAFE_TX_GAS_OPTIONAL]: '>=1.3.0', |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this 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?
|
But it depends on the Safe version. |
|
@francovenica you can see the difference between
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. |
|
@francovenica has clarified that collectibles should indeed be activated for all versions. |

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
hasFeaturewhich takes an optional Safe version param.How to test it