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/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/README.md | # 📦 Light Merkle Tree Prover
Light Prover is a service for processing of Merkle tree updates.
The correctness of the batched Merkle tree update is assured through the generation of a SNARK (generated
through [gnark](https://github.com/ConsenSys/gnark)).
# Acknowledgment
This project is based on the [Semaphore Merkle... | 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/test-data/combined.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/combined_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"
)
func TestCombined(t *testing.T) {
assert := test.NewAssert(t)
file, err :=... | 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/marshal_combined.go | package prover
import (
"encoding/json"
"fmt"
)
type CombinedParametersJSON struct {
InclusionProofInputs []InclusionProofInputsJSON `json:"input-compressed-accounts"`
NonInclusionProofInputs []NonInclusionProofInputsJSON `json:"new-addresses"`
}
func ParseCombined(inputJSON string) (NonInclusionParameters... | 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/combined_circuit.go | package prover
import (
"github.com/consensys/gnark/frontend"
"github.com/reilabs/gnark-lean-extractor/v2/abstractor"
)
type CombinedCircuit struct {
Inclusion InclusionCircuit
NonInclusion NonInclusionCircuit
}
func (circuit *CombinedCircuit) Define(api frontend.API) error {
abstractor.CallVoid(api, Inclusi... | 0 |
solana_public_repos/Lightprotocol/light-protocol/light-prover | solana_public_repos/Lightprotocol/light-protocol/light-prover/prover/combined_proving_system.go | package prover
import (
"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 CombinedParameters ... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.