Skip to content

Conversation

Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Oct 8, 2025

WHAT

@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 16:37
@Ansonhkg Ansonhkg requested review from hwrdtm and removed request for Copilot October 8, 2025 16:38
@Copilot Copilot AI review requested due to automatic review settings October 8, 2025 16:39
Copy link
Contributor

@Copilot Copilot AI left a 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.

Comment on lines 16 to +20
const REJECT_BALANCE_THRESHOLD = 0;
const LEDGER_MINIMUM_BALANCE = 10000;
const MASTER_LEDGER_MINIMUM_BALANCE = 3_000;
const PKP_LEDGER_MINIMUM_BALANCE = 3_000;

Copy link

Copilot AI Oct 8, 2025

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);
Copy link

Copilot AI Oct 8, 2025

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);
Copy link

Copilot AI Oct 8, 2025

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.

Ansonhkg and others added 3 commits October 8, 2025 20:11
…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]>
@Ansonhkg Ansonhkg marked this pull request as draft October 14, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant