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

Add _clone() of ReserveConfig for _findReserveConfigBySymbol() and _findReserveConfig() #27

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

eboadom
Copy link
Contributor

@eboadom eboadom commented Jan 18, 2023

On tests, this is a common pattern

ReserveConfig[] memory allConfigsBefore = _getReservesConfigs(
      AaveV3Polygon.POOL
    );

    ReserveConfig memory configJEURBefore = _findReserveConfigBySymbol(
      allConfigsBefore,
      'jEUR'
    );
    
    configJEURBefore.isFrozen = true;
    
    _noReservesConfigsChangesApartFrom(
      allConfigsBefore,
      allConfigsAfter,
      configJEURBefore.underlying
    );

But _noReservesConfigsChangesApartFrom was potentially a false positive because the call _findReserveConfigBySymbol will create a pointer to an element of allConfigsBefore.

So for example, this test will pass, even if it should not

ReserveConfig[] memory allConfigsBefore = _getReservesConfigs(
      AaveV3Polygon.POOL
    );

    ReserveConfig memory configAGEURBefore = _findReserveConfigBySymbol(
      allConfigsBefore,
      'agEUR'
    );

    AaveV3PolFreezeAGEUR agEURPayload = new AaveV3PolFreezeAGEUR();

    _execute(address(agEURPayload));

    ReserveConfig[] memory allConfigsAfter = _getReservesConfigs(
      AaveV3Polygon.POOL
    );

    configAGEURBefore.isFrozen = true;

    ReserveConfig memory configJEURBefore = _findReserveConfigBySymbol(
      allConfigsBefore,
      'jEUR'
    );

    _validateReserveConfig(configAGEURBefore, allConfigsAfter);

    _noReservesConfigsChangesApartFrom(
      allConfigsBefore,
      allConfigsAfter,
      configJEURBefore.underlying
    );

@github-actions
Copy link
Contributor

Foundry report

forge 0.2.0 (4dc05d2 2023-01-18T00:12:40.613647591Z)
Build log
installing solc version "0.8.17"
Successfully installed solc 0.8.17
Compiling 46 files with 0.8.17
Solc 0.8.17 finished in 7.86s
Compiler run successful (with warnings)
warning[2018]: Warning: Function state mutability can be restricted to view
 --> src/ProxyHelpers.sol:7:3:
  |
7 |   function getInitializableAdminUpgradeabilityProxyAdmin(Vm vm, address proxy)
  |   ^ (Relevant source part starts here and spans across multiple lines).



warning[2018]: Warning: Function state mutability can be restricted to view
  --> src/ProxyHelpers.sol:19:3:
   |
19 |   function getInitializableAdminUpgradeabilityProxyImplementation(Vm vm, address proxy)
   |   ^ (Relevant source part starts here and spans across multiple lines).



| Contract                 | Size (kB) | Margin (kB) |
|--------------------------|-----------|-------------|
| AaveGovernanceV2         | 0.236     | 24.34       |
| AaveV3Polygon            | 0.086     | 24.49       |
| AaveV3PolygonMockListing | 1.976     | 22.6        |
| Address                  | 0.086     | 24.49       |
| BridgeExecutorHelpers    | 0.086     | 24.49       |
| ConfiguratorInputTypes   | 0.086     | 24.49       |
| DataTypes                | 0.086     | 24.49       |
| GenericV3ListingEngine   | 10.088    | 14.488      |
| GovHelpers               | 0.236     | 24.34       |
| ProxyHelpers             | 0.086     | 24.49       |
| console                  | 0.086     | 24.49       |
| console2                 | 0.086     | 24.49       |
| stdError                 | 0.591     | 23.985      |
| stdJson                  | 0.086     | 24.49       |
| stdMath                  | 0.086     | 24.49       |
| stdStorage               | 0.086     | 24.49       |
| stdStorageSafe           | 0.086     | 24.49       |
Test error :finnadie:
No files changed, compilation skipped
2023-01-18T11:00:12.829036Z ERROR sharedbackend: Failed to send/recv `basic` err=GetAccount(0x0000000000000000000000000000000000000000, 
(code: -32000, message: missing trie node bdad16df1ad0cdce23b4e9d1e798baf5b88df554eeafe13a6bc05e64433b6631 (path ), data: None)) address=0x0000000000000000000000000000000000000000

@sakulstra sakulstra merged commit 043e0cc into master Jan 18, 2023
@kyzia551 kyzia551 deleted the fix/add-clone-on-find-config branch January 18, 2023 11:20
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.

2 participants