repo_id
stringclasses
563 values
file_path
stringlengths
40
166
content
stringlengths
1
2.94M
__index_level_0__
int64
0
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/.eslintrc.json
{ "extends": "next/core-web-vitals" }
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/public/vercel.svg
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-1...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/public/next.svg
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/page.module.css
.main { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 6rem; min-height: 100vh; } .description { display: inherit; justify-content: inherit; align-items: inherit; font-size: 0.85rem; max-width: var(--max-width); width: 100%; z-index: 2; ...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/layout.tsx
import type { Metadata } from 'next'; import { Inter } from 'next/font/google'; import './globals.css'; const inter = Inter({ subsets: ['latin'] }); export const metadata: Metadata = { title: 'Create Next App', description: 'Generated by create next app', }; export default function RootLayout({ children,...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/page.tsx
'use client'; import React, { FC, useCallback, useMemo } from 'react'; import { ComputeBudgetProgram, Keypair, TransactionMessage, VersionedTransaction, } from '@solana/web3.js'; import { ConnectionProvider, WalletProvider, useWallet, } from '@solana/wallet-adapter-react'; import { WalletNo...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/globals.css
:root { --max-width: 1100px; --border-radius: 12px; --font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace; --foreground-rgb: 0, 0, 0; --background-start-...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/.prettierignore
.anchor .DS_Store target node_modules dist build test-ledger
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/Anchor.toml
[toolchain] [features] seeds = false skip-lint = false [programs.localnet] token_escrow = "GRLu2hKaAiMbxpkAM1HeXzks9YeGuz18SEgXEizVvPqX" [programs.testnet] token_escrow = "GRLu2hKaAiMbxpkAM1HeXzks9YeGuz18SEgXEizVvPqX" [registry] url = "https://api.apr.dev" [provider] cluster = "testnet" wallet = "$HOME/.config/sol...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/package.json
{ "scripts": { "lint:fix": "prettier \"*/**/*{.js,.ts}\" -w", "lint": "prettier \"*/**/*{.js,.ts}\" --check", "test": "cargo test-sbf -p token-escrow -- --test-threads=1" }, "dependencies": { "@coral-xyz/anchor": "0.29.0" }, "devDependencies": { "chai": "^5.1.2", "mocha": "^10.7.3", ...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/tsconfig.json
{ "compilerOptions": { "types": ["mocha", "chai"], "typeRoots": ["./node_modules/@types"], "lib": ["es2015"], "module": "commonjs", "target": "es6", "esModuleInterop": true } }
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/migrations/deploy.ts
// Migrations are an early feature. Currently, they're nothing more than this // single deploy script that's invoked from the CLI, injecting a provider // configured from the workspace's Anchor.toml. const anchor = require("@coral-xyz/anchor"); module.exports = async function (provider) { // Configure client to use...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/tests/token-escrow.ts
import * as anchor from "@coral-xyz/anchor"; import { Program } from "@coral-xyz/anchor"; import { TokenEscrow } from "../target/types/token_escrow"; describe("token-escrow", () => { // Configure the client to use the local cluster. anchor.setProvider(anchor.AnchorProvider.env()); const program = anchor.workspa...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/Cargo.toml
[package] name = "token-escrow" version = "0.9.0" description = "Solana escrow implementation using account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "token_escrow" [features] no-entrypoint = [] no-lo...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/tests/test.rs
#![cfg(feature = "test-sbf")] // TODO: extend this example with a swap function // TODO: implement a version with delegate and approve // 1. escrow tokens with pda // create test env // create mint and mint tokens // escrow compressed tokens - with normal pda // - transfer tokens to compressed token account owned by p...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/tests/test_compressed_pda.rs
#![cfg(feature = "test-sbf")] // 2. escrow tokens with compressed pda // create test env // create mint and mint tokens // escrow compressed tokens - with compressed pda // release compressed tokens // TODO: 3. escrow tokens by decompression with compressed pda // this design pattern can be used to use compressed acc...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/lib.rs
#![allow(clippy::too_many_arguments)] use anchor_lang::prelude::*; use anchor_lang::solana_program::pubkey::Pubkey; use light_compressed_token::process_transfer::InputTokenDataWithContext; use light_compressed_token::process_transfer::PackedTokenTransferOutputData; use light_system_program::invoke::processor::Compresse...
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_compressed_pda/sdk.rs
#![cfg(not(target_os = "solana"))] use crate::escrow_with_compressed_pda::escrow::PackedInputCompressedPda; use anchor_lang::{InstructionData, ToAccountMetas}; use light_compressed_token::process_transfer::{ get_cpi_authority_pda, transfer_sdk::{create_inputs_and_remaining_accounts_checked, to_account_metas}, ...
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_compressed_pda/withdrawal.rs
use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::prelude::*; use light_compressed_token::process_transfer::{ CompressedTokenInstructionDataTransfer, InputTokenDataWithContext, PackedTokenTransferOutputData, }; use light_hasher::{DataHasher, Poseidon}; use light_sdk::verify::ve...
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_compressed_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_compressed_pda/escrow.rs
use crate::{create_change_output_compressed_token_account, program::TokenEscrow, EscrowTimeLock}; use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::prelude::*; use light_compressed_token::{ process_transfer::{ CompressedTokenInstructionDataTransfer, InputTokenDataWithContex...
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/.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