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/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
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/rpc/solana_rpc.rs
use crate::rpc::errors::RpcError; use crate::rpc::rpc_connection::RpcConnection; use crate::transaction_params::TransactionParams; use async_trait::async_trait; use borsh::BorshDeserialize; use log::warn; use solana_client::rpc_client::RpcClient; use solana_client::rpc_config::{RpcSendTransactionConfig, RpcTransactionC...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/rpc/mod.rs
pub mod errors; pub mod merkle_tree; pub mod rpc_connection; pub mod solana_rpc; pub use errors::{assert_rpc_error, RpcError}; pub use rpc_connection::RpcConnection; pub use solana_rpc::{RetryConfig, SolanaRpcConnection};
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/rpc/rpc_connection.rs
use crate::rpc::errors::RpcError; use crate::transaction_params::TransactionParams; use async_trait::async_trait; use borsh::BorshDeserialize; use solana_program::clock::Slot; use solana_program::instruction::Instruction; use solana_sdk::account::{Account, AccountSharedData}; use solana_sdk::commitment_config::Commitme...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/rpc/errors.rs
use solana_banks_client::BanksClientError; use solana_client::client_error::ClientError; use solana_program::instruction::InstructionError; use solana_sdk::transaction::TransactionError; use std::io; use thiserror::Error; #[derive(Error, Debug)] pub enum RpcError { #[error("BanksError: {0}")] BanksError(#[from...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/rpc/merkle_tree.rs
use std::mem; use async_trait::async_trait; use light_concurrent_merkle_tree::{ copy::ConcurrentMerkleTreeCopy, errors::ConcurrentMerkleTreeError, light_hasher::Poseidon, }; use light_indexed_merkle_tree::{copy::IndexedMerkleTreeCopy, errors::IndexedMerkleTreeError}; use light_sdk::state::MerkleTreeMetadata; use s...
0
solana_public_repos/Lightprotocol/light-protocol/client/src
solana_public_repos/Lightprotocol/light-protocol/client/src/indexer/mod.rs
use std::{fmt::Debug, future::Future}; use light_concurrent_merkle_tree::light_hasher::Poseidon; use light_indexed_merkle_tree::{ array::{IndexedArray, IndexedElement}, reference::IndexedMerkleTree, }; use light_merkle_tree_reference::MerkleTree; use light_sdk::{ compressed_account::CompressedAccountWithMe...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-prover/bench.sh
#!/usr/bin/env sh DEPTH="26" URL="http://localhost:3001/prove" gnark() { local args=("$@") ./light-prover "${args[@]}" } generate_and_test() { local compressedAccounts=$1 mkdir -p circuits CIRCUIT_FILE="/tmp/circuit_${DEPTH}_${compressedAccounts}.key" TEST_FILE="/tmp/inputs_${DEPTH}_${compres...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-prover/go.mod
module light/light-prover go 1.21 require ( github.com/consensys/gnark v0.8.0 github.com/gorilla/handlers v1.5.2 github.com/iden3/go-iden3-crypto v0.0.13 github.com/reilabs/gnark-lean-extractor/v2 v2.4.0-0.8.0 github.com/urfave/cli/v2 v2.10.2 ) require ( github.com/blang/semver/v4 v4.0.0 // indirect github.co...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-prover/LICENSE
MIT License Copyright (c) 2023 Worldcoin Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publi...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-prover/Dockerfile
FROM golang:1.20.3-alpine as builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download && go mod verify COPY . . ENV CGO_ENABLED=0 RUN go build -v -o /usr/local/bin/light-prover . FROM gcr.io/distroless/base-debian11:nonroot COPY --from=builder /usr/local/bin/light-prover /usr/local/bin/light-prover COPY --f...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-prover/go.sum
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6b...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-prover/integration_test.go
package main_test import ( "bytes" "io" "light/light-prover/logging" "light/light-prover/prover" "light/light-prover/server" "math/big" "net/http" "os" "strings" "testing" "time" gnarkLogger "github.com/consensys/gnark/logger" ) var isLightweightMode bool const ProverAddress = "localhost:8081" const Met...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-prover/main.go
package main import ( "bytes" _ "embed" "encoding/json" "fmt" "io" "light/light-prover/logging" "light/light-prover/prover" "light/light-prover/server" "os" "os/signal" "path/filepath" "github.com/consensys/gnark/constraint" gnarkLogger "github.com/consensys/gnark/logger" "github.com/urfave/cli/v2" ) f...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/merkle-tree/zero_bytes.go
package merkle_tree var ZERO_BYTES = [33][32]byte{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, { 32, 152, 245, 251, 158, 35, 158, 171, 60, 234, 195, 242, 123, 129, 228, 129, 220, 49, 36, 213, 95, 254, 213, 35, 168, 57, 238, 132, 70, 182, 72, 100, }...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/merkle-tree/indexed_merkle_tree_test.go
package merkle_tree import ( "fmt" "math/big" "testing" "github.com/stretchr/testify/require" ) func TestIndexedMerkleTreeInit(t *testing.T) { expectedRoot := []byte{33, 133, 56, 184, 142, 166, 110, 161, 4, 140, 169, 247, 115, 33, 15, 181, 76, 89, 48, 126, 58, 86, 204, 81, 16, 121, 185, 77, 75, 152, 43, 15} t...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/merkle-tree/merkle_tree_test.go
package merkle_tree import ( "fmt" "math/big" "testing" "github.com/consensys/gnark/test" ) func TestSubtrees(t *testing.T) { assert := test.NewAssert(t) treeDepth := 4 tree := NewTree(int(treeDepth)) subtrees := tree.GetRightmostSubtrees(int(treeDepth)) fmt.Println("Initial subtrees:") for i := 1; i < len...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/merkle-tree/merkle_tree.go
package merkle_tree import ( "fmt" "math/big" "github.com/iden3/go-iden3-crypto/poseidon" ) type PoseidonNode interface { Depth() int Value() big.Int Bytes() []byte withValue(index int, val big.Int) PoseidonNode writeProof(index int, out []big.Int) } func (node *PoseidonFullNode) Depth() int { return node....
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/merkle-tree/indexed_merkle_tree.go
package merkle_tree import ( "encoding/binary" "fmt" "math/big" "github.com/iden3/go-iden3-crypto/poseidon" ) type IndexedArray struct { Elements []IndexedElement CurrentNodeIndex uint32 HighestNodeIndex uint32 } type IndexedElement struct { Value *big.Int NextValue *big.Int NextIndex uint32 ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/test-data/non_inclusion.csv
1;{"new-addresses":[{"root":"0x133ec861cbeb15d0ac67f868cddf1850f1d544846075c961b348a0d369871694","value":"0x179","pathIndex":3,"pathElements":["0x0","0x2098f5fb9e239eab3ceac3f27b81e481dc3124d55ffed523a839ee8446b64864","0x1069673dcdb12263df301a6ff584a7ec261a44cb9dc68df067a4774460b1f1e1","0x18f43331537ee2af2e3d758d50f721...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/test-data/inclusion.csv
1;{"input-compressed-accounts":[{"root":"0x1ebf5c4eb04bf878b46937be63d12308bb14841813441f041812ea54ecb7b2d5","pathIndex":0,"pathElements":["0x0","0x2098f5fb9e239eab3ceac3f27b81e481dc3124d55ffed523a839ee8446b64864","0x1069673dcdb12263df301a6ff584a7ec261a44cb9dc68df067a4774460b1f1e1","0x18f43331537ee2af2e3d758d50f7210646...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/server/server.go
package server import ( "context" "encoding/json" "errors" "fmt" "io" "light/light-prover/logging" "light/light-prover/prover" "net/http" "github.com/gorilla/handlers" //"github.com/prometheus/client_golang/prometheus/promhttp" ) type Error struct { StatusCode int Code string Message string } ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/server/job.go
package server type RunningJob struct { stop chan struct{} closed chan struct{} } func (server *RunningJob) RequestStop() { close(server.stop) } func (server *RunningJob) AwaitStop() { <-server.closed } func SpawnJob(start func(), shutdown func()) RunningJob { stop := make(chan struct{}) closed := make(chan...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/scripts/targets.txt
POST http://localhost:3001/inclusion @inclusion_26_1.json
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/scripts/download_keys.sh
#!/usr/bin/env bash set -e command -v git >/dev/null 2>&1 || { echo >&2 "git is required but it's not installed. Aborting."; exit 1; } command -v curl >/dev/null 2>&1 || { echo >&2 "curl is required but it's not installed. Aborting."; exit 1; } command -v wc >/dev/null 2>&1 || { echo >&2 "wc is required but it's not ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/scripts/stress_load.sh
#!/usr/bin/env bash PROVER_ADDRESS="localhost:3001" DURATION="60s" RATE="30/1s" TARGETS_FILE="targets.txt" BASE_OUTPUT_FILE="results_${DURATION}" if [ -e "${BASE_OUTPUT_FILE}*" ]; then rm ${BASE_OUTPUT_FILE}* fi echo "POST http://$PROVER_ADDRESS/inclusion" | vegeta attack -duration=$DURATION -rate $RATE -targets=$...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/scripts/server.sh
# install goexec: go install github.com/shurcooL/goexec goexec 'http.ListenAndServe(`:8080`, http.FileServer(http.Dir(`.`)))'
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/scripts/generate_keys.sh
#!/usr/bin/env bash declare -a HEIGHTS=("40") DEFAULT_HEIGHT="26" PROVING_KEYS_DIR="./proving-keys" VERIFIER_DIR="../circuit-lib/verifier/src/verifying_keys" gnark() { local args=("$@") ./light-prover "${args[@]}" } generate_circuit() { local circuit_type=$1 local height=$2 local batch_size=$3 ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/scripts/rate_detection.sh
#!/usr/bin/env bash PROVER_ADDRESS="localhost:3001" DURATION="5s" TARGETS_FILE="targets.txt" MEAN_TIME_THRESHOLD=150 # in milliseconds # Initial settings rate=10 # Start with 10 requests per second step=5 # Increment rate by 5 in each iteration while true; do BASE_OUTPUT_FILE="results_${DURATION}" rm -f ${BA...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_update_circuit_test.go
package prover import ( "fmt" merkletree "light/light-prover/merkle-tree" "math/big" "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" ) func TestBatchUpdateCircuit(t *testing.T) { assert := test.NewAssert(t) t.Run("Valid batch update ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/non_inclusion_test.go
package prover import ( "bufio" "encoding/json" "fmt" "os" "strings" "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" ) // Iterate over data from csv file "inclusion_test_data.tsv", which contains ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/leaf_hash_gadget_test.go
package prover import ( "math/big" "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" ) type LeafHashGadgetCircuit struct { LeafLowerRangeValue frontend.Variable `gnark:"private"` LeafHigherRangeValue...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/marshal_batch_append_with_subtrees.go
package prover import ( "encoding/json" "fmt" "math/big" ) type BatchAppendWithSubtreesParametersJSON struct { PublicInputHash string `json:"publicInputHash"` OldSubTreeHashChain string `json:"oldSubTreeHashChain"` NewSubTreeHashChain string `json:"newSubTreeHashChain"` NewRoot string `...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/test_data_helpers.go
package prover import ( "fmt" merkletree "light/light-prover/merkle-tree" "math/big" "math/rand" "github.com/iden3/go-iden3-crypto/poseidon" ) func rangeIn(low, hi int) int { return low + rand.Intn(hi-low) } func BuildTestTree(depth int, numberOfCompressedAccounts int, random bool) InclusionParameters { tree...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/is_less_test.go
package prover import ( "github.com/reilabs/gnark-lean-extractor/v2/abstractor" "math/big" "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" ) type IsLessCircuit struct { A frontend.Variable `gnark:"p...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/marshal.go
package prover import ( "bytes" "encoding/binary" "encoding/json" "fmt" "io" "math/big" "os" "strings" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" ) func fromHex(i *big.Int, s string) error { s = strings.TrimPrefix(s, "0x") _, ok := i.SetString(s, 16) if !ok { ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_update_circuit.go
package prover import ( "fmt" merkle_tree "light/light-prover/merkle-tree" "light/light-prover/prover/poseidon" "math/big" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/frontend" "github.com/consensys/g...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/marshal_inclusion.go
package prover import ( "encoding/json" "fmt" "math/big" ) type InclusionProofInputsJSON struct { Root string `json:"root"` PathIndex uint32 `json:"pathIndex"` PathElements []string `json:"pathElements"` Leaf string `json:"leaf"` } type InclusionParametersJSON struct { Inputs []Inclu...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/marshal_batch_address_append.go
package prover import ( "encoding/json" "math/big" ) type BatchAddressAppendParametersJSON struct { PublicInputHash string `json:"PublicInputHash"` OldRoot string `json:"OldRoot"` NewRoot string `json:"NewRoot"` HashchainHash string `json:"HashchainHash"...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/test_data_generator.go
package prover import ( "fmt" "math/big" "os" "testing" ) func TestInclusionParameters_TestTree(t *testing.T) { file, err := os.OpenFile("../test-data/inclusion.csv", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { fmt.Println(err) return } defer func(file *os.File) { err := file.Close() if...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_append_with_subtrees_circuit.go
package prover import ( "fmt" "light/light-prover/logging" merkletree "light/light-prover/merkle-tree" "math/big" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/fron...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/extractor.go
package prover import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" "github.com/reilabs/gnark-lean-extractor/v2/extractor" ) func ExtractLean(treeHeight uint32, numberOfCompressedAccounts uint32) (string, error) { // Not checking for numberOfCompressedAccounts === 0 or treeHeight...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_circuit_helpers.go
package prover import ( "github.com/reilabs/gnark-lean-extractor/v2/abstractor" merkletree "light/light-prover/merkle-tree" "light/light-prover/prover/poseidon" "math/big" "github.com/consensys/gnark/frontend" ) func createHashChain(api frontend.API, hashes []frontend.Variable) frontend.Variable { if len(hashe...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/circuit_builder.go
package prover import ( "encoding/json" "fmt" "log" ) type CircuitType string const ( CombinedCircuitType CircuitType = "combined" InclusionCircuitType CircuitType = "inclusion" NonInclusionCircuitType CircuitType = "non-inclusion" BatchAppendWithSubtreesCircuitType Cir...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_append_with_proofs_circuit.go
package prover import ( "fmt" merkle_tree "light/light-prover/merkle-tree" "math/big" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" "github.com/re...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/marshal_non_inclusion.go
package prover import ( "encoding/json" "fmt" "math/big" ) type NonInclusionProofInputsJSON struct { Root string `json:"root"` Value string `json:"value"` PathIndex uint32 `json:"pathIndex"` PathElements []string `json:"pathElements"` LeafLowerRangeValue...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_address_append_circuit.go
package prover import ( "fmt" "light/light-prover/logging" "light/light-prover/prover/poseidon" "math/big" merkletree "light/light-prover/merkle-tree" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/fron...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/circuit_utils.go
package prover import ( "light/light-prover/prover/poseidon" "math/big" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/frontend" "github.com/reilabs/gnark-lean-extractor/v2/abstractor" ) type Proof struct { Proof groth16.Proof } type ProvingS...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/inclusion_circuit.go
package prover import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" "github.com/reilabs/gnark-lean-extractor/v2/abstractor" ) type InclusionCircuit struct { // public inputs Roots []frontend.Variable `gnark:",public"` Leaves []fro...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_append_with_subtrees_circuit_test.go
package prover import ( "math/big" "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" ) func TestBatchAppendWithSubtreesCircuit(t *testing.T) { assert := test.NewAssert(t) t.Run("Successful proofs", func(t *testing.T) { testCases := []s...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/marshal_batch_append_with_proofs.go
package prover import ( "encoding/json" "math/big" ) type BatchAppendWithProofsInputsJSON struct { PublicInputHash string `json:"publicInputHash"` OldRoot string `json:"oldRoot"` NewRoot string `json:"newRoot"` LeavesHashchainHash string `json:"leavesHashchainHash"` ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/non_inclusion_circuit.go
package prover import ( "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" "github.com/reilabs/gnark-lean-extractor/v2/abstractor" ) type NonInclusionCircuit struct { // public inputs Roots []frontend.Variable `gnark:",public"` Values []...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/inclusion_test.go
package prover import ( "bufio" "fmt" "os" "strings" "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" ) // Iterate over data from csv file "inclusion_test_data.tsv", which contains test data for the...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/inclusion_proving_system.go
package prover import ( "fmt" "light/light-prover/logging" "math/big" "strconv" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" ) type InclusionInp...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/string_utils.go
package prover import ( "encoding/hex" "fmt" "math/big" "strings" ) func ParseHexStringList(input string) ([]big.Int, error) { hexStrings := strings.Split(input, ",") result := make([]big.Int, len(hexStrings)) for i, hexString := range hexStrings { hexString = strings.TrimSpace(hexString) hexString = stri...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/proving_keys_utils.go
package prover import ( "bytes" "fmt" "io" "light/light-prover/logging" "os" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" gnarkio "github.com/consensys/gnark/io" ) type RunMode string const ( Forester RunMode = "forester" ForesterTest RunMode = "forester-test" ...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_address_append_circuit_test.go
package prover import ( "math/big" "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/test" ) func TestAddressAppendHardcoded4_1(t *testing.T) { assert := test.NewAssert(t) circuit := InitBatchAddressTreeAppendCircuit(4, 1) params := get_test_data_1_insert() witness, err := param...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/non_inclusion_proving_system.go
package prover import ( "fmt" "light/light-prover/logging" "math/big" "strconv" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend/groth16" "github.com/consensys/gnark/constraint" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/frontend/cs/r1cs" ) type NonInclusion...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/batch_append_with_proofs_circuit_test.go
package prover import ( "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" ) func TestBatchAppendWithProofsCircuit(t *testing.T) { assert := test.NewAssert(t) t.Run("Valid batch update - full HashchainHash", func(t *testing.T) { treeDept...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/marshal_update.go
package prover import ( "encoding/json" "fmt" "math/big" ) type BatchUpdateProofInputsJSON struct { PublicInputHash string `json:"publicInputHash"` OldRoot string `json:"oldRoot"` NewRoot string `json:"newRoot"` TxHashes []string `json:"txHashes"` LeavesHas...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/poseidon/poseidon_test.go
package poseidon import ( "testing" "github.com/consensys/gnark-crypto/ecc" "github.com/consensys/gnark/backend" "github.com/consensys/gnark/frontend" "github.com/consensys/gnark/test" "github.com/reilabs/gnark-lean-extractor/v2/abstractor" ) type TestPoseidonCircuit1 struct { Input frontend.Variable `gnark:"...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/poseidon/constants.go
package poseidon import ( "math/big" "github.com/consensys/gnark/frontend" ) func hex(s string) big.Int { var bi big.Int bi.SetString(s, 0) return bi } var MDS_2 = [][]frontend.Variable{ { hex("0x066f6f85d6f68a85ec10345351a23a3aaf07f38af8c952a7bceca70bd2af7ad5"), hex("0x2b9d4b4110c9ae997782e1509b1d0fdb20a...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/poseidon/poseidon.go
package poseidon import ( "github.com/consensys/gnark/frontend" "github.com/reilabs/gnark-lean-extractor/v2/abstractor" ) type cfg struct { RF int RP int constants [][]frontend.Variable mds [][]frontend.Variable } var CFG_2 = cfg{ RF: 8, RP: 56, constants: CONSTANTS_2, mds...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/lean-toolchain
leanprover/lean4:v4.2.0
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/lake-manifest.json
{"version": 6, "packagesDir": "lake-packages", "packages": [{"git": {"url": "https://github.com/leanprover-community/mathlib4.git", "subDir?": null, "rev": "753159252c585df6b6aa7c48d2b8828d58388b79", "opts": {}, "name": "mathlib", "inputRev?": "v4.2.0", "inherited": false}}, {"git": {...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/lakefile.lean
import Lake open Lake DSL package «formal-verification» { -- add package configuration options here } require mathlib from git "https://github.com/leanprover-community/mathlib4.git"@"v4.2.0" require «proven-zk» from git "https://github.com/reilabs/proven-zk.git"@"v1.4.0" lean_lib FormalVerification { moreLe...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/Main.lean
import «ProvenZk» import FormalVerification.Circuit import FormalVerification.Lemmas import FormalVerification.Merkle open LightProver (F) theorem poseidon₂_testVector : poseidon₂ vec![1, 2] = 7853200120776062878684798364095072458815029376092732009249414926327459813530 := rfl theorem poseidon₃_testVector : posei...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/FormalVerification/Merkle.lean
import «ProvenZk» import FormalVerification.Circuit import FormalVerification.Lemmas import FormalVerification.Rangecheck import FormalVerification.Poseidon import FormalVerification.RangeTree import Mathlib open LightProver (F Order Gates) def hashLevel (d : Bool) (s h : F): F := match d with | false => poseidon₂ ve...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/FormalVerification/Lemmas.lean
import Mathlib import «ProvenZk» import FormalVerification.Circuit open LightProver (F Order) axiom bn254_Fr_prime : Nat.Prime Order instance : Fact (Nat.Prime Order) := Fact.mk bn254_Fr_prime instance : Membership α (MerkleTree α H d) where mem x t := ∃i, t.itemAtFin i = x namespace ZMod lemma castInt_lt [NeZer...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/FormalVerification/Poseidon.lean
import FormalVerification.Circuit import FormalVerification.Lemmas import Mathlib import «ProvenZk» open LightProver (F Order) def sbox_uniqueAssignment (Inp : F): UniqueAssignment (LightProver.sbox Inp) id := UniqueAssignment.mk _ $ by simp [LightProver.sbox]; tauto def mds_3_uniqueAssignment (S : Vector F 3): Un...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/FormalVerification/RangeTree.lean
import «ProvenZk» import FormalVerification.Poseidon import FormalVerification.Circuit import FormalVerification.Lemmas open LightProver (F) structure Range : Type where lo : Fin (2^248) hi : Fin (2^248) index : F def Range.hash : Range → F := fun r => poseidon₃ vec![r.lo, r.index, r.hi] def RangeTree (d : ℕ)...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/FormalVerification/Circuit.lean
import ProvenZk.Gates import ProvenZk.Ext.Vector set_option linter.unusedVariables false namespace LightProver def Order : ℕ := 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001 variable [Fact (Nat.Prime Order)] abbrev F := ZMod Order abbrev Gates := GatesGnark8 Order def sbox (Inp: F) (k: F -> Pro...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification
solana_public_repos/Lightprotocol/light-protocol/light-prover/formal-verification/FormalVerification/Rangecheck.lean
import «ProvenZk» import FormalVerification.Circuit import FormalVerification.Lemmas open LightProver (F Order Gates) theorem AssertIsLess_248_semantics {A B : F} : LightProver.AssertIsLess_248 A B ↔ (A + (2^248 - B)).val < 2^248 := by unfold LightProver.AssertIsLess_248 simp [LightProver.AssertIsLess_248, Gates_...
0
solana_public_repos/Lightprotocol/light-protocol/light-prover
solana_public_repos/Lightprotocol/light-protocol/light-prover/logging/logger.go
package logging import ( gnarkLogger "github.com/consensys/gnark/logger" "github.com/rs/zerolog" "os" ) var log = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: "15:04:05"}).With().Timestamp().Logger() func Logger() *zerolog.Logger { return &log } func SetJSONOutput() { log = zerolog.New(os.Stdo...
0