-
Notifications
You must be signed in to change notification settings - Fork 87
Anson/naga artillery fix init and product 3 #926
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: hwrdtm/naga-artillery
Are you sure you want to change the base?
Anson/naga artillery fix init and product 3 #926
Conversation
…ledger balance test command: ``` NETWORK=naga-staging bun run artillery:init --auto-topu ```
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 enhances the artillery init script to ensure adequate funding for both the master account and PKP (Programmable Key Pair) ledgers. The primary focus is fixing the initialization process by adding PKP ledger funding capabilities.
- Refactored ledger balance checking and funding logic into a reusable function
- Added PKP ledger balance validation and automatic top-up functionality
- Updated balance thresholds and improved logging for better visibility
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
const REJECT_BALANCE_THRESHOLD = 0; | ||
const LEDGER_MINIMUM_BALANCE = 10000; | ||
const MASTER_LEDGER_MINIMUM_BALANCE = 3_000; | ||
const PKP_LEDGER_MINIMUM_BALANCE = 3_000; | ||
|
Copilot
AI
Oct 8, 2025
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 balance values should be configurable through environment variables or a configuration file to support different deployment environments (development, staging, production) without code changes.
Copilot uses AI. Check for mistakes.
}) => { | ||
const { availableBalance } = await balanceFetcher(); | ||
|
||
const currentAvailable = Number(availableBalance); |
Copilot
AI
Oct 8, 2025
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.
Using Number()
on a potentially large ETH balance string could result in precision loss. Consider using a decimal library like BigNumber
or decimal.js
for accurate financial calculations.
Copilot uses AI. Check for mistakes.
`✅ ${label} ledger balance after top-up: ${postTopUpBalance} ETH` | ||
); | ||
|
||
return Number(postTopUpBalance); |
Copilot
AI
Oct 8, 2025
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.
Similar to the previous comment, converting postTopUpBalance
to Number
could cause precision loss for large ETH amounts. Use a decimal library for accurate financial calculations.
Copilot uses AI. Check for mistakes.
…re sorting - request `SIGN_SESSION_KEY` prices when fetching node data so the contract returns all four product columns - extend pricing context schema to accept `SIGN_SESSION_KEY` and re-sort nodes per product before slicing to threshold - route PKP auth through `SIGN_SESSION_KEY` pricing while keeping custom auth on `LIT_ACTION` - cover the new sort logic with a unit test to prove we now pick the cheapest validators for the requested product
Co-authored-by: Copilot <[email protected]> Signed-off-by: Anson <[email protected]>
WHAT
sign-session-key
pricing support and product-awa… #925, which were made in the pnpm environment, while the load test is being run in Bun.