Conversation
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| name: system-programs | ||
| if: github.event.pull_request.draft == false | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
|
|
||
| services: | ||
| redis: | ||
| image: redis:8.0.1 | ||
| ports: | ||
| - 6379:6379 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| env: | ||
| REDIS_URL: redis://localhost:6379 | ||
|
|
||
| strategy: | ||
| matrix: | ||
| include: | ||
| - program: sdk-test-program | ||
| sub-tests: '["cargo-test-sbf -p sdk-native-test"]' | ||
| - program: sdk-anchor-test-program | ||
| sub-tests: '["cargo-test-sbf -p sdk-anchor-test", "cargo-test-sbf -p sdk-pinocchio-test"]' | ||
| - program: sdk-libs | ||
| packages: light-macros light-sdk light-program-test light-client light-batched-merkle-tree | ||
| test_cmd: | | ||
| cargo test -p light-macros | ||
| cargo test -p light-sdk | ||
| cargo test -p light-program-test | ||
| cargo test -p light-client | ||
| cargo test -p client-test | ||
| cargo test -p light-sparse-merkle-tree | ||
| cargo test -p light-batched-merkle-tree --features test-only -- --skip test_simulate_transactions --skip test_e2e | ||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup and build | ||
| uses: ./.github/actions/setup-and-build | ||
| with: | ||
| skip-components: "redis" | ||
|
|
||
| - name: build-programs | ||
| run: | | ||
| source ./scripts/devenv.sh | ||
| npx nx build @lightprotocol/programs | ||
|
|
||
| - name: Run sub-tests for ${{ matrix.program }} | ||
| if: matrix.sub-tests != null | ||
| run: | | ||
| source ./scripts/devenv.sh | ||
| npx nx build @lightprotocol/zk-compression-cli | ||
|
|
||
| IFS=',' read -r -a sub_tests <<< "${{ join(fromJSON(matrix.sub-tests), ', ') }}" | ||
| for subtest in "${sub_tests[@]}" | ||
| do | ||
| echo "$subtest" | ||
| eval "RUSTFLAGS=\"-D warnings\" $subtest" | ||
| done | ||
|
|
||
| - name: Run tests for ${{ matrix.program }} | ||
| if: matrix.test_cmd != null | ||
| run: | | ||
| source ./scripts/devenv.sh | ||
| npx nx build @lightprotocol/zk-compression-cli | ||
| ${{ matrix.test_cmd }} |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 17 days ago
In general, fix this by adding an explicit permissions block that grants only the minimal required scopes for GITHUB_TOKEN. For a test-only workflow that just checks out code and runs local commands, contents: read is sufficient.
For this specific file, the simplest, non-functional-changing fix is to add a workflow-level permissions block (so it applies to all current and future jobs) right after the name: examples-tests line. Set it to:
permissions:
contents: readThis grants only read access to repository contents, which is enough for actions/checkout@v6 and the subsequent test steps. No other scopes (like pull-requests or issues) are required by anything shown in the snippet, and no other code changes or imports are necessary.
| @@ -19,6 +19,9 @@ | ||
|
|
||
| name: examples-tests | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true |
js/compressed-token/src/utils/pack-compressed-token-accounts.ts
Dismissed
Show dismissed
Hide dismissed
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.2 to 5.9.3. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml) - [Commits](microsoft/TypeScript@v5.9.2...v5.9.3) --- updated-dependencies: - dependency-name: typescript dependency-version: 5.9.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: compressed token es module generation * fix
* chore: add address merkle tree pubkey print to light program test output * feat: statelessjs add PackedAccounts v1 and v2 * get address tree pubkey * fix feedback * fix: ts sdk anchor test * revert: anchor dev dep bump * build anchor sdk test program for ci
* fix release * fix: use cargo publish instead of cargo release - Replace 'cargo release publish' with 'cargo publish' in validate-packages.sh - cargo-release was removed in commit c7227ba - Revert workflow to use PR event data (not hardcoded commits)
* refactor: light program test make anchor programs optional deps * feat: LightAccount read only support * fix: add test serial
* chore: remove duplicate program builds * chore: cli ci mode * next try * cleanup * refactor: caching * fix solana cache * remove cli build * enable cli again * revert toolchain * fix clean checkout * remove manual redis setup * disable nx cache security * chore: add multiple prover keys caches * fix test cli ci * remove duplicate address program build * split up program tests more evenly * add js ci nx commands
| name: stateless-js-v1 | ||
| if: github.event.pull_request.draft == false | ||
| runs-on: ubuntu-latest | ||
|
|
||
| services: | ||
| redis: | ||
| image: redis:8.0.1 | ||
| ports: | ||
| - 6379:6379 | ||
| options: >- | ||
| --health-cmd "redis-cli ping" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| env: | ||
| LIGHT_PROTOCOL_VERSION: V1 | ||
| REDIS_URL: redis://localhost:6379 | ||
| CI: true | ||
|
|
||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup and build | ||
| uses: ./.github/actions/setup-and-build | ||
| with: | ||
| skip-components: "redis,disk-cleanup" | ||
| cache-suffix: "js" | ||
|
|
||
| - name: Build stateless.js with V1 | ||
| run: | | ||
| cd js/stateless.js | ||
| pnpm build:v1 | ||
|
|
||
| - name: Build CLI | ||
| - name: Build compressed-token with V1 | ||
| run: | | ||
| source ./scripts/devenv.sh | ||
| npx nx build @lightprotocol/zk-compression-cli --skip-nx-cache | ||
| cd js/compressed-token | ||
| pnpm build:v1 | ||
|
|
||
| # Comment for breaking changes to Photon | ||
| - name: Run CLI tests | ||
| - name: Build CLI (CI mode - Linux x64 only) | ||
| run: | | ||
| source ./scripts/devenv.sh | ||
| npx nx test @lightprotocol/zk-compression-cli | ||
| npx nx build-ci @lightprotocol/zk-compression-cli | ||
|
|
||
| - name: Run stateless.js tests | ||
| - name: Run stateless.js tests with V1 | ||
| run: | | ||
| source ./scripts/devenv.sh | ||
| npx nx test @lightprotocol/stateless.js | ||
| echo "Running stateless.js tests with retry logic (max 2 attempts)..." | ||
| attempt=1 | ||
| max_attempts=2 | ||
| until npx nx test-ci @lightprotocol/stateless.js; do | ||
| attempt=$((attempt + 1)) | ||
| if [ $attempt -gt $max_attempts ]; then | ||
| echo "Tests failed after $max_attempts attempts" | ||
| exit 1 | ||
| fi | ||
| echo "Attempt $attempt/$max_attempts failed, retrying..." | ||
| sleep 5 | ||
| done | ||
| echo "Tests passed on attempt $attempt" | ||
|
|
||
| - name: Run compressed-token tests | ||
| - name: Run compressed-token tests with V1 | ||
| run: | | ||
| source ./scripts/devenv.sh | ||
| npx nx test @lightprotocol/compressed-token | ||
| echo "Running compressed-token tests with retry logic (max 2 attempts)..." | ||
| attempt=1 | ||
| max_attempts=2 | ||
| until npx nx test-ci @lightprotocol/compressed-token; do | ||
| attempt=$((attempt + 1)) | ||
| if [ $attempt -gt $max_attempts ]; then | ||
| echo "Tests failed after $max_attempts attempts" | ||
| exit 1 | ||
| fi | ||
| echo "Attempt $attempt/$max_attempts failed, retrying..." | ||
| sleep 5 | ||
| done | ||
| echo "Tests passed on attempt $attempt" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 17 days ago
To fix the problem, explicitly define minimal GITHUB_TOKEN permissions for this workflow or for the specific job. Since the workflow only checks out code, builds, and runs tests, it normally only needs read access to repository contents. We can add a permissions block at the root of the workflow so it applies to all jobs (there is only one job in the snippet). This will ensure that even if the repository or org default is read-write, the workflow will only have contents: read.
Concretely, in .github/workflows/js.yml, add:
permissions:
contents: readbetween the name: js-tests-v1 section and the concurrency: block (lines 14–16 in the snippet). This does not change any existing behavior of steps, but constrains the token according to the principle of least privilege. No additional methods, definitions, or imports are needed.
| @@ -13,6 +13,9 @@ | ||
|
|
||
| name: js-tests-v1 | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true |
* feat: move proving keys management into cli * keys downloader * refactor: integrate dynamic proving key management * fix: update artifact path in prover-test workflow * fix: update artifact path in prover-test workflow * fix: add read permissions to prover-test workflow * fix: update Go setup and add linux/arm64 support in prover-release workflow * refactor: remove buildProver script and integrate dynamic prover binary management in CLI * feat: add utility to download prover binary * fix: update getProverNameByArch * fix: correct getProverNameByArch implementation * fix: add missing commas in downloadProverBinary and processProverServer * feat: lazy prover # Conflicts: # sdk-libs/program-test/src/program_test/config.rs * update prover version to 1.0.1 * fix * remove prover configuration from local test validator * feat: implement thread-safe checksum cache management * fix * preload keys for lazy test * preload test keys for lazy test * preload test keys for lazy test * fix * fix * increase default max wait time to 900 seconds * start queue workers for redis queue * bump prover version to 1.0.2 * restore download_keys.sh * chmod +x download_keys.sh * remove ProverConfig * remove build-ci & test-ci workflow cmds * use go key downloader * refactor key path construction to use filepath * add error handling for directory change in download-gnark-keys.sh * add redirect handling with limit in downloadFile function * add error handling for gnark keys download in download-gnark-keys.sh * update preload-keys * bump prover version * remove unused run mode handling * bump prover version
- Remove proving keys caching and download from setup-and-build action - Remove @lightprotocol/programs from devDependencies in stateless.js, compressed-token, and CLI packages This simplifies the CI workflow and removes unnecessary build dependencies.
* refactor: feature gate poseidon * chore: remove proving keys and programs dependency from CI - Remove proving keys caching and download from setup-and-build action - Remove @lightprotocol/programs from devDependencies in stateless.js, compressed-token, and CLI packages This simplifies the CI workflow and removes unnecessary build dependencies. * fix tests * fix tests add sdk compressed account poseidon import
* feat: enhance account-checks with pubkey validation and improved error reporting - Add next_checked_pubkey method for pubkey validation with detailed errors - Add print_on_error_pubkey helper for pubkey mismatch debugging - Add PartialEq bound to AccountInfoTrait::Pubkey for comparisons - Add InvalidAccount error variant for account validation failures - Add discriminator logging in check_discriminator for debugging - Update test_account_info to match pinocchio 0.9 Account struct layout - Update tests with correct discriminator hash * fix: update test_account_info for pinocchio 0.9 borrow state * feat: add docs * docs: fix error table and hex codes in account-checks docs - Add missing FailedBorrowRentSysvar (12014) to error table - Fix hex code conversions: 12006=0x2EE6, 12020=0x2EF4, 12021=0x2EF5 - Add language identifier 'text' to code fence in log examples Addresses CodeRabbit review feedback. * refactor: migrate account-checks error codes to 20000 range Migrated all AccountError codes from 12006-12021 to 20000-20015: - InvalidDiscriminator: 12006 → 20000 (0x4E20) - AccountOwnedByWrongProgram: 12007 → 20001 - AccountNotMutable: 12008 → 20002 - BorrowAccountDataFailed: 12009 → 20003 - InvalidAccountSize: 12010 → 20004 - AccountMutable: 12011 → 20005 - AlreadyInitialized: 12012 → 20006 - InvalidAccountBalance: 12013 → 20007 - FailedBorrowRentSysvar: 12014 → 20008 - InvalidSigner: 12015 → 20009 - InvalidSeeds: 12016 → 20010 - InvalidProgramId: 12017 → 20011 - ProgramNotExecutable: 12018 → 20012 - AccountNotZeroed: 12019 → 20013 - NotEnoughAccountKeys: 12020 → 20014 (0x4E2E) - InvalidAccount: 12021 → 20015 (0x4E2F) Updated all documentation with new error codes and hex values. All tests passing.
* feat: add version command and update Dockerfile to use Go 1.25 * feat: update prover version to 2.0.0
* chore: unify rust caches * fix go warning
* fix: prevent compressible account funding with 1 epoch * removed results from toplevel test functions * add ctoken create account tests * add close account tests * test: add ctoken transfer tests * add create ata tests * restore program ci * add compress and close tests * fix: spl instruction compatibility * add rent constant * fix failing tests asserts * add mint duplicates check * compressible add tests and overflow guards * refactor: use array map and tinyvec instead of arrayVec * refactor: unify output compressed indices into one * refactor: ctoken instruction discriminators
* feat(dashboard): add next.js ui and wire up status/metrics endpoints - add dashboard app (Next.js + Tailwind), components, hooks, and API client - include dashboard Dockerfile + env example; update gitignore and main Dockerfile - remove legacy static dashboard.html - extend Rust backend/CLI to expose status, metrics, epochs, and compressible-related data - refactor compressible/config/processor helpers, queue pressure + validation, and related telemetry/metrics * format
* rm v1 compat in mint action layout * rm * bump v * default to rent sponsored for ata * bump v * test cov loading * fix ts bump layout issue
…ext (#2274) * feat: integrate photon submodule versioning into build process * Refactor AccountInterface handling and remove unused functions - Removed `make_get_token_account_interface_body` and `make_get_ata_interface_body` functions from the photon API module. - Updated various test files to remove references to `ColdContext` and directly use compressed accounts in `AccountInterface`. - Adjusted `AccountSpec::Ata` instantiation to wrap `ata_interface` in `Box::new`. - Cleaned up imports in multiple test files by removing unused `ColdContext` references. * format
…ount state is zeroed pre initialization (#2276)
* fix: enforce canonical bump in PDA verification Audit issue #15 (HIGH): verify_pda used derive_address which accepts any bump seed, allowing non-canonical bumps for ATAs. Switch to find_program_address to derive the canonical bump and reject any non-canonical bump with InvalidSeeds error. * fix: use pinocchio::pubkey::find_program_address instead of pinocchio_pubkey * fix: remove bump from ATA instruction data and derive canonical bump on-chain Remove client-provided bump from CreateAssociatedTokenAccountInstructionData and all SDK/test callers. The on-chain program now derives the canonical bump via find_program_address, preventing non-canonical bump attacks (audit #15). - Remove bump field from instruction data structs - Update verify_pda to derive canonical bump and return it - Update validate_ata_derivation and decompress_mint callers - Remove _with_bump SDK variants and ATA2 dead code - Remove associated_token::bump from macro attribute support - Update derive_associated_token_account to return Pubkey only - Update all 100+ call sites across SDK, tests, and TypeScript * fix: update wrong bump test for canonical bump derivation With canonical bumps, the program derives the bump internally so providing a wrong bump is no longer possible. Replace with a test that passes a wrong ATA address to verify PDA validation. * fix test * fix lint
…#2265) * fix: interpret max_top_up as units of 1,000 lamports (L-07) max_top_up is u16 (max 65,535). As raw lamports this only allows ~0.065 SOL which is insufficient for many use cases. Interpreting as units of 1,000 lamports gives a max of ~65.5M lamports (~0.065 SOL becomes ~65 SOL), covering realistic rent top-up scenarios. * address comments
* fix: validate mint for all token accounts, not just compressible Audit issue #7 (MEDIUM): is_valid_mint was only called inside configure_compression_info, so non-compressible token accounts could be initialized with an invalid mint. Move validation to initialize_ctoken_account so it runs for all account types. * fix: read mint data once, pass decimals to configure_compression_info * fix: tests * fix tests * fix tests * fix tests * fix js tests
* chore: add token_pool test to CI and fix InvalidMint error expectation - Add test-compressed-token-token-pool to justfile CI targets - Fix failing_tests_add_token_pool to expect InvalidMint error instead of ConstraintSeeds (restricted_seed() parses mint before PDA check) * fix: enforce extension state checks for SPL compress (H-01 follow-up) Add extension state enforcement (paused, non-zero fees, non-nil hook) for SPL Token-2022 compress operations. Previously, SPL compress could bypass these checks, allowing an attacker to: 1. SPL Compress 10K with transfer fee mint (pool receives 9.9K) 2. SPL Decompress 10K (pool sends 10K) 3. Profit from the fee difference, draining pool funds Fix follows the same pattern as H-01 (PR #2246) - enforcement at the processing point in process_token_compression(), not in cache building. - Add enforce_extension_state() call for Compress mode in Token-2022 branch - Update test_spl_to_ctoken_fails_when_mint_paused to expect error 6127 (MintPaused from Light Token program) instead of 67 (SPL Token-2022) * fix lint
* fix: store_data may cache incorrect owner * fix test * fix: add owner comparison to new_addresses_eq and test owner fix path The new_addresses_eq helper was missing owner() comparison, which is critical since this PR fixes store_data caching the incorrect owner. Add unit tests with non-empty new_address_params to verify store_data sets owner to invoking_program on first and subsequent invocations.
* refactor: max top to be u16::MAX * fix: correct stale max_top_up doc comments Since Some(0) is now meaningful (no top-ups allowed), the doc comments saying "non-zero value" were misleading. Updated SDK structs to say "When set (Some)" and TRANSFER_CHECKED.md to specify [1, u16::MAX-1].
* chore: check compress only is applied correctly * restore: has delegate check
Entire-Checkpoint: d44264603cb5
…oken account check, add additiona create ata idempotent check (#2292) * fix: add rent-exemption and mint/owner checks for token account creation - create.rs: verify non-compressible token account is rent-exempt before initializing (audit issue #8) - create_ata.rs: in idempotent mode, deserialize existing account and verify mint and owner fields match expected values (audit issue #4) Entire-Checkpoint: caaa14ac3051 * fix: Entire-Checkpoint: caaa14ac3051 * add tests and format Entire-Checkpoint: 2b4028368dbf * chore: restore photon submodule to match main Entire-Checkpoint: c298aaf24a18
) PR #2279 fixed mint-to but missed 7 other instruction builders that hardcoded maxTopUp: 0 (no top-ups allowed). The on-chain program rejects any rent top-up with MaxTopUpExceeded (0x467b) when maxTopUp is 0. Set to 65535 (u16::MAX = no limit) to match the Rust SDK default. Files changed: - wrap.ts, unwrap.ts, create-decompress-interface-instruction.ts - create-mint.ts, decompress-mint.ts, mint-to-compressed.ts - update-mint.ts, update-metadata.ts Co-authored-by: tilo-14 <tilo@luminouslabs.com>
…pi LightToLight path (#2294) TransferInterfaceCpi hardcoded fee_payer: None for LightToLight transfers, causing PrivilegeEscalation when the on-chain program attempted rent top-ups using the readonly authority account. Pass self.payer as fee_payer instead, since payer is already writable. token-sdk: set fee_payer: Some(self.payer) in TransferInterface::instruction() and add system_program + payer to account_infos in invoke()/invoke_signed(). token-pinocchio: set fee_payer: Some(self.payer) in TransferCpi construction for both invoke() and invoke_signed(). TransferCpi already handles fee_payer in its account_infos internally. Co-authored-by: tilo-14 <tilo@luminouslabs.com>
- Restore typedoc.stateless.json accidentally deleted in PR #2065 - Add compressed-token build step before typedoc generation - Add workflow_dispatch for manual triggers - Add branch push triggers (main, swen/pub-beta-cov) with path filter on js/*/src/** Co-authored-by: tilo-14 <tilo@luminouslabs.com>
Entire-Checkpoint: b50f5875b462
* fix: add delegate to packed accounts in decompress instruction, version-aware proof chunking wip fixes fixes fix ci test fixes fix and lint upd fix ci rev fix order exporting fix regr wip fixes bump versions decompress mint at create fix ci bump versions rm md js(compressed-token): MAX_TOP_UP constant and optional maxTopUp override - Add MAX_TOP_UP (65535) in constants.ts; use in all instruction builders - mintTo action: default maxTopUp to MAX_TOP_UP when omitted - wrap/unwrap: optional maxTopUp on instruction and action - decompressMint: maxTopUp in DecompressMintParams and DecompressMintInstructionParams - createDecompressInterfaceInstruction, createMintInstruction, createMintToCompressedInstruction, update-mint, update-metadata: optional maxTopUp - Non-breaking: all new params optional, default no cap Co-authored-by: Cursor <cursoragent@cursor.com> unskip tests changelog.md * fix mc
* fix: address creation Entire-Checkpoint: e8de3c68866c * fix feature gate * fmt tests Entire-Checkpoint: 5a3de7e68923
) Rename terminology in JSDoc, comments, and error strings: - c-token → light-token - cmint/CMint → light mint - compressed mint → light mint (where referring to the type) - compressed/decompressed (state) → preserved as-is - ATA → associated token account (expanded) - via pool → via interface PDA - hot/cold terminology for token accounts and mints Co-authored-by: tilo-14 <tilo@luminouslabs.com>
* refactor: light account creation to generic function * refactor: migrate manual LightPreInit impls to create_accounts() Replace manual CPI orchestration in pda, account_loader, and two_mints test modules with the unified create_accounts() generic function, reducing boilerplate across both pinocchio and anchor manual tests. * refactor: migrate pinocchio-light-program-test processors to create_accounts() Replace manual CPI orchestration with the unified create_accounts() function across all 5 migratable processors (pda, account_loader, mint, two_mints, all). * fix: guard against u8 truncation in create_accounts() const generics Fail fast if PDAS or MINTS exceed u8::MAX, preventing silent wrapping in downstream `as u8` casts for cpi_context_offset and account indices. * fix minor issues & cleanup Entire-Checkpoint: 1da6fecc501a * fix comments Entire-Checkpoint: c788d31d848b * add light-account feature Entire-Checkpoint: 7bbee35ce40f * fix ci * fix: expose idempotent flag in associated_token:: macro Entire-Checkpoint: 5a7704933620 * fix lint
* feat: pinocchio account add custom discriminator, add 1 byte discriminator compress decompress test * feat: add 1 byte discriminator account to stress test * randomize tests and format * address feedback * test: discriminators with 2-7 bytes * feat: add discriminator compile time collision detection * fix doc comment
* refactor: add opt fee payer to revoke and approve instructions * fix: comment
No description provided.