diff --git a/README.md b/README.md index aa17e33..f032b63 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,12 @@ Now that all the deployment directories are setup, we are ready to run the simul ### Step 1: Simulated Token Genesis Event +Remove any existing data from previous runs: + +```bash +rm -rf /generated +``` + Following command generates the simulated participants with respective point lockup events. It also creates a base genesis file with treasury initialized with the participants data: ```bash @@ -258,7 +264,7 @@ This will generate following files in `/generated`: └── watcher-events.json # Simulated lockdrop contract events ``` -And a base genesis file at `/base-genesis-file/genesis.json` +And a base genesis file at `/base-genesis-file/genesis.json`. Note the path to `/generated` directory as it will be required in [Step 4](#step-4-run-lockdrop-distribution-notebook). diff --git a/test-runs/README.md b/test-runs/README.md index 248a6ad..59c3405 100644 --- a/test-runs/README.md +++ b/test-runs/README.md @@ -219,7 +219,7 @@ Since we've placed existing generated data in zenith-stack, following command sk zenith-ansible -i ./inventories/development/hosts.yml tge-site.yml -e "mode=simulate-lockdrop" ``` -This will generate a base genesis file at `/base-genesis-file/genesis.json` +This will generate a base genesis file at `/base-genesis-file/genesis.json`. Note the path to `/generated` directory as it will be required in [Step 4](#step-4-run-lockdrop-distribution-notebook). @@ -366,12 +366,12 @@ Now we can run the comprehensive test suite to validate that the zenithd node's After running the tests, compare your output from the tests above to output from the chosen test run (eg. `test-runs/run1/output.log`): -- `test_allocations`: The allocations comparisons (`Star Allocations Comparison`, `Galaxy Allocations Comparison` and `Total Allocations Comparison`) should match exactly as the TGE process is time-invariant -- `test_unlock_schedule`: +- Allocations: The allocations comparisons (`STAR ALLOCATIONS COMPARISON`, `GALAXY ALLOCATIONS COMPARISON` and `TOTAL ALLOCATIONS COMPARISON`) should match exactly as the TGE process is time-invariant +- Token unlock schedules: - Since the chain from your run starts at a later time than that from the original test run, the effective calculated unlock schedule for points will be different - - In `Unlock Blocks Comparison`, the `Expected Blocks` (your run) should be `<` `Expected Blocks` (test run) - - In `Initial Unlock Amounts Comparison`, the `Expected ($sZ)` (your run) should be `>` `Expected ($sZ)` (test run) -- `test_accrual_state`: Since this checks accrual state at time of running the test, `Expected ($sZ)` will be different across runs + - In `UNLOCK BLOCKS COMPARISON`, the `Expected Blocks` (your run) should be `<` `Expected Blocks` (test run) + - In `INITIAL UNLOCK AMOUNTS COMPARISON`, the `Expected ($sZ)` (your run) should be `>` `Expected ($sZ)` (test run) +- Accrual states: Since this checks accrual state at time of running the test, in `TOTAL UNLOCKED AT BLOCK X`, the `Expected ($sZ)` will be different across runs If all the tests pass and above conditions hold, it confirms that the simulation produces consistent results. diff --git a/test-runs/run1/output.log b/test-runs/run1/output.log index 88ecbd6..521b4e1 100644 --- a/test-runs/run1/output.log +++ b/test-runs/run1/output.log @@ -3,7 +3,7 @@ LOCKDROP ALLOCATION COMPARISON TESTS ================================================================================ test_0_star_allocations (test_allocations.AllocationTest.test_0_star_allocations) Test star allocations for all lock periods ... -Star Allocations Comparison: +STAR ALLOCATIONS COMPARISON +---------------+---------+-----------------------------------------------+--------------------+--------------------+--------------+ | Lock Period | Point | Zenith Address | Notebook ($sZ) | zenithd ($sZ) | Difference | +===============+=========+===============================================+====================+====================+==============+ @@ -17,10 +17,12 @@ Star Allocations Comparison: +---------------+---------+-----------------------------------------------+--------------------+--------------------+--------------+ | 5 years | ~tortyp | zenith1udqej93xhavjrpaxeazkgtz4m2x4tr7l07ptcj | 12,780,607,328,988 | 12,780,607,328,988 | 0 | +---------------+---------+-----------------------------------------------+--------------------+--------------------+--------------+ + + ok test_1_galaxy_allocations (test_allocations.AllocationTest.test_1_galaxy_allocations) Test galaxy allocations for all lock periods ... -Galaxy Allocations Comparison: +GALAXY ALLOCATIONS COMPARISON +---------------+---------+-----------------------------------------------+-------------------+-------------------+--------------+ | Lock Period | Point | Zenith Address | Notebook ($sZ) | zenithd ($sZ) | Difference | +===============+=========+===============================================+===================+===================+==============+ @@ -34,10 +36,12 @@ Galaxy Allocations Comparison: +---------------+---------+-----------------------------------------------+-------------------+-------------------+--------------+ | 5 years | ~byl | zenith1udqej93xhavjrpaxeazkgtz4m2x4tr7l07ptcj | 8,205,775,018,378 | 8,205,775,018,378 | 0 | +---------------+---------+-----------------------------------------------+-------------------+-------------------+--------------+ + + ok test_2_total_allocations (test_allocations.AllocationTest.test_2_total_allocations) Test total allocations for all participants ... -Total Allocations Comparison: +TOTAL ALLOCATIONS COMPARISON +------------+--------------------------+ | Source | Total Allocation ($sZ) | +============+==========================+ @@ -47,10 +51,12 @@ Total Allocations Comparison: +------------+--------------------------+ | Difference | 0 | +------------+--------------------------+ + + ok test_unlock_schedule_calculation (test_unlock_schedule.UnlockScheduleTest.test_unlock_schedule_calculation) Test unlock schedule calculations for all lock periods ... -Unlock Blocks Comparison: +UNLOCK BLOCKS COMPARISON +---------+---------------+---------------------+-------------------+------------------+--------------+ | Point | Lock Period | Start Time | Expected Blocks | zenithd Blocks | Difference | +=========+===============+=====================+===================+==================+==============+ @@ -75,7 +81,7 @@ Unlock Blocks Comparison: | ~byl | 5 years | 2025-07-07T14:43:58 | 77,287,464 | 77,287,464 | 0 | +---------+---------------+---------------------+-------------------+------------------+--------------+ -Initial Unlock Amounts Comparison: +INITIAL UNLOCK AMOUNTS COMPARISON +---------+---------------+---------------------+------------------+-----------------+--------------+ | Point | Lock Period | Start Time | Expected ($sZ) | zenithd ($sZ) | Difference | +=========+===============+=====================+==================+=================+==============+ @@ -99,10 +105,12 @@ Initial Unlock Amounts Comparison: +---------+---------------+---------------------+------------------+-----------------+--------------+ | ~byl | 5 years | 2025-07-07T14:43:58 | 167,096,014,588 | 167,096,014,588 | 0 | +---------+---------------+---------------------+------------------+-----------------+--------------+ + + ok test_accrual_state_calculation (test_accrual_state.AccrualStateTest.test_accrual_state_calculation) Test accrual state calculations after some blocks ... -Total Unlocked at Block 612: +TOTAL UNLOCKED AT BLOCK 612 +---------+---------------+----------------+--------------------+------------------+-----------------+--------------+ | Point | Lock Period | Block Height | Last Unlocked At | Expected ($sZ) | zenithd ($sZ) | Difference | +=========+===============+================+====================+==================+=================+==============+ @@ -126,6 +134,8 @@ Total Unlocked at Block 612: +---------+---------------+----------------+--------------------+------------------+-----------------+--------------+ | ~byl | 5 years | Block 612 | Block 600 | 167,158,420,664 | 167,158,420,664 | 0 | +---------+---------------+----------------+--------------------+------------------+-----------------+--------------+ + + ok ---------------------------------------------------------------------- diff --git a/tests/test_accrual_state.py b/tests/test_accrual_state.py index aa0b194..620a227 100644 --- a/tests/test_accrual_state.py +++ b/tests/test_accrual_state.py @@ -6,6 +6,10 @@ from base_test import BaseAllocationTest class AccrualStateTest(BaseAllocationTest): """Test accrual state calculations""" + def tearDown(self): + # Blank line after each test + print("\n") + def test_accrual_state_calculation(self): """Test accrual state calculations after some blocks""" # Get latest block height for testing @@ -88,7 +92,7 @@ class AccrualStateTest(BaseAllocationTest): f"Diff={difference:+,} $sZ") # Print table - print(f"\nTotal Unlocked at Block {test_block_height}:") + print(f"\nTOTAL UNLOCKED AT BLOCK {test_block_height}") headers = ["Point", "Lock Period", "Block Height", "Last Unlocked At", "Expected ($sZ)", "zenithd ($sZ)", "Difference"] print(tabulate(accrual_data, headers=headers, tablefmt="grid")) diff --git a/tests/test_allocations.py b/tests/test_allocations.py index 4faa6b3..ee82752 100644 --- a/tests/test_allocations.py +++ b/tests/test_allocations.py @@ -6,6 +6,10 @@ from base_test import BaseAllocationTest class AllocationTest(BaseAllocationTest): """Test allocation comparisons between notebook and zenithd""" + def tearDown(self): + # Blank line after each test + print("\n") + def test_0_star_allocations(self): """Test star allocations for all lock periods""" @@ -50,7 +54,7 @@ class AllocationTest(BaseAllocationTest): f"zenithd={api_allocation:,} $sZ, " f"Diff={difference:+,} $sZ") - print("\nStar Allocations Comparison:") + print("\nSTAR ALLOCATIONS COMPARISON") print(tabulate(table_data, headers=headers, tablefmt="grid")) def test_1_galaxy_allocations(self): @@ -97,7 +101,7 @@ class AllocationTest(BaseAllocationTest): f"zenithd={api_allocation:,} $sZ, " f"Diff={difference:+,} $sZ") - print("\nGalaxy Allocations Comparison:") + print("\nGALAXY ALLOCATIONS COMPARISON") print(tabulate(table_data, headers=headers, tablefmt="grid")) def test_2_total_allocations(self): @@ -126,7 +130,7 @@ class AllocationTest(BaseAllocationTest): ] headers = ["Source", "Total Allocation ($sZ)"] - print("\nTotal Allocations Comparison:") + print("\nTOTAL ALLOCATIONS COMPARISON") print(tabulate(table_data, headers=headers, tablefmt="grid")) self.assertEqual(notebook_total, api_total, diff --git a/tests/test_unlock_schedule.py b/tests/test_unlock_schedule.py index b636beb..297d324 100644 --- a/tests/test_unlock_schedule.py +++ b/tests/test_unlock_schedule.py @@ -7,6 +7,10 @@ from base_test import BaseAllocationTest, SECONDS_PER_YEAR, BLOCK_DURATION_SECON class UnlockScheduleTest(BaseAllocationTest): """Test unlock schedule calculations""" + def tearDown(self): + # Blank line after each test + print("\n") + def test_unlock_schedule_calculation(self): """Test unlock schedule calculations for all lock periods""" @@ -97,11 +101,11 @@ class UnlockScheduleTest(BaseAllocationTest): f"Diff={unlock_diff:+,} $sZ") # Print tables - print("\nUnlock Blocks Comparison:") + print("\nUNLOCK BLOCKS COMPARISON") unlock_blocks_headers = ["Point", "Lock Period", "Start Time", "Expected Blocks", "zenithd Blocks", "Difference"] print(tabulate(unlock_blocks_data, headers=unlock_blocks_headers, tablefmt="grid")) - print("\nInitial Unlock Amounts Comparison:") + print("\nINITIAL UNLOCK AMOUNTS COMPARISON") initial_unlock_headers = ["Point", "Lock Period", "Start Time", "Expected ($sZ)", "zenithd ($sZ)", "Difference"] print(tabulate(initial_unlock_data, headers=initial_unlock_headers, tablefmt="grid"))