Skip to content

Latest commit

 

History

History
154 lines (100 loc) · 4.71 KB

File metadata and controls

154 lines (100 loc) · 4.71 KB

Detailed Analysis of SkipStressTestStorage Unit Tests

Contract Overview

contract SkipStressTestStorage is DeployHelper, SigningUtils

This contract inherits from DeployHelper and SigningUtils, indicating it uses helper functions for deployment and signing operations.

Setup

function setUp() public {
    deployAllContractsStressTest(500000);
}

This function sets up the testing environment by deploying all necessary contracts with a parameter of 500000.

Test Cases

1. testAddSubSafe

function testAddSubSafe() public

Purpose: Verifies the basic functionality of adding a subSafe to an existing Safe.

Steps:

  1. Sets up a root organization and one Safe.
  2. Creates a new Safe.
  3. Adds the new Safe as a subSafe to the existing Safe.
  4. Verifies the hierarchical relationships using isTreeMember and isSuperSafe functions.

2. testAddSubSafeLinealSecuenceMaxLevel

function testAddSubSafeLinealSecuenceMaxLevel() public

Purpose: Stress tests the addition of subSafes in a linear sequence up to the maximum depth limit.

Steps:

  1. Sets up a root organization and one Safe.
  2. Creates arrays to store 8100 subSafe addresses and IDs.
  3. Updates the depth tree limit to 8102.
  4. Iteratively creates and adds subSafes, each being a child of the previous one.
  5. Verifies the hierarchical relationships for each new Safe.

3. testAddThreeSubSafeLinealSecuenceMaxLevel

function testAddThreeSubSafeLinealSecuenceMaxLevel() public

Purpose: Tests adding three subSafes at each level in a hierarchical structure.

Steps:

  1. Creates a new organization Safe.
  2. Calls createTreeStressTest to build a tree with 3 subSafes per level, up to 30000 Safes.
  3. Removes the entire tree structure.

4. testAddFourthSubSafeLinealSecuenceMaxLevel

function testAddFourthSubSafeLinealSecuenceMaxLevel() public

Purpose: Similar to the previous test, but with four subSafes at each level.

Steps:

  1. Creates a new organization Safe.
  2. Calls createTreeStressTest to build a tree with 4 subSafes per level, up to 22000 Safes.

5. testAddFifthSubSafeLinealSecuenceMaxLevel

function testAddFifthSubSafeLinealSecuenceMaxLevel() public

Purpose: Tests adding five subSafes at each level in the hierarchy.

Steps:

  1. Creates a new organization Safe.
  2. Calls createTreeStressTest to build a tree with 5 subSafes per level, up to 20000 Safes.

6. testSeveralsSmallOrgsSafeSecuenceMaxLevel

function testSeveralsSmallOrgsSafeSecuenceMaxLevel() public

Purpose: Tests creating multiple small organizations with different structures.

Steps:

  1. Creates three separate organization Safes.
  2. Builds three different tree structures:
    • One with 3 subSafes per level, up to 1100 Safes.
    • One with 4 subSafes per level, up to 1400 Safes.
    • One with 5 subSafes per level, up to 4000 Safes.

7. testSeveralsBigOrgsSafeSecuenceMaxLevel

function testSeveralsBigOrgsSafeSecuenceMaxLevel() public

Purpose: Tests creating multiple large organizations with different structures.

Steps:

  1. Creates three separate organization Safes.
  2. Builds three different large tree structures:
    • One with 3 subSafes per level, up to 30000 Safes.
    • One with 4 subSafes per level, up to 22000 Safes.
    • One with 5 subSafes per level, up to 20000 Safes.

8. testFullOrgSafeSecuenceMaxLevel

function testFullOrgSafeSecuenceMaxLevel() public

Purpose: Tests creating a full organization with multiple root Safes and different structures.

Steps:

  1. Creates one organization Safe and two root Safes.
  2. Builds three different tree structures within the same organization:
    • One with 3 subSafes per level, up to 30000 Safes.
    • One with 4 subSafes per level, up to 22000 Safes.
    • One with 5 subSafes per level, up to 20000 Safes.

Helper Functions

createTreeStressTest

This function is used by several test cases to create complex tree structures of Safes. It takes parameters for organization name, root Safe name, organization Safe address, root Safe address, number of members per Safe, and total number of Safe wallets to create.

pod and subOldlevels

These are utility functions used in calculations for the tree structure creation.

Conclusion

These stress tests thoroughly examine the Palmera Module's ability to handle complex hierarchical structures of Safes. They test the system's limits in terms of depth and breadth of the Safe hierarchy, as well as its performance under various organizational structures. The tests ensure that the module can correctly manage and verify relationships between Safes in large, complex organizations.