Skip to content

Conversation

@naddison36
Copy link
Collaborator

@naddison36 naddison36 commented Jun 23, 2023

When reviewing the Uniswap V3 Strategy PR, it was clear we need to remove the _deprecated property from the Strategy struct that is used by the Vault's strategies mapping.

Looking at both the OETH and OUSD vault storage, there is no impact in removing this

OUSD strategies storage https://evm.storage/eth/17540105/0xe75d77b1865ae93c7eaa3040b038d7aa7bc02f70/strategies#map

OETH strategies storage
https://evm.storage/eth/17540186/0x39254033945aa2e4809cc2977e7087bee48bd7ab/strategies#map

@rafaelugolini rafaelugolini temporarily deployed to preview-oeth-nicka-coll-o9kgkp June 23, 2023 05:22 Inactive
// Strategies approved for use by the Vault
struct Strategy {
bool isSupported;
uint256 _deprecated; // Deprecated storage slot
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will affect any future changes to the struct (since any new prop added might already have values set for existing strategies). Uniswap strategy already does that. It's probably low impact but I'd prefer not to do it

Copy link
Collaborator Author

@naddison36 naddison36 Jun 23, 2023

Choose a reason for hiding this comment

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

That's why we need to do this now. The Uniswap V3 Strategy will add another bool after this which means we have two bools using three storage slots.

Each read from a storage slot costs 2,100 gas

Copy link
Collaborator

Choose a reason for hiding this comment

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

I get your point. But how do we make sure that we don't accidentally use the old value in slot1 (set before deprecation) when we add more vars to this? Right now, having this named _depreacted acts as a reminder for us

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, it makes more sense to remove it then

@naddison36 naddison36 mentioned this pull request Jun 23, 2023
6 tasks
@naddison36 naddison36 added the contracts Works related to contracts label Jun 23, 2023
Copy link
Member

@sparrowDom sparrowDom left a comment

Choose a reason for hiding this comment

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

LGTM.

Pretty cool demonstration of how the evm storage tool helps answer the question of whether we have any dirty data in the deprecated slot.

@sparrowDom sparrowDom temporarily deployed to preview-oeth-nicka-coll-o9kgkp June 23, 2023 09:43 Inactive
@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Merging #1653 (838e741) into nicka/collateral-swaps (77e77f4) will not change coverage.
The diff coverage is 100.00%.

@@                   Coverage Diff                   @@
##           nicka/collateral-swaps    #1653   +/-   ##
=======================================================
  Coverage                   69.36%   69.36%           
=======================================================
  Files                          44       44           
  Lines                        2350     2350           
  Branches                      617      617           
=======================================================
  Hits                         1630     1630           
  Misses                        717      717           
  Partials                        3        3           
Impacted Files Coverage Δ
contracts/contracts/vault/VaultCore.sol 98.73% <ø> (ø)
contracts/contracts/vault/VaultStorage.sol 100.00% <ø> (ø)
contracts/contracts/vault/VaultAdmin.sol 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sparrowDom sparrowDom merged commit b0c07fe into nicka/collateral-swaps Jun 23, 2023
@sparrowDom sparrowDom deleted the nicka/collateral-swaps-strategy branch June 23, 2023 10:22
@DanielVF
Copy link
Contributor

Depreciating this variable was done on December 3, 2020. The deploy script file for the relaunch of OUSD was made on Dec 20th, 2020, so it seems likely from the commit history that this depreciated variable has never been live on the current vault. The actual deploy was something like the last day of the year 2020.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contracts Works related to contracts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants