Skip to content

Conversation

@tilo-14
Copy link
Contributor

@tilo-14 tilo-14 commented Oct 21, 2025

Adds examples for compressed account operations:

Structure:

  • basic-operations/anchor/ - Anchor framework examples
  • basic-operations/native/ - Native Rust examples
  • organized as Cargo workspaces

Programs included:

  • create: Create compressed accounts with derived addresses
  • update: Update compressed account data
  • close: Close compressed accounts
  • reinit: Reinitialize compressed accounts
  • burn: Permanently burn compressed accounts

Features:

  • SHA256 hashing for flat serialization
  • light-sdk 0.16.0 compatibility
  • Full workspace configuration
  • Compiles to deployable .so binaries
  • Test files for each operation

@ananas-block
Copy link
Contributor

pls add basic operations to ci

@tilo-14 tilo-14 force-pushed the add-basic-operations-examples branch from 8c12690 to 3da2b1f Compare October 24, 2025 18:32
Examples for compressed account operations in both Anchor and Native Rust.

Structure:
- basic-operations/anchor/ - Five standalone Anchor projects (create, update, close, reinit, burn)
- basic-operations/native/ - Native Rust workspace with five programs

Features:
- Each Anchor project is independent with complete workspace configuration
- SHA256 hashing for flat serialization
- light-sdk 0.15.0+ compatibility
- Rust and TypeScript tests for all operations
- CI workflow integration for both Anchor and Native tests
- confirmTransactionIndexed() for reliable test synchronization
@tilo-14 tilo-14 force-pushed the add-basic-operations-examples branch from 3a938ad to 53f3805 Compare October 24, 2025 18:52
tilo-14 added 7 commits October 26, 2025 19:26
…ually

Each basic-operations/anchor subdirectory (burn, create, update, close, reinit)
is a standalone Anchor project, not a workspace. This updates the CI matrix to
list each project individually and dynamically extract the program name for the
test validator.
- Add missing anchor feature to light-sdk-types in all basic-operations Anchor programs
- Fix validator startup script to extract program name from Anchor.toml instead of using basename
- Resolves prover health check failures and TypeScript connection errors
Split basic-operations/native workspace tests to run individual packages sequentially.
This prevents multiple tests from starting prover instances simultaneously.
…s examples

- Update light-sdk dependencies to latest versions across all examples
- Optimize Cargo.lock files, reducing size significantly
- Update Photon indexer revision in setup action
- Fix import statements and update test files
- Fix anchor close test: use ProgramTestConfig with true for embedded prover
- Remove unnecessary explicit lifetime parameters from LightAccount in native programs
- Update Cargo.lock and dependencies
Comment on lines 117 to 124
async fn get_message_account(
rpc: &mut LightProgramTest,
address: [u8; 32],
) -> MyCompressedAccount {
let account = get_compressed_account(rpc, address).await;
let data = &account.data.as_ref().unwrap().data;
MyCompressedAccount::deserialize(&mut &data[..]).unwrap()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

propagate the error please

tilo-14 and others added 5 commits October 29, 2025 17:45
…ments

This commit migrates all Anchor test files to use helper classes exported from @lightprotocol/[email protected] instead of local definitions:

- Migrated to SDK exports: PackedAccounts, SystemAccountMetaConfig, confirmTx
- Updated constructor patterns from static factory methods to standard ES6 constructors
- Removed ~210 lines of duplicate helper class definitions per test file
- Fixed close test to handle SDK behavior change where closed accounts return empty Buffer instead of throwing errors
- Updated README.md with correct version requirements (Rust 1.90.0, Solana 2.3.11, Anchor 0.31.1)
- Updated all package.json files to use @lightprotocol/[email protected]

All tests verified working with local test validators.
Remove get_compressed_account and get_message_account helper functions
from all test files as they obscure error origins with unnecessary unwraps.
Replace with direct RPC calls in test functions for clearer error tracing.

All tests continue to pass with simplified code.
@ananas-block ananas-block merged commit 66ab844 into main Oct 30, 2025
16 checks passed
@ananas-block ananas-block deleted the add-basic-operations-examples branch October 30, 2025 03:24
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.

3 participants