-
Notifications
You must be signed in to change notification settings - Fork 89
Chore: Payment benchmarking tests #1032
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: naga
Are you sure you want to change the base?
Conversation
| nativeFundingAmount: '0.8', | ||
| ledgerDepositAmount: '12', |
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.
Bumped because of failing ci E2E tests running out of funds, could be reverted after @glitch003 reduces fees on naga-test
| const LIVE_NETWORK_FUNDING_AMOUNT = '0.2'; | ||
| const LOCAL_NETWORK_FUNDING_AMOUNT = '1'; | ||
| const LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT = '1'; | ||
| const LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT = '1.2'; |
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.
Bumped because of failing ci E2E tests running out of funds, could be reverted after @glitch003 reduces fees on naga-test
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 migrates payment benchmarking tests from the pkp-parallel-keygen repository to the JS SDK. The tests execute various Lit Actions with different operations (encryption/decryption, fetch requests, data processing, signing) to benchmark execution costs and provide pricing examples.
Key changes:
- New payment benchmark test suite executing 5 different Lit Action scenarios
- Support for reusing test accounts across runs via private key configuration
- Decoupled EOA auth context generation from account funding in test helpers
- Increased funding amounts for live network testing to support benchmark execution
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/e2e/src/tickets/payment-benchmark.spec.ts |
Entry point for payment benchmark test suite |
packages/e2e/src/test-helpers/executeJs/paymentBenchmarks/paymentBenchmark.ts |
Main test suite with 5 benchmark scenarios and payment detail logging |
packages/e2e/src/test-helpers/executeJs/paymentBenchmarks/litActions/decryptWithinLitAction.ts |
Lit Action for decryption and fetch operations |
packages/e2e/src/test-helpers/executeJs/paymentBenchmarks/litActions/encryptDecryptWithinLitAction.ts |
Lit Action for encryption/decryption within the action |
packages/e2e/src/test-helpers/executeJs/paymentBenchmarks/litActions/verifiableDataJob.ts |
Lit Action for data processing and signing |
packages/e2e/src/test-helpers/executeJs/paymentBenchmarks/litActions/oracleOperation.ts |
Lit Action for external data fetching and price medianization |
packages/e2e/src/test-helpers/executeJs/paymentBenchmarks/litActions/crossChainSwap.ts |
Complex Lit Action simulating cross-chain swap with multiple signatures |
packages/e2e/src/helper/createTestAccount.ts |
Updated to support optional private key parameter and decoupled EOA auth context from funding |
packages/e2e/src/init.ts |
Increased funding amounts for live network testing |
packages/e2e/src/helper/createTestEnv.ts |
Increased native funding and ledger deposit amounts |
.env.sample |
Added documentation for optional TEST_ALICE_PRIVATE_KEY and TEST_BOB_PRIVATE_KEY |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sourceToken: 'ETH', | ||
| destToken: 'BTC', | ||
| amountIn: '1.0', // 1 ETH | ||
| userAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', // Example address |
Copilot
AI
Dec 19, 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.
This example address appears to be truncated (missing the last character for a valid Ethereum address, which should be 42 characters including '0x'). Valid Ethereum addresses have 40 hexadecimal characters after '0x'. Consider using a complete example address like '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0' or a well-known test address.
| userAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', // Example address | |
| userAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0', // Example address |
| async function oracleOperation() { | ||
| // Helper function to calculate median | ||
| const median = (arr: number[]) => { | ||
| const arrSorted = arr.sort((a, b) => a - b); |
Copilot
AI
Dec 19, 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 sorting operation here mutates the original array. This could cause unexpected side effects if the array is used elsewhere. Consider using a copy of the array by changing 'arr.sort' to '[...arr].sort' or 'arr.slice().sort()'.
| const arrSorted = arr.sort((a, b) => a - b); | |
| const arrSorted = [...arr].sort((a, b) => a - b); |
| }); | ||
|
|
||
| // Parse the decrypted API key | ||
| const apiKey = JSON.parse(decryptedApiKey); |
Copilot
AI
Dec 19, 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.
Unused variable apiKey.
| const apiKey = JSON.parse(decryptedApiKey); | |
| JSON.parse(decryptedApiKey); |
| // Parse the decrypted API key | ||
| const apiKey = JSON.parse(decryptedApiKey); | ||
|
|
Copilot
AI
Dec 19, 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.
Unused variable apiKey.
| // Parse the decrypted API key | |
| const apiKey = JSON.parse(decryptedApiKey); |
Description
The main purpose of this PR is to migrate the tests from pkp-parallel-keygen to the JS SDK. These tests execution Lit Actions with varying uses of
fetch,decryption, and execution time to give an example of cost for executionpackages/e2e/src/test-helpers/executeJs/paymentBenchmarks/paymentBenchmark.tsis the test suite the executes all of the Lit Actionspackages/e2e/src/test-helpers/executeJs/paymentBenchmarks/litActions/contains the Lit Actions for each test casepackages/e2e/src/helper/createTestAccount.tswas updated to support providing a private key to use for the tests so a new account wasn't generated and required funding for every test runeoaAuthContextwas decoupled from thefundAccountflag for the scenario where the EOA already have sufficient funds deposited into the Ledger contract and didn't require fundingThe output of running the benchmark suite looks like:
Type of change
How Has This Been Tested?
TEST_ALICE_PRIVATE_KEYin root.envto reuse an EOA for each test runNETWORK=naga-test pnpm test:target packages/e2e/src/tickets/payment-benchmark.spec.tsChecklist: