Make generated directory path configurable

This commit is contained in:
Shreerang Kale 2025-08-04 15:38:07 +05:30
parent 1130af7377
commit 24ef1cc1ba
3 changed files with 17 additions and 65 deletions

View File

@ -99,10 +99,10 @@ Following command allows users to create the base genesis file while simulating
This will generate base genesis file at `<path/to/zenith-stack>/base-genesis-file/genesis.json`
This will also generate following files in `<path/to/zenith-stack>/lockdrop-simulation/generated`:
This will also generate following files in `<path/to/zenith-stack>/generated`:
```bash
lockdrop-simulation/generated/
<path/to/zenith-stack>/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: <path/to/zenith-stack>/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="<path/to/zenith-stack>/generated"
```
2. **Run All Tests**
Navigate to the lockdrop-simulation directory (if not already there):

View File

@ -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",

View File

@ -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)