From 24ef1cc1badab262cceca3c064f05eb44ed163d1 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 4 Aug 2025 15:38:07 +0530 Subject: [PATCH 1/6] Make generated directory path configurable --- README.md | 12 +++-- lockdrop-calculations-simulated.ipynb | 65 +++------------------------ tests/base_test.py | 5 ++- 3 files changed, 17 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 6878f1d..ee8a01e 100644 --- a/README.md +++ b/README.md @@ -99,10 +99,10 @@ Following command allows users to create the base genesis file while simulating This will generate base genesis file at `/base-genesis-file/genesis.json` -This will also generate following files in `/lockdrop-simulation/generated`: +This will also generate following files in `/generated`: ```bash -lockdrop-simulation/generated/ +/generated/ ├── generated-participants.json # Mock participant data with attestations ├── generated-accounts.json # Ethereum and Zenith account pairs ├── point-allocation-stats.json # Statistics about galaxy/star allocation @@ -119,7 +119,7 @@ Get the private key of first account present in this file: ```bash # Working directory: /ansible -jq -r '.[0].zenithPrivateKey' ../lockdrop-simulation/generated/generated-accounts.json +jq -r '.[0].zenithPrivateKey' ../generated/generated-accounts.json ``` Note this private key down as it will be required in next step. @@ -218,6 +218,12 @@ Run comprehensive tests to validate that the zenithd node's TGE allocations and export RPC_API_ENDPOINT="http://localhost:26657" ``` + Add path to the `generated` directory that was generated in `zenith-stack` repo in above steps: + + ```bash + export GENERATED_DIR="/generated" + ``` + 2. **Run All Tests** Navigate to the lockdrop-simulation directory (if not already there): diff --git a/lockdrop-calculations-simulated.ipynb b/lockdrop-calculations-simulated.ipynb index 15f85d8..27f723a 100644 --- a/lockdrop-calculations-simulated.ipynb +++ b/lockdrop-calculations-simulated.ipynb @@ -424,70 +424,15 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "26573d6b", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "================================================================================\n", - "📁 WATCHER EVENTS DATA SUMMARY\n", - "================================================================================\n", - "✅ Successfully loaded 40200 PointLockedEvent records from watcher file\n", - "\n", - "🔢 LOCK DURATION DISTRIBUTION\n", - "Lock Period Stars Galaxies Total\n", - " 1 Year 8075 39 8114\n", - " 2 Years 8056 43 8099\n", - " 3 Years 7870 36 7906\n", - " 4 Years 8112 33 8145\n", - " 5 Years 7887 49 7936\n", - " Total 40000 200 40200\n", - "\n", - "📊 PARTICIPATION RATES\n", - " Stars: 61.2% (40,000/65,280)\n", - " Galaxies: 78.1% (200/256)\n", - "\n", - "================================================================================\n", - "================================================================================\n", - "📈 DYNAMIC LOCKDROP ANALYSIS\n", - "================================================================================\n", - "\n", - "🎯 PARTICIPATION SUMMARY\n", - " Point Type Count Participation Rate\n", - " Stars (Total) 40,000 61.2%\n", - " Stars (1Y) 8,075 12.3%\n", - " Stars (2Y) 8,056 12.3%\n", - " Stars (3Y) 7,870 12.0%\n", - " Stars (4Y) 8,112 12.4%\n", - " Stars (5Y) 7,887 12.0%\n", - "Galaxies (Total) 200 78.1%\n", - " Galaxies (5Y) 49 19.1%\n", - "\n", - "💰 RAW PARTICIPANT ALLOCATIONS\n", - "Point Type Total Allocation ($Z) Max Per Point (Raw) Adjusted Max Per Point\n", - " Stars 1,283,457,024.0 32,086.425600 32,030.964000\n", - " Galaxies 5,033,164.8 25,165.824000 25,088.292000\n", - "\n", - "⚙️ QUANTA CALCULATION\n", - "Point Type Raw Z per Block Adjusted Z per Block (q)\n", - " Stars 0.000406702988820 0.000406\n", - " Galaxies 0.000318982736329 0.000318\n", - "\n", - "🔄 ROUNDING ERROR ANALYSIS\n", - "Point Type Rounding Error per Point Total Rounding Error % of Supply Destination\n", - " Stars 55.461600000 $Z 2,218,464.000000 $Z 0.05165264% Bonus Pool\n", - " Galaxies 77.532000000 $Z 15,506.400000 $Z 0.00036103% Bonus Pool\n", - "\n", - "================================================================================\n" - ] - } - ], + "outputs": [], "source": [ "# Load events from watcher file\n", - "watcher_events_path = './generated/watcher-events.json'\n", + "import os\n", + "\n", + "watcher_events_path = os.path.join(os.getenv('GENERATED_DIR', './generated'), 'watcher-events.json')\n", "events = load_watcher_events(watcher_events_path)\n", "lock_stats = analyze_lockdrop_events(events)\n", "\n", diff --git a/tests/base_test.py b/tests/base_test.py index 8564dab..15c239a 100644 --- a/tests/base_test.py +++ b/tests/base_test.py @@ -18,6 +18,7 @@ class BaseAllocationTest(unittest.TestCase): """Load data once for all tests""" cls.rest_api_endpoint = os.getenv('REST_API_ENDPOINT') cls.rpc_api_endpoint = os.getenv('RPC_API_ENDPOINT') + cls.generated_dir = os.getenv('GENERATED_DIR', './generated') if not cls.rest_api_endpoint: raise unittest.SkipTest("REST_API_ENDPOINT environment variable not set") @@ -25,9 +26,9 @@ class BaseAllocationTest(unittest.TestCase): raise unittest.SkipTest("RPC_API_ENDPOINT environment variable not set") # Load data files - with open('./generated/watcher-events.json', 'r') as f: + with open(f'{cls.generated_dir}/watcher-events.json', 'r') as f: cls.watcher_events = json.load(f) - with open('./generated/generated-participants.json', 'r') as f: + with open(f'{cls.generated_dir}/generated-participants.json', 'r') as f: cls.participants = json.load(f) with open('lockdrop_allocations_notebook.json', 'r') as f: cls.notebook_allocations = json.load(f) -- 2.54.0 From 680f5e45a1a825967b6128f64f3f17cc66d970ca Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 4 Aug 2025 16:00:21 +0530 Subject: [PATCH 2/6] Update readme --- README.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ee8a01e..04db938 100644 --- a/README.md +++ b/README.md @@ -30,30 +30,34 @@ The lockdrop simulation validates the Zenith Network's token distribution mechan **Note**: Replace `` in the commands below with the actual path where you cloned the zenith-stack repository. - Go to the directory where playbooks are located: + Run following commands with necessary permissions, as root or through sudo - ```bash - cd /ansible - ``` - - Install `zenith-ansible`: + Install `zenith-ansible` at `/usr/local/bin`: ```bash # Download the binary from generic package registry - curl -OJ https://git.vdb.to/api/packages/LaconicNetwork/generic/zenith-stack/v0.2.4/zenith-ansible + curl -L https://git.vdb.to/api/packages/LaconicNetwork/generic/zenith-stack/v0.2.4/zenith-ansible -o /usr/local/bin/zenith-ansible ``` + **NOTE**: Make sure `/usr/local/bin` is in your `$PATH` + Make it executable: ```bash - chmod +x ./zenith-ansible + chmod +x /usr/local/bin/zenith-ansible ``` - For more details about `zenith-ansible` check this [doc](./ansible/zenith-ansible-shiv/README.md) + Verify installation: + + ```bash + which zenith-ansible + ``` + + For more details about `zenith-ansible` check this [doc](https://git.vdb.to/LaconicNetwork/zenith-stack/src/tag/v0.2.4/ansible/zenith-ansible-shiv/README.md) 2. **Configure Variables** - Configure variables required for this simulation by following [this guide](../ansible/zenith-config-cli/docs/stage1-lockdrop-simulation.md). + Configure variables required for this simulation by following [this guide](https://git.vdb.to/LaconicNetwork/zenith-stack/src/tag/v0.2.4/ansible/zenith-config-cli/docs/stage1-lockdrop-simulation.md). The configuration tool allows flexible simulation parameters: - **Participant count**: Configure the total number of mock participants @@ -78,13 +82,13 @@ The lockdrop simulation validates the Zenith Network's token distribution mechan Setup the deployment directories and pull required docker images to generate base genesis file along with other artifacts: ```bash - ./zenith-ansible -i ./inventories/development/hosts.yml tge-site.yml -e "mode=setup" + zenith-ansible -i ./inventories/development/hosts.yml tge-site.yml -e "mode=setup" ``` Setup the deployment directories and pull required docker images to sign the gentx and setup stage 1 validator node: ```bash - ./zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=setup" --skip-tags onboarding + zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=setup" --skip-tags onboarding ``` ## Run Simulation @@ -94,7 +98,7 @@ The lockdrop simulation validates the Zenith Network's token distribution mechan Following command allows users to create the base genesis file while simulating lockdrop participants: ```bash -./zenith-ansible -i ./inventories/development/hosts.yml tge-site.yml -e "mode=simulate-lockdrop" +zenith-ansible -i ./inventories/development/hosts.yml tge-site.yml -e "mode=simulate-lockdrop" ``` This will generate base genesis file at `/base-genesis-file/genesis.json` @@ -127,7 +131,7 @@ Note this private key down as it will be required in next step. Now run the playbook to sign the gentx and generate final genesis file: ```bash -./zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=sign" +zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=sign" ``` Use the private key noted above when prompted. @@ -144,7 +148,7 @@ This will: Now, we can use this genesis file to run the stage 1 validator node: ```bash -./zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=start" --skip-tags onboarding +zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=start" --skip-tags onboarding ``` After starting the node, verify it's running correctly: @@ -284,13 +288,13 @@ cd /ansible Stop validator deployment: ```bash -./zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=stop" --skip-tags onboarding +zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=stop" --skip-tags onboarding ``` Clean up validator deployment: ```bash -./zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=cleanup" --skip-tags onboarding -K +zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=cleanup" --skip-tags onboarding -K ``` ### Python Virtual Environment Cleanup -- 2.54.0 From 8a7284f71c8a6f9c45a471c74e5d0c03e21b83ed Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 4 Aug 2025 16:19:42 +0530 Subject: [PATCH 3/6] Keep output --- lockdrop-calculations-simulated.ipynb | 61 ++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/lockdrop-calculations-simulated.ipynb b/lockdrop-calculations-simulated.ipynb index 27f723a..61cc331 100644 --- a/lockdrop-calculations-simulated.ipynb +++ b/lockdrop-calculations-simulated.ipynb @@ -424,10 +424,67 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "26573d6b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "================================================================================\n", + "📁 WATCHER EVENTS DATA SUMMARY\n", + "================================================================================\n", + "✅ Successfully loaded 40200 PointLockedEvent records from watcher file\n", + "\n", + "🔢 LOCK DURATION DISTRIBUTION\n", + "Lock Period Stars Galaxies Total\n", + " 1 Year 8075 39 8114\n", + " 2 Years 8056 43 8099\n", + " 3 Years 7870 36 7906\n", + " 4 Years 8112 33 8145\n", + " 5 Years 7887 49 7936\n", + " Total 40000 200 40200\n", + "\n", + "📊 PARTICIPATION RATES\n", + " Stars: 61.2% (40,000/65,280)\n", + " Galaxies: 78.1% (200/256)\n", + "\n", + "================================================================================\n", + "================================================================================\n", + "📈 DYNAMIC LOCKDROP ANALYSIS\n", + "================================================================================\n", + "\n", + "🎯 PARTICIPATION SUMMARY\n", + " Point Type Count Participation Rate\n", + " Stars (Total) 40,000 61.2%\n", + " Stars (1Y) 8,075 12.3%\n", + " Stars (2Y) 8,056 12.3%\n", + " Stars (3Y) 7,870 12.0%\n", + " Stars (4Y) 8,112 12.4%\n", + " Stars (5Y) 7,887 12.0%\n", + "Galaxies (Total) 200 78.1%\n", + " Galaxies (5Y) 49 19.1%\n", + "\n", + "💰 RAW PARTICIPANT ALLOCATIONS\n", + "Point Type Total Allocation ($Z) Max Per Point (Raw) Adjusted Max Per Point\n", + " Stars 1,283,457,024.0 32,086.425600 32,030.964000\n", + " Galaxies 5,033,164.8 25,165.824000 25,088.292000\n", + "\n", + "⚙️ QUANTA CALCULATION\n", + "Point Type Raw Z per Block Adjusted Z per Block (q)\n", + " Stars 0.000406702988820 0.000406\n", + " Galaxies 0.000318982736329 0.000318\n", + "\n", + "🔄 ROUNDING ERROR ANALYSIS\n", + "Point Type Rounding Error per Point Total Rounding Error % of Supply Destination\n", + " Stars 55.461600000 $Z 2,218,464.000000 $Z 0.05165264% Bonus Pool\n", + " Galaxies 77.532000000 $Z 15,506.400000 $Z 0.00036103% Bonus Pool\n", + "\n", + "================================================================================\n" + ] + } + ], "source": [ "# Load events from watcher file\n", "import os\n", -- 2.54.0 From cf20d5772125a3690060ba6ce3dd870812f77f02 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 4 Aug 2025 17:18:15 +0530 Subject: [PATCH 4/6] Add gitignore file --- .gitignore | 4 ++++ README.md | 25 +++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d91ed86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +venv +__pycache__ +generated +.ipynb_checkpoints diff --git a/README.md b/README.md index 04db938..5df79d6 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ The lockdrop simulation validates the Zenith Network's token distribution mechan ```bash # For example: - mkdir /home/$USER/stage1-lockdrop-simulation + mkdir -p /home/$USER/stage1-lockdrop-simulation ``` Make sure you are in ansible directory: @@ -167,12 +167,17 @@ Execute the Jupyter notebook to perform lockdrop allocation calculations and gen 1. **Create Virtual Environment and Install Dependencies** - Navigate to the lockdrop-simulation directory: + Clone lockdrop simulation directory: ```bash - cd /lockdrop-simulation + git clone git@git.vdb.to:LaconicNetwork/lockdrop-simulation.git + + # Navigate to lockdrop-simulation directory + cd lockdrop-simulation ``` + Checkout to the latest [release](https://git.vdb.to/LaconicNetwork/lockdrop-simulation/releases) + Create and activate a Python virtual environment: ```bash @@ -186,6 +191,12 @@ Execute the Jupyter notebook to perform lockdrop allocation calculations and gen pip install -r requirements.txt ``` + Configure path to the `generated` directory that was generated in `zenith-stack` repo in above steps: + + ```bash + export GENERATED_DIR="/generated" + ``` + 2. **Execute the Notebook** Run the notebook to generate allocation calculations: @@ -201,7 +212,7 @@ Execute the Jupyter notebook to perform lockdrop allocation calculations and gen 3. **View Notebook Results (Optional)** - To view the analysis on generated data, open the notebook in your browser: + To view the analysis on generated data, open the notebook in your browser at : ```bash jupyter notebook lockdrop-calculations-simulated.ipynb @@ -222,12 +233,6 @@ Run comprehensive tests to validate that the zenithd node's TGE allocations and export RPC_API_ENDPOINT="http://localhost:26657" ``` - Add path to the `generated` directory that was generated in `zenith-stack` repo in above steps: - - ```bash - export GENERATED_DIR="/generated" - ``` - 2. **Run All Tests** Navigate to the lockdrop-simulation directory (if not already there): -- 2.54.0 From 1675d72b87f549f00c98586173e57f0457032f74 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 4 Aug 2025 18:43:06 +0530 Subject: [PATCH 5/6] Update versions --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5df79d6..02ababa 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The lockdrop simulation validates the Zenith Network's token distribution mechan ```bash # Download the binary from generic package registry - curl -L https://git.vdb.to/api/packages/LaconicNetwork/generic/zenith-stack/v0.2.4/zenith-ansible -o /usr/local/bin/zenith-ansible + curl -L https://git.vdb.to/api/packages/LaconicNetwork/generic/zenith-stack/v0.2.5/zenith-ansible -o /usr/local/bin/zenith-ansible ``` **NOTE**: Make sure `/usr/local/bin` is in your `$PATH` @@ -53,11 +53,11 @@ The lockdrop simulation validates the Zenith Network's token distribution mechan which zenith-ansible ``` - For more details about `zenith-ansible` check this [doc](https://git.vdb.to/LaconicNetwork/zenith-stack/src/tag/v0.2.4/ansible/zenith-ansible-shiv/README.md) + For more details about `zenith-ansible` check this [doc](https://git.vdb.to/LaconicNetwork/zenith-stack/src/tag/v0.2.5/ansible/zenith-ansible-shiv/README.md) 2. **Configure Variables** - Configure variables required for this simulation by following [this guide](https://git.vdb.to/LaconicNetwork/zenith-stack/src/tag/v0.2.4/ansible/zenith-config-cli/docs/stage1-lockdrop-simulation.md). + Configure variables required for this simulation by following [this guide](https://git.vdb.to/LaconicNetwork/zenith-stack/src/tag/v0.2.5/ansible/zenith-config-cli/docs/stage1-lockdrop-simulation.md). The configuration tool allows flexible simulation parameters: - **Participant count**: Configure the total number of mock participants -- 2.54.0 From 8548087a8fe8e36bc8fe898a474e71605093c2e6 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Mon, 4 Aug 2025 18:45:21 +0530 Subject: [PATCH 6/6] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 02ababa..4e488bd 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ Run comprehensive tests to validate that the zenithd node's TGE allocations and Navigate to the lockdrop-simulation directory (if not already there): ```bash - cd /lockdrop-simulation + cd ``` Activate `venv`: @@ -307,7 +307,7 @@ zenith-ansible -i ./inventories/development/hosts.yml stage1-site.yml -e "mode=c Go to `lockdrop-simulation` directory: ```bash -cd /lockdrop-simulation +cd ``` Clean up Python virtual environment: -- 2.54.0