-
Notifications
You must be signed in to change notification settings - Fork 5
feat(validator-debt): e2e test script #256
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces an end-to-end test script for the validator debt lifecycle in the DoubleZero system. The script automates testing of the complete debt flow from initialization through collection on a local Solana fork.
Changes:
- Added a comprehensive bash script that orchestrates the full validator debt workflow: initialization, calculation, finalization, and debt collection
- Implemented environment variable controls for selective step execution and epoch override
- Included verification, logging utilities, and summary views for test observability
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sh/test_full_debt_flow.sh
Outdated
| set -eu | ||
|
|
||
| # Constants | ||
| MAINNET_BETA_DEBT_ACCOUNTANT_KEY=acLisxTpNkoctPZoqssyo58pcdnHzJyRFhod7Wxkz5a |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant name suggests this is a mainnet-beta key, but it's being used in a local test environment. Consider renaming to TEST_DEBT_ACCOUNTANT_KEY or LOCAL_DEBT_ACCOUNTANT_KEY to clarify this is for testing purposes and avoid confusion with production keys.
| MAINNET_BETA_DEBT_ACCOUNTANT_KEY=acLisxTpNkoctPZoqssyo58pcdnHzJyRFhod7Wxkz5a | |
| TEST_DEBT_ACCOUNTANT_KEY=acLisxTpNkoctPZoqssyo58pcdnHzJyRFhod7Wxkz5a |
sh/test_full_debt_flow.sh
Outdated
| sleep 2 | ||
| done | ||
|
|
||
| log_error "Solana fork did not start within 60 seconds." |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message states '60 seconds' but this conflicts with the actual timeout calculation: 60 iterations × 2 seconds sleep = 120 seconds. Update the message to '120 seconds' for accuracy.
| log_error "Solana fork did not start within 60 seconds." | |
| log_error "Solana fork did not start within 120 seconds." |
| echo "$ $VALIDATOR_DEBT_CLI calculate-validator-debt --epoch $DZ_EPOCH -ul --dz-ledger-url http://localhost:8899" | ||
|
|
||
| # Note: This requires the DZ Ledger to be running or a mock. | ||
| # In local testing, we might need to use --post-to-ledger-only or --dry-run |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions '--post-to-ledger-only' as a potential flag but this flag is never used in the actual command invocation. Either implement this flag in the fallback logic or remove it from the comment to avoid confusion.
| # In local testing, we might need to use --post-to-ledger-only or --dry-run | |
| # In local testing, we might need to use --dry-run |
sh/test_full_debt_flow.sh
Outdated
| # In god-mode, we need to wait for a minute between initializations | ||
| # so let's run the steps | ||
|
|
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is unclear and incomplete. It mentions waiting 'for a minute between initializations' and references 'god-mode', but neither concept is explained or implemented here. Either clarify what god-mode means and why a wait is needed, or remove the misleading comment.
| # In god-mode, we need to wait for a minute between initializations | |
| # so let's run the steps |
sh/test_full_debt_flow.sh
Outdated
| log_info "Waiting 5 seconds for transaction to confirm..." | ||
| sleep 5 |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded 5-second sleep is a magic number that may be insufficient for transaction confirmation in some environments. Consider extracting this to a configurable constant at the top of the file (e.g., TRANSACTION_CONFIRMATION_WAIT=5) and adding a comment explaining why this specific duration was chosen.
Summary of Changes
Testing Verification