repo_id
stringclasses
279 values
file_path
stringlengths
43
179
content
stringlengths
1
4.18M
__index_level_0__
int64
0
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_pda/sdk.rs
#![cfg(not(target_os = "solana"))] use anchor_lang::{InstructionData, ToAccountMetas}; use light_compressed_token::{ process_transfer::get_cpi_authority_pda, process_transfer::{ transfer_sdk::{ create_inputs_and_remaining_accounts, create_inputs_and_remaining_accounts_checked, t...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_pda/withdrawal.rs
use anchor_lang::prelude::*; use light_compressed_token::process_transfer::{ CompressedTokenInstructionDataTransfer, InputTokenDataWithContext, PackedTokenTransferOutputData, }; use light_system_program::invoke::processor::CompressedProof; use crate::{ create_change_output_compressed_token_account, EscrowC...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_pda/mod.rs
pub mod escrow; pub mod sdk; pub mod withdrawal; pub use escrow::*;
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_pda/escrow.rs
use crate::create_change_output_compressed_token_account; use anchor_lang::prelude::*; use light_compressed_token::{ process_transfer::{ CompressedTokenInstructionDataTransfer, InputTokenDataWithContext, PackedTokenTransferOutputData, }, program::LightCompressedToken, }; use light_sdk::{ligh...
0
solana_public_repos/Lightprotocol/light-protocol/examples/node
solana_public_repos/Lightprotocol/light-protocol/examples/node/esm/package.json
{ "name": "stateless.js-node-client", "type": "module", "version": "0.1.0", "description": "Example node client for stateless.js", "main": "index.js", "scripts": { "build": "tsc", "test-validator": "./../../../cli/test_bin/run test-validator", "test": "pnpm test-validator && node dist/index.js" ...
0
solana_public_repos/Lightprotocol/light-protocol/examples/node
solana_public_repos/Lightprotocol/light-protocol/examples/node/esm/tsconfig.json
{ "compilerOptions": { "moduleResolution": "Node", "module": "ESNext", "outDir": "dist", "sourceMap": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true } }
0
solana_public_repos/Lightprotocol/light-protocol/examples/node/esm
solana_public_repos/Lightprotocol/light-protocol/examples/node/esm/src/index.ts
import { airdropSol, compress, createRpc } from "@lightprotocol/stateless.js"; import { Keypair } from "@solana/web3.js"; const rpc = createRpc(); const keypair = new Keypair(); (async () => { await airdropSol({ connection: rpc, lamports: 1e11, recipientPublicKey: keypair.publicKey, }); const tx = a...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/push-compressed-token-idl.sh
#!/usr/bin/env bash cd "$(git rev-parse --show-toplevel)" PDA_FILE="target/idl/light_system_program.json" TOKEN_FILE="target/idl/light_compressed_token.json" DEST_DIR="js/compressed-token/src/idl" TS_FILE="$DEST_DIR/light_compressed_token.ts" # ts output file path DEST_DIR_STATELESS="js/stateless.js/src/idls" TS_FIL...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/getAccountState.sh
#!/usr/bin/env bash # run this to regenerate the following accounts: # merkle_tree_pubkey # nullifier_queue_pubkey # governance_authority_pda # group_pda # # to add more accounts to regenerate, add them to setup_test_programs_with_accounts and test script cd test-programs/system-test && cargo test-sbf regenerate_acco...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/devenv.sh
#!/usr/bin/env bash # Command to deactivate the devenv. It sets the old environment variables. deactivate () { PS1="${LIGHT_PROTOCOL_OLD_PS1}" RUSTUP_HOME="${LIGHT_PROTOCOL_OLD_RUSTUP_HOME}" CARGO_HOME="${LIGHT_PROTOCOL_OLD_CARGO_HOME}" NPM_CONFIG_PREFIX="${LIGHT_PROTOCOL_OLD_NPM_CONFIG_PREFIX}" PA...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/install.sh
#!/usr/bin/env bash set -euo pipefail PREFIX="${PWD}/.local" INSTALL_LOG="${PREFIX}/.install_log" # Versions VERSIONS=( "go:1.21.7" "node:20.9.0" "pnpm:9.5.0" "solana:1.18.22" "anchor:anchor-v0.29.0" "jq:jq-1.7.1" "photon:0.50.0" ) # Architecture-specific suffixes SUFFIXES=( "go_Darw...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/lint.sh
#!/usr/bin/env bash set -e npx nx run-many --target=format:check --all npx nx run-many --target=lint --all cargo fmt --all -- --check cargo clippy \ --workspace \ --exclude photon-api \ --exclude name-service \ --exclude mixed-accounts \ -- -A clippy::result_large_err \ -A clipp...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/deploy-devnet.sh
# assumes that programs have been build with build-verifiable.sh # Creates buffer accounts # Buffer account addresses can be used in multisig action # Array of program names libraries=("account_compression" "light_compressed_token" "light_system_program" "light_registry") BUFFER_KEYPAIR_PATH="target/buffer" create_...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/release-all-rust-crates.sh
#!/usr/bin/env bash # Configuration CRATES_IO_TOKEN=${CRATES_IO_TOKEN} # Ensure cargo, git, and gh are installed command -v cargo >/dev/null 2>&1 || { echo >&2 "Cargo is not installed. Aborting."; exit 1; } command -v git >/dev/null 2>&1 || { echo >&2 "Git is not installed. Aborting."; exit 1; } command -v gh >/dev/n...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/push-stateless-js-idls.sh
#!/usr/bin/env bash cd "$(git rev-parse --show-toplevel)" SOURCE_DIR="./target/types" DEST_DIR="./js" DEST_DIR_STATELESS="$DEST_DIR/stateless.js/src/idls" FILES_TO_COPY=( "account_compression.ts" "light_system_program.ts" "light_registry.ts" ) # copy each type file into the respective location for FILE in...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/build.sh
#!/usr/bin/env bash command -v pnpm >/dev/null 2>&1 || { echo >&2 "pnpm is not installed. Aborting."; exit 1; } command -v npx >/dev/null 2>&1 || { echo >&2 "npx is not installed. Aborting."; exit 1; } . "./scripts/devenv.sh" || { echo >&2 "Failed to source devenv.sh. Aborting."; exit 1; } set -eux pnpm install |...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/clean.sh
#!/usr/bin/env bash find . -type d -name "test-ledger" -exec sh -c 'echo "Deleting {}"; rm -rf "{}"' \; npx nx reset
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/deploy.sh
# assumes that programs have been build with build-verifiable.sh # Creates buffer accounts # Buffer account addresses can be used in multisig action # Array of program names libraries=("account_compression" "light_compressed_token" "light_system_program" "light_registry") BUFFER_KEYPAIR_PATH="target/buffer" create_...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/tsc-create-r1cs.sh
#!/usr/bin/env bash # Ensure we're working from the root directory of the monorepo SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" REPO_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )" SEMAPHORE_MTB_SETUP="../semaphore-mtb-setup/semaphore-mtb-setup" cd "$REPO_ROOT" # Get phase 1 ptau file. # TODO: fix when extr...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/test.sh
#!/usr/bin/env bash . "./scripts/devenv.sh" || { echo >&2 "Failed to source devenv.sh. Aborting."; exit 1; } set -eux npx nx run-many --target=test --all --parallel=false
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/build-verifiable.sh
#!/usr/bin/env bash # Builds the verifiable solana-verify crate solana-verify build --library-name account_compression &&\ solana-verify build --library-name light_compressed_token &&\ solana-verify build --library-name light_system_program &&\ solana-verify build --library-name light_registry
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/coverage.sh
#!/usr/bin/env bash . "./scripts/devenv.sh" || { echo >&2 "Failed to source devenv.sh. Aborting."; exit 1; } set -eux export RUST_MIN_STACK=8388608 export RUSTFLAGS="-D warnings" ROOT_DIR=$(git rev-parse --show-toplevel) cargo llvm-cov \ --all-targets --workspace \ --exclude light-concurrent-merkle-tree \ --...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/bump-versions-and-publish-npm.sh
#!/usr/bin/env bash cd "$(git rev-parse --show-toplevel)" if ! command -v pnpm &> /dev/null; then echo "pnpm is not installed. Please install pnpm first." exit 1 fi get_package_dir() { case "$1" in "@lightprotocol/hasher.rs") echo "hasher.rs" ;; "@lightprotocol/stateless.js") echo "js/sta...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/scripts/format.sh
#!/usr/bin/env bash set -e npx nx run-many --target=format --all npx nx run-many --target=lint:fix --all cargo fmt --all cargo clippy \ --workspace \ --exclude name-service \ --exclude photon-api \ --exclude name-service \ -- -A clippy::result_large_err \ -A clippy::empty-docs ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/vitest.node.config.ts
import { defineConfig, mergeConfig } from 'vitest/config'; import viteConfig from './vitest.config'; export default mergeConfig(viteConfig, defineConfig({ resolve: { conditions: ["node-addons"] }, }));
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/rollup.config.js
import typescript from "@rollup/plugin-typescript"; import { wasm } from "@rollup/plugin-wasm"; import pkg from "./package.json"; import copy from "rollup-plugin-copy"; const outdir = (fmt, platform, inline) => { return `${platform}${inline ? `-${inline}` : ""}/${fmt}`; }; const rolls = (fmt, platform, inline) => (...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/package.json
{ "name": "@lightprotocol/hasher.rs", "version": "0.2.0", "description": "", "keywords": [], "author": "", "license": "ISC", "sideEffects": false, "type": "module", "main": "./dist/browser-fat/umd/index_browser_fat.js", "module": "./dist/browser-fat/es/index_browser_fat.js", "exports": { ".": ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/tsconfig.json
{ "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { "target": "ES2022", "noEmit": true, "module": "ES2022", "lib": ["dom", "ES2022"], "types": ["vitest/globals"], "declaration": true, "declarationDir": "dist/types", "strict": true, "mo...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/tsconfig.benches.json
{ "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { "outDir": "./lib", "rootDirs": ["src", "benches"], "baseUrl": "src", "esModuleInterop": true, "target": "ESNext", "module": "ESNext" }, "extends": "tsconfig.json", "include": ["benches"] }
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/vitest.config.ts
import { defineConfig } from 'vitest/config' export default defineConfig({ test: { globals: true, }, });
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/tests/wasm.test.ts
import { blake2b } from "@noble/hashes/blake2b"; import { WasmFactory } from ".."; import {BN} from "@coral-xyz/anchor"; function isNode() { return ( Object.prototype.toString.call( typeof process !== "undefined" ? process : 0 ) === "[object process]" ); } describe("Test hasher", (...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/benches/poseidon.test.ts
import {blake2str, poseidon} from "light-wasm"; import {BN} from "@coral-xyz/anchor"; import { blake2b } from "@noble/hashes/blake2b"; import * as circomlibjs from "circomlibjs"; import { Bench } from 'tinybench'; const bench = new Bench({ time: 5000 }); const circomPoseidon = await circomlibjs.buildPoseidonOpt(); be...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/benches/blake.test.ts
import { blake2b } from "@noble/hashes/blake2b"; import { Bench } from 'tinybench'; const bench = new Bench({ time: 1000 }); bench .add('@noble/hashes/blake2b', async () => { blake2b.create({ dkLen: 32 }).update("").digest(); }) await bench.run(); console.table(bench.table());
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/Cargo.toml
[package] name = "light-wasm-hasher" version = "1.1.0" edition = "2021" description = "WASM wrapper for blake2 and Poseidon hashing" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" [lib] crate-type = ["cdylib", "rlib"] [dependencies] wasm-bindgen = "0.2.89" light-poseidon = "0.2"...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/Cargo.lock
# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "bumpalo" version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "cfg-...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/src/lib.rs
mod hash; pub fn set_panic_hook() { // When the `console_error_panic_hook` feature is enabled, we can call the // `set_panic_hook` function at least once during initialization, and then // we will get better error messages if our code ever panics. // // For more details see // https://github.com...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/src/hash/blake2.rs
use blake2b_simd::Params; use wasm_bindgen::prelude::wasm_bindgen; #[wasm_bindgen(js_name = blake2str)] pub fn blake2_string(input: String, hash_length: usize) -> Vec<u8> { Params::new() .hash_length(hash_length) .hash(input.as_bytes()) .as_bytes() .to_vec() } #[wasm_bindgen(js_nam...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/src/hash/mod.rs
pub mod blake2; pub mod poseidon;
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/wasm/src/hash/poseidon.rs
use ark_bn254::Fr; use js_sys::{Array, Uint8Array}; use light_poseidon::{Poseidon, PoseidonBytesHasher, PoseidonError}; use num_bigint::BigUint; use wasm_bindgen::{prelude::wasm_bindgen, JsValue}; use crate::set_panic_hook; #[wasm_bindgen] pub fn poseidon(inputs: &Array) -> Result<Uint8Array, JsValue> { set_panic...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/main/index_browser_fat.ts
export type { LightWasm, LightWasmCreator, HasherLoadOptions } from "./model.js"; export { WasmFactory, hasSimd as hasWasmSimd } from "./wasm.js"; import wasm from "./wasm/light_wasm_hasher_bg.wasm"; import wasmSimd from "./wasm-simd/hasher_wasm_simd_bg.wasm"; import { setWasmInit, setWasmSimdInit } from "./wasm.js"; ...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/main/index_node.ts
export type { LightWasm, LightWasmCreator, HasherLoadOptions } from "./model.js"; export { WasmFactory, hasSimd as hasWasmSimd } from "./wasm.js"; import wasm from "./wasm/light_wasm_hasher_bg.wasm"; import wasmSimd from "./wasm-simd/hasher_wasm_simd_bg.wasm"; import { setWasmInit, setWasmSimdInit } from "./wasm.js"; ...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/main/wasm.ts
import type { LightWasmCreator, LightWasm, InitInput, WasmInput, HasherLoadOptions, } from "./model.js"; import init, { blake2 as blake2Wasm, blake2str as blake2strWasm, poseidon as poseidonWasm, } from "./wasm/light_wasm_hasher"; import simdInit, { blake2 as blake2Simd, blake2str as blake2strSimd,...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/main/model.ts
import { BN } from "@coral-xyz/anchor"; export interface LightWasm { blakeHash(input: string | Uint8Array, hashLength: number): Uint8Array; poseidonHash(input: string[] | BN[]): Uint8Array; poseidonHashString(input: string[] | BN[]): string; poseidonHashBN(input: string[] | BN[]): BN; } export interface Light...
0
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src
solana_public_repos/Lightprotocol/light-protocol/hasher.rs/src/main/index_browser_slim.ts
export type { LightWasm, LightWasmCreator, HasherLoadOptions } from "./model.js"; export { WasmFactory, hasSimd as hasWasmSimd } from "./wasm.js";
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester/Cargo.toml
[package] name = "forester" version = "1.1.0" edition = "2021" [dependencies] config = "0.14.0" anchor-lang = { workspace = true } clap = {version = "4.5.9", features = ["derive", "env"]} solana-sdk = { workspace = true } solana-client = { workspace = true } solana-transaction-status = { workspace = true } solana-acco...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester/Dockerfile
FROM rust:1.79 AS builder WORKDIR /app RUN apt-get update && apt install -y clang lld COPY .. . RUN cargo build --release --package forester FROM debian:12-slim RUN apt-get update && apt-get install -y ca-certificates libssl-dev && rm -rf /var/lib/apt/lists/* RUN mkdir -p /app/config COPY --from=builder /app/target/re...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester/Cargo.lock
# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "Inflector" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" dependencies = [ "lazy...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester/README.md
# Light Forester ## Description Forester is a service for nullifying the state and address merkle trees. It subscribes to the nullifier queue and nullifies merkle tree leaves. ## Configuration Forester requires a configuration file, `forester.toml`, specifying necessary keys: - `STATE_MERKLE_TREE_PUBKEY`: Address o...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester/.dockerignore
**/*.log .git/ **/test-ledger/ **/logs/ target **/target/ node_modules **/node_modules Dockerfile .dockerignore .git
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester/package.json
{ "name": "@lightprotocol/forester", "version": "0.3.0", "license": "GPL-3.0", "scripts": { "build": "cargo build", "test": "RUSTFLAGS=\"--cfg tokio_unstable -D warnings\" cargo test --package forester -- --test-threads=1 --nocapture", "docker:build": "docker build --tag forester -f Dockerfile .." ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester/.env.example
export FORESTER_RPC_URL="http://localhost:8899" export FORESTER_WS_RPC_URL="ws://localhost:8900" export FORESTER_INDEXER_URL="http://localhost:8784" export FORESTER_PROVER_URL="http://localhost:3001" export FORESTER_PUSH_GATEWAY_URL="http://localhost:9092/metrics/job/forester" export FORESTER_PAYER=[1, 2, 3, 4, 5, 6, 7...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/tests/e2e_test.rs
use account_compression::utils::constants::{ADDRESS_QUEUE_VALUES, STATE_NULLIFIER_QUEUE_VALUES}; use account_compression::AddressMerkleTreeAccount; use forester::queue_helpers::fetch_queue_item_data; use forester::run_pipeline; use forester::utils::get_protocol_config; use forester_utils::indexer::{AddressMerkleTreeAcc...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/tests/test_utils.rs
use account_compression::initialize_address_merkle_tree::Pubkey; use forester::config::{ExternalServicesConfig, GeneralConfig}; use forester::metrics::register_metrics; use forester::photon_indexer::PhotonIndexer; use forester::telemetry::setup_telemetry; use forester::ForesterConfig; use forester_utils::indexer::{Inde...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/telemetry.rs
use env_logger::Env; use std::sync::Once; use tracing_appender::rolling::{RollingFileAppender, Rotation}; use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer}; static INIT: Once = Once::new(); pub fn setup_telemetry() { INIT.call_once(|| { let file_appender = Roll...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/photon_indexer.rs
use crate::utils::decode_hash; use account_compression::initialize_address_merkle_tree::Pubkey; use forester_utils::indexer::{Indexer, IndexerError, MerkleProof, NewAddressProofWithContext}; use light_client::rpc::RpcConnection; use photon_api::apis::configuration::{ApiKey, Configuration}; use photon_api::models::{Addr...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/slot_tracker.rs
use light_client::rpc::RpcConnection; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::UNIX_EPOCH; use std::{sync::Arc, time::SystemTime}; use tokio::time::{sleep, Duration}; use tracing::{debug, error}; pub fn slot_duration() -> Duration { Duration::from_nanos(solana_sdk::genesis_config::GenesisConfig...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/forester_status.rs
use anchor_lang::{AccountDeserialize, Discriminator}; use forester_utils::forester_epoch::TreeType; use light_client::rpc::{RpcConnection, SolanaRpcConnection}; use light_registry::{protocol_config::state::ProtocolConfigPda, EpochPda, ForesterEpochPda}; use solana_sdk::{account::ReadableAccount, commitment_config::Comm...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/config.rs
use crate::cli::{StartArgs, StatusArgs}; use crate::errors::ForesterError; use account_compression::initialize_address_merkle_tree::Pubkey; use account_compression::utils::constants::{ADDRESS_QUEUE_VALUES, STATE_NULLIFIER_QUEUE_VALUES}; use anchor_lang::Id; use forester_utils::forester_epoch::{Epoch, TreeAccounts, Tree...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/lib.rs
pub type Result<T> = std::result::Result<T, ForesterError>; pub mod cli; pub mod config; pub mod epoch_manager; pub mod errors; pub mod forester_status; pub mod metrics; pub mod pagerduty; pub mod photon_indexer; pub mod pubsub_client; pub mod queue_helpers; pub mod rollover; pub mod send_transaction; mod slot_tracker...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/pubsub_client.rs
use crate::errors::ForesterError; use crate::queue_helpers::QueueUpdate; use crate::ForesterConfig; use crate::Result; use account_compression::initialize_address_merkle_tree::Pubkey; use futures::StreamExt; use solana_account_decoder::UiAccountEncoding; use solana_client::nonblocking::pubsub_client::PubsubClient; use ...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/metrics.rs
use crate::Result; use lazy_static::lazy_static; use prometheus::{Encoder, GaugeVec, IntCounterVec, IntGauge, IntGaugeVec, Registry, TextEncoder}; use reqwest::Client; use std::sync::Once; use std::time::{SystemTime, UNIX_EPOCH}; use tokio::sync::Mutex; use tracing::{debug, error}; lazy_static! { pub static ref RE...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/queue_helpers.rs
use crate::{errors::ForesterError, Result}; use account_compression::initialize_address_merkle_tree::Pubkey; use account_compression::QueueAccount; use light_client::rpc::RpcConnection; use light_hash_set::HashSet; use std::mem; use tracing::debug; #[derive(Debug, Clone)] pub struct QueueItemData { pub hash: [u8; ...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/pagerduty.rs
use reqwest::Client; use serde::Serialize; use std::time::Duration; #[derive(Debug, Serialize)] struct PagerDutyPayload { routing_key: String, event_action: String, payload: PagerDutyAlertPayload, } #[derive(Debug, Serialize)] struct PagerDutyAlertPayload { summary: String, severity: String, s...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/errors.rs
use account_compression::initialize_address_merkle_tree::Error as AccountCompressionError; use config::ConfigError; use forester_utils::indexer::IndexerError; use light_client::rpc::errors::RpcError; use light_client::rpc_pool::PoolError; use light_hash_set::HashSetError; use photon_api::apis::{default_api::GetCompress...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/send_transaction.rs
use crate::config::QueueConfig; use crate::epoch_manager::{MerkleProofType, WorkItem}; use crate::errors::ForesterError; use crate::queue_helpers::fetch_queue_item_data; use crate::Result; use account_compression::utils::constants::{ ADDRESS_MERKLE_TREE_CHANGELOG, ADDRESS_MERKLE_TREE_INDEXED_CHANGELOG, ADDRESS_QUEU...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/main.rs
use clap::Parser; use forester::cli::{Cli, Commands}; use forester::errors::ForesterError; use forester::metrics::register_metrics; use forester::photon_indexer::PhotonIndexer; use forester::telemetry::setup_telemetry; use forester::{forester_status, run_pipeline, ForesterConfig}; use light_client::rpc::{RpcConnection,...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/tree_finder.rs
use crate::tree_data_sync::fetch_trees; use crate::Result; use forester_utils::forester_epoch::TreeAccounts; use light_client::rpc::RpcConnection; use light_client::rpc_pool::SolanaRpcPool; use std::sync::Arc; use tokio::sync::broadcast; use tokio::time::{interval, Duration}; use tracing::{debug, error, info}; pub str...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/tree_data_sync.rs
use crate::Result; use account_compression::utils::check_discrimininator::check_discriminator; use account_compression::{AddressMerkleTreeAccount, MerkleTreeMetadata, StateMerkleTreeAccount}; use borsh::BorshDeserialize; use forester_utils::forester_epoch::{TreeAccounts, TreeType}; use light_client::rpc::RpcConnection;...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/utils.rs
use light_client::rpc::RpcConnection; use light_registry::protocol_config::state::{ProtocolConfig, ProtocolConfigPda}; use light_registry::utils::get_protocol_config_pda_address; use std::time::{SystemTime, UNIX_EPOCH}; use tracing::debug; pub fn decode_hash(account: &str) -> [u8; 32] { let bytes = bs58::decode(ac...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/cli.rs
use clap::{Parser, Subcommand}; #[derive(Parser)] #[clap(author, version, about, long_about = None)] pub struct Cli { #[command(subcommand)] pub command: Commands, } #[allow(clippy::large_enum_variant)] #[derive(Subcommand)] pub enum Commands { Start(StartArgs), Status(StatusArgs), } #[derive(Parser,...
0
solana_public_repos/Lightprotocol/light-protocol/forester
solana_public_repos/Lightprotocol/light-protocol/forester/src/epoch_manager.rs
use crate::errors::ForesterError; use crate::queue_helpers::QueueItemData; use crate::rollover::{ is_tree_ready_for_rollover, rollover_address_merkle_tree, rollover_state_merkle_tree, }; use crate::send_transaction::{ send_batched_transactions, BuildTransactionBatchConfig, EpochManagerTransactions, SendBatc...
0
solana_public_repos/Lightprotocol/light-protocol/forester/src
solana_public_repos/Lightprotocol/light-protocol/forester/src/rollover/mod.rs
mod operations; mod state; pub use operations::{ get_tree_fullness, is_tree_ready_for_rollover, rollover_address_merkle_tree, rollover_state_merkle_tree, }; pub use state::RolloverState;
0
solana_public_repos/Lightprotocol/light-protocol/forester/src
solana_public_repos/Lightprotocol/light-protocol/forester/src/rollover/state.rs
use std::sync::atomic::{AtomicBool, Ordering}; #[derive(Debug)] pub struct RolloverState { is_rollover_in_progress: AtomicBool, } impl RolloverState { pub fn new() -> Self { Self { is_rollover_in_progress: AtomicBool::new(false), } } pub fn try_start_rollover(&self) -> boo...
0
solana_public_repos/Lightprotocol/light-protocol/forester/src
solana_public_repos/Lightprotocol/light-protocol/forester/src/rollover/operations.rs
use std::sync::Arc; use light_registry::account_compression_cpi::sdk::{ create_rollover_address_merkle_tree_instruction, create_rollover_state_merkle_tree_instruction, CreateRolloverMerkleTreeInstructionInputs, }; use light_registry::protocol_config::state::ProtocolConfig; use solana_sdk::instruction::Instruct...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/xtask/Cargo.toml
[package] name = "xtask" version = "1.1.0" edition = "2021" [dependencies] account-compression = { workspace = true } anyhow = "1.0" ark-bn254 = "0.4" ark-ff = "0.4" clap = { version = "4", features = ["derive"] } groth16-solana = "0.0.3" light-concurrent-merkle-tree = { path = "../merkle-tree/concurrent", version = "...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/fee.rs
use account_compression::{ state::queue::QueueAccount, utils::constants::{ ADDRESS_MERKLE_TREE_HEIGHT, ADDRESS_QUEUE_VALUES, STATE_MERKLE_TREE_HEIGHT, STATE_NULLIFIER_QUEUE_VALUES, }, AddressMerkleTreeAccount, StateMerkleTreeAccount, StateMerkleTreeConfig, }; use light_utils::fee::comput...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/create_vkeyrs_from_gnark_key.rs
use clap::Parser; use groth16_solana::groth16::Groth16Verifyingkey; use light_utils::rustfmt; use quote::quote; use std::{ fs::{self, File}, io::{self, prelude::*}, path::{Path, PathBuf}, }; #[derive(Debug, Parser)] pub struct Options { #[clap(long)] output_path: PathBuf, #[clap(long)] inpu...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/zero_bytes.rs
use std::{fs::File, io::prelude::*, path::PathBuf}; use clap::Parser; use light_hasher::{zero_bytes::MAX_HEIGHT, Hasher, Keccak, Poseidon, Sha256}; use light_utils::rustfmt; use quote::quote; use crate::Hash; #[derive(Debug, Parser)] pub struct Options { #[clap(value_enum, long, default_value_t = Hash::Sha256)] ...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/main.rs
use clap::{Parser, ValueEnum}; mod bench; mod create_vkeyrs_from_gnark_key; mod fee; mod hash_set; mod type_sizes; mod zero_bytes; mod zero_indexed_leaf; #[derive(Debug, Clone, ValueEnum)] enum Hash { Keccak, Poseidon, Sha256, } #[derive(Parser)] pub struct XtaskOptions { #[clap(subcommand)] comm...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/zero_indexed_leaf.rs
use std::{fs::File, io::prelude::*, mem, path::PathBuf}; use clap::Parser; use light_hasher::{Hasher, Keccak, Poseidon, Sha256}; use light_utils::rustfmt; use quote::quote; use crate::Hash; #[derive(Debug, Parser)] pub struct Options { #[clap(value_enum, long, default_value_t = Hash::Sha256)] hash: Hash, ...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/type_sizes.rs
use std::mem; use account_compression::{ state::queue::QueueAccount, utils::constants::{ ADDRESS_MERKLE_TREE_CANOPY_DEPTH, ADDRESS_MERKLE_TREE_CHANGELOG, ADDRESS_MERKLE_TREE_HEIGHT, ADDRESS_MERKLE_TREE_INDEXED_CHANGELOG, ADDRESS_MERKLE_TREE_ROOTS, ADDRESS_QUEUE_VALUES, STATE_MERKLE_TREE...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/bench.rs
use clap::{ArgAction, Parser}; use std::collections::HashMap; use std::io::{BufRead, BufReader}; use std::process::{Command, Stdio}; use std::{fs::File, io::prelude::*}; use tabled::{Table, Tabled}; pub const DESTINATION: &str = "target/"; #[derive(Debug, Parser)] pub struct Options { /// Select the test to run. ...
0
solana_public_repos/Lightprotocol/light-protocol/xtask
solana_public_repos/Lightprotocol/light-protocol/xtask/src/hash_set.rs
use ark_bn254::Fr; use ark_ff::UniformRand; use clap::Parser; use light_hash_set::HashSet; use light_utils::prime::find_next_prime_with_load_factor; use num_bigint::BigUint; use rand::thread_rng; use tabled::{Table, Tabled}; #[derive(Parser)] pub struct HashSetOptions { #[clap(subcommand)] command: Command, } ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/forester-utils/Cargo.toml
[package] name = "forester-utils" version = "1.2.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/lightprotocol/light-protocol" description = "Utility library for Light's Forester node implementation" [dependencies] # Light Protocol account-compression = { workspace = true } light-compressed...
0
solana_public_repos/Lightprotocol/light-protocol/forester-utils
solana_public_repos/Lightprotocol/light-protocol/forester-utils/src/registry.rs
use crate::address_merkle_tree_config::{get_address_bundle_config, get_state_bundle_config}; use crate::create_account_instruction; use account_compression::{ AddressMerkleTreeConfig, AddressQueueConfig, NullifierQueueConfig, QueueAccount, StateMerkleTreeConfig, }; use crate::indexer::{AddressMerkleTreeAccount...
0
solana_public_repos/Lightprotocol/light-protocol/forester-utils
solana_public_repos/Lightprotocol/light-protocol/forester-utils/src/lib.rs
use account_compression::initialize_address_merkle_tree::Pubkey; use anchor_lang::solana_program::instruction::Instruction; use anchor_lang::solana_program::system_instruction; use light_client::rpc::{RpcConnection, RpcError}; use light_concurrent_merkle_tree::copy::ConcurrentMerkleTreeCopy; use light_hash_set::HashSet...
0
solana_public_repos/Lightprotocol/light-protocol/forester-utils
solana_public_repos/Lightprotocol/light-protocol/forester-utils/src/forester_epoch.rs
use std::fmt::Display; // TODO: move into separate forester utils crate use anchor_lang::{ prelude::borsh, solana_program::pubkey::Pubkey, AnchorDeserialize, AnchorSerialize, }; use light_client::rpc::{RpcConnection, RpcError}; use light_registry::{ protocol_config::state::{EpochState, ProtocolConfig}, sdk:...
0
solana_public_repos/Lightprotocol/light-protocol/forester-utils
solana_public_repos/Lightprotocol/light-protocol/forester-utils/src/address_merkle_tree_config.rs
use crate::{ get_concurrent_merkle_tree, get_hash_set, get_indexed_merkle_tree, indexer::{AddressMerkleTreeAccounts, StateMerkleTreeAccounts}, AccountZeroCopy, }; use account_compression::{ AddressMerkleTreeAccount, AddressMerkleTreeConfig, AddressQueueConfig, NullifierQueueConfig, QueueAccount, Sta...
0
solana_public_repos/Lightprotocol/light-protocol/forester-utils/src
solana_public_repos/Lightprotocol/light-protocol/forester-utils/src/indexer/mod.rs
use num_bigint::BigUint; use solana_sdk::signature::Keypair; use std::fmt::Debug; use account_compression::initialize_address_merkle_tree::{ Error as AccountCompressionError, Pubkey, }; use light_client::rpc::RpcConnection; use light_compressed_token::TokenData; use light_hash_set::HashSetError; use light_hasher::...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/assets/logo.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg width="153.5" height="153.5" viewBox="0 0 153.5 153.5" fill="none" version="1.1" id="svg68" sodipodi:docname="logo.svg" inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/client/Cargo.toml
[package] name = "light-client" version = "0.9.1" edition = "2021" license = "Apache-2.0" repository = "https://github.com/lightprotocol/light-protocol" description = "Client library for Light Protocol" [features] devenv = [] [dependencies] # Solana solana-banks-client = { workspace = true } solana-client = { workspa...
0
solana_public_repos/Lightprotocol/light-protocol/client
solana_public_repos/Lightprotocol/light-protocol/client/tests/rpc_client.rs
use light_client::photon_rpc::Base58Conversions; use light_client::photon_rpc::Hash; use light_client::{ photon_rpc::{AddressWithTree, PhotonClient}, rpc::SolanaRpcConnection, }; use light_compressed_token::mint_sdk::{ create_create_token_pool_instruction, create_mint_to_instruction, }; use light_program_te...
0
solana_public_repos/Lightprotocol/light-protocol/client
solana_public_repos/Lightprotocol/light-protocol/client/src/lib.rs
pub mod indexer; pub mod photon_rpc; pub mod rpc; pub mod rpc_pool; pub mod transaction_params;
0
solana_public_repos/Lightprotocol/light-protocol/client
solana_public_repos/Lightprotocol/light-protocol/client/src/rpc_pool.rs
use async_trait::async_trait; use bb8::{Pool, PooledConnection}; use solana_sdk::commitment_config::CommitmentConfig; use std::time::Duration; use thiserror::Error; use tokio::time::sleep; use crate::rpc::{RpcConnection, RpcError}; #[derive(Error, Debug)] pub enum PoolError { #[error("Failed to create RPC client:...
0
solana_public_repos/Lightprotocol/light-protocol/client
solana_public_repos/Lightprotocol/light-protocol/client/src/transaction_params.rs
#[derive(Debug, Clone, PartialEq)] pub struct TransactionParams { pub num_input_compressed_accounts: u8, pub num_output_compressed_accounts: u8, pub num_new_addresses: u8, pub compress: i64, pub fee_config: FeeConfig, } #[derive(Debug, Clone, PartialEq)] pub struct FeeConfig { pub state_merkle_...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/photon_rpc/types.rs
use solana_sdk::{bs58, pubkey::Pubkey}; use super::PhotonClientError; pub type Address = [u8; 32]; pub type Hash = [u8; 32]; pub struct AddressWithTree { pub address: Address, pub tree: Pubkey, } pub trait Base58Conversions { fn to_base58(&self) -> String; fn from_base58(s: &str) -> Result<Self, Pho...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/photon_rpc/error.rs
use photon_api::{ apis::{ default_api::{ GetCompressedAccountPostError, GetCompressedAccountProofPostError, GetLatestCompressionSignaturesPostError, GetMultipleCompressedAccountProofsPostError, GetMultipleNewAddressProofsV2PostError, GetTransactionWithCompressionInfoPostE...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/photon_rpc/models.rs
use crate::photon_rpc::types::{Base58Conversions, Hash}; #[derive(Debug)] pub struct CompressedAccount { pub hash: Hash, pub data: String, pub owner: String, pub lamports: u64, pub executable: bool, pub rent_epoch: u64, } #[derive(Debug)] pub struct TokenAccountBalance { pub amount: String...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/photon_rpc/photon_client.rs
use crate::indexer::{MerkleProof, NewAddressProofWithContext}; use photon_api::{ apis::configuration::{ApiKey, Configuration}, models::GetCompressedAccountsByOwnerPostRequestParams, }; use solana_sdk::{bs58, pubkey::Pubkey}; use super::types::AddressWithTree; use super::{ models::{AccountBalanceResponse, C...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/photon_rpc/mod.rs
mod error; mod models; mod photon_client; mod types; pub use error::PhotonClientError; pub use models::{AccountBalance, CompressedAccount, CompressedAccountResponse}; pub use models::{TokenAccountBalance, TokenAccountBalanceResponse}; pub use photon_client::PhotonClient; pub use types::{Address, AddressWithTree, Base5...
0