From c743ee8df9d85e03e13b95b828389e9f431016dc Mon Sep 17 00:00:00 2001 From: ananas Date: Tue, 20 Jan 2026 06:31:48 +0000 Subject: [PATCH] chore(sdk-libs): bump versions --- .github/workflows/release-rust.yml | 32 +++-- .github/workflows/rust.yml | 2 +- Cargo.lock | 24 ++-- Cargo.toml | 28 ++-- program-libs/token-interface/Cargo.toml | 3 +- scripts/release/create-release-pr.sh | 28 +++- scripts/release/detect-version-changes.sh | 33 ++++- scripts/release/validate-packages.sh | 18 ++- sdk-libs/client/Cargo.toml | 2 +- sdk-libs/event/Cargo.toml | 2 +- sdk-libs/macros/Cargo.toml | 2 +- sdk-libs/photon-api/Cargo.toml | 2 +- sdk-libs/program-test/Cargo.toml | 6 +- sdk-libs/sdk-pinocchio/Cargo.toml | 2 +- sdk-libs/sdk-types/Cargo.toml | 2 +- sdk-libs/sdk/Cargo.toml | 2 +- sdk-libs/token-sdk/Cargo.toml | 3 +- .../token-sdk/tests/account_metas_test.rs | 134 ------------------ sdk-libs/token-types/Cargo.toml | 4 +- 19 files changed, 124 insertions(+), 205 deletions(-) delete mode 100644 sdk-libs/token-sdk/tests/account_metas_test.rs diff --git a/.github/workflows/release-rust.yml b/.github/workflows/release-rust.yml index 4883d62adb..db84baf519 100644 --- a/.github/workflows/release-rust.yml +++ b/.github/workflows/release-rust.yml @@ -26,6 +26,21 @@ jobs: git fetch origin ${{ github.event.pull_request.base.sha }} git fetch origin ${{ github.event.pull_request.head.sha }} + - name: Determine release type + id: release-type + run: | + PR_TITLE="${{ github.event.pull_request.title }}" + if [[ "$PR_TITLE" == *"program-libs"* ]]; then + echo "type=program-libs" >> $GITHUB_OUTPUT + elif [[ "$PR_TITLE" == *"sdk-libs"* ]]; then + echo "type=sdk-libs" >> $GITHUB_OUTPUT + else + echo "Error: Could not determine release type from PR title: $PR_TITLE" + echo "PR title must contain 'program-libs' or 'sdk-libs'" + exit 1 + fi + echo "Detected release type: $(cat $GITHUB_OUTPUT)" + - name: Set up Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -40,29 +55,32 @@ jobs: env: BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} + RELEASE_TYPE: ${{ steps.release-type.outputs.type }} run: | echo "=========================================" echo "Phase 1: Validation (dry-run)" echo "=========================================" - ./scripts/release/validate-packages.sh "$BASE_SHA" "$HEAD_SHA" + ./scripts/release/validate-packages.sh "$RELEASE_TYPE" "$BASE_SHA" "$HEAD_SHA" - name: Publish packages to crates.io env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} + RELEASE_TYPE: ${{ steps.release-type.outputs.type }} run: | echo "" echo "=========================================" echo "Phase 2: Publishing (atomic)" echo "=========================================" - ./scripts/release/validate-packages.sh --execute "$BASE_SHA" "$HEAD_SHA" + ./scripts/release/validate-packages.sh --execute "$RELEASE_TYPE" "$BASE_SHA" "$HEAD_SHA" - name: Create GitHub releases env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} + RELEASE_TYPE: ${{ steps.release-type.outputs.type }} run: | echo "" echo "=========================================" @@ -70,7 +88,7 @@ jobs: echo "=========================================" # Detect packages that were published - PACKAGES_STRING=$(./scripts/release/detect-version-changes.sh "$BASE_SHA" "$HEAD_SHA") + PACKAGES_STRING=$(./scripts/release/detect-version-changes.sh "$RELEASE_TYPE" "$BASE_SHA" "$HEAD_SHA") read -ra PACKAGES <<< "$PACKAGES_STRING" for pkg in "${PACKAGES[@]}"; do @@ -105,11 +123,3 @@ jobs: echo "" echo "✓ GitHub releases created" - - - name: Trigger docs sync - uses: peter-evans/repository-dispatch@v4 - with: - token: ${{ secrets.DOCS_REPO_TOKEN }} - repository: Lightprotocol/docs - event-type: sync-handlers - client-payload: '{"commit": "${{ github.sha }}", "release": true}' diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1059723c6c..d7437a252a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -59,7 +59,7 @@ jobs: cargo test -p light-hash-set --all-features cargo test -p batched-merkle-tree-test -- --skip test_simulate_transactions --skip test_e2e cargo test -p light-concurrent-merkle-tree - cargo test -p light-token-interface --features poseidon + cargo test -p light-token-interface --features poseidon,test-only cargo test -p light-compressible --all-features - name: program-libs-slow packages: light-bloom-filter light-indexed-merkle-tree batched-merkle-tree-test diff --git a/Cargo.lock b/Cargo.lock index b0733a2baf..1c65c4356f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3558,7 +3558,7 @@ dependencies = [ [[package]] name = "light-client" -version = "0.17.2" +version = "0.18.0" dependencies = [ "anchor-lang", "async-trait", @@ -3724,7 +3724,7 @@ dependencies = [ [[package]] name = "light-event" -version = "0.2.1" +version = "0.3.0" dependencies = [ "borsh 0.10.4", "light-compressed-account", @@ -3888,7 +3888,7 @@ dependencies = [ [[package]] name = "light-program-test" -version = "0.17.1" +version = "0.18.0" dependencies = [ "account-compression", "anchor-lang", @@ -3994,7 +3994,7 @@ dependencies = [ [[package]] name = "light-sdk" -version = "0.17.1" +version = "0.18.0" dependencies = [ "anchor-lang", "bincode", @@ -4026,7 +4026,7 @@ dependencies = [ [[package]] name = "light-sdk-macros" -version = "0.17.1" +version = "0.18.0" dependencies = [ "borsh 0.10.4", "darling", @@ -4045,7 +4045,7 @@ dependencies = [ [[package]] name = "light-sdk-pinocchio" -version = "0.17.1" +version = "0.18.0" dependencies = [ "borsh 0.10.4", "light-account-checks", @@ -4061,7 +4061,7 @@ dependencies = [ [[package]] name = "light-sdk-types" -version = "0.17.1" +version = "0.18.0" dependencies = [ "anchor-lang", "borsh 0.10.4", @@ -4178,7 +4178,7 @@ dependencies = [ [[package]] name = "light-token" -version = "0.2.1" +version = "0.3.0" dependencies = [ "anchor-lang", "arrayvec", @@ -4186,7 +4186,6 @@ dependencies = [ "light-account-checks", "light-batched-merkle-tree", "light-compressed-account", - "light-compressed-token", "light-compressible", "light-macros", "light-program-profiler", @@ -4233,7 +4232,7 @@ dependencies = [ [[package]] name = "light-token-interface" -version = "0.1.1" +version = "0.2.0" dependencies = [ "aligned-sized", "anchor-lang", @@ -4247,7 +4246,6 @@ dependencies = [ "light-heap", "light-macros", "light-program-profiler", - "light-token-interface", "light-zero-copy", "num-bigint 0.4.6", "pinocchio", @@ -4268,7 +4266,7 @@ dependencies = [ [[package]] name = "light-token-types" -version = "0.2.1" +version = "0.3.0" dependencies = [ "anchor-lang", "borsh 0.10.4", @@ -4953,7 +4951,7 @@ dependencies = [ [[package]] name = "photon-api" -version = "0.53.0" +version = "0.54.0" dependencies = [ "reqwest 0.12.26", "serde", diff --git a/Cargo.toml b/Cargo.toml index f96717ec79..84454b65ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -178,45 +178,47 @@ light-hash-set = { version = "4.0.0", path = "program-libs/hash-set" } light-indexed-merkle-tree = { version = "5.0.0", path = "program-libs/indexed-merkle-tree" } light-concurrent-merkle-tree = { version = "5.0.0", path = "program-libs/concurrent-merkle-tree" } light-sparse-merkle-tree = { version = "0.3.0", path = "sparse-merkle-tree" } -light-client = { path = "sdk-libs/client", version = "0.17.2" } -light-event = { path = "sdk-libs/event", version = "0.2.1" } +light-client = { path = "sdk-libs/client", version = "0.18.0" } +light-event = { path = "sdk-libs/event", version = "0.3.0" } light-hasher = { path = "program-libs/hasher", version = "5.0.0", default-features = false } light-macros = { path = "program-libs/macros", version = "2.2.0" } light-merkle-tree-reference = { path = "program-tests/merkle-tree", version = "4.0.0" } light-heap = { path = "program-libs/heap", version = "2.0.0" } light-prover-client = { path = "prover/client", version = "5.0.1" } -light-sdk = { path = "sdk-libs/sdk", version = "0.17.1" } -light-sdk-pinocchio = { path = "sdk-libs/sdk-pinocchio", version = "0.17.1" } -light-sdk-macros = { path = "sdk-libs/macros", version = "0.17.1" } -light-sdk-types = { path = "sdk-libs/sdk-types", version = "0.17.1", default-features = false } +light-sdk = { path = "sdk-libs/sdk", version = "0.18.0" } +light-sdk-pinocchio = { path = "sdk-libs/sdk-pinocchio", version = "0.18.0" } +light-sdk-macros = { path = "sdk-libs/macros", version = "0.18.0" } +light-sdk-types = { path = "sdk-libs/sdk-types", version = "0.18.0", default-features = false } light-compressed-account = { path = "program-libs/compressed-account", version = "0.8.0", default-features = false } light-compressible = { path = "program-libs/compressible", version = "0.3.0", default-features = false } -light-token-interface = { path = "program-libs/token-interface", version = "0.1.1" } +light-token-interface = { path = "program-libs/token-interface", version = "0.2.0" } light-account-checks = { path = "program-libs/account-checks", version = "0.6.0", default-features = false } light-verifier = { path = "program-libs/verifier", version = "7.0.0" } light-zero-copy = { path = "program-libs/zero-copy", version = "0.6.0", default-features = false } light-zero-copy-derive = { path = "program-libs/zero-copy-derive", version = "0.6.0" } -photon-api = { path = "sdk-libs/photon-api", version = "0.53.0" } +photon-api = { path = "sdk-libs/photon-api", version = "0.54.0" } forester-utils = { path = "forester-utils", version = "2.0.0" } account-compression = { path = "programs/account-compression", version = "2.0.0", features = [ "cpi", ] } -light-compressed-token = { path = "programs/compressed-token/program", version = "2.1.0", features = [ +# Note: v2.1.0 exists as GitHub release but not on crates.io +light-compressed-token = { path = "programs/compressed-token/program", version = "2.0.0", features = [ "cpi", ] } -light-token-types = { path = "sdk-libs/token-types", version = "0.2.1" } -light-token = { path = "sdk-libs/token-sdk", version = "0.2.1" } +light-token-types = { path = "sdk-libs/token-types", version = "0.3.0" } +light-token = { path = "sdk-libs/token-sdk", version = "0.3.0" } light-token-client = { path = "sdk-libs/token-client", version = "0.1.0" } light-system-program-anchor = { path = "anchor-programs/system", version = "2.0.0", features = [ "cpi", ] } -light-registry = { path = "programs/registry", version = "2.1.0", features = [ +# Note: v2.1.0 exists as GitHub release but not on crates.io +light-registry = { path = "programs/registry", version = "2.0.0", features = [ "cpi", ] } create-address-test-program = { path = "program-tests/create-address-test-program", version = "1.0.0", features = [ "cpi", ] } -light-program-test = { path = "sdk-libs/program-test", version = "0.17.1" } +light-program-test = { path = "sdk-libs/program-test", version = "0.18.0" } light-batched-merkle-tree = { path = "program-libs/batched-merkle-tree", version = "0.8.0" } light-merkle-tree-metadata = { path = "program-libs/merkle-tree-metadata", version = "0.8.0" } aligned-sized = { path = "program-libs/aligned-sized", version = "1.1.0" } diff --git a/program-libs/token-interface/Cargo.toml b/program-libs/token-interface/Cargo.toml index 180c907ace..298f3ccfc7 100644 --- a/program-libs/token-interface/Cargo.toml +++ b/program-libs/token-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-token-interface" -version = "0.1.1" +version = "0.2.0" edition = { workspace = true } description = "Light Protocol token instruction data types." license = "MIT" @@ -52,7 +52,6 @@ light-account-checks = { workspace = true, features = [ "solana", ] } spl-token-metadata-interface = "0.6.0" -light-token-interface = { workspace = true, features = ["poseidon", "test-only"] } light-hasher = { workspace = true, features = ["keccak", "sha256", "poseidon"] } [lints.rust.unexpected_cfgs] diff --git a/scripts/release/create-release-pr.sh b/scripts/release/create-release-pr.sh index ee41fc7555..1cc71f1095 100755 --- a/scripts/release/create-release-pr.sh +++ b/scripts/release/create-release-pr.sh @@ -25,8 +25,24 @@ fi # Function to get version changes between two git refs # Output format: One line per package: "package-name old-version new-version" get_version_changes() { - local base_ref="$1" - local head_ref="$2" + local release_type="$1" + local base_ref="$2" + local head_ref="$3" + + # Set the grep pattern based on release type + local grep_pattern + case "$release_type" in + program-libs) + grep_pattern='program-libs/' + ;; + sdk-libs) + grep_pattern='(sdk-libs|program-tests/merkle-tree|sparse-merkle-tree|prover)/' + ;; + *) + echo "Error: Release type must be 'program-libs' or 'sdk-libs'" >&2 + return 1 + ;; + esac # Fetch if comparing against remote refs if [[ "$base_ref" == origin/* ]]; then @@ -44,7 +60,7 @@ get_version_changes() { diff_args=("$base_ref...$head_ref") fi - # Get list of changed Cargo.toml files in program-libs, sdk-libs, program-tests/merkle-tree, sparse-merkle-tree, and prover + # Get list of changed Cargo.toml files in the specified directory while IFS= read -r file; do # Extract old and new version from the diff local versions=$(git diff "${diff_args[@]}" -- "$file" | grep -E '^\+version|^-version' | grep -v '+++\|---') @@ -60,7 +76,7 @@ get_version_changes() { echo "$pkg_name $old_ver $new_ver" fi fi - done < <(git diff "${diff_args[@]}" --name-only -- '**/Cargo.toml' | grep -E '(program-libs|sdk-libs|program-tests/merkle-tree|sparse-merkle-tree|prover)/') + done < <(git diff "${diff_args[@]}" --name-only -- '**/Cargo.toml' | grep -E "$grep_pattern") } # Check if there are changes @@ -85,7 +101,7 @@ echo "Comparing against: $TARGET_BRANCH" echo "" # Get version changes using the function -VERSION_CHANGES_RAW=$(get_version_changes "$TARGET_BRANCH" "HEAD") +VERSION_CHANGES_RAW=$(get_version_changes "$RELEASE_TYPE" "$TARGET_BRANCH" "HEAD") # Build packages array and formatted version changes PACKAGES=() @@ -111,7 +127,7 @@ echo "" # Validate packages using the validation script (comparing against target branch) # Note: Changes are in working directory but not yet committed -if "$SCRIPT_DIR/validate-packages.sh" "$TARGET_BRANCH" "HEAD"; then +if "$SCRIPT_DIR/validate-packages.sh" "$RELEASE_TYPE" "$TARGET_BRANCH" "HEAD"; then echo "" echo "All crates validated successfully" else diff --git a/scripts/release/detect-version-changes.sh b/scripts/release/detect-version-changes.sh index 657374ab4e..877b841522 100755 --- a/scripts/release/detect-version-changes.sh +++ b/scripts/release/detect-version-changes.sh @@ -2,14 +2,35 @@ set -euo pipefail # Detect packages with version changes between two git refs -# Usage: ./scripts/detect-version-changes.sh [base-ref] [head-ref] +# Usage: ./scripts/detect-version-changes.sh [base-ref] [head-ref] # Arguments: +# release-type: Type of release (program-libs or sdk-libs) # base-ref: Base reference to compare against (default: origin/main) # head-ref: Head reference to compare (default: HEAD) # Outputs: Space-separated list of package names to stdout -BASE_REF="${1:-origin/main}" -HEAD_REF="${2:-HEAD}" +if [ $# -lt 1 ]; then + echo "Usage: $0 [base-ref] [head-ref]" >&2 + exit 1 +fi + +RELEASE_TYPE=$1 +BASE_REF="${2:-origin/main}" +HEAD_REF="${3:-HEAD}" + +# Set the grep pattern based on release type +case "$RELEASE_TYPE" in + program-libs) + GREP_PATTERN='program-libs/' + ;; + sdk-libs) + GREP_PATTERN='(sdk-libs|program-tests/merkle-tree|sparse-merkle-tree|prover)/' + ;; + *) + echo "Error: Release type must be 'program-libs' or 'sdk-libs'" >&2 + exit 1 + ;; +esac # Fetch if comparing against remote refs if [[ "$BASE_REF" == origin/* ]]; then @@ -29,8 +50,8 @@ else DIFF_ARGS=("$BASE_REF...$HEAD_REF") fi -# Get list of changed Cargo.toml files in program-libs, sdk-libs, program-tests/merkle-tree, sparse-merkle-tree, and prover -for file in $(git diff "${DIFF_ARGS[@]}" --name-only -- '**/Cargo.toml' | grep -E '(program-libs|sdk-libs|program-tests/merkle-tree|sparse-merkle-tree|prover)/'); do +# Get list of changed Cargo.toml files in the specified directory +for file in $(git diff "${DIFF_ARGS[@]}" --name-only -- '**/Cargo.toml' | grep -E "$GREP_PATTERN"); do # Extract old and new version from the diff versions=$(git diff "${DIFF_ARGS[@]}" -- "$file" | grep -E '^\+version|^-version' | grep -v '+++\|---') old_ver=$(echo "$versions" | grep '^-version' | head -1 | awk -F'"' '{print $2}') @@ -48,7 +69,7 @@ for file in $(git diff "${DIFF_ARGS[@]}" --name-only -- '**/Cargo.toml' | grep - done if [ ${#PACKAGES[@]} -eq 0 ]; then - echo "No packages with version changes detected" >&2 + echo "No packages with version changes detected in $RELEASE_TYPE" >&2 exit 1 fi diff --git a/scripts/release/validate-packages.sh b/scripts/release/validate-packages.sh index e4c06481d7..4ab19e579f 100755 --- a/scripts/release/validate-packages.sh +++ b/scripts/release/validate-packages.sh @@ -3,10 +3,11 @@ set -euo pipefail # Validate or publish packages using cargo-release # Usage: -# ./scripts/validate-packages.sh [base-ref] [head-ref] # Dry-run validation -# ./scripts/validate-packages.sh --execute [base-ref] [head-ref] # Actual publish +# ./scripts/validate-packages.sh [base-ref] [head-ref] # Dry-run validation +# ./scripts/validate-packages.sh --execute [base-ref] [head-ref] # Actual publish # Arguments: # --execute: Actually publish to crates.io (default: dry-run only) +# release-type: Type of release (program-libs or sdk-libs) # base-ref: Base reference to compare against (default: origin/main) # head-ref: Head reference to compare (default: HEAD) # Exits with 0 on success, 1 on failure @@ -20,15 +21,22 @@ if [ "${1:-}" = "--execute" ]; then shift fi -BASE_REF="${1:-origin/main}" -HEAD_REF="${2:-HEAD}" +if [ $# -lt 1 ]; then + echo "Usage: $0 [--execute] [base-ref] [head-ref]" >&2 + exit 1 +fi + +RELEASE_TYPE=$1 +BASE_REF="${2:-origin/main}" +HEAD_REF="${3:-HEAD}" echo "Detecting packages with version changes..." +echo "Release type: $RELEASE_TYPE" echo "Comparing: $BASE_REF...$HEAD_REF" echo "" # Detect packages using the detection script -PACKAGES_STRING=$("$SCRIPT_DIR/detect-version-changes.sh" "$BASE_REF" "$HEAD_REF") +PACKAGES_STRING=$("$SCRIPT_DIR/detect-version-changes.sh" "$RELEASE_TYPE" "$BASE_REF" "$HEAD_REF") # Convert to array read -ra PACKAGES <<< "$PACKAGES_STRING" diff --git a/sdk-libs/client/Cargo.toml b/sdk-libs/client/Cargo.toml index b06698093b..599bec023e 100644 --- a/sdk-libs/client/Cargo.toml +++ b/sdk-libs/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-client" -version = "0.17.2" +version = "0.18.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/lightprotocol/light-protocol" diff --git a/sdk-libs/event/Cargo.toml b/sdk-libs/event/Cargo.toml index 20bf6c076e..caf6d42fcc 100644 --- a/sdk-libs/event/Cargo.toml +++ b/sdk-libs/event/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-event" -version = "0.2.1" +version = "0.3.0" description = "Event types and utilities for Light Protocol" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/sdk-libs/macros/Cargo.toml b/sdk-libs/macros/Cargo.toml index dba703dfe0..2512bfa30b 100644 --- a/sdk-libs/macros/Cargo.toml +++ b/sdk-libs/macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-sdk-macros" -version = "0.17.1" +version = "0.18.0" description = "Macros for Programs using the Light SDK for ZK Compression " repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/sdk-libs/photon-api/Cargo.toml b/sdk-libs/photon-api/Cargo.toml index f930a6df5c..87841b3079 100644 --- a/sdk-libs/photon-api/Cargo.toml +++ b/sdk-libs/photon-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "photon-api" -version = "0.53.0" +version = "0.54.0" authors = ["OpenAPI Generator team and contributors"] description = "Solana indexer for general compression" license = "Apache-2.0" diff --git a/sdk-libs/program-test/Cargo.toml b/sdk-libs/program-test/Cargo.toml index 0b147de2bb..9a23add219 100644 --- a/sdk-libs/program-test/Cargo.toml +++ b/sdk-libs/program-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-program-test" -version = "0.17.1" +version = "0.18.0" description = "A fast local test environment for Solana programs using compressed accounts and tokens." license = "MIT" edition = "2021" @@ -32,8 +32,8 @@ litesvm = { workspace = true } spl-token-2022 = { workspace = true } -light-registry = { workspace = true, features = ["cpi"], optional = true } -light-compressed-token = { workspace = true, features = ["cpi"], optional = true } +light-registry = { workspace = true, version = "2.0.0", features = ["cpi"], optional = true } +light-compressed-token = { workspace = true, version = "2.0.0", features = ["cpi"], optional = true } account-compression = { workspace = true, features = ["cpi"], optional = true } photon-api = { workspace = true } diff --git a/sdk-libs/sdk-pinocchio/Cargo.toml b/sdk-libs/sdk-pinocchio/Cargo.toml index f6079e9a72..69b636b705 100644 --- a/sdk-libs/sdk-pinocchio/Cargo.toml +++ b/sdk-libs/sdk-pinocchio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-sdk-pinocchio" -version = "0.17.1" +version = "0.18.0" description = "Rust SDK for ZK Compression on Solana with Pinocchio features" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/sdk-libs/sdk-types/Cargo.toml b/sdk-libs/sdk-types/Cargo.toml index fc3f065245..13eb248cab 100644 --- a/sdk-libs/sdk-types/Cargo.toml +++ b/sdk-libs/sdk-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-sdk-types" -version = "0.17.1" +version = "0.18.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/lightprotocol/light-protocol" diff --git a/sdk-libs/sdk/Cargo.toml b/sdk-libs/sdk/Cargo.toml index 3b85434a53..ffd4f3db1b 100644 --- a/sdk-libs/sdk/Cargo.toml +++ b/sdk-libs/sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-sdk" -version = "0.17.1" +version = "0.18.0" description = "Rust SDK for ZK Compression on Solana" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" diff --git a/sdk-libs/token-sdk/Cargo.toml b/sdk-libs/token-sdk/Cargo.toml index 08f86f0e9f..bd3f5fce1b 100644 --- a/sdk-libs/token-sdk/Cargo.toml +++ b/sdk-libs/token-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-token" -version = "0.2.1" +version = "0.3.0" edition = { workspace = true } description = "SDK for compressed tokens on Light Protocol" license = "Apache-2.0" @@ -59,7 +59,6 @@ light-sdk-macros = { workspace = true, optional = true } [dev-dependencies] light-account-checks = { workspace = true, features = ["test-only", "pinocchio", "std"] } anchor-lang = { workspace = true } -light-compressed-token = { workspace = true } pinocchio = { workspace = true } diff --git a/sdk-libs/token-sdk/tests/account_metas_test.rs b/sdk-libs/token-sdk/tests/account_metas_test.rs deleted file mode 100644 index c01ce91e76..0000000000 --- a/sdk-libs/token-sdk/tests/account_metas_test.rs +++ /dev/null @@ -1,134 +0,0 @@ -#![cfg(feature = "v1")] -use anchor_lang::ToAccountMetas; -use light_sdk::constants::REGISTERED_PROGRAM_PDA; -use light_token::{ - compressed_token::{ - batch_compress::{get_batch_compress_instruction_account_metas, BatchCompressMetaConfig}, - transfer::account_metas::{ - get_transfer_instruction_account_metas, TokenAccountsMetaConfig, - }, - }, - utils::TokenDefaultAccounts, -}; -use light_token_types::constants::{ - ACCOUNT_COMPRESSION_PROGRAM_ID, CPI_AUTHORITY_PDA, LIGHT_SYSTEM_PROGRAM_ID, NOOP_PROGRAM_ID, - PROGRAM_ID as LIGHT_TOKEN_PROGRAM_ID, -}; -use solana_pubkey::Pubkey; - -// TODO: Rewrite to use get_transfer_instruction_account_metas -#[test] -fn test_to_compressed_token_account_metas_compress() { - // Create test accounts - let fee_payer = Pubkey::new_unique(); - let authority = Pubkey::new_unique(); - - let default_pubkeys = TokenDefaultAccounts::default(); - let reference = light_compressed_token::accounts::TransferInstruction { - fee_payer, - authority, - registered_program_pda: default_pubkeys.registered_program_pda, - noop_program: default_pubkeys.noop_program, - account_compression_authority: default_pubkeys.account_compression_authority, - account_compression_program: default_pubkeys.account_compression_program, - self_program: default_pubkeys.self_program, - cpi_authority_pda: default_pubkeys.cpi_authority_pda, - light_system_program: default_pubkeys.light_system_program, - token_pool_pda: None, - compress_or_decompress_token_account: None, - token_program: None, - system_program: default_pubkeys.system_program, - }; - - // Test our function - let meta_config = TokenAccountsMetaConfig::new(fee_payer, authority); - let account_metas = get_transfer_instruction_account_metas(meta_config); - let reference_metas = reference.to_account_metas(Some(true)); - - assert_eq!(account_metas, reference_metas); -} - -#[test] -fn test_to_compressed_token_account_metas_with_optional_accounts() { - // Create test accounts - let fee_payer = Pubkey::new_unique(); - let authority = Pubkey::new_unique(); - - // Optional accounts - let spl_interface_pda = Pubkey::new_unique(); - let compress_or_decompress_token_account = Pubkey::new_unique(); - let spl_token_program = Pubkey::new_unique(); - - let default_pubkeys = TokenDefaultAccounts::default(); - let reference = light_compressed_token::accounts::TransferInstruction { - fee_payer, - authority, - light_system_program: default_pubkeys.light_system_program, - cpi_authority_pda: default_pubkeys.cpi_authority_pda, - registered_program_pda: default_pubkeys.registered_program_pda, - noop_program: default_pubkeys.noop_program, - account_compression_authority: default_pubkeys.account_compression_authority, - account_compression_program: default_pubkeys.account_compression_program, - self_program: default_pubkeys.self_program, - token_pool_pda: Some(spl_interface_pda), - compress_or_decompress_token_account: Some(compress_or_decompress_token_account), - token_program: Some(spl_token_program), - system_program: default_pubkeys.system_program, - }; - - let meta_config = TokenAccountsMetaConfig::compress( - fee_payer, - authority, - reference.token_pool_pda.unwrap(), - reference.compress_or_decompress_token_account.unwrap(), - reference.token_program.unwrap(), - ); - let account_metas = get_transfer_instruction_account_metas(meta_config); - let reference_metas = reference.to_account_metas(Some(true)); - - assert_eq!(account_metas, reference_metas); -} -#[ignore = "failing v1 tests"] -#[test] -fn test_get_batch_compress_instruction_account_metas() { - let fee_payer = Pubkey::new_unique(); - let authority = Pubkey::new_unique(); - let spl_interface_pda = Pubkey::new_unique(); - let sender_token_account = Pubkey::new_unique(); - let token_program = Pubkey::new_unique(); - let merkle_tree = Pubkey::new_unique(); - - let config = BatchCompressMetaConfig::new( - fee_payer, - authority, - spl_interface_pda, - sender_token_account, - token_program, - merkle_tree, - false, - ); - let default_pubkeys = TokenDefaultAccounts::default(); - - let account_metas = get_batch_compress_instruction_account_metas(config); - - let reference = light_compressed_token::accounts::MintToInstruction { - fee_payer, - authority, - cpi_authority_pda: Pubkey::from(CPI_AUTHORITY_PDA), - mint: None, - token_pool_pda: spl_interface_pda, - token_program, - light_system_program: Pubkey::from(LIGHT_SYSTEM_PROGRAM_ID), - registered_program_pda: Pubkey::from(REGISTERED_PROGRAM_PDA), - noop_program: Pubkey::from(NOOP_PROGRAM_ID), - account_compression_authority: default_pubkeys.account_compression_authority, - account_compression_program: Pubkey::from(ACCOUNT_COMPRESSION_PROGRAM_ID), - merkle_tree, - self_program: Pubkey::from(LIGHT_TOKEN_PROGRAM_ID), - system_program: Pubkey::default(), - sol_pool_pda: None, - }; - - let reference_metas = reference.to_account_metas(Some(true)); - assert_eq!(account_metas, reference_metas); -} diff --git a/sdk-libs/token-types/Cargo.toml b/sdk-libs/token-types/Cargo.toml index b1faf18196..2e773a14b5 100644 --- a/sdk-libs/token-types/Cargo.toml +++ b/sdk-libs/token-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "light-token-types" -version = "0.2.1" +version = "0.3.0" edition = "2021" description = "ctoken and compressed token types for Light Protocol" license = "Apache-2.0" @@ -18,7 +18,7 @@ idl-build = ["anchor-lang/idl-build", "anchor", "light-sdk-types/idl-build"] borsh = { workspace = true } light-macros = { workspace = true } anchor-lang = { workspace = true, optional = true } -light-sdk-types = { workspace = true } +light-sdk-types = { workspace = true, features = ["std"] } light-account-checks = { workspace = true } light-compressed-account = { workspace = true, features = ["std"] } thiserror = { workspace = true }