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

feat: add multiple update* methods #149

Merged
merged 25 commits into from
May 17, 2023
Merged

Conversation

pscott
Copy link
Collaborator

@pscott pscott commented Apr 21, 2023

I initially wanted to go for an updateSettings that encompasses all the settings we have, however it is currently not possible because it would break the forge coverage tool we are using (indeed, the optimizer isn't used when using forge coverage, which results in a stack too deep).

So I've decided to go for:

    function updateStrategies(
       Strategy calldata _proposalValidationStrategy,
       address[] calldata _authenticatorsToAdd,
       address[] calldata _authenticatorsToRemove,
       Strategy[] calldata _votingStrategiesToAdd,
       string[] calldata _votingStrategiesMetadataURIsToAdd,
       uint8[] calldata _votingIndicesToRemove
   ) external;
   
   function updateSettings(
       uint32 _minVotingDuration,
       uint32 _maxVotingDuration,
       uint32 _votingDelay,
       string calldata _metadataURI
   ) external;

Closes #148

@pscott pscott requested a review from Orland0x April 24, 2023 13:30
@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Merging #149 (3de402b) into main (538ae1c) will decrease coverage by 0.39%.
The diff coverage is 86.84%.

@@            Coverage Diff             @@
##             main     #149      +/-   ##
==========================================
- Coverage   84.35%   83.96%   -0.39%     
==========================================
  Files          28       28              
  Lines         409      424      +15     
  Branches       91      101      +10     
==========================================
+ Hits          345      356      +11     
- Misses         54       55       +1     
- Partials       10       13       +3     
Impacted Files Coverage Δ
src/Space.sol 95.31% <86.84%> (-2.92%) ⬇️

@Orland0x
Copy link
Contributor

Orland0x commented May 1, 2023

Agree with this PR, adding and removing strategies separately was bad UX.

Do we need to keep the original single use entry points now then?

@pscott
Copy link
Collaborator Author

pscott commented May 1, 2023

Agree with this PR, adding and removing strategies separately was bad UX.

Do we need to keep the original single use entry points now then?

I originally thought "yes" because it would provide more granularity but if we wish to reduce code bloat then maybe we could remove them indeed.

@Orland0x
Copy link
Contributor

Orland0x commented May 8, 2023

Agree with this PR, adding and removing strategies separately was bad UX.
Do we need to keep the original single use entry points now then?

I originally thought "yes" because it would provide more granularity but if we wish to reduce code bloat then maybe we could remove them indeed.

yeah i say we remove them. I think we should have just a single entry point updateSettings. Users can just leave arguments empty that they dont want to change.

@pscott
Copy link
Collaborator Author

pscott commented May 12, 2023

Removed the external granular entrypoints and decided to keep only updateSettings and updateStrategies.

If you wish to ignore some fields, use:

  • 0xffffffff for uin32s (votingDelay, min/maxVotingDuration) (NO_UPDATE_DURATION)
  • I do not want to update the metadataURI to ignore setting the metadatauri (NO_UPDATE_METADATA_URI).
  • 0x1337133713371337133713371337133713371337 to ignore the proposal Strategy (NO_UPDATE_PROPOSAL_STRATEGY)
  • Empty arrays to ignore everything that's passed as an array (authenticators to add/remove, voting strategies to add/remove)

Also removed the EmptyArray check in the internal functions since they are now special values in updateStrategies. Added the checks in the constructor (see a10fd7d)

src/Space.sol Outdated Show resolved Hide resolved
@arr00
Copy link
Contributor

arr00 commented May 14, 2023

Are no-update keys the best solution to this? I feel like the experience for anyone not using sx frontend is not intuitive.

@Orland0x
Copy link
Contributor

Are no-update keys the best solution to this? I feel like the experience for anyone not using sx frontend is not intuitive.

Have you got any other ideas? Its not ideal, but as 99%+ of use will be through our UI i feel the ux improvement is worth it.

@arr00
Copy link
Contributor

arr00 commented May 15, 2023

Are no-update keys the best solution to this? I feel like the experience for anyone not using sx frontend is not intuitive.

Have you got any other ideas? Its not ideal, but as 99%+ of use will be through our UI i feel the ux improvement is worth it.

Even with our frontend, for users who check what they sign, it will be very confusing. There could be a uint8 where you set update bit flags (this is still not good ui). We could also just have a bunch of update booleans as parameters and it wouldn't cause such a large increase in gas (assuming a chain with cheap calldata).

Considering these options, current approach may be best (definitely should comment in values of no update keys though)

src/Space.sol Outdated Show resolved Hide resolved
@pscott pscott force-pushed the feat_add_update_settings_entrypoint branch from 7ae1324 to 835262b Compare May 15, 2023 13:53
src/types.sol Outdated Show resolved Hide resolved
src/Space.sol Outdated Show resolved Hide resolved
Copy link
Contributor

@Orland0x Orland0x left a comment

Choose a reason for hiding this comment

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

tACK

@pscott pscott merged commit 72c2d54 into main May 17, 2023
Orland0x added a commit that referenced this pull request May 18, 2023
* feat: add updateAuthenticators, updateVotingStrategies and updateSettings

* feat: add updateAuthenticatorsAndVotingStrategies

* fix: add --via-ir to forge coverage

* fix: add via_ir in foundry.toml

* refactor: split the functions into updateSettings and updateStrategies

* fix: check for metadatauriupdated event when testing

* fix: check for _min and _max and do not use internal setters

* refactor: move back from votingStrategiesMetadataURIs to votingStrategyMetadataURIs

* refactor: remove set* entrypoints

* refactor: remove EmptyArray check in internal functions

* fix: Differentiate NO_UPDATE_METADATA_URI and NO_UPDATE_METADATA_URI_HASH

* fix: fix NO_UPDATE_METADATA_URI_HASH

* fix: remove useless comments

* refactor: changing magic values for NO_UPDATE

* refactor: use types instead of variables for no_update

* refactor: use input struct for update settings

* fix: remove extra comments on UpdateSettingsInput

* chore: remove extra comment in updateSettings function

* chore: add comments on values of NO_UPDATE_*

* chore: fix typo in Space.col comments

* chore: updated comments

---------

Co-authored-by: Orland0x <[email protected]>
Orland0x added a commit that referenced this pull request May 18, 2023
* chore: readme 1

* chore: moved proposal validation utils to common utils dir

* chore: renamed WhitelistStrategy to WhitelistVotingStrategy

* chore updated readme

* fix: casing

* refactor: move len checks to top of initializer

* feat: check array lengths match

* chore: updated tests

* fix: readme typo

* chore: added usage intructions to readme

* feat(proposal validation): metadata uri (#157)

* feat: proposal validation metadata

* chore: updated tests

---------

Co-authored-by: Orlando <[email protected]>

* refactor: moved active proposal limitier params to space level (#155)

* refactor: moved active proposal limitier params to space level

* fix: limit active proposals per space not globally

* fix: forked test error

---------

Co-authored-by: Orlando <[email protected]>

* feat: erc4824 support (#159)

* feat: erc4824 interface

* feat: space implements erc4824

* chore: dao uri setter tests

* feat: add daoURI to space creation event

* chore: fixed conflict issues

---------

Co-authored-by: Orlando <[email protected]>

* feat: set veto guardian in execution strategy setup (#163)

* feat: veto guardian in timelock setup

* feat: veto guardian in comp timelock setup

* chore: updated tests

* chore: fixed tests

* feat: setup events in timelock exec strats

* chore: inccrease codecov threshold

* chore: increased coverage

* chore: removed patch cov requirement

---------

Co-authored-by: Orlando <[email protected]>

* feat: add multiple update* methods (#149)

* feat: add updateAuthenticators, updateVotingStrategies and updateSettings

* feat: add updateAuthenticatorsAndVotingStrategies

* fix: add --via-ir to forge coverage

* fix: add via_ir in foundry.toml

* refactor: split the functions into updateSettings and updateStrategies

* fix: check for metadatauriupdated event when testing

* fix: check for _min and _max and do not use internal setters

* refactor: move back from votingStrategiesMetadataURIs to votingStrategyMetadataURIs

* refactor: remove set* entrypoints

* refactor: remove EmptyArray check in internal functions

* fix: Differentiate NO_UPDATE_METADATA_URI and NO_UPDATE_METADATA_URI_HASH

* fix: fix NO_UPDATE_METADATA_URI_HASH

* fix: remove useless comments

* refactor: changing magic values for NO_UPDATE

* refactor: use types instead of variables for no_update

* refactor: use input struct for update settings

* fix: remove extra comments on UpdateSettingsInput

* chore: remove extra comment in updateSettings function

* chore: add comments on values of NO_UPDATE_*

* chore: fix typo in Space.col comments

* chore: updated comments

---------

Co-authored-by: Orland0x <[email protected]>

* refactor: move len checks to top of initializer

* feat: check array lengths match

* chore: updated tests

---------

Co-authored-by: Orlando <[email protected]>
Co-authored-by: pscott <[email protected]>
@Orland0x Orland0x deleted the feat_add_update_settings_entrypoint branch October 11, 2023 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add updateAuthenticators, updateVotingStrategies, and updateSettings
3 participants