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/js
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/.eslintrc.json
|
{
"root": true,
"ignorePatterns": ["node_modules", "lib"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json", "./tsconfig.test.json"]
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-unused-vars": 0,
"no-prototype-builtins": 0
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/approve-and-mint-to.test.ts
|
import { describe, it, expect, beforeAll, assert } from 'vitest';
import { PublicKey, Signer, Keypair, SystemProgram } from '@solana/web3.js';
import {
MINT_SIZE,
TOKEN_2022_PROGRAM_ID,
TOKEN_PROGRAM_ID,
createInitializeMint2Instruction,
} from '@solana/spl-token';
import { approveAndMintTo, createTokenPool } from '../../src/actions';
import {
Rpc,
bn,
buildAndSignTx,
dedupeSigner,
newAccountWithLamports,
sendAndConfirmTx,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
import { BN } from '@coral-xyz/anchor';
async function createTestSplMint(
rpc: Rpc,
payer: Signer,
mintKeypair: Signer,
mintAuthority: Keypair,
isToken2022 = false,
) {
const programId = isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
const rentExemptBalance =
await rpc.getMinimumBalanceForRentExemption(MINT_SIZE);
const createMintAccountInstruction = SystemProgram.createAccount({
fromPubkey: payer.publicKey,
lamports: rentExemptBalance,
newAccountPubkey: mintKeypair.publicKey,
programId,
space: MINT_SIZE,
});
const initializeMintInstruction = createInitializeMint2Instruction(
mintKeypair.publicKey,
TEST_TOKEN_DECIMALS,
mintAuthority.publicKey,
null,
programId,
);
const { blockhash } = await rpc.getLatestBlockhash();
const tx = buildAndSignTx(
[createMintAccountInstruction, initializeMintInstruction],
payer,
blockhash,
dedupeSigner(payer, [mintKeypair]),
);
await sendAndConfirmTx(rpc, tx);
}
const TEST_TOKEN_DECIMALS = 2;
describe('approveAndMintTo', () => {
let rpc: Rpc;
let payer: Signer;
let bob: PublicKey;
let mintKeypair: Keypair;
let mint: PublicKey;
let mintAuthority: Keypair;
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc);
bob = Keypair.generate().publicKey;
mintAuthority = Keypair.generate();
mintKeypair = Keypair.generate();
mint = mintKeypair.publicKey;
/// Create external SPL mint
await createTestSplMint(rpc, payer, mintKeypair, mintAuthority);
/// Register mint
await createTokenPool(rpc, payer, mint);
});
it('should mintTo compressed account with external spl mint', async () => {
assert(mint.equals(mintKeypair.publicKey));
await approveAndMintTo(
rpc,
payer,
mint,
bob,
mintAuthority,
1000000000,
);
await assertApproveAndMintTo(rpc, mint, bn(1000000000), bob);
});
it('should mintTo compressed account with external token 2022 mint', async () => {
const payer = await newAccountWithLamports(rpc);
const bob = Keypair.generate().publicKey;
const token22MintAuthority = Keypair.generate();
const token22MintKeypair = Keypair.generate();
const token22Mint = token22MintKeypair.publicKey;
/// Create external SPL mint
await createTestSplMint(
rpc,
payer,
token22MintKeypair,
token22MintAuthority,
true,
);
const mintAccountInfo = await rpc.getAccountInfo(token22Mint);
assert(mintAccountInfo!.owner.equals(TOKEN_2022_PROGRAM_ID));
/// Register mint
await createTokenPool(rpc, payer, token22Mint);
assert(token22Mint.equals(token22MintKeypair.publicKey));
await approveAndMintTo(
rpc,
payer,
token22Mint,
bob,
token22MintAuthority,
1000000000,
);
await assertApproveAndMintTo(rpc, token22Mint, bn(1000000000), bob);
});
});
/**
* Assert that approveAndMintTo() creates a new compressed token account for the
* recipient
*/
async function assertApproveAndMintTo(
rpc: Rpc,
refMint: PublicKey,
refAmount: BN,
refTo: PublicKey,
) {
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(
refTo,
{
mint: refMint,
},
);
const compressedTokenAccount = compressedTokenAccounts.items[0];
expect(compressedTokenAccount.parsed.mint.toBase58()).toBe(
refMint.toBase58(),
);
expect(compressedTokenAccount.parsed.amount.eq(refAmount)).toBe(true);
expect(compressedTokenAccount.parsed.owner.equals(refTo)).toBe(true);
expect(compressedTokenAccount.parsed.delegate).toBe(null);
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/merge-token-accounts.test.ts
|
import { describe, it, expect, beforeAll, beforeEach } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import {
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
import { createMint, mintTo, mergeTokenAccounts } from '../../src/actions';
describe('mergeTokenAccounts', () => {
let rpc: Rpc;
let payer: Signer;
let owner: Signer;
let mint: PublicKey;
let mintAuthority: Keypair;
const { merkleTree } = defaultTestStateTreeAccounts();
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc, 1e9);
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
2,
mintKeypair,
)
).mint;
});
beforeEach(async () => {
owner = await newAccountWithLamports(rpc, 1e9);
// Mint multiple token accounts to the owner
for (let i = 0; i < 5; i++) {
await mintTo(
rpc,
payer,
mint,
owner.publicKey,
mintAuthority,
bn(100),
);
}
});
it.only('should merge all token accounts', async () => {
const preAccounts = await rpc.getCompressedTokenAccountsByOwner(
owner.publicKey,
{ mint },
);
expect(preAccounts.items.length).to.be.greaterThan(1);
await mergeTokenAccounts(rpc, payer, mint, owner, merkleTree);
const postAccounts = await rpc.getCompressedTokenAccountsByOwner(
owner.publicKey,
{ mint },
);
expect(postAccounts.items.length).to.be.lessThan(
preAccounts.items.length,
);
const totalBalance = postAccounts.items.reduce(
(sum, account) => sum.add(account.parsed.amount),
bn(0),
);
expect(totalBalance.toNumber()).to.equal(500); // 5 accounts * 100 tokens each
});
// TODO: add coverage for this apparent edge case. not required for now though.
it('should handle merging when there is only one account', async () => {
try {
await mergeTokenAccounts(rpc, payer, mint, owner, merkleTree);
console.log('First merge succeeded');
const postFirstMergeAccounts =
await rpc.getCompressedTokenAccountsByOwner(owner.publicKey, {
mint,
});
console.log('Accounts after first merge:', postFirstMergeAccounts);
} catch (error) {
console.error('First merge failed:', error);
throw error;
}
// Second merge attempt
try {
await mergeTokenAccounts(rpc, payer, mint, owner, merkleTree);
console.log('Second merge succeeded');
} catch (error) {
console.error('Second merge failed:', error);
}
const finalAccounts = await rpc.getCompressedTokenAccountsByOwner(
owner.publicKey,
{ mint },
);
console.log('Final accounts:', finalAccounts);
expect(finalAccounts.items.length).to.equal(1);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/create-mint.test.ts
|
import { describe, it, expect, beforeAll, assert } from 'vitest';
import { CompressedTokenProgram } from '../../src/program';
import { PublicKey, Signer, Keypair } from '@solana/web3.js';
import { unpackMint, unpackAccount } from '@solana/spl-token';
import { createMint } from '../../src/actions';
import {
Rpc,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
/**
* Asserts that createMint() creates a new spl mint account + the respective
* system pool account
*/
async function assertCreateMint(
mint: PublicKey,
authority: PublicKey,
rpc: Rpc,
decimals: number,
poolAccount: PublicKey,
) {
const mintAcc = await rpc.getAccountInfo(mint);
const unpackedMint = unpackMint(mint, mintAcc);
expect(unpackedMint.mintAuthority?.toString()).toBe(authority.toString());
expect(unpackedMint.supply).toBe(0n);
expect(unpackedMint.decimals).toBe(decimals);
expect(unpackedMint.isInitialized).toBe(true);
expect(unpackedMint.freezeAuthority).toBe(null);
expect(unpackedMint.tlvData.length).toBe(0);
/// Pool (omnibus) account is a regular SPL Token account
const poolAccountInfo = await rpc.getAccountInfo(poolAccount);
const unpackedPoolAccount = unpackAccount(poolAccount, poolAccountInfo);
expect(unpackedPoolAccount.mint.equals(mint)).toBe(true);
expect(unpackedPoolAccount.amount).toBe(0n);
expect(
unpackedPoolAccount.owner.equals(
CompressedTokenProgram.deriveCpiAuthorityPda,
),
).toBe(true);
expect(unpackedPoolAccount.delegate).toBe(null);
}
const TEST_TOKEN_DECIMALS = 2;
describe('createMint', () => {
let rpc: Rpc;
let payer: Signer;
let mint: PublicKey;
let mintAuthority: Keypair;
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc, 1e9);
});
it('should create mint', async () => {
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
)
).mint;
const poolAccount = CompressedTokenProgram.deriveTokenPoolPda(mint);
assert(mint.equals(mintKeypair.publicKey));
await assertCreateMint(
mint,
mintAuthority.publicKey,
rpc,
TEST_TOKEN_DECIMALS,
poolAccount,
);
/// Mint already exists
await expect(
createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
),
).rejects.toThrow();
});
it('should create mint with payer as authority', async () => {
mint = (
await createMint(rpc, payer, payer.publicKey, TEST_TOKEN_DECIMALS)
).mint;
const poolAccount = CompressedTokenProgram.deriveTokenPoolPda(mint);
await assertCreateMint(
mint,
payer.publicKey,
rpc,
TEST_TOKEN_DECIMALS,
poolAccount,
);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/transfer.test.ts
|
import { describe, it, expect, beforeAll, beforeEach, assert } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
ParsedTokenAccount,
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
import { createMint, mintTo, transfer } from '../../src/actions';
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';
/**
* Assert that we created recipient and change-account for the sender, with all
* amounts correctly accounted for
*/
async function assertTransfer(
rpc: Rpc,
senderPreCompressedTokenAccounts: ParsedTokenAccount[],
refMint: PublicKey,
refAmount: BN,
refSender: PublicKey,
refRecipient: PublicKey,
expectedAccountCountSenderPost?: number,
expectedAccountCountRecipientPost?: number,
) {
/// Transfer can merge input compressed accounts therefore we need to pass all as ref
const senderPostCompressedTokenAccounts = (
await rpc.getCompressedTokenAccountsByOwner(refSender, {
mint: refMint,
})
).items;
/// pre = post-amount
const sumPre = senderPreCompressedTokenAccounts.reduce(
(acc, curr) => bn(acc).add(curr.parsed.amount),
bn(0),
);
const sumPost = senderPostCompressedTokenAccounts.reduce(
(acc, curr) => bn(acc).add(curr.parsed.amount),
bn(0),
);
if (expectedAccountCountSenderPost) {
expect(senderPostCompressedTokenAccounts.length).toBe(
expectedAccountCountSenderPost,
);
}
expect(sumPre.sub(refAmount).eq(sumPost)).toBe(true);
const recipientCompressedTokenAccounts = (
await rpc.getCompressedTokenAccountsByOwner(refRecipient, {
mint: refMint,
})
).items;
if (expectedAccountCountRecipientPost) {
expect(recipientCompressedTokenAccounts.length).toBe(
expectedAccountCountRecipientPost,
);
}
/// recipient should have received the amount
const recipientCompressedTokenAccount = recipientCompressedTokenAccounts[0];
expect(recipientCompressedTokenAccount.parsed.amount.eq(refAmount)).toBe(
true,
);
expect(recipientCompressedTokenAccount.parsed.delegate).toBe(null);
}
const TEST_TOKEN_DECIMALS = 2;
describe('transfer', () => {
let rpc: Rpc;
let payer: Signer;
let bob: Signer;
let charlie: Signer;
let mint: PublicKey;
let mintAuthority: Keypair;
const { merkleTree } = defaultTestStateTreeAccounts();
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc, 1e9);
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
)
).mint;
});
beforeEach(async () => {
bob = await newAccountWithLamports(rpc, 1e9);
charlie = await newAccountWithLamports(rpc, 1e9);
await mintTo(rpc, payer, mint, bob.publicKey, mintAuthority, bn(1000));
});
it('should transfer from bob -> charlie', async () => {
/// send 700 from bob -> charlie
/// bob: 300, charlie: 700
const bobPreCompressedTokenAccounts = (
await rpc.getCompressedTokenAccountsByOwner(bob.publicKey, {
mint,
})
).items;
await transfer(
rpc,
payer,
mint,
bn(700),
bob,
charlie.publicKey,
merkleTree,
);
await assertTransfer(
rpc,
bobPreCompressedTokenAccounts,
mint,
bn(700),
bob.publicKey,
charlie.publicKey,
1,
1,
);
/// send 200 from bob -> charlie
/// bob: 100, charlie: (700+200)
const bobPreCompressedTokenAccounts2 =
await rpc.getCompressedTokenAccountsByOwner(bob.publicKey, {
mint,
});
await transfer(
rpc,
payer,
mint,
bn(200),
bob,
charlie.publicKey,
merkleTree,
);
await assertTransfer(
rpc,
bobPreCompressedTokenAccounts2.items,
mint,
bn(200),
bob.publicKey,
charlie.publicKey,
1,
2,
);
/// send 5 from charlie -> bob
/// bob: (100+5), charlie: (695+200)
const charliePreCompressedTokenAccounts3 =
await rpc.getCompressedTokenAccountsByOwner(charlie.publicKey, {
mint,
});
await transfer(
rpc,
payer,
mint,
bn(5),
charlie,
bob.publicKey,
merkleTree,
);
await assertTransfer(
rpc,
charliePreCompressedTokenAccounts3.items,
mint,
bn(5),
charlie.publicKey,
bob.publicKey,
2,
2,
);
/// send 700 from charlie -> bob, 2 compressed account inputs
/// bob: (100+5+700), charlie: (195)
const charliePreCompressedTokenAccounts4 =
await rpc.getCompressedTokenAccountsByOwner(charlie.publicKey, {
mint,
});
await transfer(rpc, payer, mint, bn(700), charlie, bob.publicKey);
await assertTransfer(
rpc,
charliePreCompressedTokenAccounts4.items,
mint,
bn(700),
charlie.publicKey,
bob.publicKey,
1,
3,
);
await expect(
transfer(
rpc,
payer,
mint,
10000,
bob,
charlie.publicKey,
merkleTree,
),
).rejects.toThrow('Not enough balance for transfer');
});
it('should transfer token 2022 from bob -> charlie', async () => {
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
undefined,
true,
)
).mint;
const mintAccountInfo = await rpc.getAccountInfo(mint);
assert.equal(
mintAccountInfo!.owner.toBase58(),
TOKEN_2022_PROGRAM_ID.toBase58(),
);
await mintTo(rpc, payer, mint, bob.publicKey, mintAuthority, bn(1000));
/// send 700 from bob -> charlie
/// bob: 300, charlie: 700
const bobPreCompressedTokenAccounts = (
await rpc.getCompressedTokenAccountsByOwner(bob.publicKey, {
mint,
})
).items;
await transfer(
rpc,
payer,
mint,
bn(700),
bob,
charlie.publicKey,
merkleTree,
);
await assertTransfer(
rpc,
bobPreCompressedTokenAccounts,
mint,
bn(700),
bob.publicKey,
charlie.publicKey,
1,
1,
);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/compress.test.ts
|
import { describe, it, expect, beforeAll } from 'vitest';
import {
PublicKey,
Keypair,
Signer,
ComputeBudgetProgram,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
ParsedTokenAccount,
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
dedupeSigner,
buildAndSignTx,
sendAndConfirmTx,
getTestRpc,
} from '@lightprotocol/stateless.js';
import {
compress,
createMint,
createTokenProgramLookupTable,
decompress,
mintTo,
} from '../../src/actions';
import {
createAssociatedTokenAccount,
TOKEN_2022_PROGRAM_ID,
} from '@solana/spl-token';
import { CompressedTokenProgram } from '../../src/program';
import { WasmFactory } from '@lightprotocol/hasher.rs';
/**
* Assert that we created recipient and change ctokens for the sender, with all
* amounts correctly accounted for
*/
async function assertCompress(
rpc: Rpc,
refSenderAtaBalanceBefore: BN,
refSenderAta: PublicKey,
refMint: PublicKey,
refAmounts: BN[],
refRecipients: PublicKey[],
refRecipientCompressedTokenBalancesBefore: ParsedTokenAccount[][],
) {
if (refAmounts.length !== refRecipients.length) {
throw new Error('Mismatch in length of amounts and recipients arrays');
}
const refSenderAtaBalanceAfter =
await rpc.getTokenAccountBalance(refSenderAta);
const totalAmount = refAmounts.reduce((acc, curr) => acc.add(curr), bn(0));
expect(
refSenderAtaBalanceBefore
.sub(totalAmount)
.eq(bn(refSenderAtaBalanceAfter.value.amount)),
).toBe(true);
for (let i = 0; i < refRecipients.length; i++) {
const recipientCompressedTokenBalanceAfter =
await rpc.getCompressedTokenAccountsByOwner(refRecipients[i], {
mint: refMint,
});
const recipientSumPost =
recipientCompressedTokenBalanceAfter.items.reduce(
(acc, curr) => bn(acc).add(curr.parsed.amount),
bn(0),
);
const recipientSumPre = refRecipientCompressedTokenBalancesBefore[
i
].reduce((acc, curr) => bn(acc).add(curr.parsed.amount), bn(0));
/// recipient should have received the amount
expect(recipientSumPost.eq(refAmounts[i].add(recipientSumPre))).toBe(
true,
);
}
}
const TEST_TOKEN_DECIMALS = 2;
describe('compress', () => {
let rpc: Rpc;
let payer: Signer;
let bob: Signer;
let bobAta: PublicKey;
let charlie: Signer;
let mint: PublicKey;
let mintAuthority: Keypair;
let lut: PublicKey;
const { merkleTree } = defaultTestStateTreeAccounts();
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc, 1e9);
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
)
).mint;
bob = await newAccountWithLamports(rpc, 1e9);
charlie = await newAccountWithLamports(rpc, 1e9);
bobAta = await createAssociatedTokenAccount(
rpc,
payer,
mint,
bob.publicKey,
);
await mintTo(rpc, payer, mint, bob.publicKey, mintAuthority, bn(10000));
await decompress(rpc, payer, mint, bn(9000), bob, bobAta);
/// Setup LUT.
const { address } = await createTokenProgramLookupTable(
rpc,
payer,
payer,
);
lut = address;
}, 80_000);
it('should compress from bobAta -> charlie', async () => {
const senderAtaBalanceBefore = await rpc.getTokenAccountBalance(bobAta);
const recipientCompressedTokenBalanceBefore =
await rpc.getCompressedTokenAccountsByOwner(charlie.publicKey, {
mint,
});
await compress(
rpc,
payer,
mint,
bn(700),
bob,
bobAta,
charlie.publicKey,
merkleTree,
);
await assertCompress(
rpc,
bn(senderAtaBalanceBefore.value.amount),
bobAta,
mint,
[bn(700)],
[charlie.publicKey],
[recipientCompressedTokenBalanceBefore.items],
);
});
const maxBatchSize = 15;
const recipients = Array.from(
{ length: maxBatchSize },
() => Keypair.generate().publicKey,
);
const amounts = Array.from({ length: maxBatchSize }, (_, i) => bn(i + 1));
it('should compress to multiple (11 max without LUT) recipients with array of amounts and addresses', async () => {
const senderAtaBalanceBefore = await rpc.getTokenAccountBalance(bobAta);
const recipientCompressedTokenBalancesBefore = await Promise.all(
recipients.map(recipient =>
rpc.getCompressedTokenAccountsByOwner(recipient, { mint }),
),
);
await compress(
rpc,
payer,
mint,
amounts.slice(0, 11),
bob,
bobAta,
recipients.slice(0, 11),
merkleTree,
);
for (let i = 0; i < recipients.length; i++) {
await assertCompress(
rpc,
bn(senderAtaBalanceBefore.value.amount),
bobAta,
mint,
amounts.slice(0, 11),
recipients.slice(0, 11),
recipientCompressedTokenBalancesBefore.map(x => x.items),
);
}
const senderAtaBalanceAfter = await rpc.getTokenAccountBalance(bobAta);
const totalCompressed = amounts
.slice(0, 11)
.reduce((sum, amount) => sum.add(amount), bn(0));
expect(senderAtaBalanceAfter.value.amount).toEqual(
bn(senderAtaBalanceBefore.value.amount)
.sub(totalCompressed)
.toString(),
);
});
it('should fail when passing unequal array lengths for amounts and toAddress', async () => {
await expect(
compress(
rpc,
payer,
mint,
amounts.slice(0, 10),
bob,
bobAta,
recipients.slice(0, 11),
merkleTree,
),
).rejects.toThrow(
'Amount and toAddress arrays must have the same length',
);
await expect(
compress(
rpc,
payer,
mint,
amounts[0],
bob,
bobAta,
recipients,
merkleTree,
),
).rejects.toThrow(
'Both amount and toAddress must be arrays or both must be single values',
);
});
it(`should compress-batch to max ${maxBatchSize} recipients optimized with LUT`, async () => {
/// Fetch state of LUT
const lookupTableAccount = (await rpc.getAddressLookupTable(lut))
.value!;
/// Mint to max recipients with LUT
const ix = await CompressedTokenProgram.compress({
payer: payer.publicKey,
owner: bob.publicKey,
source: bobAta,
toAddress: recipients,
amount: amounts,
mint,
outputStateTree: merkleTree,
});
const { blockhash } = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [bob]);
const tx = buildAndSignTx(
[ComputeBudgetProgram.setComputeUnitLimit({ units: 500_000 }), ix],
payer,
blockhash,
additionalSigners,
[lookupTableAccount],
);
const txId = await sendAndConfirmTx(rpc, tx);
return txId;
});
it('should compress from bob Token 2022 Ata -> charlie', async () => {
const mintKeypair = Keypair.generate();
const token22Mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
undefined,
true,
)
).mint;
const mintAccountInfo = await rpc.getAccountInfo(token22Mint);
expect(
mintAccountInfo!.owner.toBase58(),
TOKEN_2022_PROGRAM_ID.toBase58(),
);
bob = await newAccountWithLamports(rpc, 1e9);
charlie = await newAccountWithLamports(rpc, 1e9);
const bobToken2022Ata = await createAssociatedTokenAccount(
rpc,
payer,
token22Mint,
bob.publicKey,
undefined,
TOKEN_2022_PROGRAM_ID,
);
await mintTo(
rpc,
payer,
token22Mint,
bob.publicKey,
mintAuthority,
bn(10000),
);
await decompress(
rpc,
payer,
token22Mint,
bn(9000),
bob,
bobToken2022Ata,
);
const senderAtaBalanceBefore =
await rpc.getTokenAccountBalance(bobToken2022Ata);
const recipientCompressedTokenBalanceBefore =
await rpc.getCompressedTokenAccountsByOwner(charlie.publicKey, {
mint: token22Mint,
});
await compress(
rpc,
payer,
token22Mint,
bn(701),
bob,
bobToken2022Ata,
charlie.publicKey,
merkleTree,
);
await assertCompress(
rpc,
bn(senderAtaBalanceBefore.value.amount),
bobToken2022Ata,
token22Mint,
[bn(701)],
[charlie.publicKey],
[recipientCompressedTokenBalanceBefore.items],
);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/mint-to.test.ts
|
import { describe, it, expect, beforeAll } from 'vitest';
import {
PublicKey,
Signer,
Keypair,
ComputeBudgetProgram,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
createMint,
createTokenProgramLookupTable,
mintTo,
} from '../../src/actions';
import {
getTestKeypair,
newAccountWithLamports,
bn,
defaultTestStateTreeAccounts,
Rpc,
sendAndConfirmTx,
buildAndSignTx,
dedupeSigner,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgram } from '../../src/program';
import { WasmFactory } from '@lightprotocol/hasher.rs';
/**
* Asserts that mintTo() creates a new compressed token account for the
* recipient
*/
async function assertMintTo(
rpc: Rpc,
refMint: PublicKey,
refAmount: BN,
refTo: PublicKey,
) {
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(
refTo,
{
mint: refMint,
},
);
const compressedTokenAccount = compressedTokenAccounts.items[0];
expect(compressedTokenAccount.parsed.mint.toBase58()).toBe(
refMint.toBase58(),
);
expect(compressedTokenAccount.parsed.amount.eq(refAmount)).toBe(true);
expect(compressedTokenAccount.parsed.owner.equals(refTo)).toBe(true);
expect(compressedTokenAccount.parsed.delegate).toBe(null);
}
const TEST_TOKEN_DECIMALS = 2;
describe('mintTo', () => {
let rpc: Rpc;
let payer: Signer;
let bob: Signer;
let mint: PublicKey;
let mintAuthority: Keypair;
let lut: PublicKey;
const { merkleTree } = defaultTestStateTreeAccounts();
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc);
bob = getTestKeypair();
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
)
).mint;
/// Setup LUT.
const { address } = await createTokenProgramLookupTable(
rpc,
payer,
payer,
);
lut = address;
}, 80_000);
it('should mint to bob', async () => {
const amount = bn(1000);
await mintTo(rpc, payer, mint, bob.publicKey, mintAuthority, amount);
await assertMintTo(rpc, mint, amount, bob.publicKey);
/// wrong authority
await expect(
mintTo(rpc, payer, mint, bob.publicKey, payer, amount),
).rejects.toThrowError(/custom program error: 0x1782/);
/// with output state merkle tree defined
await mintTo(
rpc,
payer,
mint,
bob.publicKey,
mintAuthority,
amount,
merkleTree,
);
});
const maxRecipients = 18;
const recipients = Array.from(
{ length: maxRecipients },
() => Keypair.generate().publicKey,
);
const amounts = Array.from({ length: maxRecipients }, (_, i) => bn(i + 1));
it('should mint to multiple recipients', async () => {
/// mint to three recipients
await mintTo(
rpc,
payer,
mint,
recipients.slice(0, 3),
mintAuthority,
amounts.slice(0, 3),
);
/// Mint to 10 recipients
await mintTo(
rpc,
payer,
mint,
recipients.slice(0, 10),
mintAuthority,
amounts.slice(0, 10),
);
// Uneven amounts
await expect(
mintTo(
rpc,
payer,
mint,
recipients,
mintAuthority,
amounts.slice(0, 2),
),
).rejects.toThrowError(
/Amount and toPubkey arrays must have the same length/,
);
});
it(`should mint to ${recipients.length} recipients optimized with LUT`, async () => {
const lookupTableAccount = (await rpc.getAddressLookupTable(lut))
.value!;
const ix = await CompressedTokenProgram.mintTo({
feePayer: payer.publicKey,
mint,
authority: mintAuthority.publicKey,
amount: amounts,
toPubkey: recipients,
merkleTree,
});
const { blockhash } = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [mintAuthority]);
const tx = buildAndSignTx(
[ComputeBudgetProgram.setComputeUnitLimit({ units: 500_000 }), ix],
payer,
blockhash,
additionalSigners,
[lookupTableAccount],
);
return await sendAndConfirmTx(rpc, tx);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/decompress.test.ts
|
import { describe, it, expect, beforeAll } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
ParsedTokenAccount,
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
import { createMint, decompress, mintTo } from '../../src/actions';
import { createAssociatedTokenAccount } from '@solana/spl-token';
/**
* Assert that we created recipient and change ctokens for the sender, with all
* amounts correctly accounted for
*/
async function assertDecompress(
rpc: Rpc,
refRecipientAtaBalanceBefore: BN,
refRecipientAta: PublicKey, // all
refMint: PublicKey,
refAmount: BN,
refSender: PublicKey,
refSenderCompressedTokenBalanceBefore: ParsedTokenAccount[],
) {
const refRecipientAtaBalanceAfter =
await rpc.getTokenAccountBalance(refRecipientAta);
const senderCompressedTokenBalanceAfter = (
await rpc.getCompressedTokenAccountsByOwner(refSender, {
mint: refMint,
})
).items;
const senderSumPost = senderCompressedTokenBalanceAfter.reduce(
(acc, curr) => bn(acc).add(curr.parsed.amount),
bn(0),
);
const senderSumPre = refSenderCompressedTokenBalanceBefore.reduce(
(acc, curr) => bn(acc).add(curr.parsed.amount),
bn(0),
);
/// recipient ata should have received the amount
expect(
bn(refRecipientAtaBalanceAfter.value.amount)
.sub(refAmount)
.eq(refRecipientAtaBalanceBefore),
).toBe(true);
/// should have sent the amount
expect(senderSumPost.eq(senderSumPre.sub(refAmount))).toBe(true);
}
const TEST_TOKEN_DECIMALS = 2;
describe('decompress', () => {
let rpc: Rpc;
let payer: Signer;
let bob: Signer;
let charlie: Signer;
let charlieAta: PublicKey;
let mint: PublicKey;
let mintAuthority: Keypair;
const { merkleTree } = defaultTestStateTreeAccounts();
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc, 1e9);
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
)
).mint;
bob = await newAccountWithLamports(rpc, 1e9);
charlie = await newAccountWithLamports(rpc, 1e9);
charlieAta = await createAssociatedTokenAccount(
rpc,
payer,
mint,
charlie.publicKey,
);
await mintTo(rpc, payer, mint, bob.publicKey, mintAuthority, bn(1000));
});
const LOOP = 10;
it(`should decompress from bob -> charlieAta ${LOOP} times`, async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
for (let i = 0; i < LOOP; i++) {
const recipientAtaBalanceBefore =
await rpc.getTokenAccountBalance(charlieAta);
const senderCompressedTokenBalanceBefore =
await rpc.getCompressedTokenAccountsByOwner(bob.publicKey, {
mint,
});
await decompress(
rpc,
payer,
mint,
bn(5),
bob,
charlieAta,
merkleTree,
);
await assertDecompress(
rpc,
bn(recipientAtaBalanceBefore.value.amount),
charlieAta,
mint,
bn(5),
bob.publicKey,
senderCompressedTokenBalanceBefore.items,
);
}
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/custom-program-id.test.ts
|
import { describe, it, expect } from 'vitest';
import { CompressedTokenProgram } from '../../src/program';
import { PublicKey } from '@solana/web3.js';
describe('custom programId', () => {
it('should switch programId', async () => {
const defaultProgramId = new PublicKey(
'cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m',
);
const solMint = new PublicKey(
'So11111111111111111111111111111111111111112',
);
const expectedPoolPda = new PublicKey(
'3EJpXEsHL6JxNoPJWjF4QTKuvFvxzsUPbf1xF8iMbnL7',
);
const newProgramId = new PublicKey(
'2WpGefPmpKMbkyLewupcfb8DuJ1ZMSPkMSu5WEvDMpF4',
);
// Check default program ID
expect(CompressedTokenProgram.programId).toEqual(defaultProgramId);
expect(CompressedTokenProgram.deriveTokenPoolPda(solMint)).toEqual(
expectedPoolPda,
);
expect(CompressedTokenProgram.program.programId).toEqual(
defaultProgramId,
);
// Set new program ID
CompressedTokenProgram.setProgramId(newProgramId);
// Verify program ID was updated
expect(CompressedTokenProgram.programId).toEqual(newProgramId);
expect(CompressedTokenProgram.deriveTokenPoolPda(solMint)).not.toEqual(
expectedPoolPda,
);
expect(CompressedTokenProgram.program.programId).toEqual(newProgramId);
// Reset program ID
CompressedTokenProgram.setProgramId(defaultProgramId);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/compress-spl-token-account.test.ts
|
import { describe, it, expect, beforeAll, assert } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import {
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless.js';
import {
createMint,
decompress,
mintTo,
compressSplTokenAccount,
} from '../../src/actions';
import {
createAssociatedTokenAccount,
mintToChecked,
TOKEN_2022_PROGRAM_ID,
} from '@solana/spl-token';
import { WasmFactory } from '@lightprotocol/hasher.rs';
const TEST_TOKEN_DECIMALS = 2;
describe('compressSplTokenAccount', () => {
let rpc: Rpc;
let payer: Signer;
let alice: Signer;
let aliceAta: PublicKey;
let mint: PublicKey;
let mintAuthority: Keypair;
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc, 1e9);
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
)
).mint;
alice = await newAccountWithLamports(rpc, 1e9);
aliceAta = await createAssociatedTokenAccount(
rpc,
payer,
mint,
alice.publicKey,
);
// Mint some tokens to alice's ATA
await mintTo(
rpc,
payer,
mint,
alice.publicKey,
mintAuthority,
bn(1000),
);
await decompress(rpc, payer, mint, bn(1000), alice, aliceAta);
}, 80_000);
it('should compress entire token balance when remainingAmount is undefined', async () => {
// Get initial ATA balance
const ataBalanceBefore = await rpc.getTokenAccountBalance(aliceAta);
const initialCompressedBalance =
await rpc.getCompressedTokenAccountsByOwner(alice.publicKey, {
mint,
});
// Compress the entire balance
await compressSplTokenAccount(
rpc,
payer,
mint,
alice,
aliceAta,
defaultTestStateTreeAccounts().merkleTree,
);
// Get final balances
const ataBalanceAfter = await rpc.getTokenAccountBalance(aliceAta);
const compressedBalanceAfter =
await rpc.getCompressedTokenAccountsByOwner(alice.publicKey, {
mint,
});
// Assert ATA is empty
expect(bn(ataBalanceAfter.value.amount).eq(bn(0))).toBe(true);
// Assert compressed balance equals original ATA balance
const totalCompressedAmount = compressedBalanceAfter.items.reduce(
(sum, item) => sum.add(item.parsed.amount),
bn(0),
);
const initialCompressedAmount = initialCompressedBalance.items.reduce(
(sum, item) => sum.add(item.parsed.amount),
bn(0),
);
expect(
totalCompressedAmount.eq(
bn(ataBalanceBefore.value.amount).add(initialCompressedAmount),
),
).toBe(true);
});
it('should fail when trying to compress more than available balance', async () => {
// Mint new tokens for this test
const testAmount = bn(100);
await mintToChecked(
rpc,
payer,
mint,
aliceAta,
mintAuthority,
testAmount.toNumber(),
TEST_TOKEN_DECIMALS,
);
// Try to compress more than available
await expect(
compressSplTokenAccount(
rpc,
payer,
mint,
alice,
aliceAta,
defaultTestStateTreeAccounts().merkleTree,
bn(testAmount.add(bn(1))), // Try to leave more than available
),
).rejects.toThrow();
});
it('should leave specified remaining amount in token account', async () => {
/// still has 100
expect(
Number((await rpc.getTokenAccountBalance(aliceAta)).value.amount),
).toBe(100);
const remainingAmount = bn(10);
const ataBalanceBefore = await rpc.getTokenAccountBalance(aliceAta);
const initialCompressedBalance =
await rpc.getCompressedTokenAccountsByOwner(alice.publicKey, {
mint,
});
// Compress tokens while leaving remainingAmount
await compressSplTokenAccount(
rpc,
payer,
mint,
alice,
aliceAta,
defaultTestStateTreeAccounts().merkleTree,
remainingAmount,
);
// Get final balances
const ataBalanceAfter = await rpc.getTokenAccountBalance(aliceAta);
const compressedBalanceAfter =
await rpc.getCompressedTokenAccountsByOwner(alice.publicKey, {
mint,
});
// Assert remaining amount in ATA
expect(bn(ataBalanceAfter.value.amount).eq(remainingAmount)).toBe(true);
// Assert compressed amount is correct
const totalCompressedAmount = compressedBalanceAfter.items.reduce(
(sum, item) => sum.add(item.parsed.amount),
bn(0),
);
const initialCompressedAmount = initialCompressedBalance.items.reduce(
(sum, item) => sum.add(item.parsed.amount),
bn(0),
);
// Assert that the total compressed amount equals:
// Initial ATA balance - remaining amount + initial compressed amount
expect(
totalCompressedAmount.eq(
bn(ataBalanceBefore.value.amount)
.sub(remainingAmount)
.add(initialCompressedAmount),
),
).toBe(true);
});
it('should handle remainingAmount = current balance', async () => {
// Mint some tokens for testing
const testAmount = bn(100);
await mintToChecked(
rpc,
payer,
mint,
aliceAta,
mintAuthority,
testAmount.toNumber(),
TEST_TOKEN_DECIMALS,
);
const balanceBefore = await rpc.getTokenAccountBalance(aliceAta);
const compressedBefore = await rpc.getCompressedTokenAccountsByOwner(
alice.publicKey,
{ mint },
);
await compressSplTokenAccount(
rpc,
payer,
mint,
alice,
aliceAta,
defaultTestStateTreeAccounts().merkleTree,
bn(balanceBefore.value.amount),
);
const balanceAfter = await rpc.getTokenAccountBalance(aliceAta);
const compressedAfter = await rpc.getCompressedTokenAccountsByOwner(
alice.publicKey,
{ mint },
);
expect(balanceAfter.value.amount).toBe(balanceBefore.value.amount);
expect(compressedAfter.items.length).toBe(
compressedBefore.items.length + 1,
);
expect(compressedAfter.items[0].parsed.amount.eq(bn(0))).toBe(true);
});
it('should fail when non-owner tries to compress', async () => {
const nonOwner = await newAccountWithLamports(rpc, 1e9);
// Mint some tokens to ensure non-zero balance
await mintToChecked(
rpc,
payer,
mint,
aliceAta,
mintAuthority,
100,
TEST_TOKEN_DECIMALS,
);
await expect(
compressSplTokenAccount(
rpc,
payer,
mint,
nonOwner, // wrong signer
aliceAta,
defaultTestStateTreeAccounts().merkleTree,
),
).rejects.toThrow();
});
it('should fail with invalid state tree', async () => {
const invalidTree = Keypair.generate().publicKey;
// Mint some tokens to ensure non-zero balance
await mintToChecked(
rpc,
payer,
mint,
aliceAta,
mintAuthority,
100,
TEST_TOKEN_DECIMALS,
);
await expect(
compressSplTokenAccount(
rpc,
payer,
mint,
alice,
aliceAta,
invalidTree,
),
).rejects.toThrow();
});
it('should compress entire token 2022 account balance when remainingAmount is undefined', async () => {
const mintKeypair = Keypair.generate();
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
undefined,
true,
)
).mint;
const mintAccountInfo = await rpc.getAccountInfo(mint);
assert.equal(
mintAccountInfo!.owner.toBase58(),
TOKEN_2022_PROGRAM_ID.toBase58(),
);
alice = await newAccountWithLamports(rpc, 1e9);
aliceAta = await createAssociatedTokenAccount(
rpc,
payer,
mint,
alice.publicKey,
undefined,
TOKEN_2022_PROGRAM_ID,
);
// Mint some tokens to alice's ATA
await mintTo(
rpc,
payer,
mint,
alice.publicKey,
mintAuthority,
bn(1000),
);
await decompress(rpc, payer, mint, bn(1000), alice, aliceAta);
// Get initial ATA balance
const ataBalanceBefore = await rpc.getTokenAccountBalance(aliceAta);
const initialCompressedBalance =
await rpc.getCompressedTokenAccountsByOwner(alice.publicKey, {
mint,
});
// Compress the entire balance
await compressSplTokenAccount(
rpc,
payer,
mint,
alice,
aliceAta,
defaultTestStateTreeAccounts().merkleTree,
);
// Get final balances
const ataBalanceAfter = await rpc.getTokenAccountBalance(aliceAta);
const compressedBalanceAfter =
await rpc.getCompressedTokenAccountsByOwner(alice.publicKey, {
mint,
});
// Assert ATA is empty
expect(bn(ataBalanceAfter.value.amount).eq(bn(0))).toBe(true);
// Assert compressed balance equals original ATA balance
const totalCompressedAmount = compressedBalanceAfter.items.reduce(
(sum, item) => sum.add(item.parsed.amount),
bn(0),
);
const initialCompressedAmount = initialCompressedBalance.items.reduce(
(sum, item) => sum.add(item.parsed.amount),
bn(0),
);
expect(
totalCompressedAmount.eq(
bn(ataBalanceBefore.value.amount).add(initialCompressedAmount),
),
).toBe(true);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/rpc-token-interop.test.ts
|
import { describe, it, assert, beforeAll } from 'vitest';
import { Keypair, PublicKey, Signer } from '@solana/web3.js';
import {
Rpc,
newAccountWithLamports,
bn,
createRpc,
getTestRpc,
TestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
import { createMint, mintTo, transfer } from '../../src/actions';
const TEST_TOKEN_DECIMALS = 2;
describe('rpc-interop token', () => {
let rpc: Rpc;
let testRpc: TestRpc;
let payer: Signer;
let bob: Signer;
let charlie: Signer;
let mint: PublicKey;
let mintAuthority: Keypair;
beforeAll(async () => {
rpc = createRpc();
const lightWasm = await WasmFactory.getInstance();
payer = await newAccountWithLamports(rpc, 1e9, 256);
mintAuthority = Keypair.generate();
const mintKeypair = Keypair.generate();
testRpc = await getTestRpc(lightWasm);
mint = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
)
).mint;
bob = await newAccountWithLamports(rpc, 1e9, 256);
charlie = await newAccountWithLamports(rpc, 1e9, 256);
await mintTo(rpc, payer, mint, bob.publicKey, mintAuthority, bn(1000));
await transfer(rpc, payer, mint, bn(700), bob, charlie.publicKey);
});
it('getCompressedTokenAccountsByOwner should match', async () => {
const senderAccounts = (
await rpc.getCompressedTokenAccountsByOwner(bob.publicKey, { mint })
).items;
const senderAccountsTest = (
await testRpc.getCompressedTokenAccountsByOwner(bob.publicKey, {
mint,
})
).items;
assert.equal(senderAccounts.length, senderAccountsTest.length);
senderAccounts.forEach((account, index) => {
assert.equal(
account.parsed.owner.toBase58(),
senderAccountsTest[index].parsed.owner.toBase58(),
);
assert.isTrue(
account.parsed.amount.eq(
senderAccountsTest[index].parsed.amount,
),
);
});
const receiverAccounts = (
await rpc.getCompressedTokenAccountsByOwner(charlie.publicKey, {
mint,
})
).items;
const receiverAccountsTest = (
await testRpc.getCompressedTokenAccountsByOwner(charlie.publicKey, {
mint,
})
).items;
assert.equal(receiverAccounts.length, receiverAccountsTest.length);
receiverAccounts.forEach((account, index) => {
assert.equal(
account.parsed.owner.toBase58(),
receiverAccountsTest[index].parsed.owner.toBase58(),
);
assert.isTrue(
account.parsed.amount.eq(
receiverAccountsTest[index].parsed.amount,
),
);
});
});
it('getCompressedTokenAccountBalance should match ', async () => {
const senderAccounts = await rpc.getCompressedTokenAccountsByOwner(
bob.publicKey,
{ mint },
);
const balance = await rpc.getCompressedTokenAccountBalance(
bn(senderAccounts.items[0].compressedAccount.hash),
);
const balanceTest = await testRpc.getCompressedTokenAccountBalance(
bn(senderAccounts.items[0].compressedAccount.hash),
);
assert.isTrue(balance.amount.eq(balanceTest.amount));
assert.isNotNull(balance.amount);
assert.isNotNull(balanceTest.amount);
});
it('getCompressedTokenBalancesByOwner should match', async () => {
const balances = (
await rpc.getCompressedTokenBalancesByOwner(bob.publicKey, { mint })
).items;
const balancesTest = (
await testRpc.getCompressedTokenBalancesByOwner(bob.publicKey, {
mint,
})
).items;
assert.equal(balances.length, balancesTest.length);
balances.forEach((balance, index) => {
assert.isTrue(balance.balance.eq(balancesTest[index].balance));
});
const balancesReceiver = (
await rpc.getCompressedTokenBalancesByOwner(charlie.publicKey, {
mint,
})
).items;
const balancesReceiverTest = (
await testRpc.getCompressedTokenBalancesByOwner(charlie.publicKey, {
mint,
})
).items;
assert.equal(balancesReceiver.length, balancesReceiverTest.length);
balancesReceiver.forEach((balance, index) => {
assert.isTrue(
balance.balance.eq(balancesReceiverTest[index].balance),
);
});
});
it('getCompressedTokenBalancesByOwnerV2 should match', async () => {
const balances = (
await rpc.getCompressedTokenBalancesByOwnerV2(bob.publicKey, {
mint,
})
).value.items;
const balancesTest = (
await testRpc.getCompressedTokenBalancesByOwnerV2(bob.publicKey, {
mint,
})
).value.items;
assert.equal(balances.length, balancesTest.length);
balances.forEach((balance, index) => {
assert.isTrue(balance.balance.eq(balancesTest[index].balance));
});
const balancesReceiver = (
await rpc.getCompressedTokenBalancesByOwnerV2(charlie.publicKey, {
mint,
})
).value.items;
const balancesReceiverTest = (
await testRpc.getCompressedTokenBalancesByOwnerV2(
charlie.publicKey,
{
mint,
},
)
).value.items;
assert.equal(balancesReceiver.length, balancesReceiverTest.length);
balancesReceiver.forEach((balance, index) => {
assert.isTrue(
balance.balance.eq(balancesReceiverTest[index].balance),
);
});
});
it('[test-rpc missing] getSignaturesForTokenOwner should match', async () => {
const signatures = (
await rpc.getCompressionSignaturesForTokenOwner(bob.publicKey)
).items;
assert.equal(signatures.length, 2);
const signaturesReceiver = (
await rpc.getCompressionSignaturesForTokenOwner(charlie.publicKey)
).items;
assert.equal(signaturesReceiver.length, 1);
});
it('[test-rpc missing] getTransactionWithCompressionInfo should return correct token pre and post balances', async () => {
const signatures = (
await rpc.getCompressionSignaturesForTokenOwner(bob.publicKey)
).items;
const tx = await rpc.getTransactionWithCompressionInfo(
// most recent
signatures[0].signature,
);
assert.isTrue(
tx!.compressionInfo.preTokenBalances![0].amount.eq(bn(1000)),
);
assert.isTrue(
tx!.compressionInfo.postTokenBalances![0].amount.eq(bn(300)),
);
assert.isTrue(tx!.compressionInfo.postTokenBalances!.length === 2);
assert.isTrue(tx!.compressionInfo.preTokenBalances!.length === 1);
});
it('[delegate unused] getCompressedTokenAccountsByDelegate should match', async () => {
const accs = await rpc.getCompressedTokenAccountsByDelegate(
bob.publicKey,
{ mint },
);
assert.equal(accs.items.length, 0);
});
it('[rpc] getCompressedTokenAccountsByOwner with 2 mints should return both mints', async () => {
// additional mint
const mint2 = (
await createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
)
).mint;
await mintTo(rpc, payer, mint2, bob.publicKey, mintAuthority, bn(1000));
const senderAccounts = await rpc.getCompressedTokenAccountsByOwner(
bob.publicKey,
);
// check that mint and mint2 exist in list of senderaccounts at least once
assert.isTrue(
senderAccounts.items.some(
account => account.parsed.mint.toBase58() === mint.toBase58(),
),
);
assert.isTrue(
senderAccounts.items.some(
account => account.parsed.mint.toBase58() === mint2.toBase58(),
),
);
});
it('getCompressedMintTokenHolders should return correct holders', async () => {
const holders = await rpc.getCompressedMintTokenHolders(mint);
assert.equal(holders.value.items.length, 2);
const bobHolder = holders.value.items.find(
holder => holder.owner.toBase58() === bob.publicKey.toBase58(),
);
assert.isNotNull(bobHolder);
assert.isTrue(bobHolder!.balance.eq(bn(300)));
const charlieHolder = holders.value.items.find(
holder => holder.owner.toBase58() === charlie.publicKey.toBase58(),
);
assert.isNotNull(charlieHolder);
assert.isTrue(charlieHolder!.balance.eq(bn(700)));
});
it('getCompressedMintTokenHolders should handle cursor and limit', async () => {
// Get first holder with limit 1
const firstPage = await rpc.getCompressedMintTokenHolders(mint, {
limit: bn(1),
});
assert.equal(firstPage.value.items.length, 1);
assert.isNotNull(firstPage.value.cursor);
// Get second holder using cursor
const secondPage = await rpc.getCompressedMintTokenHolders(mint, {
cursor: firstPage.value.cursor!,
limit: bn(1),
});
assert.equal(secondPage.value.items.length, 1);
// Verify we got both holders across the pages
const allHolders = [
...firstPage.value.items,
...secondPage.value.items,
];
assert.equal(allHolders.length, 2);
const hasCharlie = allHolders.some(
holder => holder.owner.toBase58() === charlie.publicKey.toBase58(),
);
const hasBob = allHolders.some(
holder => holder.owner.toBase58() === bob.publicKey.toBase58(),
);
assert.isTrue(hasCharlie && hasBob);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/create-token-pool.test.ts
|
import { describe, it, expect, beforeAll, assert } from 'vitest';
import { CompressedTokenProgram } from '../../src/program';
import { PublicKey, Signer, Keypair, SystemProgram } from '@solana/web3.js';
import {
unpackMint,
unpackAccount,
MINT_SIZE,
TOKEN_PROGRAM_ID,
createInitializeMint2Instruction,
} from '@solana/spl-token';
import { createMint, createTokenPool } from '../../src/actions';
import {
Rpc,
buildAndSignTx,
dedupeSigner,
newAccountWithLamports,
sendAndConfirmTx,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
/**
* Assert that createTokenPool() creates system-pool account for external mint,
* with external mintAuthority.
*/
async function assertRegisterMint(
mint: PublicKey,
authority: PublicKey,
rpc: Rpc,
decimals: number,
poolAccount: PublicKey,
) {
const mintAcc = await rpc.getAccountInfo(mint);
const unpackedMint = unpackMint(mint, mintAcc);
expect(unpackedMint.mintAuthority?.toString()).toBe(authority.toString());
expect(unpackedMint.supply).toBe(0n);
expect(unpackedMint.decimals).toBe(decimals);
expect(unpackedMint.isInitialized).toBe(true);
expect(unpackedMint.freezeAuthority).toBe(null);
expect(unpackedMint.tlvData.length).toBe(0);
/// Pool (omnibus) account is a regular SPL Token account
const poolAccountInfo = await rpc.getAccountInfo(poolAccount);
const unpackedPoolAccount = unpackAccount(poolAccount, poolAccountInfo);
expect(unpackedPoolAccount.mint.equals(mint)).toBe(true);
expect(unpackedPoolAccount.amount).toBe(0n);
expect(
unpackedPoolAccount.owner.equals(
CompressedTokenProgram.deriveCpiAuthorityPda,
),
).toBe(true);
expect(unpackedPoolAccount.delegate).toBe(null);
}
async function createTestSplMint(
rpc: Rpc,
payer: Signer,
mintKeypair: Signer,
mintAuthority: Keypair,
) {
const rentExemptBalance =
await rpc.getMinimumBalanceForRentExemption(MINT_SIZE);
const createMintAccountInstruction = SystemProgram.createAccount({
fromPubkey: payer.publicKey,
lamports: rentExemptBalance,
newAccountPubkey: mintKeypair.publicKey,
programId: TOKEN_PROGRAM_ID,
space: MINT_SIZE,
});
const initializeMintInstruction = createInitializeMint2Instruction(
mintKeypair.publicKey,
TEST_TOKEN_DECIMALS,
mintAuthority.publicKey,
null,
TOKEN_PROGRAM_ID,
);
const { blockhash } = await rpc.getLatestBlockhash();
const tx = buildAndSignTx(
[createMintAccountInstruction, initializeMintInstruction],
payer,
blockhash,
dedupeSigner(payer, [mintKeypair]),
);
await sendAndConfirmTx(rpc, tx);
}
const TEST_TOKEN_DECIMALS = 2;
describe('createTokenPool', () => {
let rpc: Rpc;
let payer: Signer;
let mintKeypair: Keypair;
let mint: PublicKey;
let mintAuthority: Keypair;
beforeAll(async () => {
const lightWasm = await WasmFactory.getInstance();
rpc = await getTestRpc(lightWasm);
payer = await newAccountWithLamports(rpc);
mintAuthority = Keypair.generate();
mintKeypair = Keypair.generate();
mint = mintKeypair.publicKey;
/// Create external SPL mint
await createTestSplMint(rpc, payer, mintKeypair, mintAuthority);
});
it('should register existing spl mint', async () => {
const poolAccount = CompressedTokenProgram.deriveTokenPoolPda(mint);
assert(mint.equals(mintKeypair.publicKey));
/// Mint already exists externally
await expect(
createMint(
rpc,
payer,
mintAuthority.publicKey,
TEST_TOKEN_DECIMALS,
mintKeypair,
),
).rejects.toThrow();
await createTokenPool(rpc, payer, mint);
await assertRegisterMint(
mint,
mintAuthority.publicKey,
rpc,
TEST_TOKEN_DECIMALS,
poolAccount,
);
/// Mint already registered
await expect(createTokenPool(rpc, payer, mint)).rejects.toThrow();
});
it('should create mint with payer as authority', async () => {
/// Create new external SPL mint with payer === authority
mintKeypair = Keypair.generate();
mint = mintKeypair.publicKey;
await createTestSplMint(rpc, payer, mintKeypair, payer as Keypair);
await createTokenPool(rpc, payer, mint);
const poolAccount = CompressedTokenProgram.deriveTokenPoolPda(mint);
await assertRegisterMint(
mint,
payer.publicKey,
rpc,
TEST_TOKEN_DECIMALS,
poolAccount,
);
});
});
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/program.ts
|
import {
PublicKey,
Keypair,
TransactionInstruction,
SystemProgram,
Connection,
AddressLookupTableProgram,
AccountMeta,
} from '@solana/web3.js';
import { BN, Program, AnchorProvider, setProvider } from '@coral-xyz/anchor';
import { IDL, LightCompressedToken } from './idl/light_compressed_token';
import {
CompressedProof,
LightSystemProgram,
ParsedTokenAccount,
TokenTransferOutputData,
bn,
confirmConfig,
CompressedTokenInstructionDataTransfer,
defaultStaticAccountsStruct,
sumUpLamports,
toArray,
useWallet,
validateSameOwner,
validateSufficientBalance,
defaultTestStateTreeAccounts,
} from '@lightprotocol/stateless.js';
import {
MINT_SIZE,
TOKEN_2022_PROGRAM_ID,
TOKEN_PROGRAM_ID,
createInitializeMint2Instruction,
createMintToInstruction,
} from '@solana/spl-token';
import { CPI_AUTHORITY_SEED, POOL_SEED } from './constants';
import { packCompressedTokenAccounts } from './instructions/pack-compressed-token-accounts';
export type CompressParams = {
/**
* The payer of the transaction.
*/
payer: PublicKey;
/**
* owner of the *uncompressed* token account.
*/
owner: PublicKey;
/**
* source (associated) token account address.
*/
source: PublicKey;
/**
* owner of the compressed token account.
* To compress to a batch of recipients, pass an array of PublicKeys.
*/
toAddress: PublicKey | PublicKey[];
/**
* Mint address of the token to compress.
*/
mint: PublicKey;
/**
* amount of tokens to compress.
*/
amount: number | BN | number[] | BN[];
/**
* The state tree that the tx output should be inserted into. Defaults to a
* public state tree if unspecified.
*/
outputStateTree?: PublicKey;
/**
* Optional: The token program ID. Default: SPL Token Program ID
*/
tokenProgramId?: PublicKey;
};
export type CompressSplTokenAccountParams = {
/**
* Tx feepayer
*/
feePayer: PublicKey;
/**
* Authority that owns the token account
*/
authority: PublicKey;
/**
* Token account to compress
*/
tokenAccount: PublicKey;
/**
* Mint public key
*/
mint: PublicKey;
/**
* Optional: remaining amount to leave in token account. Default: 0
*/
remainingAmount?: BN;
/**
* The state tree that the compressed token account should be inserted into.
*/
outputStateTree: PublicKey;
/**
* Optional: The token program ID. Default: SPL Token Program ID
*/
tokenProgramId?: PublicKey;
};
export type DecompressParams = {
/**
* The payer of the transaction.
*/
payer: PublicKey;
/**
* input state to be consumed
*/
inputCompressedTokenAccounts: ParsedTokenAccount[];
/**
* address of **uncompressed** destination token account.
*/
toAddress: PublicKey;
/**
* amount of tokens to decompress.
*/
amount: number | BN;
/**
* The recent state root indices of the input state. The expiry is tied to
* the proof.
*/
recentInputStateRootIndices: number[];
/**
* The recent validity proof for state inclusion of the input state. It
* expires after n slots.
*/
recentValidityProof: CompressedProof;
/**
* The state tree that the change tx output should be inserted into.
* Defaults to a public state tree if unspecified.
*/
outputStateTree?: PublicKey;
/**
* Optional: The token program ID. Default: SPL Token Program ID
*/
tokenProgramId?: PublicKey;
};
export type TransferParams = {
/**
* The payer of the transaction
*/
payer: PublicKey;
/**
* The input state to be consumed
*/
inputCompressedTokenAccounts: ParsedTokenAccount[];
/**
* Recipient address
*/
toAddress: PublicKey;
/**
* Amount of tokens to transfer
*/
amount: BN | number;
/**
* The recent state root indices of the input state. The expiry is tied to
* the proof.
*/
recentInputStateRootIndices: number[];
/**
* The recent validity proof for state inclusion of the input state. It
* expires after n slots.
*/
recentValidityProof: CompressedProof;
/**
* The state trees that the tx output should be inserted into. This can be a
* single PublicKey or an array of PublicKey. Defaults to the 0th state tree
* of input state.
*/
outputStateTrees?: PublicKey[] | PublicKey;
};
/**
* Create Mint account for compressed Tokens
*/
export type CreateMintParams = {
/**
* Tx feepayer
*/
feePayer: PublicKey;
/**
* Mint authority
*/
authority: PublicKey;
/**
* Mint public key
*/
mint: PublicKey;
/**
* Mint decimals
*/
decimals: number;
/**
* Optional: freeze authority
*/
freezeAuthority: PublicKey | null;
/**
* lamport amount for mint account rent exemption
*/
rentExemptBalance: number;
/**
* Optional: The token program ID. Default: SPL Token Program ID
*/
tokenProgramId?: PublicKey;
};
/**
* Parameters for merging compressed token accounts
*/
export type MergeTokenAccountsParams = {
/**
* Tx feepayer
*/
payer: PublicKey;
/**
* Owner of the token accounts to be merged
*/
owner: PublicKey;
/**
* Mint public key
*/
mint: PublicKey;
/**
* Array of compressed token accounts to merge
*/
inputCompressedTokenAccounts: ParsedTokenAccount[];
/**
* Optional: Public key of the state tree to merge into
*/
outputStateTree: PublicKey;
/**
* Optional: Recent validity proof for state inclusion
*/
recentValidityProof: CompressedProof;
/**
* Optional: Recent state root indices of the input state
*/
recentInputStateRootIndices: number[];
};
/**
* Create compressed token accounts
*/
export type MintToParams = {
/**
* Tx feepayer
*/
feePayer: PublicKey;
/**
* Mint authority
*/
authority: PublicKey;
/**
* Mint public key
*/
mint: PublicKey;
/**
* The Solana Public Keys to mint to.
*/
toPubkey: PublicKey[] | PublicKey;
/**
* The amount of compressed tokens to mint.
*/
amount: BN | BN[] | number | number[];
/**
* Public key of the state tree to mint into. Defaults to a public state
* tree if unspecified.
*/
merkleTree?: PublicKey;
/**
* Optional: The token program ID. Default: SPL Token Program ID
*/
tokenProgramId?: PublicKey;
};
/**
* Register an existing SPL mint account to the compressed token program
* Creates an omnibus account for the mint
*/
export type RegisterMintParams = {
/** Tx feepayer */
feePayer: PublicKey;
/** Mint public key */
mint: PublicKey;
/**
* Optional: The token program ID. Default: SPL Token Program ID
*/
tokenProgramId?: PublicKey;
};
/**
* Mint from existing SPL mint to compressed token accounts
*/
export type ApproveAndMintToParams = {
/**
* Tx feepayer
*/
feePayer: PublicKey;
/**
* Mint authority
*/
authority: PublicKey;
/**
* Mint authority (associated) token account
*/
authorityTokenAccount: PublicKey;
/**
* Mint public key
*/
mint: PublicKey;
/**
* The Solana Public Key to mint to.
*/
toPubkey: PublicKey;
/**
* The amount of compressed tokens to mint.
*/
amount: BN | number;
/**
* Public key of the state tree to mint into. Defaults to a public state
* tree if unspecified.
*/
merkleTree?: PublicKey;
/**
* Optional: The token program ID. Default: SPL Token Program ID
*/
tokenProgramId?: PublicKey;
};
export type CreateTokenProgramLookupTableParams = {
/**
* The payer of the transaction.
*/
payer: PublicKey;
/**
* The authority of the transaction.
*/
authority: PublicKey;
/**
* Recently finalized Solana slot.
*/
recentSlot: number;
/**
* Optional Mint addresses to store in the lookup table.
*/
mints?: PublicKey[];
/**
* Optional additional addresses to store in the lookup table.
*/
remainingAccounts?: PublicKey[];
};
/**
* Sum up the token amounts of the compressed token accounts
*/
export const sumUpTokenAmount = (accounts: ParsedTokenAccount[]): BN => {
return accounts.reduce(
(acc, account: ParsedTokenAccount) => acc.add(account.parsed.amount),
bn(0),
);
};
/**
* Validate that all the compressed token accounts are owned by the same owner.
*/
export const validateSameTokenOwner = (accounts: ParsedTokenAccount[]) => {
const owner = accounts[0].parsed.owner;
accounts.forEach(acc => {
if (!acc.parsed.owner.equals(owner)) {
throw new Error('Token accounts must be owned by the same owner');
}
});
};
/**
* Parse compressed token accounts to get the mint, current owner and delegate.
*/
export const parseTokenData = (
compressedTokenAccounts: ParsedTokenAccount[],
) => {
const mint = compressedTokenAccounts[0].parsed.mint;
const currentOwner = compressedTokenAccounts[0].parsed.owner;
const delegate = compressedTokenAccounts[0].parsed.delegate;
return { mint, currentOwner, delegate };
};
/**
* Create the output state for a transfer transaction.
* @param inputCompressedTokenAccounts Input state
* @param toAddress Recipient address
* @param amount Amount of tokens to transfer
* @returns Output token data for the transfer
* instruction
*/
export function createTransferOutputState(
inputCompressedTokenAccounts: ParsedTokenAccount[],
toAddress: PublicKey,
amount: number | BN,
): TokenTransferOutputData[] {
amount = bn(amount);
const inputAmount = sumUpTokenAmount(inputCompressedTokenAccounts);
const inputLamports = sumUpLamports(
inputCompressedTokenAccounts.map(acc => acc.compressedAccount),
);
const changeAmount = inputAmount.sub(amount);
validateSufficientBalance(changeAmount);
if (changeAmount.eq(bn(0)) && inputLamports.eq(bn(0))) {
return [
{
owner: toAddress,
amount,
lamports: inputLamports,
tlv: null,
},
];
}
/// validates token program
validateSameOwner(
inputCompressedTokenAccounts.map(acc => acc.compressedAccount),
);
validateSameTokenOwner(inputCompressedTokenAccounts);
const outputCompressedAccounts: TokenTransferOutputData[] = [
{
owner: inputCompressedTokenAccounts[0].parsed.owner,
amount: changeAmount,
lamports: inputLamports,
tlv: null,
},
{
owner: toAddress,
amount,
lamports: bn(0),
tlv: null,
},
];
return outputCompressedAccounts;
}
/**
* Create the output state for a compress transaction.
* @param inputCompressedTokenAccounts Input state
* @param amount Amount of tokens to compress
* @returns Output token data for the compress
* instruction
*/
export function createDecompressOutputState(
inputCompressedTokenAccounts: ParsedTokenAccount[],
amount: number | BN,
): TokenTransferOutputData[] {
amount = bn(amount);
const inputLamports = sumUpLamports(
inputCompressedTokenAccounts.map(acc => acc.compressedAccount),
);
const inputAmount = sumUpTokenAmount(inputCompressedTokenAccounts);
const changeAmount = inputAmount.sub(amount);
validateSufficientBalance(changeAmount);
/// lamports gets decompressed
if (changeAmount.eq(bn(0)) && inputLamports.eq(bn(0))) {
return [];
}
validateSameOwner(
inputCompressedTokenAccounts.map(acc => acc.compressedAccount),
);
validateSameTokenOwner(inputCompressedTokenAccounts);
const tokenTransferOutputs: TokenTransferOutputData[] = [
{
owner: inputCompressedTokenAccounts[0].parsed.owner,
amount: changeAmount,
lamports: inputLamports,
tlv: null,
},
];
return tokenTransferOutputs;
}
export class CompressedTokenProgram {
/**
* @internal
*/
constructor() {}
/**
* Public key that identifies the CompressedPda program
*/
static programId: PublicKey = new PublicKey(
'cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m',
);
/**
* Set a custom programId via PublicKey or base58 encoded string.
* This method is not required for regular usage.
*
* Use this only if you know what you are doing.
*/
static setProgramId(programId: PublicKey | string) {
this.programId =
typeof programId === 'string'
? new PublicKey(programId)
: programId;
// Reset program when programId changes
this._program = null;
}
private static _program: Program<LightCompressedToken> | null = null;
/** @internal */
static get program(): Program<LightCompressedToken> {
if (!this._program) {
this.initializeProgram();
}
return this._program!;
}
/**
* @internal
* Initializes the program statically if not already initialized.
*/
private static initializeProgram() {
if (!this._program) {
/// Note: We can use a mock connection because we're using the
/// program only for serde and building instructions, not for
/// interacting with the network.
const mockKeypair = Keypair.generate();
const mockConnection = new Connection(
'http://127.0.0.1:8899',
'confirmed',
);
const mockProvider = new AnchorProvider(
mockConnection,
useWallet(mockKeypair),
confirmConfig,
);
setProvider(mockProvider);
this._program = new Program(IDL, this.programId, mockProvider);
}
}
/** @internal */
static deriveTokenPoolPda(mint: PublicKey): PublicKey {
const seeds = [POOL_SEED, mint.toBuffer()];
const [address, _] = PublicKey.findProgramAddressSync(
seeds,
this.programId,
);
return address;
}
/** @internal */
static get deriveCpiAuthorityPda(): PublicKey {
const [address, _] = PublicKey.findProgramAddressSync(
[CPI_AUTHORITY_SEED],
this.programId,
);
return address;
}
/**
* Construct createMint instruction for compressed tokens
*/
static async createMint(
params: CreateMintParams,
): Promise<TransactionInstruction[]> {
const { mint, authority, feePayer, rentExemptBalance, tokenProgramId } =
params;
const tokenProgram = tokenProgramId ?? TOKEN_PROGRAM_ID;
/// Create and initialize SPL Mint account
const createMintAccountInstruction = SystemProgram.createAccount({
fromPubkey: feePayer,
lamports: rentExemptBalance,
newAccountPubkey: mint,
programId: tokenProgram,
space: MINT_SIZE,
});
const initializeMintInstruction = createInitializeMint2Instruction(
mint,
params.decimals,
authority,
params.freezeAuthority,
tokenProgram,
);
const ix = await this.createTokenPool({
feePayer,
mint,
tokenProgramId: tokenProgram,
});
return [createMintAccountInstruction, initializeMintInstruction, ix];
}
/**
* Enable compression for an existing SPL mint, creating an omnibus account.
* For new mints, use `CompressedTokenProgram.createMint`.
*/
static async createTokenPool(
params: RegisterMintParams,
): Promise<TransactionInstruction> {
const { mint, feePayer, tokenProgramId } = params;
const tokenProgram = tokenProgramId ?? TOKEN_PROGRAM_ID;
const tokenPoolPda = this.deriveTokenPoolPda(mint);
const ix = await this.program.methods
.createTokenPool()
.accounts({
mint,
feePayer,
tokenPoolPda,
systemProgram: SystemProgram.programId,
tokenProgram,
cpiAuthorityPda: this.deriveCpiAuthorityPda,
})
.instruction();
return ix;
}
/**
* Construct mintTo instruction for compressed tokens
*/
static async mintTo(params: MintToParams): Promise<TransactionInstruction> {
const systemKeys = defaultStaticAccountsStruct();
const {
mint,
feePayer,
authority,
merkleTree,
toPubkey,
amount,
tokenProgramId,
} = params;
const tokenProgram = tokenProgramId ?? TOKEN_PROGRAM_ID;
const tokenPoolPda = this.deriveTokenPoolPda(mint);
const amounts = toArray<BN | number>(amount).map(amount => bn(amount));
const toPubkeys = toArray(toPubkey);
if (amounts.length !== toPubkeys.length) {
throw new Error(
'Amount and toPubkey arrays must have the same length',
);
}
const instruction = await this.program.methods
.mintTo(toPubkeys, amounts, null)
.accounts({
feePayer,
authority,
cpiAuthorityPda: this.deriveCpiAuthorityPda,
mint,
tokenPoolPda,
tokenProgram,
lightSystemProgram: LightSystemProgram.programId,
registeredProgramPda: systemKeys.registeredProgramPda,
noopProgram: systemKeys.noopProgram,
accountCompressionAuthority:
systemKeys.accountCompressionAuthority,
accountCompressionProgram: systemKeys.accountCompressionProgram,
merkleTree:
merkleTree ?? defaultTestStateTreeAccounts().merkleTree,
selfProgram: this.programId,
solPoolPda: null,
})
.instruction();
return instruction;
}
/// TODO: add compressBatch functionality for batch minting
/**
* Mint tokens from registed SPL mint account to a compressed account
*/
static async approveAndMintTo(params: ApproveAndMintToParams) {
const {
mint,
feePayer,
authorityTokenAccount,
authority,
merkleTree,
toPubkey,
tokenProgramId,
} = params;
const amount: bigint = BigInt(params.amount.toString());
/// 1. Mint to existing ATA of mintAuthority.
const splMintToInstruction = createMintToInstruction(
mint,
authorityTokenAccount,
authority,
amount,
[],
tokenProgramId,
);
/// 2. Compress from mint authority ATA to recipient compressed account
const compressInstruction = await this.compress({
payer: feePayer,
owner: authority,
source: authorityTokenAccount,
toAddress: toPubkey,
mint,
amount: params.amount,
outputStateTree: merkleTree,
tokenProgramId,
});
return [splMintToInstruction, compressInstruction];
}
/**
* Construct transfer instruction for compressed tokens
*/
static async transfer(
params: TransferParams,
): Promise<TransactionInstruction> {
const {
payer,
inputCompressedTokenAccounts,
recentInputStateRootIndices,
recentValidityProof,
amount,
outputStateTrees,
toAddress,
} = params;
const tokenTransferOutputs: TokenTransferOutputData[] =
createTransferOutputState(
inputCompressedTokenAccounts,
toAddress,
amount,
);
const {
inputTokenDataWithContext,
packedOutputTokenData,
remainingAccountMetas,
} = packCompressedTokenAccounts({
inputCompressedTokenAccounts,
outputStateTrees,
rootIndices: recentInputStateRootIndices,
tokenTransferOutputs,
});
const { mint, currentOwner } = parseTokenData(
inputCompressedTokenAccounts,
);
const data: CompressedTokenInstructionDataTransfer = {
proof: recentValidityProof,
mint,
delegatedTransfer: null, // TODO: implement
inputTokenDataWithContext,
outputCompressedAccounts: packedOutputTokenData,
compressOrDecompressAmount: null,
isCompress: false,
cpiContext: null,
lamportsChangeAccountMerkleTreeIndex: null,
};
const encodedData = this.program.coder.types.encode(
'CompressedTokenInstructionDataTransfer',
data,
);
const {
accountCompressionAuthority,
noopProgram,
registeredProgramPda,
accountCompressionProgram,
} = defaultStaticAccountsStruct();
const instruction = await this.program.methods
.transfer(encodedData)
.accounts({
feePayer: payer!,
authority: currentOwner!,
cpiAuthorityPda: this.deriveCpiAuthorityPda,
lightSystemProgram: LightSystemProgram.programId,
registeredProgramPda: registeredProgramPda,
noopProgram: noopProgram,
accountCompressionAuthority: accountCompressionAuthority,
accountCompressionProgram: accountCompressionProgram,
selfProgram: this.programId,
tokenPoolPda: null,
compressOrDecompressTokenAccount: null,
tokenProgram: null,
})
.remainingAccounts(remainingAccountMetas)
.instruction();
return instruction;
}
/**
* Create lookup table instructions for the token program's default accounts.
*/
static async createTokenProgramLookupTable(
params: CreateTokenProgramLookupTableParams,
) {
const { authority, mints, recentSlot, payer, remainingAccounts } =
params;
const [createInstruction, lookupTableAddress] =
AddressLookupTableProgram.createLookupTable({
authority,
payer: authority,
recentSlot,
});
let optionalMintKeys: PublicKey[] = [];
if (mints) {
optionalMintKeys = [
...mints,
...mints.map(mint => this.deriveTokenPoolPda(mint)),
];
}
const extendInstruction = AddressLookupTableProgram.extendLookupTable({
payer,
authority,
lookupTable: lookupTableAddress,
addresses: [
this.deriveCpiAuthorityPda,
LightSystemProgram.programId,
defaultStaticAccountsStruct().registeredProgramPda,
defaultStaticAccountsStruct().noopProgram,
defaultStaticAccountsStruct().accountCompressionAuthority,
defaultStaticAccountsStruct().accountCompressionProgram,
defaultTestStateTreeAccounts().merkleTree,
defaultTestStateTreeAccounts().nullifierQueue,
defaultTestStateTreeAccounts().addressTree,
defaultTestStateTreeAccounts().addressQueue,
this.programId,
TOKEN_PROGRAM_ID,
TOKEN_2022_PROGRAM_ID,
authority,
...optionalMintKeys,
...(remainingAccounts ?? []),
],
});
return {
instructions: [createInstruction, extendInstruction],
address: lookupTableAddress,
};
}
/**
* Create compress instruction
* @returns compressInstruction
*/
static async compress(
params: CompressParams,
): Promise<TransactionInstruction> {
const {
payer,
owner,
source,
toAddress,
mint,
outputStateTree,
tokenProgramId,
} = params;
if (Array.isArray(params.amount) !== Array.isArray(params.toAddress)) {
throw new Error(
'Both amount and toAddress must be arrays or both must be single values',
);
}
let tokenTransferOutputs: TokenTransferOutputData[];
if (Array.isArray(params.amount) && Array.isArray(params.toAddress)) {
if (params.amount.length !== params.toAddress.length) {
throw new Error(
'Amount and toAddress arrays must have the same length',
);
}
tokenTransferOutputs = params.amount.map((amt, index) => {
const amount = bn(amt);
return {
owner: (params.toAddress as PublicKey[])[index],
amount,
lamports: bn(0),
tlv: null,
};
});
} else {
tokenTransferOutputs = [
{
owner: toAddress as PublicKey,
amount: bn(params.amount as number | BN),
lamports: bn(0),
tlv: null,
},
];
}
const {
inputTokenDataWithContext,
packedOutputTokenData,
remainingAccountMetas,
} = packCompressedTokenAccounts({
inputCompressedTokenAccounts: [],
outputStateTrees: outputStateTree,
rootIndices: [],
tokenTransferOutputs,
});
const data: CompressedTokenInstructionDataTransfer = {
proof: null,
mint,
delegatedTransfer: null, // TODO: implement
inputTokenDataWithContext,
outputCompressedAccounts: packedOutputTokenData,
compressOrDecompressAmount: Array.isArray(params.amount)
? params.amount
.map(amt => new BN(amt))
.reduce((sum, amt) => sum.add(amt), new BN(0))
: new BN(params.amount),
isCompress: true,
cpiContext: null,
lamportsChangeAccountMerkleTreeIndex: null,
};
const encodedData = this.program.coder.types.encode(
'CompressedTokenInstructionDataTransfer',
data,
);
const tokenProgram = tokenProgramId ?? TOKEN_PROGRAM_ID;
const instruction = await this.program.methods
.transfer(encodedData)
.accounts({
feePayer: payer,
authority: owner,
cpiAuthorityPda: this.deriveCpiAuthorityPda,
lightSystemProgram: LightSystemProgram.programId,
registeredProgramPda:
defaultStaticAccountsStruct().registeredProgramPda,
noopProgram: defaultStaticAccountsStruct().noopProgram,
accountCompressionAuthority:
defaultStaticAccountsStruct().accountCompressionAuthority,
accountCompressionProgram:
defaultStaticAccountsStruct().accountCompressionProgram,
selfProgram: this.programId,
tokenPoolPda: this.deriveTokenPoolPda(mint),
compressOrDecompressTokenAccount: source, // token
tokenProgram,
})
.remainingAccounts(remainingAccountMetas)
.instruction();
return instruction;
}
/**
* Construct decompress instruction
*/
static async decompress(
params: DecompressParams,
): Promise<TransactionInstruction> {
const {
payer,
inputCompressedTokenAccounts,
toAddress,
outputStateTree,
recentValidityProof,
recentInputStateRootIndices,
tokenProgramId,
} = params;
const amount = bn(params.amount);
const tokenTransferOutputs = createDecompressOutputState(
inputCompressedTokenAccounts,
amount,
);
/// Pack
const {
inputTokenDataWithContext,
packedOutputTokenData,
remainingAccountMetas,
} = packCompressedTokenAccounts({
inputCompressedTokenAccounts,
outputStateTrees: outputStateTree,
rootIndices: recentInputStateRootIndices,
tokenTransferOutputs: tokenTransferOutputs,
});
const { mint, currentOwner } = parseTokenData(
inputCompressedTokenAccounts,
);
const data: CompressedTokenInstructionDataTransfer = {
proof: recentValidityProof,
mint,
delegatedTransfer: null, // TODO: implement
inputTokenDataWithContext,
outputCompressedAccounts: packedOutputTokenData,
compressOrDecompressAmount: amount,
isCompress: false,
cpiContext: null,
lamportsChangeAccountMerkleTreeIndex: null,
};
const encodedData = this.program.coder.types.encode(
'CompressedTokenInstructionDataTransfer',
data,
);
const {
accountCompressionAuthority,
noopProgram,
registeredProgramPda,
accountCompressionProgram,
} = defaultStaticAccountsStruct();
const tokenProgram = tokenProgramId ?? TOKEN_PROGRAM_ID;
const instruction = await this.program.methods
.transfer(encodedData)
.accounts({
feePayer: payer,
authority: currentOwner,
cpiAuthorityPda: this.deriveCpiAuthorityPda,
lightSystemProgram: LightSystemProgram.programId,
registeredProgramPda: registeredProgramPda,
noopProgram: noopProgram,
accountCompressionAuthority: accountCompressionAuthority,
accountCompressionProgram: accountCompressionProgram,
selfProgram: this.programId,
tokenPoolPda: this.deriveTokenPoolPda(mint),
compressOrDecompressTokenAccount: toAddress,
tokenProgram,
})
.remainingAccounts(remainingAccountMetas)
.instruction();
return instruction;
}
static async mergeTokenAccounts(
params: MergeTokenAccountsParams,
): Promise<TransactionInstruction[]> {
const {
payer,
owner,
inputCompressedTokenAccounts,
outputStateTree,
recentValidityProof,
recentInputStateRootIndices,
} = params;
if (inputCompressedTokenAccounts.length > 3) {
throw new Error('Cannot merge more than 3 token accounts at once');
}
const ix = await this.transfer({
payer,
inputCompressedTokenAccounts,
toAddress: owner,
amount: inputCompressedTokenAccounts.reduce(
(sum, account) => sum.add(account.parsed.amount),
new BN(0),
),
outputStateTrees: outputStateTree,
recentInputStateRootIndices,
recentValidityProof,
});
return [ix];
}
static async compressSplTokenAccount(
params: CompressSplTokenAccountParams,
): Promise<TransactionInstruction> {
const {
feePayer,
authority,
tokenAccount,
mint,
remainingAmount,
outputStateTree,
tokenProgramId,
} = params;
const tokenProgram = tokenProgramId ?? TOKEN_PROGRAM_ID;
const remainingAccountMetas: AccountMeta[] = [
{
pubkey: outputStateTree,
isSigner: false,
isWritable: true,
},
];
const instruction = await this.program.methods
.compressSplTokenAccount(authority, remainingAmount ?? null, null)
.accounts({
feePayer,
authority,
cpiAuthorityPda: this.deriveCpiAuthorityPda,
lightSystemProgram: LightSystemProgram.programId,
registeredProgramPda:
defaultStaticAccountsStruct().registeredProgramPda,
noopProgram: defaultStaticAccountsStruct().noopProgram,
accountCompressionAuthority:
defaultStaticAccountsStruct().accountCompressionAuthority,
accountCompressionProgram:
defaultStaticAccountsStruct().accountCompressionProgram,
selfProgram: this.programId,
tokenPoolPda: this.deriveTokenPoolPda(mint),
compressOrDecompressTokenAccount: tokenAccount,
tokenProgram,
systemProgram: SystemProgram.programId,
})
.remainingAccounts(remainingAccountMetas)
.instruction();
return instruction;
}
static async get_mint_program_id(
mint: PublicKey,
connection: Connection,
): Promise<PublicKey | undefined> {
return (await connection.getAccountInfo(mint))?.owner;
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/types.ts
|
import { PublicKey } from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedProof } from '@lightprotocol/stateless.js';
/// TODO: remove index_mt_account on-chain. passed as part of
/// CompressedTokenInstructionDataInvoke
export type TokenTransferOutputData = {
/**
* The owner of the output token account
*/
owner: PublicKey;
/**
* The amount of tokens of the output token account
*/
amount: BN;
/**
* lamports associated with the output token account
*/
lamports: BN | null;
/**
* TokenExtension tlv
*/
tlv: Buffer | null;
};
export type PackedTokenTransferOutputData = {
/**
* The owner of the output token account
*/
owner: PublicKey;
/**
* The amount of tokens of the output token account
*/
amount: BN;
/**
* lamports associated with the output token account
*/
lamports: BN | null;
/**
* Merkle tree pubkey index in remaining accounts
*/
merkleTreeIndex: number;
/**
* TokenExtension tlv
*/
tlv: Buffer | null;
};
export type InputTokenDataWithContext = {
/**
* The amount of tokens to transfer
*/
amount: BN;
/**
* Optional: The index of the delegate in remaining accounts
*/
delegateIndex: number | null;
/**
* The index of the merkle tree address in remaining accounts
*/
merkleTreePubkeyIndex: number;
/**
* The index of the nullifier queue address in remaining accounts
*/
nullifierQueuePubkeyIndex: number;
/**
* The index of the leaf in the merkle tree
*/
leafIndex: number;
/**
* Lamports in the input token account.
*/
lamports: BN | null;
/**
* TokenExtension tlv
*/
tlv: Buffer | null;
};
export type CompressedTokenInstructionDataInvoke = {
/**
* Validity proof
*/
proof: CompressedProof | null;
/**
* The root indices of the transfer
*/
rootIndices: number[];
/**
* The mint of the transfer
*/
mint: PublicKey;
/**
* Whether the signer is a delegate
* TODO: implement delegated transfer struct
*/
delegatedTransfer: null;
/**
* Input token data with packed merkle context
*/
inputTokenDataWithContext: InputTokenDataWithContext[];
/**
* Data of the output token accounts
*/
outputCompressedAccounts: TokenTransferOutputData[];
/**
* The indices of the output state merkle tree accounts in 'remaining
* accounts'
*/
outputStateMerkleTreeAccountIndices: Buffer;
/**
* The index of the Merkle tree for a lamport change account.
*/
lamportsChangeAccountMerkleTreeIndex: number | null;
};
export type TokenData = {
/**
* The mint associated with this account
*/
mint: PublicKey;
/**
* The owner of this account
*/
owner: PublicKey;
/**
* The amount of tokens this account holds
*/
amount: BN;
/**
* If `delegate` is `Some` then `delegated_amount` represents the amount
* authorized by the delegate
*/
delegate: PublicKey | null;
/**
* The account's state
*/
state: number;
/**
* TokenExtension tlv
*/
tlv: Buffer | null;
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/constants.ts
|
export const POOL_SEED = Buffer.from('pool');
export const CPI_AUTHORITY_SEED = Buffer.from('cpi_authority');
export const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/index.ts
|
export * from './idl';
export * from './instructions';
export * from './constants';
export * from './program';
export * from './types';
export * from './actions';
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/idl/index.ts
|
export * from './light_compressed_token';
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/idl/light_compressed_token.ts
|
export type LightCompressedToken = {
version: '1.2.0';
name: 'light_compressed_token';
instructions: [
{
name: 'createTokenPool';
docs: [
'This instruction creates a token pool for a given mint. Every spl mint',
'can have one token pool. When a token is compressed the tokens are',
'transferrred to the token pool, and their compressed equivalent is',
'minted into a Merkle tree.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
{
name: 'mint';
isMut: true;
isSigner: false;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
];
args: [];
},
{
name: 'mintTo';
docs: [
'Mints tokens from an spl token mint to a list of compressed accounts.',
'Minted tokens are transferred to a pool account owned by the compressed',
'token program. The instruction creates one compressed output account for',
'every amount and pubkey input pair. A constant amount of lamports can be',
'transferred to each output account to enable. A use case to add lamports',
'to a compressed token account is to prevent spam. This is the only way',
'to add lamports to a compressed token account.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'mint';
isMut: true;
isSigner: false;
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
docs: ['programs'];
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'merkleTree';
isMut: true;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
{
name: 'solPoolPda';
isMut: true;
isSigner: false;
isOptional: true;
},
];
args: [
{
name: 'publicKeys';
type: {
vec: 'publicKey';
};
},
{
name: 'amounts';
type: {
vec: 'u64';
};
},
{
name: 'lamports';
type: {
option: 'u64';
};
},
];
},
{
name: 'compressSplTokenAccount';
docs: [
'Compresses the balance of an spl token account sub an optional remaining',
'amount. This instruction does not close the spl token account. To close',
'the account bundle a close spl account instruction in your transaction.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
];
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
docs: ['this program is the signer of the cpi.'];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
isOptional: true;
},
{
name: 'compressOrDecompressTokenAccount';
isMut: true;
isSigner: false;
isOptional: true;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
isOptional: true;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'owner';
type: 'publicKey';
},
{
name: 'remainingAmount';
type: {
option: 'u64';
};
},
{
name: 'cpiContext';
type: {
option: {
defined: 'CompressedCpiContext';
};
};
},
];
},
{
name: 'transfer';
docs: [
'Transfers compressed tokens from one account to another. All accounts',
'must be of the same mint. Additional spl tokens can be compressed or',
'decompressed. In one transaction only compression or decompression is',
'possible. Lamports can be transferred alongside tokens. If output token',
'accounts specify less lamports than inputs the remaining lamports are',
'transferred to an output compressed account. Signer must be owner or',
'delegate. If a delegated token account is transferred the delegate is',
'not preserved.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
];
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
docs: ['this program is the signer of the cpi.'];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
isOptional: true;
},
{
name: 'compressOrDecompressTokenAccount';
isMut: true;
isSigner: false;
isOptional: true;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
isOptional: true;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'inputs';
type: 'bytes';
},
];
},
{
name: 'approve';
docs: [
'Delegates an amount to a delegate. A compressed token account is either',
'completely delegated or not. Prior delegates are not preserved. Cannot',
'be called by a delegate.',
'The instruction creates two output accounts:',
'1. one account with delegated amount',
'2. one account with remaining(change) amount',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
];
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
docs: ['this program is the signer of the cpi.'];
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'inputs';
type: 'bytes';
},
];
},
{
name: 'revoke';
docs: [
'Revokes a delegation. The instruction merges all inputs into one output',
'account. Cannot be called by a delegate. Delegates are not preserved.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
];
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
docs: ['this program is the signer of the cpi.'];
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'inputs';
type: 'bytes';
},
];
},
{
name: 'freeze';
docs: [
'Freezes compressed token accounts. Inputs must not be frozen. Creates as',
'many outputs as inputs. Balances and delegates are preserved.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
docs: ['that this program is the signer of the cpi.'];
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
{
name: 'mint';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'inputs';
type: 'bytes';
},
];
},
{
name: 'thaw';
docs: [
'Thaws frozen compressed token accounts. Inputs must be frozen. Creates',
'as many outputs as inputs. Balances and delegates are preserved.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
docs: ['that this program is the signer of the cpi.'];
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
{
name: 'mint';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'inputs';
type: 'bytes';
},
];
},
{
name: 'burn';
docs: [
'Burns compressed tokens and spl tokens from the pool account. Delegates',
'can burn tokens. The output compressed token account remains delegated.',
'Creates one output compressed token account.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
];
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'mint';
isMut: true;
isSigner: false;
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'inputs';
type: 'bytes';
},
];
},
{
name: 'stubIdlBuild';
docs: [
'This function is a stub to allow Anchor to include the input types in',
'the IDL. It should not be included in production builds nor be called in',
'practice.',
];
accounts: [
{
name: 'feePayer';
isMut: true;
isSigner: true;
docs: ['UNCHECKED: only pays fees.'];
},
{
name: 'authority';
isMut: false;
isSigner: true;
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
];
},
{
name: 'cpiAuthorityPda';
isMut: false;
isSigner: false;
},
{
name: 'lightSystemProgram';
isMut: false;
isSigner: false;
},
{
name: 'registeredProgramPda';
isMut: false;
isSigner: false;
},
{
name: 'noopProgram';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionAuthority';
isMut: false;
isSigner: false;
},
{
name: 'accountCompressionProgram';
isMut: false;
isSigner: false;
},
{
name: 'selfProgram';
isMut: false;
isSigner: false;
docs: ['this program is the signer of the cpi.'];
},
{
name: 'tokenPoolPda';
isMut: true;
isSigner: false;
isOptional: true;
},
{
name: 'compressOrDecompressTokenAccount';
isMut: true;
isSigner: false;
isOptional: true;
},
{
name: 'tokenProgram';
isMut: false;
isSigner: false;
isOptional: true;
},
{
name: 'systemProgram';
isMut: false;
isSigner: false;
},
];
args: [
{
name: 'inputs1';
type: {
defined: 'CompressedTokenInstructionDataTransfer';
};
},
{
name: 'inputs2';
type: {
defined: 'TokenData';
};
},
];
},
];
types: [
{
name: 'AccessMetadata';
type: {
kind: 'struct';
fields: [
{
name: 'owner';
docs: ['Owner of the Merkle tree.'];
type: 'publicKey';
},
{
name: 'programOwner';
docs: [
'Program owner of the Merkle tree. This will be used for program owned Merkle trees.',
];
type: 'publicKey';
},
{
name: 'forester';
docs: [
'Optional privileged forester pubkey, can be set for custom Merkle trees',
'without a network fee. Merkle trees without network fees are not',
'forested by light foresters. The variable is not used in the account',
'compression program but the registry program. The registry program',
'implements access control to prevent contention during forester. The',
'forester pubkey specified in this struct can bypass contention checks.',
];
type: 'publicKey';
},
];
};
},
{
name: 'AccountState';
type: {
kind: 'enum';
variants: [
{
name: 'Initialized';
},
{
name: 'Frozen';
},
];
};
},
{
name: 'CompressedAccount';
type: {
kind: 'struct';
fields: [
{
name: 'owner';
type: 'publicKey';
},
{
name: 'lamports';
type: 'u64';
},
{
name: 'address';
type: {
option: {
array: ['u8', 32];
};
};
},
{
name: 'data';
type: {
option: {
defined: 'CompressedAccountData';
};
};
},
];
};
},
{
name: 'CompressedAccountData';
type: {
kind: 'struct';
fields: [
{
name: 'discriminator';
type: {
array: ['u8', 8];
};
},
{
name: 'data';
type: 'bytes';
},
{
name: 'dataHash';
type: {
array: ['u8', 32];
};
},
];
};
},
{
name: 'CompressedCpiContext';
type: {
kind: 'struct';
fields: [
{
name: 'setContext';
docs: [
'Is set by the program that is invoking the CPI to signal that is should',
'set the cpi context.',
];
type: 'bool';
},
{
name: 'firstSetContext';
docs: [
'Is set to wipe the cpi context since someone could have set it before',
'with unrelated data.',
];
type: 'bool';
},
{
name: 'cpiContextAccountIndex';
docs: [
'Index of cpi context account in remaining accounts.',
];
type: 'u8';
},
];
};
},
{
name: 'CompressedProof';
type: {
kind: 'struct';
fields: [
{
name: 'a';
type: {
array: ['u8', 32];
};
},
{
name: 'b';
type: {
array: ['u8', 64];
};
},
{
name: 'c';
type: {
array: ['u8', 32];
};
},
];
};
},
{
name: 'CompressedTokenInstructionDataTransfer';
type: {
kind: 'struct';
fields: [
{
name: 'proof';
type: {
option: {
defined: 'CompressedProof';
};
};
},
{
name: 'mint';
type: 'publicKey';
},
{
name: 'delegatedTransfer';
docs: [
'Is required if the signer is delegate,',
'-> delegate is authority account,',
'owner = Some(owner) is the owner of the token account.',
];
type: {
option: {
defined: 'DelegatedTransfer';
};
};
},
{
name: 'inputTokenDataWithContext';
type: {
vec: {
defined: 'InputTokenDataWithContext';
};
};
},
{
name: 'outputCompressedAccounts';
type: {
vec: {
defined: 'PackedTokenTransferOutputData';
};
};
},
{
name: 'isCompress';
type: 'bool';
},
{
name: 'compressOrDecompressAmount';
type: {
option: 'u64';
};
},
{
name: 'cpiContext';
type: {
option: {
defined: 'CompressedCpiContext';
};
};
},
{
name: 'lamportsChangeAccountMerkleTreeIndex';
type: {
option: 'u8';
};
},
];
};
},
{
name: 'DelegatedTransfer';
docs: [
'Struct to provide the owner when the delegate is signer of the transaction.',
];
type: {
kind: 'struct';
fields: [
{
name: 'owner';
type: 'publicKey';
},
{
name: 'delegateChangeAccountIndex';
docs: [
'Index of change compressed account in output compressed accounts. In',
"case that the delegate didn't spend the complete delegated compressed",
'account balance the change compressed account will be delegated to her',
'as well.',
];
type: {
option: 'u8';
};
},
];
};
},
{
name: 'InputTokenDataWithContext';
type: {
kind: 'struct';
fields: [
{
name: 'amount';
type: 'u64';
},
{
name: 'delegateIndex';
type: {
option: 'u8';
};
},
{
name: 'merkleContext';
type: {
defined: 'PackedMerkleContext';
};
},
{
name: 'rootIndex';
type: 'u16';
},
{
name: 'lamports';
type: {
option: 'u64';
};
},
{
name: 'tlv';
docs: [
'Placeholder for TokenExtension tlv data (unimplemented)',
];
type: {
option: 'bytes';
};
},
];
};
},
{
name: 'InstructionDataInvoke';
type: {
kind: 'struct';
fields: [
{
name: 'proof';
type: {
option: {
defined: 'CompressedProof';
};
};
},
{
name: 'inputCompressedAccountsWithMerkleContext';
type: {
vec: {
defined: 'PackedCompressedAccountWithMerkleContext';
};
};
},
{
name: 'outputCompressedAccounts';
type: {
vec: {
defined: 'OutputCompressedAccountWithPackedContext';
};
};
},
{
name: 'relayFee';
type: {
option: 'u64';
};
},
{
name: 'newAddressParams';
type: {
vec: {
defined: 'NewAddressParamsPacked';
};
};
},
{
name: 'compressOrDecompressLamports';
type: {
option: 'u64';
};
},
{
name: 'isCompress';
type: 'bool';
},
];
};
},
{
name: 'InstructionDataInvokeCpi';
type: {
kind: 'struct';
fields: [
{
name: 'proof';
type: {
option: {
defined: 'CompressedProof';
};
};
},
{
name: 'newAddressParams';
type: {
vec: {
defined: 'NewAddressParamsPacked';
};
};
},
{
name: 'inputCompressedAccountsWithMerkleContext';
type: {
vec: {
defined: 'PackedCompressedAccountWithMerkleContext';
};
};
},
{
name: 'outputCompressedAccounts';
type: {
vec: {
defined: 'OutputCompressedAccountWithPackedContext';
};
};
},
{
name: 'relayFee';
type: {
option: 'u64';
};
},
{
name: 'compressOrDecompressLamports';
type: {
option: 'u64';
};
},
{
name: 'isCompress';
type: 'bool';
},
{
name: 'cpiContext';
type: {
option: {
defined: 'CompressedCpiContext';
};
};
},
];
};
},
{
name: 'MerkleTreeMetadata';
type: {
kind: 'struct';
fields: [
{
name: 'accessMetadata';
type: {
defined: 'AccessMetadata';
};
},
{
name: 'rolloverMetadata';
type: {
defined: 'RolloverMetadata';
};
},
{
name: 'associatedQueue';
type: 'publicKey';
},
{
name: 'nextMerkleTree';
type: 'publicKey';
},
];
};
},
{
name: 'MerkleTreeSequenceNumber';
type: {
kind: 'struct';
fields: [
{
name: 'pubkey';
type: 'publicKey';
},
{
name: 'seq';
type: 'u64';
},
];
};
},
{
name: 'NewAddressParamsPacked';
type: {
kind: 'struct';
fields: [
{
name: 'seed';
type: {
array: ['u8', 32];
};
},
{
name: 'addressQueueAccountIndex';
type: 'u8';
},
{
name: 'addressMerkleTreeAccountIndex';
type: 'u8';
},
{
name: 'addressMerkleTreeRootIndex';
type: 'u16';
},
];
};
},
{
name: 'OutputCompressedAccountWithPackedContext';
type: {
kind: 'struct';
fields: [
{
name: 'compressedAccount';
type: {
defined: 'CompressedAccount';
};
},
{
name: 'merkleTreeIndex';
type: 'u8';
},
];
};
},
{
name: 'PackedCompressedAccountWithMerkleContext';
type: {
kind: 'struct';
fields: [
{
name: 'compressedAccount';
type: {
defined: 'CompressedAccount';
};
},
{
name: 'merkleContext';
type: {
defined: 'PackedMerkleContext';
};
},
{
name: 'rootIndex';
docs: [
'Index of root used in inclusion validity proof.',
];
type: 'u16';
},
{
name: 'readOnly';
docs: [
'Placeholder to mark accounts read-only unimplemented set to false.',
];
type: 'bool';
},
];
};
},
{
name: 'PackedMerkleContext';
type: {
kind: 'struct';
fields: [
{
name: 'merkleTreePubkeyIndex';
type: 'u8';
},
{
name: 'nullifierQueuePubkeyIndex';
type: 'u8';
},
{
name: 'leafIndex';
type: 'u32';
},
{
name: 'queueIndex';
docs: [
'Index of leaf in queue. Placeholder of batched Merkle tree updates',
'currently unimplemented.',
];
type: {
option: {
defined: 'QueueIndex';
};
};
},
];
};
},
{
name: 'PackedTokenTransferOutputData';
type: {
kind: 'struct';
fields: [
{
name: 'owner';
type: 'publicKey';
},
{
name: 'amount';
type: 'u64';
},
{
name: 'lamports';
type: {
option: 'u64';
};
},
{
name: 'merkleTreeIndex';
type: 'u8';
},
{
name: 'tlv';
docs: [
'Placeholder for TokenExtension tlv data (unimplemented)',
];
type: {
option: 'bytes';
};
},
];
};
},
{
name: 'PublicTransactionEvent';
type: {
kind: 'struct';
fields: [
{
name: 'inputCompressedAccountHashes';
type: {
vec: {
array: ['u8', 32];
};
};
},
{
name: 'outputCompressedAccountHashes';
type: {
vec: {
array: ['u8', 32];
};
};
},
{
name: 'outputCompressedAccounts';
type: {
vec: {
defined: 'OutputCompressedAccountWithPackedContext';
};
};
},
{
name: 'outputLeafIndices';
type: {
vec: 'u32';
};
},
{
name: 'sequenceNumbers';
type: {
vec: {
defined: 'MerkleTreeSequenceNumber';
};
};
},
{
name: 'relayFee';
type: {
option: 'u64';
};
},
{
name: 'isCompress';
type: 'bool';
},
{
name: 'compressOrDecompressLamports';
type: {
option: 'u64';
};
},
{
name: 'pubkeyArray';
type: {
vec: 'publicKey';
};
},
{
name: 'message';
type: {
option: 'bytes';
};
},
];
};
},
{
name: 'QueueIndex';
type: {
kind: 'struct';
fields: [
{
name: 'queueId';
docs: ['Id of queue in queue account.'];
type: 'u8';
},
{
name: 'index';
docs: ['Index of compressed account hash in queue.'];
type: 'u16';
},
];
};
},
{
name: 'RolloverMetadata';
type: {
kind: 'struct';
fields: [
{
name: 'index';
docs: ['Unique index.'];
type: 'u64';
},
{
name: 'rolloverFee';
docs: [
'This fee is used for rent for the next account.',
'It accumulates in the account so that once the corresponding Merkle tree account is full it can be rolled over',
];
type: 'u64';
},
{
name: 'rolloverThreshold';
docs: [
'The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).',
];
type: 'u64';
},
{
name: 'networkFee';
docs: ['Tip for maintaining the account.'];
type: 'u64';
},
{
name: 'rolledoverSlot';
docs: [
'The slot when the account was rolled over, a rolled over account should not be written to.',
];
type: 'u64';
},
{
name: 'closeThreshold';
docs: [
'If current slot is greater than rolledover_slot + close_threshold and',
"the account is empty it can be closed. No 'close' functionality has been",
'implemented yet.',
];
type: 'u64';
},
{
name: 'additionalBytes';
docs: [
'Placeholder for bytes of additional accounts which are tied to the',
'Merkle trees operation and need to be rolled over as well.',
];
type: 'u64';
},
];
};
},
{
name: 'TokenData';
type: {
kind: 'struct';
fields: [
{
name: 'mint';
docs: ['The mint associated with this account'];
type: 'publicKey';
},
{
name: 'owner';
docs: ['The owner of this account.'];
type: 'publicKey';
},
{
name: 'amount';
docs: ['The amount of tokens this account holds.'];
type: 'u64';
},
{
name: 'delegate';
docs: [
'If `delegate` is `Some` then `delegated_amount` represents',
'the amount authorized by the delegate',
];
type: {
option: 'publicKey';
};
},
{
name: 'state';
docs: ["The account's state"];
type: {
defined: 'AccountState';
};
},
{
name: 'tlv';
docs: [
'Placeholder for TokenExtension tlv data (unimplemented)',
];
type: {
option: 'bytes';
};
},
];
};
},
];
errors: [
{
code: 6000;
name: 'SignerCheckFailed';
msg: 'Signer check failed';
},
{
code: 6001;
name: 'CreateTransferInstructionFailed';
msg: 'Create transfer instruction failed';
},
{
code: 6002;
name: 'AccountNotFound';
msg: 'Account not found';
},
{
code: 6003;
name: 'SerializationError';
msg: 'Serialization error';
},
];
};
export const IDL: LightCompressedToken = {
version: '1.2.0',
name: 'light_compressed_token',
instructions: [
{
name: 'createTokenPool',
docs: [
'This instruction creates a token pool for a given mint. Every spl mint',
'can have one token pool. When a token is compressed the tokens are',
'transferrred to the token pool, and their compressed equivalent is',
'minted into a Merkle tree.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
{
name: 'mint',
isMut: true,
isSigner: false,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
],
args: [],
},
{
name: 'mintTo',
docs: [
'Mints tokens from an spl token mint to a list of compressed accounts.',
'Minted tokens are transferred to a pool account owned by the compressed',
'token program. The instruction creates one compressed output account for',
'every amount and pubkey input pair. A constant amount of lamports can be',
'transferred to each output account to enable. A use case to add lamports',
'to a compressed token account is to prevent spam. This is the only way',
'to add lamports to a compressed token account.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'mint',
isMut: true,
isSigner: false,
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
docs: ['programs'],
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'merkleTree',
isMut: true,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
{
name: 'solPoolPda',
isMut: true,
isSigner: false,
isOptional: true,
},
],
args: [
{
name: 'publicKeys',
type: {
vec: 'publicKey',
},
},
{
name: 'amounts',
type: {
vec: 'u64',
},
},
{
name: 'lamports',
type: {
option: 'u64',
},
},
],
},
{
name: 'compressSplTokenAccount',
docs: [
'Compresses the balance of an spl token account sub an optional remaining',
'amount. This instruction does not close the spl token account. To close',
'the account bundle a close spl account instruction in your transaction.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
],
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
docs: ['this program is the signer of the cpi.'],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
isOptional: true,
},
{
name: 'compressOrDecompressTokenAccount',
isMut: true,
isSigner: false,
isOptional: true,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
isOptional: true,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'owner',
type: 'publicKey',
},
{
name: 'remainingAmount',
type: {
option: 'u64',
},
},
{
name: 'cpiContext',
type: {
option: {
defined: 'CompressedCpiContext',
},
},
},
],
},
{
name: 'transfer',
docs: [
'Transfers compressed tokens from one account to another. All accounts',
'must be of the same mint. Additional spl tokens can be compressed or',
'decompressed. In one transaction only compression or decompression is',
'possible. Lamports can be transferred alongside tokens. If output token',
'accounts specify less lamports than inputs the remaining lamports are',
'transferred to an output compressed account. Signer must be owner or',
'delegate. If a delegated token account is transferred the delegate is',
'not preserved.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
],
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
docs: ['this program is the signer of the cpi.'],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
isOptional: true,
},
{
name: 'compressOrDecompressTokenAccount',
isMut: true,
isSigner: false,
isOptional: true,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
isOptional: true,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'inputs',
type: 'bytes',
},
],
},
{
name: 'approve',
docs: [
'Delegates an amount to a delegate. A compressed token account is either',
'completely delegated or not. Prior delegates are not preserved. Cannot',
'be called by a delegate.',
'The instruction creates two output accounts:',
'1. one account with delegated amount',
'2. one account with remaining(change) amount',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
],
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
docs: ['this program is the signer of the cpi.'],
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'inputs',
type: 'bytes',
},
],
},
{
name: 'revoke',
docs: [
'Revokes a delegation. The instruction merges all inputs into one output',
'account. Cannot be called by a delegate. Delegates are not preserved.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
],
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
docs: ['this program is the signer of the cpi.'],
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'inputs',
type: 'bytes',
},
],
},
{
name: 'freeze',
docs: [
'Freezes compressed token accounts. Inputs must not be frozen. Creates as',
'many outputs as inputs. Balances and delegates are preserved.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
docs: ['that this program is the signer of the cpi.'],
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
{
name: 'mint',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'inputs',
type: 'bytes',
},
],
},
{
name: 'thaw',
docs: [
'Thaws frozen compressed token accounts. Inputs must be frozen. Creates',
'as many outputs as inputs. Balances and delegates are preserved.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
docs: ['that this program is the signer of the cpi.'],
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
{
name: 'mint',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'inputs',
type: 'bytes',
},
],
},
{
name: 'burn',
docs: [
'Burns compressed tokens and spl tokens from the pool account. Delegates',
'can burn tokens. The output compressed token account remains delegated.',
'Creates one output compressed token account.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
],
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'mint',
isMut: true,
isSigner: false,
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'inputs',
type: 'bytes',
},
],
},
{
name: 'stubIdlBuild',
docs: [
'This function is a stub to allow Anchor to include the input types in',
'the IDL. It should not be included in production builds nor be called in',
'practice.',
],
accounts: [
{
name: 'feePayer',
isMut: true,
isSigner: true,
docs: ['UNCHECKED: only pays fees.'],
},
{
name: 'authority',
isMut: false,
isSigner: true,
docs: [
'Authority is verified through proof since both owner and delegate',
'are included in the token data hash, which is a public input to the',
'validity proof.',
],
},
{
name: 'cpiAuthorityPda',
isMut: false,
isSigner: false,
},
{
name: 'lightSystemProgram',
isMut: false,
isSigner: false,
},
{
name: 'registeredProgramPda',
isMut: false,
isSigner: false,
},
{
name: 'noopProgram',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionAuthority',
isMut: false,
isSigner: false,
},
{
name: 'accountCompressionProgram',
isMut: false,
isSigner: false,
},
{
name: 'selfProgram',
isMut: false,
isSigner: false,
docs: ['this program is the signer of the cpi.'],
},
{
name: 'tokenPoolPda',
isMut: true,
isSigner: false,
isOptional: true,
},
{
name: 'compressOrDecompressTokenAccount',
isMut: true,
isSigner: false,
isOptional: true,
},
{
name: 'tokenProgram',
isMut: false,
isSigner: false,
isOptional: true,
},
{
name: 'systemProgram',
isMut: false,
isSigner: false,
},
],
args: [
{
name: 'inputs1',
type: {
defined: 'CompressedTokenInstructionDataTransfer',
},
},
{
name: 'inputs2',
type: {
defined: 'TokenData',
},
},
],
},
],
types: [
{
name: 'AccessMetadata',
type: {
kind: 'struct',
fields: [
{
name: 'owner',
docs: ['Owner of the Merkle tree.'],
type: 'publicKey',
},
{
name: 'programOwner',
docs: [
'Program owner of the Merkle tree. This will be used for program owned Merkle trees.',
],
type: 'publicKey',
},
{
name: 'forester',
docs: [
'Optional privileged forester pubkey, can be set for custom Merkle trees',
'without a network fee. Merkle trees without network fees are not',
'forested by light foresters. The variable is not used in the account',
'compression program but the registry program. The registry program',
'implements access control to prevent contention during forester. The',
'forester pubkey specified in this struct can bypass contention checks.',
],
type: 'publicKey',
},
],
},
},
{
name: 'AccountState',
type: {
kind: 'enum',
variants: [
{
name: 'Initialized',
},
{
name: 'Frozen',
},
],
},
},
{
name: 'CompressedAccount',
type: {
kind: 'struct',
fields: [
{
name: 'owner',
type: 'publicKey',
},
{
name: 'lamports',
type: 'u64',
},
{
name: 'address',
type: {
option: {
array: ['u8', 32],
},
},
},
{
name: 'data',
type: {
option: {
defined: 'CompressedAccountData',
},
},
},
],
},
},
{
name: 'CompressedAccountData',
type: {
kind: 'struct',
fields: [
{
name: 'discriminator',
type: {
array: ['u8', 8],
},
},
{
name: 'data',
type: 'bytes',
},
{
name: 'dataHash',
type: {
array: ['u8', 32],
},
},
],
},
},
{
name: 'CompressedCpiContext',
type: {
kind: 'struct',
fields: [
{
name: 'setContext',
docs: [
'Is set by the program that is invoking the CPI to signal that is should',
'set the cpi context.',
],
type: 'bool',
},
{
name: 'firstSetContext',
docs: [
'Is set to wipe the cpi context since someone could have set it before',
'with unrelated data.',
],
type: 'bool',
},
{
name: 'cpiContextAccountIndex',
docs: [
'Index of cpi context account in remaining accounts.',
],
type: 'u8',
},
],
},
},
{
name: 'CompressedProof',
type: {
kind: 'struct',
fields: [
{
name: 'a',
type: {
array: ['u8', 32],
},
},
{
name: 'b',
type: {
array: ['u8', 64],
},
},
{
name: 'c',
type: {
array: ['u8', 32],
},
},
],
},
},
{
name: 'CompressedTokenInstructionDataTransfer',
type: {
kind: 'struct',
fields: [
{
name: 'proof',
type: {
option: {
defined: 'CompressedProof',
},
},
},
{
name: 'mint',
type: 'publicKey',
},
{
name: 'delegatedTransfer',
docs: [
'Is required if the signer is delegate,',
'-> delegate is authority account,',
'owner = Some(owner) is the owner of the token account.',
],
type: {
option: {
defined: 'DelegatedTransfer',
},
},
},
{
name: 'inputTokenDataWithContext',
type: {
vec: {
defined: 'InputTokenDataWithContext',
},
},
},
{
name: 'outputCompressedAccounts',
type: {
vec: {
defined: 'PackedTokenTransferOutputData',
},
},
},
{
name: 'isCompress',
type: 'bool',
},
{
name: 'compressOrDecompressAmount',
type: {
option: 'u64',
},
},
{
name: 'cpiContext',
type: {
option: {
defined: 'CompressedCpiContext',
},
},
},
{
name: 'lamportsChangeAccountMerkleTreeIndex',
type: {
option: 'u8',
},
},
],
},
},
{
name: 'DelegatedTransfer',
docs: [
'Struct to provide the owner when the delegate is signer of the transaction.',
],
type: {
kind: 'struct',
fields: [
{
name: 'owner',
type: 'publicKey',
},
{
name: 'delegateChangeAccountIndex',
docs: [
'Index of change compressed account in output compressed accounts. In',
"case that the delegate didn't spend the complete delegated compressed",
'account balance the change compressed account will be delegated to her',
'as well.',
],
type: {
option: 'u8',
},
},
],
},
},
{
name: 'InputTokenDataWithContext',
type: {
kind: 'struct',
fields: [
{
name: 'amount',
type: 'u64',
},
{
name: 'delegateIndex',
type: {
option: 'u8',
},
},
{
name: 'merkleContext',
type: {
defined: 'PackedMerkleContext',
},
},
{
name: 'rootIndex',
type: 'u16',
},
{
name: 'lamports',
type: {
option: 'u64',
},
},
{
name: 'tlv',
docs: [
'Placeholder for TokenExtension tlv data (unimplemented)',
],
type: {
option: 'bytes',
},
},
],
},
},
{
name: 'InstructionDataInvoke',
type: {
kind: 'struct',
fields: [
{
name: 'proof',
type: {
option: {
defined: 'CompressedProof',
},
},
},
{
name: 'inputCompressedAccountsWithMerkleContext',
type: {
vec: {
defined:
'PackedCompressedAccountWithMerkleContext',
},
},
},
{
name: 'outputCompressedAccounts',
type: {
vec: {
defined:
'OutputCompressedAccountWithPackedContext',
},
},
},
{
name: 'relayFee',
type: {
option: 'u64',
},
},
{
name: 'newAddressParams',
type: {
vec: {
defined: 'NewAddressParamsPacked',
},
},
},
{
name: 'compressOrDecompressLamports',
type: {
option: 'u64',
},
},
{
name: 'isCompress',
type: 'bool',
},
],
},
},
{
name: 'InstructionDataInvokeCpi',
type: {
kind: 'struct',
fields: [
{
name: 'proof',
type: {
option: {
defined: 'CompressedProof',
},
},
},
{
name: 'newAddressParams',
type: {
vec: {
defined: 'NewAddressParamsPacked',
},
},
},
{
name: 'inputCompressedAccountsWithMerkleContext',
type: {
vec: {
defined:
'PackedCompressedAccountWithMerkleContext',
},
},
},
{
name: 'outputCompressedAccounts',
type: {
vec: {
defined:
'OutputCompressedAccountWithPackedContext',
},
},
},
{
name: 'relayFee',
type: {
option: 'u64',
},
},
{
name: 'compressOrDecompressLamports',
type: {
option: 'u64',
},
},
{
name: 'isCompress',
type: 'bool',
},
{
name: 'cpiContext',
type: {
option: {
defined: 'CompressedCpiContext',
},
},
},
],
},
},
{
name: 'MerkleTreeMetadata',
type: {
kind: 'struct',
fields: [
{
name: 'accessMetadata',
type: {
defined: 'AccessMetadata',
},
},
{
name: 'rolloverMetadata',
type: {
defined: 'RolloverMetadata',
},
},
{
name: 'associatedQueue',
type: 'publicKey',
},
{
name: 'nextMerkleTree',
type: 'publicKey',
},
],
},
},
{
name: 'MerkleTreeSequenceNumber',
type: {
kind: 'struct',
fields: [
{
name: 'pubkey',
type: 'publicKey',
},
{
name: 'seq',
type: 'u64',
},
],
},
},
{
name: 'NewAddressParamsPacked',
type: {
kind: 'struct',
fields: [
{
name: 'seed',
type: {
array: ['u8', 32],
},
},
{
name: 'addressQueueAccountIndex',
type: 'u8',
},
{
name: 'addressMerkleTreeAccountIndex',
type: 'u8',
},
{
name: 'addressMerkleTreeRootIndex',
type: 'u16',
},
],
},
},
{
name: 'OutputCompressedAccountWithPackedContext',
type: {
kind: 'struct',
fields: [
{
name: 'compressedAccount',
type: {
defined: 'CompressedAccount',
},
},
{
name: 'merkleTreeIndex',
type: 'u8',
},
],
},
},
{
name: 'PackedCompressedAccountWithMerkleContext',
type: {
kind: 'struct',
fields: [
{
name: 'compressedAccount',
type: {
defined: 'CompressedAccount',
},
},
{
name: 'merkleContext',
type: {
defined: 'PackedMerkleContext',
},
},
{
name: 'rootIndex',
docs: [
'Index of root used in inclusion validity proof.',
],
type: 'u16',
},
{
name: 'readOnly',
docs: [
'Placeholder to mark accounts read-only unimplemented set to false.',
],
type: 'bool',
},
],
},
},
{
name: 'PackedMerkleContext',
type: {
kind: 'struct',
fields: [
{
name: 'merkleTreePubkeyIndex',
type: 'u8',
},
{
name: 'nullifierQueuePubkeyIndex',
type: 'u8',
},
{
name: 'leafIndex',
type: 'u32',
},
{
name: 'queueIndex',
docs: [
'Index of leaf in queue. Placeholder of batched Merkle tree updates',
'currently unimplemented.',
],
type: {
option: {
defined: 'QueueIndex',
},
},
},
],
},
},
{
name: 'PackedTokenTransferOutputData',
type: {
kind: 'struct',
fields: [
{
name: 'owner',
type: 'publicKey',
},
{
name: 'amount',
type: 'u64',
},
{
name: 'lamports',
type: {
option: 'u64',
},
},
{
name: 'merkleTreeIndex',
type: 'u8',
},
{
name: 'tlv',
docs: [
'Placeholder for TokenExtension tlv data (unimplemented)',
],
type: {
option: 'bytes',
},
},
],
},
},
{
name: 'PublicTransactionEvent',
type: {
kind: 'struct',
fields: [
{
name: 'inputCompressedAccountHashes',
type: {
vec: {
array: ['u8', 32],
},
},
},
{
name: 'outputCompressedAccountHashes',
type: {
vec: {
array: ['u8', 32],
},
},
},
{
name: 'outputCompressedAccounts',
type: {
vec: {
defined:
'OutputCompressedAccountWithPackedContext',
},
},
},
{
name: 'outputLeafIndices',
type: {
vec: 'u32',
},
},
{
name: 'sequenceNumbers',
type: {
vec: {
defined: 'MerkleTreeSequenceNumber',
},
},
},
{
name: 'relayFee',
type: {
option: 'u64',
},
},
{
name: 'isCompress',
type: 'bool',
},
{
name: 'compressOrDecompressLamports',
type: {
option: 'u64',
},
},
{
name: 'pubkeyArray',
type: {
vec: 'publicKey',
},
},
{
name: 'message',
type: {
option: 'bytes',
},
},
],
},
},
{
name: 'QueueIndex',
type: {
kind: 'struct',
fields: [
{
name: 'queueId',
docs: ['Id of queue in queue account.'],
type: 'u8',
},
{
name: 'index',
docs: ['Index of compressed account hash in queue.'],
type: 'u16',
},
],
},
},
{
name: 'RolloverMetadata',
type: {
kind: 'struct',
fields: [
{
name: 'index',
docs: ['Unique index.'],
type: 'u64',
},
{
name: 'rolloverFee',
docs: [
'This fee is used for rent for the next account.',
'It accumulates in the account so that once the corresponding Merkle tree account is full it can be rolled over',
],
type: 'u64',
},
{
name: 'rolloverThreshold',
docs: [
'The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).',
],
type: 'u64',
},
{
name: 'networkFee',
docs: ['Tip for maintaining the account.'],
type: 'u64',
},
{
name: 'rolledoverSlot',
docs: [
'The slot when the account was rolled over, a rolled over account should not be written to.',
],
type: 'u64',
},
{
name: 'closeThreshold',
docs: [
'If current slot is greater than rolledover_slot + close_threshold and',
"the account is empty it can be closed. No 'close' functionality has been",
'implemented yet.',
],
type: 'u64',
},
{
name: 'additionalBytes',
docs: [
'Placeholder for bytes of additional accounts which are tied to the',
'Merkle trees operation and need to be rolled over as well.',
],
type: 'u64',
},
],
},
},
{
name: 'TokenData',
type: {
kind: 'struct',
fields: [
{
name: 'mint',
docs: ['The mint associated with this account'],
type: 'publicKey',
},
{
name: 'owner',
docs: ['The owner of this account.'],
type: 'publicKey',
},
{
name: 'amount',
docs: ['The amount of tokens this account holds.'],
type: 'u64',
},
{
name: 'delegate',
docs: [
'If `delegate` is `Some` then `delegated_amount` represents',
'the amount authorized by the delegate',
],
type: {
option: 'publicKey',
},
},
{
name: 'state',
docs: ["The account's state"],
type: {
defined: 'AccountState',
},
},
{
name: 'tlv',
docs: [
'Placeholder for TokenExtension tlv data (unimplemented)',
],
type: {
option: 'bytes',
},
},
],
},
},
],
errors: [
{
code: 6000,
name: 'SignerCheckFailed',
msg: 'Signer check failed',
},
{
code: 6001,
name: 'CreateTransferInstructionFailed',
msg: 'Create transfer instruction failed',
},
{
code: 6002,
name: 'AccountNotFound',
msg: 'Account not found',
},
{
code: 6003,
name: 'SerializationError',
msg: 'Serialization error',
},
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/instructions/pack-compressed-token-accounts.ts
|
import {
ParsedTokenAccount,
InputTokenDataWithContext,
getIndexOrAdd,
bn,
padOutputStateMerkleTrees,
TokenTransferOutputData,
} from '@lightprotocol/stateless.js';
import { PublicKey, AccountMeta } from '@solana/web3.js';
import { PackedTokenTransferOutputData } from '../types';
export type PackCompressedTokenAccountsParams = {
/** Input state to be consumed */
inputCompressedTokenAccounts: ParsedTokenAccount[];
/**
* State trees that the output should be inserted into. Defaults to the 0th
* state tree of the input state. Gets padded to the length of
* outputCompressedAccounts.
*/
outputStateTrees?: PublicKey[] | PublicKey;
/** Optional remaining accounts to append to */
remainingAccounts?: PublicKey[];
/**
* Root indices that are used on-chain to fetch the correct root
* from the state Merkle tree account for validity proof verification.
*/
rootIndices: number[];
tokenTransferOutputs: TokenTransferOutputData[];
};
// TODO: include owner and lamports in packing.
/**
* Packs Compressed Token Accounts.
*/
export function packCompressedTokenAccounts(
params: PackCompressedTokenAccountsParams,
): {
inputTokenDataWithContext: InputTokenDataWithContext[];
remainingAccountMetas: AccountMeta[];
packedOutputTokenData: PackedTokenTransferOutputData[];
} {
const {
inputCompressedTokenAccounts,
outputStateTrees,
remainingAccounts = [],
rootIndices,
tokenTransferOutputs,
} = params;
const _remainingAccounts = remainingAccounts.slice();
let delegateIndex: number | null = null;
if (
inputCompressedTokenAccounts.length > 0 &&
inputCompressedTokenAccounts[0].parsed.delegate
) {
delegateIndex = getIndexOrAdd(
_remainingAccounts,
inputCompressedTokenAccounts[0].parsed.delegate,
);
}
/// TODO: move pubkeyArray to remainingAccounts
/// Currently just packs 'delegate' to pubkeyArray
const packedInputTokenData: InputTokenDataWithContext[] = [];
/// pack inputs
inputCompressedTokenAccounts.forEach(
(account: ParsedTokenAccount, index) => {
const merkleTreePubkeyIndex = getIndexOrAdd(
_remainingAccounts,
account.compressedAccount.merkleTree,
);
const nullifierQueuePubkeyIndex = getIndexOrAdd(
_remainingAccounts,
account.compressedAccount.nullifierQueue,
);
packedInputTokenData.push({
amount: account.parsed.amount,
delegateIndex,
merkleContext: {
merkleTreePubkeyIndex,
nullifierQueuePubkeyIndex,
leafIndex: account.compressedAccount.leafIndex,
queueIndex: null,
},
rootIndex: rootIndices[index],
lamports: account.compressedAccount.lamports.eq(bn(0))
? null
: account.compressedAccount.lamports,
tlv: null,
});
},
);
/// pack output state trees
const paddedOutputStateMerkleTrees = padOutputStateMerkleTrees(
outputStateTrees,
tokenTransferOutputs.length,
inputCompressedTokenAccounts.map(acc => acc.compressedAccount),
);
const packedOutputTokenData: PackedTokenTransferOutputData[] = [];
paddedOutputStateMerkleTrees.forEach((account, index) => {
const merkleTreeIndex = getIndexOrAdd(_remainingAccounts, account);
packedOutputTokenData.push({
owner: tokenTransferOutputs[index].owner,
amount: tokenTransferOutputs[index].amount,
lamports: tokenTransferOutputs[index].lamports?.eq(bn(0))
? null
: tokenTransferOutputs[index].lamports,
merkleTreeIndex,
tlv: null,
});
});
// to meta
const remainingAccountMetas = _remainingAccounts.map(
(account): AccountMeta => ({
pubkey: account,
isWritable: true,
isSigner: false,
}),
);
return {
inputTokenDataWithContext: packedInputTokenData,
remainingAccountMetas,
packedOutputTokenData,
};
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/instructions/index.ts
|
export * from './pack-compressed-token-accounts';
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/create-token-pool.ts
|
import {
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { CompressedTokenProgram } from '../program';
import {
Rpc,
buildAndSignTx,
sendAndConfirmTx,
} from '@lightprotocol/stateless.js';
/**
* Register an existing mint with the CompressedToken program
*
* @param rpc RPC to use
* @param payer Payer of the transaction and initialization fees
* @param mintAuthority Account or multisig that will control minting. Is signer.
* @param mintAddress Address of the existing mint
* @param confirmOptions Options for confirming the transaction
*
* @return transaction signature
*/
export async function createTokenPool(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
confirmOptions?: ConfirmOptions,
tokenProgramId?: PublicKey,
): Promise<TransactionSignature> {
tokenProgramId = tokenProgramId
? tokenProgramId
: await CompressedTokenProgram.get_mint_program_id(mint, rpc);
const ix = await CompressedTokenProgram.createTokenPool({
feePayer: payer.publicKey,
mint,
tokenProgramId,
});
const { blockhash } = await rpc.getLatestBlockhash();
const tx = buildAndSignTx([ix], payer, blockhash);
const txId = await sendAndConfirmTx(rpc, tx, confirmOptions);
return txId;
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/create-mint.ts
|
import {
ConfirmOptions,
Keypair,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { CompressedTokenProgram } from '../program';
import {
MINT_SIZE,
TOKEN_2022_PROGRAM_ID,
TOKEN_PROGRAM_ID,
} from '@solana/spl-token';
import {
Rpc,
buildAndSignTx,
sendAndConfirmTx,
dedupeSigner,
} from '@lightprotocol/stateless.js';
/**
* Create and initialize a new compressed token mint
*
* @param rpc RPC to use
* @param payer Payer of the transaction and initialization fees
* @param mintAuthority Account or multisig that will control minting
* @param decimals Location of the decimal place
* @param keypair Optional keypair, defaulting to a new random one
* @param confirmOptions Options for confirming the transaction
*
* @return Address of the new mint and the transaction signature
*/
export async function createMint(
rpc: Rpc,
payer: Signer,
mintAuthority: PublicKey,
decimals: number,
keypair = Keypair.generate(),
confirmOptions?: ConfirmOptions,
isToken22 = false,
): Promise<{ mint: PublicKey; transactionSignature: TransactionSignature }> {
const rentExemptBalance =
await rpc.getMinimumBalanceForRentExemption(MINT_SIZE);
const tokenProgramId = isToken22 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
const ixs = await CompressedTokenProgram.createMint({
feePayer: payer.publicKey,
mint: keypair.publicKey,
decimals,
authority: mintAuthority,
freezeAuthority: null, // TODO: add feature
rentExemptBalance,
tokenProgramId,
});
const { blockhash } = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [keypair]);
const tx = buildAndSignTx(ixs, payer, blockhash, additionalSigners);
const txId = await sendAndConfirmTx(rpc, tx, confirmOptions);
return { mint: keypair.publicKey, transactionSignature: txId };
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/create-token-program-lookup-table.ts
|
import { PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgram } from '../program';
/**
* Create a lookup table for the token program's default accounts
*
* @param rpc Rpc connection to use
* @param payer Payer of the transaction fees
* @param authority Authority of the lookup table
* @param mints Optional array of mint public keys to include in
* the lookup table
* @param additionalAccounts Optional array of additional account public keys
* to include in the lookup table
*
* @return Transaction signatures and the address of the created lookup table
*/
export async function createTokenProgramLookupTable(
rpc: Rpc,
payer: Signer,
authority: Signer,
mints?: PublicKey[],
additionalAccounts?: PublicKey[],
): Promise<{ txIds: TransactionSignature[]; address: PublicKey }> {
const recentSlot = await rpc.getSlot('finalized');
const { instructions, address } =
await CompressedTokenProgram.createTokenProgramLookupTable({
payer: payer.publicKey,
authority: authority.publicKey,
mints,
remainingAccounts: additionalAccounts,
recentSlot,
});
const additionalSigners = dedupeSigner(payer, [authority]);
const blockhashCtx = await rpc.getLatestBlockhash();
const signedTx = buildAndSignTx(
[instructions[0]],
payer,
blockhashCtx.blockhash,
additionalSigners,
);
/// Must wait for the first instruction to be finalized.
const txId = await sendAndConfirmTx(
rpc,
signedTx,
{ commitment: 'finalized' },
blockhashCtx,
);
const blockhashCtx2 = await rpc.getLatestBlockhash();
const signedTx2 = buildAndSignTx(
[instructions[1]],
payer,
blockhashCtx2.blockhash,
additionalSigners,
);
const txId2 = await sendAndConfirmTx(
rpc,
signedTx2,
{ commitment: 'finalized' },
blockhashCtx2,
);
return { txIds: [txId, txId2], address };
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/mint-to.ts
|
import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgram } from '../program';
/**
* Mint compressed tokens to a solana address
*
* @param rpc Rpc to use
* @param payer Payer of the transaction fees
* @param mint Mint for the account
* @param destination Address of the account to mint to. Can be an array of
* addresses if the amount is an array of amounts.
* @param authority Minting authority
* @param amount Amount to mint. Can be an array of amounts if the
* destination is an array of addresses.
* @param merkleTree State tree account that the compressed tokens should be
* part of. Defaults to the default state tree account.
* @param confirmOptions Options for confirming the transaction
*
* @return Signature of the confirmed transaction
*/
export async function mintTo(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
destination: PublicKey | PublicKey[],
authority: Signer,
amount: number | BN | number[] | BN[],
merkleTree?: PublicKey,
confirmOptions?: ConfirmOptions,
tokenProgramId?: PublicKey,
): Promise<TransactionSignature> {
tokenProgramId = tokenProgramId
? tokenProgramId
: await CompressedTokenProgram.get_mint_program_id(mint, rpc);
const additionalSigners = dedupeSigner(payer, [authority]);
const ix = await CompressedTokenProgram.mintTo({
feePayer: payer.publicKey,
mint,
authority: authority.publicKey,
amount: amount,
toPubkey: destination,
merkleTree,
tokenProgramId,
});
const { blockhash } = await rpc.getLatestBlockhash();
const tx = buildAndSignTx(
[ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }), ix],
payer,
blockhash,
additionalSigners,
);
const txId = await sendAndConfirmTx(rpc, tx, confirmOptions);
return txId;
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/compress.ts
|
import {
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
ComputeBudgetProgram,
} from '@solana/web3.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedTokenProgram } from '../program';
/**
* Compress SPL tokens
*
* @param rpc Rpc connection to use
* @param payer Payer of the transaction fees
* @param mint Mint of the compressed token
* @param amount Number of tokens to transfer
* @param owner Owner of the compressed tokens.
* @param sourceTokenAccount Source (associated) token account
* @param toAddress Destination address of the recipient
* @param merkleTree State tree account that the compressed tokens
* should be inserted into. Defaults to a default
* state tree account.
* @param confirmOptions Options for confirming the transaction
*
*
* @return Signature of the confirmed transaction
*/
export async function compress(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
amount: number | BN | number[] | BN[],
owner: Signer,
sourceTokenAccount: PublicKey,
toAddress: PublicKey | Array<PublicKey>,
merkleTree?: PublicKey,
confirmOptions?: ConfirmOptions,
tokenProgramId?: PublicKey,
): Promise<TransactionSignature> {
tokenProgramId = tokenProgramId
? tokenProgramId
: await CompressedTokenProgram.get_mint_program_id(mint, rpc);
const compressIx = await CompressedTokenProgram.compress({
payer: payer.publicKey,
owner: owner.publicKey,
source: sourceTokenAccount,
toAddress,
amount,
mint,
outputStateTree: merkleTree,
tokenProgramId,
});
const blockhashCtx = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [owner]);
const signedTx = buildAndSignTx(
[
ComputeBudgetProgram.setComputeUnitLimit({
units: 1_000_000,
}),
compressIx,
],
payer,
blockhashCtx.blockhash,
additionalSigners,
);
const txId = await sendAndConfirmTx(
rpc,
signedTx,
confirmOptions,
blockhashCtx,
);
return txId;
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/merge-token-accounts.ts
|
import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import {
Rpc,
dedupeSigner,
buildAndSignTx,
sendAndConfirmTx,
bn,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgram } from '../program';
/**
* Merge multiple compressed token accounts for a given mint into a single
* account
*
* @param rpc RPC to use
* @param payer Payer of the transaction fees
* @param mint Public key of the token's mint
* @param owner Owner of the token accounts to be merged
* @param merkleTree Optional merkle tree for compressed tokens
* @param confirmOptions Options for confirming the transaction
*
* @return Array of transaction signatures
*/
export async function mergeTokenAccounts(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
owner: Signer,
merkleTree?: PublicKey,
confirmOptions?: ConfirmOptions,
): Promise<TransactionSignature> {
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(
owner.publicKey,
{ mint },
);
if (compressedTokenAccounts.items.length === 0) {
throw new Error(
`No compressed token accounts found for mint ${mint.toBase58()}`,
);
}
if (compressedTokenAccounts.items.length >= 6) {
throw new Error(
`Too many compressed token accounts used for mint ${mint.toBase58()}`,
);
}
const instructions = [
ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }),
];
for (
let i = 0;
i < compressedTokenAccounts.items.slice(0, 6).length;
i += 3
) {
const batch = compressedTokenAccounts.items.slice(i, i + 3);
const proof = await rpc.getValidityProof(
batch.map(account => bn(account.compressedAccount.hash)),
);
const batchInstructions =
await CompressedTokenProgram.mergeTokenAccounts({
payer: payer.publicKey,
owner: owner.publicKey,
mint,
inputCompressedTokenAccounts: batch,
outputStateTree: merkleTree!,
recentValidityProof: proof.compressedProof,
recentInputStateRootIndices: proof.rootIndices,
});
instructions.push(...batchInstructions);
}
const { blockhash } = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [owner]);
const signedTx = buildAndSignTx(
instructions,
payer,
blockhash,
additionalSigners,
);
const txId = await sendAndConfirmTx(rpc, signedTx, confirmOptions);
return txId;
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/transfer.ts
|
import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import {
bn,
sendAndConfirmTx,
buildAndSignTx,
Rpc,
ParsedTokenAccount,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedTokenProgram } from '../program';
/**
* Transfer compressed tokens from one owner to another
*
* @param rpc Rpc to use
* @param payer Payer of the transaction fees
* @param mint Mint of the compressed token
* @param amount Number of tokens to transfer
* @param owner Owner of the compressed tokens
* @param toAddress Destination address of the recipient
* @param merkleTree State tree account that the compressed tokens should be
* inserted into. Defaults to the default state tree
* account.
* @param confirmOptions Options for confirming the transaction
*
*
* @return Signature of the confirmed transaction
*/
export async function transfer(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
amount: number | BN,
owner: Signer,
toAddress: PublicKey,
/// TODO: allow multiple
merkleTree?: PublicKey,
confirmOptions?: ConfirmOptions,
): Promise<TransactionSignature> {
amount = bn(amount);
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(
owner.publicKey,
{
mint,
},
);
const [inputAccounts] = selectMinCompressedTokenAccountsForTransfer(
compressedTokenAccounts.items,
amount,
);
const proof = await rpc.getValidityProof(
inputAccounts.map(account => bn(account.compressedAccount.hash)),
);
const ix = await CompressedTokenProgram.transfer({
payer: payer.publicKey,
inputCompressedTokenAccounts: inputAccounts,
toAddress,
amount,
recentInputStateRootIndices: proof.rootIndices,
recentValidityProof: proof.compressedProof,
outputStateTrees: merkleTree,
});
const { blockhash } = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [owner]);
const signedTx = buildAndSignTx(
[ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }), ix],
payer,
blockhash,
additionalSigners,
);
const txId = await sendAndConfirmTx(rpc, signedTx, confirmOptions);
return txId;
}
/**
* Selects the minimal number of compressed token accounts for a transfer.
*
* 1. Sorts the accounts by amount in descending order
* 2. Accumulates the amount until it is greater than or equal to the transfer
* amount
*/
export function selectMinCompressedTokenAccountsForTransfer(
accounts: ParsedTokenAccount[],
transferAmount: BN,
): [
selectedAccounts: ParsedTokenAccount[],
total: BN,
totalLamports: BN | null,
] {
let accumulatedAmount = bn(0);
let accumulatedLamports = bn(0);
const selectedAccounts: ParsedTokenAccount[] = [];
accounts.sort((a, b) => b.parsed.amount.cmp(a.parsed.amount));
for (const account of accounts) {
if (accumulatedAmount.gte(bn(transferAmount))) break;
accumulatedAmount = accumulatedAmount.add(account.parsed.amount);
accumulatedLamports = accumulatedLamports.add(
account.compressedAccount.lamports,
);
selectedAccounts.push(account);
}
if (accumulatedAmount.lt(bn(transferAmount))) {
throw new Error(
`Not enough balance for transfer. Required: ${transferAmount.toString()}, available: ${accumulatedAmount.toString()}`,
);
}
return [
selectedAccounts,
accumulatedAmount,
accumulatedLamports.lt(bn(0)) ? accumulatedLamports : null,
];
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/approve-and-mint-to.ts
|
import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgram } from '../program';
import { getOrCreateAssociatedTokenAccount } from '@solana/spl-token';
/**
* Mint compressed tokens to a solana address from an external mint authority
*
* @param rpc Rpc to use
* @param payer Payer of the transaction fees
* @param mint Mint for the account
* @param destination Address of the account to mint to
* @param authority Minting authority
* @param amount Amount to mint
* @param merkleTree State tree account that the compressed tokens should be
* part of. Defaults to the default state tree account.
* @param confirmOptions Options for confirming the transaction
*
* @return Signature of the confirmed transaction
*/
export async function approveAndMintTo(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
destination: PublicKey,
authority: Signer,
amount: number | BN,
merkleTree?: PublicKey,
confirmOptions?: ConfirmOptions,
tokenProgramId?: PublicKey,
): Promise<TransactionSignature> {
tokenProgramId = tokenProgramId
? tokenProgramId
: await CompressedTokenProgram.get_mint_program_id(mint, rpc);
const authorityTokenAccount = await getOrCreateAssociatedTokenAccount(
rpc,
payer,
mint,
authority.publicKey,
undefined,
undefined,
confirmOptions,
tokenProgramId,
);
const ixs = await CompressedTokenProgram.approveAndMintTo({
feePayer: payer.publicKey,
mint,
authority: authority.publicKey,
authorityTokenAccount: authorityTokenAccount.address,
amount,
toPubkey: destination,
merkleTree,
tokenProgramId,
});
const { blockhash } = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [authority]);
const tx = buildAndSignTx(
[
ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }),
...ixs,
],
payer,
blockhash,
additionalSigners,
);
const txId = await sendAndConfirmTx(rpc, tx, confirmOptions);
return txId;
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/compress-spl-token-account.ts
|
import {
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
ComputeBudgetProgram,
} from '@solana/web3.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedTokenProgram } from '../program';
/**
* Compress SPL tokens into compressed token format
*
* @param rpc Rpc connection to use
* @param payer Payer of the transaction fees
* @param mint Mint of the token to compress
* @param owner Owner of the token account
* @param tokenAccount Token account to compress
* @param outputStateTree State tree to insert the compressed token account into
* @param remainingAmount Optional: amount to leave in token account. Default: 0
* @param confirmOptions Options for confirming the transaction
*
* @return Signature of the confirmed transaction
*/
export async function compressSplTokenAccount(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
owner: Signer,
tokenAccount: PublicKey,
outputStateTree: PublicKey,
remainingAmount?: BN,
confirmOptions?: ConfirmOptions,
tokenProgramId?: PublicKey,
): Promise<TransactionSignature> {
tokenProgramId = tokenProgramId
? tokenProgramId
: await CompressedTokenProgram.get_mint_program_id(mint, rpc);
const compressIx = await CompressedTokenProgram.compressSplTokenAccount({
feePayer: payer.publicKey,
authority: owner.publicKey,
tokenAccount,
mint,
remainingAmount,
outputStateTree,
tokenProgramId,
});
const blockhashCtx = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [owner]);
const signedTx = buildAndSignTx(
[
ComputeBudgetProgram.setComputeUnitLimit({
units: 1_000_000,
}),
compressIx,
],
payer,
blockhashCtx.blockhash,
additionalSigners,
);
const txId = await sendAndConfirmTx(
rpc,
signedTx,
confirmOptions,
blockhashCtx,
);
return txId;
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/index.ts
|
export * from './approve-and-mint-to';
export * from './compress';
export * from './decompress';
export * from './create-mint';
export * from './mint-to';
export * from './merge-token-accounts';
export * from './create-token-pool';
export * from './transfer';
export * from './create-token-program-lookup-table';
export * from './compress-spl-token-account';
| 0
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src
|
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/decompress.ts
|
import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import {
bn,
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedTokenProgram } from '../program';
import { selectMinCompressedTokenAccountsForTransfer } from './transfer';
/**
* Decompress compressed tokens
*
* @param rpc Rpc to use
* @param payer Payer of the transaction fees
* @param mint Mint of the compressed token
* @param amount Number of tokens to transfer
* @param owner Owner of the compressed tokens
* @param toAddress Destination **uncompressed** (associated) token account
* address.
* @param merkleTree State tree account that any change compressed tokens should be
* inserted into. Defaults to a default state tree
* account.
* @param confirmOptions Options for confirming the transaction
*
*
* @return Signature of the confirmed transaction
*/
export async function decompress(
rpc: Rpc,
payer: Signer,
mint: PublicKey,
amount: number | BN,
owner: Signer,
toAddress: PublicKey,
/// TODO: allow multiple
merkleTree?: PublicKey,
confirmOptions?: ConfirmOptions,
tokenProgramId?: PublicKey,
): Promise<TransactionSignature> {
tokenProgramId = tokenProgramId
? tokenProgramId
: await CompressedTokenProgram.get_mint_program_id(mint, rpc);
amount = bn(amount);
const compressedTokenAccounts = await rpc.getCompressedTokenAccountsByOwner(
owner.publicKey,
{
mint,
},
);
/// TODO: consider using a different selection algorithm
const [inputAccounts] = selectMinCompressedTokenAccountsForTransfer(
compressedTokenAccounts.items,
amount,
);
const proof = await rpc.getValidityProof(
inputAccounts.map(account => bn(account.compressedAccount.hash)),
);
const ix = await CompressedTokenProgram.decompress({
payer: payer.publicKey,
inputCompressedTokenAccounts: inputAccounts,
toAddress, // TODO: add explicit check that it is a token account
amount,
outputStateTree: merkleTree,
recentInputStateRootIndices: proof.rootIndices,
recentValidityProof: proof.compressedProof,
tokenProgramId,
});
const { blockhash } = await rpc.getLatestBlockhash();
const additionalSigners = dedupeSigner(payer, [owner]);
const signedTx = buildAndSignTx(
[ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }), ix],
payer,
blockhash,
additionalSigners,
);
const txId = await sendAndConfirmTx(rpc, signedTx, confirmOptions);
return txId;
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol
|
solana_public_repos/Lightprotocol/light-protocol/tsconfig/package.json
|
{
"name": "@lightprotocol/tsconfig",
"version": "0.0.0",
"private": true,
"files": [
"base.json"
]
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol
|
solana_public_repos/Lightprotocol/light-protocol/tsconfig/base.json
|
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"module": "CommonJS",
"esModuleInterop": true,
"noFallthroughCasesInSwitch": true,
"preserveWatchOutput": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitAny": false,
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
},
"exclude": ["node_modules"]
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol
|
solana_public_repos/Lightprotocol/light-protocol/utils/Cargo.toml
|
[package]
name = "light-utils"
version = "1.1.0"
description = "Common utility functions used in Light Protocol"
repository = "https://github.com/Lightprotocol/light-protocol"
license = "Apache-2.0"
edition = "2021"
[dependencies]
anyhow = "1.0"
ark-ff = "0.4"
light-bounded-vec = { version = "1.1.0", path = "../merkle-tree/bounded-vec" }
num-bigint = { version = "0.4", features = ["rand"] }
thiserror = "1.0"
solana-program = { workspace = true }
ark-bn254 = "0.4.0"
rand = "0.8"
[dev-dependencies]
bytemuck = "1.17"
memoffset = "0.9"
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/bigint.rs
|
use num_bigint::BigUint;
use crate::UtilsError;
/// Converts the given [`num_bigint::BigUint`](num_bigint::BigUint) into a little-endian
/// byte array.
pub fn bigint_to_le_bytes_array<const BYTES_SIZE: usize>(
bigint: &BigUint,
) -> Result<[u8; BYTES_SIZE], UtilsError> {
let mut array = [0u8; BYTES_SIZE];
let bytes = bigint.to_bytes_le();
if bytes.len() > BYTES_SIZE {
return Err(UtilsError::InputTooLarge(BYTES_SIZE));
}
array[..bytes.len()].copy_from_slice(bytes.as_slice());
Ok(array)
}
/// Converts the given [`ark_ff::BigUint`](ark_ff::BigUint) into a big-endian
/// byte array.
pub fn bigint_to_be_bytes_array<const BYTES_SIZE: usize>(
bigint: &BigUint,
) -> Result<[u8; BYTES_SIZE], UtilsError> {
let mut array = [0u8; BYTES_SIZE];
let bytes = bigint.to_bytes_be();
if bytes.len() > BYTES_SIZE {
return Err(UtilsError::InputTooLarge(BYTES_SIZE));
}
let start_pos = BYTES_SIZE - bytes.len();
array[start_pos..].copy_from_slice(bytes.as_slice());
Ok(array)
}
#[cfg(test)]
mod test {
use num_bigint::{RandBigInt, ToBigUint};
use rand::thread_rng;
use super::*;
const ITERATIONS: usize = 64;
#[test]
fn test_bigint_conversion_rand() {
let mut rng = thread_rng();
for _ in 0..ITERATIONS {
let b64 = rng.gen_biguint(32);
let b64_converted: [u8; 8] = bigint_to_be_bytes_array(&b64).unwrap();
let b64_converted = BigUint::from_bytes_be(&b64_converted);
assert_eq!(b64, b64_converted);
let b64_converted: [u8; 8] = bigint_to_le_bytes_array(&b64).unwrap();
let b64_converted = BigUint::from_bytes_le(&b64_converted);
assert_eq!(b64, b64_converted);
let b128 = rng.gen_biguint(128);
let b128_converted: [u8; 16] = bigint_to_be_bytes_array(&b128).unwrap();
let b128_converted = BigUint::from_bytes_be(&b128_converted);
assert_eq!(b128, b128_converted);
let b128_converted: [u8; 16] = bigint_to_le_bytes_array(&b128).unwrap();
let b128_converted = BigUint::from_bytes_le(&b128_converted);
assert_eq!(b128, b128_converted);
let b256 = rng.gen_biguint(256);
let b256_converted: [u8; 32] = bigint_to_be_bytes_array(&b256).unwrap();
let b256_converted = BigUint::from_bytes_be(&b256_converted);
assert_eq!(b256, b256_converted);
let b256_converted: [u8; 32] = bigint_to_le_bytes_array(&b256).unwrap();
let b256_converted = BigUint::from_bytes_le(&b256_converted);
assert_eq!(b256, b256_converted);
let b320 = rng.gen_biguint(320);
let b320_converted: [u8; 40] = bigint_to_be_bytes_array(&b320).unwrap();
let b320_converted = BigUint::from_bytes_be(&b320_converted);
assert_eq!(b320, b320_converted);
let b320_converted: [u8; 40] = bigint_to_le_bytes_array(&b320).unwrap();
let b320_converted = BigUint::from_bytes_le(&b320_converted);
assert_eq!(b320, b320_converted);
let b384 = rng.gen_biguint(384);
let b384_converted: [u8; 48] = bigint_to_be_bytes_array(&b384).unwrap();
let b384_converted = BigUint::from_bytes_be(&b384_converted);
assert_eq!(b384, b384_converted);
let b384_converted: [u8; 48] = bigint_to_le_bytes_array(&b384).unwrap();
let b384_converted = BigUint::from_bytes_le(&b384_converted);
assert_eq!(b384, b384_converted);
let b448 = rng.gen_biguint(448);
let b448_converted: [u8; 56] = bigint_to_be_bytes_array(&b448).unwrap();
let b448_converted = BigUint::from_bytes_be(&b448_converted);
assert_eq!(b448, b448_converted);
let b448_converted: [u8; 56] = bigint_to_le_bytes_array(&b448).unwrap();
let b448_converted = BigUint::from_bytes_le(&b448_converted);
assert_eq!(b448, b448_converted);
let b768 = rng.gen_biguint(768);
let b768_converted: [u8; 96] = bigint_to_be_bytes_array(&b768).unwrap();
let b768_converted = BigUint::from_bytes_be(&b768_converted);
assert_eq!(b768, b768_converted);
let b768_converted: [u8; 96] = bigint_to_le_bytes_array(&b768).unwrap();
let b768_converted = BigUint::from_bytes_le(&b768_converted);
assert_eq!(b768, b768_converted);
let b832 = rng.gen_biguint(832);
let b832_converted: [u8; 104] = bigint_to_be_bytes_array(&b832).unwrap();
let b832_converted = BigUint::from_bytes_be(&b832_converted);
assert_eq!(b832, b832_converted);
let b832_converted: [u8; 104] = bigint_to_le_bytes_array(&b832).unwrap();
let b832_converted = BigUint::from_bytes_le(&b832_converted);
assert_eq!(b832, b832_converted);
}
}
#[test]
fn test_bigint_conversion_zero() {
let zero = 0_u32.to_biguint().unwrap();
let b64_converted: [u8; 8] = bigint_to_be_bytes_array(&zero).unwrap();
let b64_converted = BigUint::from_bytes_be(&b64_converted);
assert_eq!(zero, b64_converted);
let b64_converted: [u8; 8] = bigint_to_le_bytes_array(&zero).unwrap();
let b64_converted = BigUint::from_bytes_le(&b64_converted);
assert_eq!(zero, b64_converted);
let b128_converted: [u8; 16] = bigint_to_be_bytes_array(&zero).unwrap();
let b128_converted = BigUint::from_bytes_be(&b128_converted);
assert_eq!(zero, b128_converted);
let b128_converted: [u8; 16] = bigint_to_le_bytes_array(&zero).unwrap();
let b128_converted = BigUint::from_bytes_le(&b128_converted);
assert_eq!(zero, b128_converted);
let b256_converted: [u8; 32] = bigint_to_be_bytes_array(&zero).unwrap();
let b256_converted = BigUint::from_bytes_be(&b256_converted);
assert_eq!(zero, b256_converted);
let b256_converted: [u8; 32] = bigint_to_le_bytes_array(&zero).unwrap();
let b256_converted = BigUint::from_bytes_le(&b256_converted);
assert_eq!(zero, b256_converted);
let b320_converted: [u8; 40] = bigint_to_be_bytes_array(&zero).unwrap();
let b320_converted = BigUint::from_bytes_be(&b320_converted);
assert_eq!(zero, b320_converted);
let b320_converted: [u8; 40] = bigint_to_le_bytes_array(&zero).unwrap();
let b320_converted = BigUint::from_bytes_le(&b320_converted);
assert_eq!(zero, b320_converted);
let b384_converted: [u8; 48] = bigint_to_be_bytes_array(&zero).unwrap();
let b384_converted = BigUint::from_bytes_be(&b384_converted);
assert_eq!(zero, b384_converted);
let b384_converted: [u8; 48] = bigint_to_le_bytes_array(&zero).unwrap();
let b384_converted = BigUint::from_bytes_le(&b384_converted);
assert_eq!(zero, b384_converted);
let b448_converted: [u8; 56] = bigint_to_be_bytes_array(&zero).unwrap();
let b448_converted = BigUint::from_bytes_be(&b448_converted);
assert_eq!(zero, b448_converted);
let b448_converted: [u8; 56] = bigint_to_le_bytes_array(&zero).unwrap();
let b448_converted = BigUint::from_bytes_le(&b448_converted);
assert_eq!(zero, b448_converted);
let b768_converted: [u8; 96] = bigint_to_be_bytes_array(&zero).unwrap();
let b768_converted = BigUint::from_bytes_be(&b768_converted);
assert_eq!(zero, b768_converted);
let b768_converted: [u8; 96] = bigint_to_le_bytes_array(&zero).unwrap();
let b768_converted = BigUint::from_bytes_le(&b768_converted);
assert_eq!(zero, b768_converted);
let b832_converted: [u8; 104] = bigint_to_be_bytes_array(&zero).unwrap();
let b832_converted = BigUint::from_bytes_be(&b832_converted);
assert_eq!(zero, b832_converted);
let b832_converted: [u8; 104] = bigint_to_le_bytes_array(&zero).unwrap();
let b832_converted = BigUint::from_bytes_le(&b832_converted);
assert_eq!(zero, b832_converted);
}
#[test]
fn test_bigint_conversion_one() {
let one = 1_u32.to_biguint().unwrap();
let b64_converted: [u8; 8] = bigint_to_be_bytes_array(&one).unwrap();
let b64_converted = BigUint::from_bytes_be(&b64_converted);
assert_eq!(one, b64_converted);
let b64_converted: [u8; 8] = bigint_to_le_bytes_array(&one).unwrap();
let b64_converted = BigUint::from_bytes_le(&b64_converted);
assert_eq!(one, b64_converted);
let b64 = BigUint::from_bytes_be(&[0, 0, 0, 0, 0, 0, 0, 1]);
assert_eq!(one, b64);
let b64 = BigUint::from_bytes_le(&[1, 0, 0, 0, 0, 0, 0, 0]);
assert_eq!(one, b64);
let b128_converted: [u8; 16] = bigint_to_be_bytes_array(&one).unwrap();
let b128_converted = BigUint::from_bytes_be(&b128_converted);
assert_eq!(one, b128_converted);
let b128_converted: [u8; 16] = bigint_to_le_bytes_array(&one).unwrap();
let b128_converted = BigUint::from_bytes_le(&b128_converted);
assert_eq!(one, b128_converted);
let b256_converted: [u8; 32] = bigint_to_be_bytes_array(&one).unwrap();
let b256_converted = BigUint::from_bytes_be(&b256_converted);
assert_eq!(one, b256_converted);
let b256_converted: [u8; 32] = bigint_to_le_bytes_array(&one).unwrap();
let b256_converted = BigUint::from_bytes_le(&b256_converted);
assert_eq!(one, b256_converted);
let b320_converted: [u8; 40] = bigint_to_be_bytes_array(&one).unwrap();
let b320_converted = BigUint::from_bytes_be(&b320_converted);
assert_eq!(one, b320_converted);
let b320_converted: [u8; 40] = bigint_to_le_bytes_array(&one).unwrap();
let b320_converted = BigUint::from_bytes_le(&b320_converted);
assert_eq!(one, b320_converted);
let b384_converted: [u8; 48] = bigint_to_be_bytes_array(&one).unwrap();
let b384_converted = BigUint::from_bytes_be(&b384_converted);
assert_eq!(one, b384_converted);
let b384_converted: [u8; 48] = bigint_to_le_bytes_array(&one).unwrap();
let b384_converted = BigUint::from_bytes_le(&b384_converted);
assert_eq!(one, b384_converted);
let b448_converted: [u8; 56] = bigint_to_be_bytes_array(&one).unwrap();
let b448_converted = BigUint::from_bytes_be(&b448_converted);
assert_eq!(one, b448_converted);
let b448_converted: [u8; 56] = bigint_to_le_bytes_array(&one).unwrap();
let b448_converted = BigUint::from_bytes_le(&b448_converted);
assert_eq!(one, b448_converted);
let b768_converted: [u8; 96] = bigint_to_be_bytes_array(&one).unwrap();
let b768_converted = BigUint::from_bytes_be(&b768_converted);
assert_eq!(one, b768_converted);
let b768_converted: [u8; 96] = bigint_to_le_bytes_array(&one).unwrap();
let b768_converted = BigUint::from_bytes_le(&b768_converted);
assert_eq!(one, b768_converted);
let b832_converted: [u8; 104] = bigint_to_be_bytes_array(&one).unwrap();
let b832_converted = BigUint::from_bytes_be(&b832_converted);
assert_eq!(one, b832_converted);
let b832_converted: [u8; 104] = bigint_to_le_bytes_array(&one).unwrap();
let b832_converted = BigUint::from_bytes_le(&b832_converted);
assert_eq!(one, b832_converted);
}
#[test]
fn test_bigint_conversion_invalid_size() {
let b8 = BigUint::from_bytes_be(&[1; 8]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b8);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 7], UtilsError> = bigint_to_be_bytes_array(&b8);
assert!(matches!(res, Err(UtilsError::InputTooLarge(7))));
let res: Result<[u8; 8], UtilsError> = bigint_to_be_bytes_array(&b8);
assert!(res.is_ok());
let b8 = BigUint::from_bytes_le(&[1; 8]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b8);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 7], UtilsError> = bigint_to_le_bytes_array(&b8);
assert!(matches!(res, Err(UtilsError::InputTooLarge(7))));
let res: Result<[u8; 8], UtilsError> = bigint_to_le_bytes_array(&b8);
assert!(res.is_ok());
let b16 = BigUint::from_bytes_be(&[1; 16]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b16);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 15], UtilsError> = bigint_to_be_bytes_array(&b16);
assert!(matches!(res, Err(UtilsError::InputTooLarge(15))));
let res: Result<[u8; 16], UtilsError> = bigint_to_be_bytes_array(&b16);
assert!(res.is_ok());
let b16 = BigUint::from_bytes_le(&[1; 16]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b16);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 15], UtilsError> = bigint_to_le_bytes_array(&b16);
assert!(matches!(res, Err(UtilsError::InputTooLarge(15))));
let res: Result<[u8; 16], UtilsError> = bigint_to_le_bytes_array(&b16);
assert!(res.is_ok());
let b32 = BigUint::from_bytes_be(&[1; 32]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b32);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 31], UtilsError> = bigint_to_be_bytes_array(&b32);
assert!(matches!(res, Err(UtilsError::InputTooLarge(31))));
let res: Result<[u8; 32], UtilsError> = bigint_to_be_bytes_array(&b32);
assert!(res.is_ok());
let b32 = BigUint::from_bytes_le(&[1; 32]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b32);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 31], UtilsError> = bigint_to_le_bytes_array(&b32);
assert!(matches!(res, Err(UtilsError::InputTooLarge(31))));
let res: Result<[u8; 32], UtilsError> = bigint_to_le_bytes_array(&b32);
assert!(res.is_ok());
let b64 = BigUint::from_bytes_be(&[1; 64]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b64);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 63], UtilsError> = bigint_to_be_bytes_array(&b64);
assert!(matches!(res, Err(UtilsError::InputTooLarge(63))));
let res: Result<[u8; 64], UtilsError> = bigint_to_be_bytes_array(&b64);
assert!(res.is_ok());
let b64 = BigUint::from_bytes_le(&[1; 64]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b64);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 63], UtilsError> = bigint_to_le_bytes_array(&b64);
assert!(matches!(res, Err(UtilsError::InputTooLarge(63))));
let res: Result<[u8; 64], UtilsError> = bigint_to_le_bytes_array(&b64);
assert!(res.is_ok());
let b128 = BigUint::from_bytes_be(&[1; 128]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b128);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 127], UtilsError> = bigint_to_be_bytes_array(&b128);
assert!(matches!(res, Err(UtilsError::InputTooLarge(127))));
let res: Result<[u8; 128], UtilsError> = bigint_to_be_bytes_array(&b128);
assert!(res.is_ok());
let b128 = BigUint::from_bytes_le(&[1; 128]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b128);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 127], UtilsError> = bigint_to_le_bytes_array(&b128);
assert!(matches!(res, Err(UtilsError::InputTooLarge(127))));
let res: Result<[u8; 128], UtilsError> = bigint_to_le_bytes_array(&b128);
assert!(res.is_ok());
let b256 = BigUint::from_bytes_be(&[1; 256]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b256);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 255], UtilsError> = bigint_to_be_bytes_array(&b256);
assert!(matches!(res, Err(UtilsError::InputTooLarge(255))));
let res: Result<[u8; 256], UtilsError> = bigint_to_be_bytes_array(&b256);
assert!(res.is_ok());
let b256 = BigUint::from_bytes_le(&[1; 256]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b256);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 255], UtilsError> = bigint_to_le_bytes_array(&b256);
assert!(matches!(res, Err(UtilsError::InputTooLarge(255))));
let res: Result<[u8; 256], UtilsError> = bigint_to_le_bytes_array(&b256);
assert!(res.is_ok());
let b512 = BigUint::from_bytes_be(&[1; 512]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b512);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 511], UtilsError> = bigint_to_be_bytes_array(&b512);
assert!(matches!(res, Err(UtilsError::InputTooLarge(511))));
let res: Result<[u8; 512], UtilsError> = bigint_to_be_bytes_array(&b512);
assert!(res.is_ok());
let b512 = BigUint::from_bytes_le(&[1; 512]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b512);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 511], UtilsError> = bigint_to_le_bytes_array(&b512);
assert!(matches!(res, Err(UtilsError::InputTooLarge(511))));
let res: Result<[u8; 512], UtilsError> = bigint_to_le_bytes_array(&b512);
assert!(res.is_ok());
let b768 = BigUint::from_bytes_be(&[1; 768]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b768);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 767], UtilsError> = bigint_to_be_bytes_array(&b768);
assert!(matches!(res, Err(UtilsError::InputTooLarge(767))));
let res: Result<[u8; 768], UtilsError> = bigint_to_be_bytes_array(&b768);
assert!(res.is_ok());
let b768 = BigUint::from_bytes_le(&[1; 768]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b768);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 767], UtilsError> = bigint_to_le_bytes_array(&b768);
assert!(matches!(res, Err(UtilsError::InputTooLarge(767))));
let res: Result<[u8; 768], UtilsError> = bigint_to_le_bytes_array(&b768);
assert!(res.is_ok());
let b1024 = BigUint::from_bytes_be(&[1; 1024]);
let res: Result<[u8; 1], UtilsError> = bigint_to_be_bytes_array(&b1024);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 1023], UtilsError> = bigint_to_be_bytes_array(&b1024);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1023))));
let res: Result<[u8; 1024], UtilsError> = bigint_to_be_bytes_array(&b1024);
assert!(res.is_ok());
let b1024 = BigUint::from_bytes_le(&[1; 1024]);
let res: Result<[u8; 1], UtilsError> = bigint_to_le_bytes_array(&b1024);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1))));
let res: Result<[u8; 1023], UtilsError> = bigint_to_le_bytes_array(&b1024);
assert!(matches!(res, Err(UtilsError::InputTooLarge(1023))));
let res: Result<[u8; 1024], UtilsError> = bigint_to_le_bytes_array(&b1024);
assert!(res.is_ok());
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/fee.rs
|
use crate::UtilsError;
pub fn compute_rollover_fee(
rollover_threshold: u64,
tree_height: u32,
rent: u64,
) -> Result<u64, UtilsError> {
let number_of_transactions = 1 << tree_height;
if rollover_threshold > 100 {
return Err(UtilsError::InvalidRolloverThreshold);
}
if rollover_threshold == 0 {
return Ok(rent);
}
// rent / (total_number_of_leaves * (rollover_threshold / 100))
// (with ceil division)
Ok((rent * 100).div_ceil(number_of_transactions * rollover_threshold))
}
#[test]
fn test_compute_rollover_fee() {
let rollover_threshold = 100;
let tree_height = 26;
let rent = 1392890880;
let total_number_of_leaves = 1 << tree_height;
let fee = compute_rollover_fee(rollover_threshold, tree_height, rent).unwrap();
// assert_ne!(fee, 0u64);
assert!((fee + 1) * (total_number_of_leaves * 100 / rollover_threshold) > rent);
let rollover_threshold = 50;
let fee = compute_rollover_fee(rollover_threshold, tree_height, rent).unwrap();
assert!((fee + 1) * (total_number_of_leaves * 100 / rollover_threshold) > rent);
let rollover_threshold: u64 = 95;
let fee = compute_rollover_fee(rollover_threshold, tree_height, rent).unwrap();
assert!((fee + 1) * (total_number_of_leaves * 100 / rollover_threshold) > rent);
}
#[test]
fn test_concurrent_tree_compute_rollover_fee() {
let merkle_tree_lamports = 9496836480;
let queue_lamports = 2293180800;
let cpi_context_lamports = 143487360;
let rollover_threshold = 95;
let height = 26;
let rollover_fee = compute_rollover_fee(
rollover_threshold,
height,
merkle_tree_lamports + cpi_context_lamports,
)
.unwrap()
+ compute_rollover_fee(rollover_threshold, height, queue_lamports).unwrap();
let lifetime_lamports = rollover_fee * ((2u64.pow(height)) as f64 * 0.95) as u64;
println!("rollover_fee: {}", rollover_fee);
println!("lifetime_lamports: {}", lifetime_lamports);
println!(
"lifetime_lamports < total lamports: {}",
lifetime_lamports > merkle_tree_lamports + queue_lamports + cpi_context_lamports
);
println!(
"lifetime_lamports - total lamports: {}",
lifetime_lamports - (merkle_tree_lamports + queue_lamports + cpi_context_lamports)
);
assert!(lifetime_lamports > (merkle_tree_lamports + queue_lamports + cpi_context_lamports));
}
#[test]
fn test_address_tree_compute_rollover_fee() {
let merkle_tree_lamports = 9639711360;
let queue_lamports = 2293180800;
let rollover_threshold = 95;
let height = 26;
let rollover_fee = compute_rollover_fee(rollover_threshold, height, merkle_tree_lamports)
.unwrap()
+ compute_rollover_fee(rollover_threshold, height, queue_lamports).unwrap();
let lifetime_lamports = rollover_fee * ((2u64.pow(height)) as f64 * 0.95) as u64;
println!("rollover_fee: {}", rollover_fee);
println!("lifetime_lamports: {}", lifetime_lamports);
println!(
"lifetime_lamports < total lamports: {}",
lifetime_lamports > merkle_tree_lamports + queue_lamports
);
println!(
"lifetime_lamports - total lamports: {}",
lifetime_lamports - (merkle_tree_lamports + queue_lamports)
);
assert!(lifetime_lamports > (merkle_tree_lamports + queue_lamports));
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/lib.rs
|
use std::{
env,
io::{self, prelude::*},
process::{Command, Stdio},
thread::spawn,
};
use ark_ff::PrimeField;
use num_bigint::BigUint;
use solana_program::keccak::hashv;
use thiserror::Error;
pub mod bigint;
pub mod fee;
pub mod offset;
pub mod prime;
pub mod rand;
#[derive(Debug, Error, PartialEq)]
pub enum UtilsError {
#[error("Invalid input size, expected at most {0}")]
InputTooLarge(usize),
#[error("Invalid chunk size")]
InvalidChunkSize,
#[error("Invalid seeds")]
InvalidSeeds,
#[error("Invalid rollover thresold")]
InvalidRolloverThreshold,
}
// NOTE(vadorovsky): Unfortunately, we need to do it by hand.
// `num_derive::ToPrimitive` doesn't support data-carrying enums.
impl From<UtilsError> for u32 {
fn from(e: UtilsError) -> u32 {
match e {
UtilsError::InputTooLarge(_) => 12001,
UtilsError::InvalidChunkSize => 12002,
UtilsError::InvalidSeeds => 12003,
UtilsError::InvalidRolloverThreshold => 12004,
}
}
}
impl From<UtilsError> for solana_program::program_error::ProgramError {
fn from(e: UtilsError) -> Self {
solana_program::program_error::ProgramError::Custom(e.into())
}
}
pub fn is_smaller_than_bn254_field_size_be(bytes: &[u8; 32]) -> bool {
let bigint = BigUint::from_bytes_be(bytes);
bigint < ark_bn254::Fr::MODULUS.into()
}
pub fn hash_to_bn254_field_size_be(bytes: &[u8]) -> Option<([u8; 32], u8)> {
let mut bump_seed = [u8::MAX];
// Loops with decreasing bump seed to find a valid hash which is less than
// bn254 Fr modulo field size.
for _ in 0..u8::MAX {
{
let mut hashed_value: [u8; 32] = hashv(&[bytes, bump_seed.as_ref()]).to_bytes();
// Truncates to 31 bytes so that value is less than bn254 Fr modulo
// field size.
hashed_value[0] = 0;
if is_smaller_than_bn254_field_size_be(&hashed_value) {
return Some((hashed_value, bump_seed[0]));
}
}
bump_seed[0] -= 1;
}
None
}
/// Hashes the provided `bytes` with Keccak256 and ensures the result fits
/// in the BN254 prime field by repeatedly hashing the inputs with various
/// "bump seeds" and truncating the resulting hash to 31 bytes.
///
/// The attempted "bump seeds" are bytes from 255 to 0.
///
/// # Examples
///
/// ```
/// use light_utils::hashv_to_bn254_field_size_be;
///
/// hashv_to_bn254_field_size_be(&[b"foo", b"bar"]);
/// ```
pub fn hashv_to_bn254_field_size_be(bytes: &[&[u8]]) -> [u8; 32] {
let mut hashed_value: [u8; 32] = hashv(bytes).to_bytes();
// Truncates to 31 bytes so that value is less than bn254 Fr modulo
// field size.
hashed_value[0] = 0;
hashed_value
}
/// Applies `rustfmt` on the given string containing Rust code. The purpose of
/// this function is to be able to format autogenerated code (e.g. with `quote`
/// macro).
pub fn rustfmt(code: String) -> Result<Vec<u8>, anyhow::Error> {
let mut cmd = match env::var_os("RUSTFMT") {
Some(r) => Command::new(r),
None => Command::new("rustfmt"),
};
let mut cmd = cmd
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;
let mut stdin = cmd.stdin.take().unwrap();
let mut stdout = cmd.stdout.take().unwrap();
let stdin_handle = spawn(move || {
stdin.write_all(code.as_bytes()).unwrap();
});
let mut formatted_code = vec![];
io::copy(&mut stdout, &mut formatted_code)?;
let _ = cmd.wait();
stdin_handle.join().unwrap();
Ok(formatted_code)
}
#[cfg(test)]
mod tests {
use num_bigint::ToBigUint;
use solana_program::pubkey::Pubkey;
use crate::bigint::bigint_to_be_bytes_array;
use super::*;
#[test]
fn test_is_smaller_than_bn254_field_size_be() {
let modulus: BigUint = ark_bn254::Fr::MODULUS.into();
let modulus_bytes: [u8; 32] = bigint_to_be_bytes_array(&modulus).unwrap();
assert!(!is_smaller_than_bn254_field_size_be(&modulus_bytes));
let bigint = modulus.clone() - 1.to_biguint().unwrap();
let bigint_bytes: [u8; 32] = bigint_to_be_bytes_array(&bigint).unwrap();
assert!(is_smaller_than_bn254_field_size_be(&bigint_bytes));
let bigint = modulus + 1.to_biguint().unwrap();
let bigint_bytes: [u8; 32] = bigint_to_be_bytes_array(&bigint).unwrap();
assert!(!is_smaller_than_bn254_field_size_be(&bigint_bytes));
}
#[test]
fn test_hash_to_bn254_field_size_be() {
for _ in 0..10_000 {
let input_bytes = Pubkey::new_unique().to_bytes(); // Sample input
let (hashed_value, bump) = hash_to_bn254_field_size_be(input_bytes.as_slice())
.expect("Failed to find a hash within BN254 field size");
assert_eq!(bump, 255, "Bump seed should be 0");
assert!(
is_smaller_than_bn254_field_size_be(&hashed_value),
"Hashed value should be within BN254 field size"
);
}
let max_input = [u8::MAX; 32];
let (hashed_value, bump) = hash_to_bn254_field_size_be(max_input.as_slice())
.expect("Failed to find a hash within BN254 field size");
assert_eq!(bump, 255, "Bump seed should be 255");
assert!(
is_smaller_than_bn254_field_size_be(&hashed_value),
"Hashed value should be within BN254 field size"
);
}
#[test]
fn test_hashv_to_bn254_field_size_be() {
for _ in 0..10_000 {
let input_bytes = [Pubkey::new_unique().to_bytes(); 4];
let input_bytes = input_bytes.iter().map(|x| x.as_slice()).collect::<Vec<_>>();
let hashed_value = hashv_to_bn254_field_size_be(input_bytes.as_slice());
assert!(
is_smaller_than_bn254_field_size_be(&hashed_value),
"Hashed value should be within BN254 field size"
);
}
let max_input = [[u8::MAX; 32]; 16];
let max_input = max_input.iter().map(|x| x.as_slice()).collect::<Vec<_>>();
let hashed_value = hashv_to_bn254_field_size_be(max_input.as_slice());
assert!(
is_smaller_than_bn254_field_size_be(&hashed_value),
"Hashed value should be within BN254 field size"
);
}
#[test]
fn test_rustfmt() {
let unformatted_code = "use std::mem;
fn main() { println!(\"{}\", mem::size_of::<u64>()); }
"
.to_string();
let formatted_code = rustfmt(unformatted_code).unwrap();
assert_eq!(
String::from_utf8_lossy(&formatted_code),
"use std::mem;
fn main() {
println!(\"{}\", mem::size_of::<u64>());
}
"
);
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/prime.rs
|
/// Finds the lowest prime number which is greater than the provided number
/// `n`.
pub fn find_next_prime(mut n: u32) -> u32 {
// Handle small numbers separately
if n <= 2 {
return 2;
} else if n <= 3 {
return 3;
}
// All prime numbers greater than 3 are of the form 6k + 1 or 6k + 5 (or
// 6k - 1).
// That's because:
//
// 6k is divisible by 2 and 3.
// 6k + 2 = 2(3k + 1) is divisible by 2.
// 6k + 3 = 3(2k + 1) is divisible by 3.
// 6k + 4 = 2(3k + 2) is divisible by 2.
//
// This leaves only 6k + 1 and 6k + 5 as candidates.
// Ensure the candidate is of the form 6k - 1 or 6k + 1.
let remainder = n % 6;
if remainder != 0 {
// Check if `n` already satisfies the pattern and is prime.
if remainder == 5 && is_prime(n) {
return n;
}
if remainder == 1 && is_prime(n) {
return n;
}
// Add `6 - remainder` to `n`, to it satisfies the `6k` pattern.
n = n + 6 - remainder;
// Check if `6k - 1` candidate is prime.
let candidate = n - 1;
if is_prime(candidate) {
return candidate;
}
}
// Consequently add `6`, keep checking `6k + 1` and `6k + 5` candidates.
loop {
let candidate = n + 1;
if is_prime(candidate) {
return candidate;
}
let candidate = n + 5;
if is_prime(candidate) {
return candidate;
}
n += 6;
}
}
pub fn find_next_prime_with_load_factor(n: u32, load_factor: f64) -> u32 {
// SAFETY: These type coercions should not cause any issues.
//
// * `f64` can precisely represent all integer values up to 2^53, which is
// more than `u32::MAX`. `u64` and `usize` would be too large though.
// * We want to return and find an integer (prime number), so coercing `f64`
// back to `u32` is intentional here.
let minimum = n as f64 / load_factor;
find_next_prime(minimum as u32)
}
/// Checks whether the provided number `n` is a prime number.
pub fn is_prime(n: u32) -> bool {
if n <= 1 {
return false;
}
if n <= 3 {
return true;
}
if n % 2 == 0 || n % 3 == 0 {
return false;
}
let mut i = 5;
while i * i <= n {
if n % i == 0 || n % (i + 2) == 0 {
return false;
}
i += 6;
}
true
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_find_next_prime() {
assert_eq!(find_next_prime(0), 2);
assert_eq!(find_next_prime(2), 2);
assert_eq!(find_next_prime(3), 3);
assert_eq!(find_next_prime(4), 5);
assert_eq!(find_next_prime(10), 11);
assert_eq!(find_next_prime(17), 17);
assert_eq!(find_next_prime(19), 19);
assert_eq!(find_next_prime(28), 29);
assert_eq!(find_next_prime(100), 101);
assert_eq!(find_next_prime(102), 103);
assert_eq!(find_next_prime(105), 107);
assert_eq!(find_next_prime(1000), 1009);
assert_eq!(find_next_prime(2000), 2003);
assert_eq!(find_next_prime(3000), 3001);
assert_eq!(find_next_prime(4000), 4001);
assert_eq!(find_next_prime(4800), 4801);
assert_eq!(find_next_prime(5000), 5003);
assert_eq!(find_next_prime(6000), 6007);
assert_eq!(find_next_prime(6850), 6857);
assert_eq!(find_next_prime(7000), 7001);
assert_eq!(find_next_prime(7900), 7901);
assert_eq!(find_next_prime(7907), 7907);
}
#[test]
fn test_find_next_prime_with_load_factor() {
assert_eq!(find_next_prime_with_load_factor(4800, 0.5), 9601);
assert_eq!(find_next_prime_with_load_factor(4800, 0.7), 6857);
}
#[test]
fn test_is_prime() {
assert_eq!(is_prime(1), false);
assert_eq!(is_prime(2), true);
assert_eq!(is_prime(3), true);
assert_eq!(is_prime(4), false);
assert_eq!(is_prime(17), true);
assert_eq!(is_prime(19), true);
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/rand.rs
|
use std::ops::{Bound, RangeBounds};
use rand::{
distributions::uniform::{SampleRange, SampleUniform},
Rng,
};
use crate::prime::find_next_prime;
const PRIME_RETRIES: usize = 10;
/// Generates a random prime number in the given range. It returns `None` when
/// generating such number was not possible.
pub fn gen_prime<N, R, T>(rng: &mut N, range: R) -> Option<T>
where
N: Rng,
R: Clone + RangeBounds<T> + SampleRange<T>,
T: Into<u32> + From<u32> + Copy + PartialOrd + SampleUniform,
{
for _ in 0..PRIME_RETRIES {
let sample: T = rng.gen_range(range.clone());
let next_prime = find_next_prime(sample.into());
match range.end_bound() {
Bound::Included(end) => {
if next_prime > (*end).into() {
continue;
}
}
Bound::Excluded(end) => {
if next_prime >= (*end).into() {
continue;
}
}
_ => {}
};
return Some(T::from(next_prime));
}
None
}
/// Generates a random value in the given range, excluding the values provided
/// in `exclude`.
pub fn gen_range_exclude<N, R, T>(rng: &mut N, range: R, exclude: &[T]) -> T
where
N: Rng,
R: Clone + SampleRange<T>,
T: PartialEq + SampleUniform,
{
loop {
// This utility is supposed to be used only in unit tests. This `clone`
// is harmless and necessary (can't pass a reference to range, it has
// to be moved).
let sample = rng.gen_range(range.clone());
if !exclude.contains(&sample) {
return sample;
}
}
}
#[cfg(test)]
mod test {
use rand::Rng;
use crate::prime::is_prime;
use super::*;
#[test]
fn test_gen_prime() {
let mut rng = rand::thread_rng();
let mut successful_gens = 0;
for i in 0..10_000 {
let sample: Option<u32> = gen_prime(&mut rng, 1..10_000);
println!("sample {i}: {sample:?}");
if let Some(sample) = sample {
successful_gens += 1;
assert!(is_prime(sample));
}
}
println!("generated {successful_gens} prime numbers out of 10000 iterations");
}
#[test]
fn test_gen_range_exclude() {
let mut rng = rand::thread_rng();
for n_excluded in 1..100 {
let excluded: Vec<u64> = (0..n_excluded).map(|_| rng.gen_range(0..100)).collect();
for _ in 0..10_000 {
let sample = gen_range_exclude(&mut rng, 0..100, excluded.as_slice());
for excluded in excluded.iter() {
assert_ne!(&sample, excluded);
}
}
}
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils/src
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/offset/copy.rs
|
use std::{mem, ptr};
use light_bounded_vec::{
BoundedVec, BoundedVecMetadata, CyclicBoundedVec, CyclicBoundedVecMetadata,
};
/// Creates a copy of value of type `T` based on the provided `bytes` buffer.
///
/// # Safety
///
/// This is higly unsafe. This function doesn't ensure alignment and
/// correctness of provided buffer. The responsibility of such checks is on
/// the caller.
pub unsafe fn read_value_at<T>(bytes: &[u8], offset: &mut usize) -> T
where
T: Clone,
{
let size = mem::size_of::<T>();
let ptr = bytes[*offset..*offset + size].as_ptr() as *const T;
*offset += size;
ptr::read(ptr)
}
/// Creates a `BoundedVec` from the sequence of values provided in `bytes` buffer.
///
/// # Safety
///
/// This is higly unsafe. This function doesn't ensure alignment and
/// correctness of provided buffer. The responsibility of such checks is on
/// the caller.
///
/// The `T` type needs to be either a primitive or struct consisting of
/// primitives. It cannot contain any nested heap-backed stucture (like vectors,
/// slices etc.).
pub unsafe fn read_bounded_vec_at<T>(
bytes: &[u8],
offset: &mut usize,
metadata: &BoundedVecMetadata,
) -> BoundedVec<T>
where
T: Clone,
{
let size = mem::size_of::<T>() * metadata.capacity();
let ptr = bytes[*offset..*offset + size].as_ptr() as *const T;
let mut vec = BoundedVec::with_metadata(metadata);
let dst_ptr: *mut T = vec.as_mut_ptr();
for i in 0..metadata.length() {
let val = ptr::read(ptr.add(i));
// SAFETY: We ensured the bounds.
unsafe { ptr::write(dst_ptr.add(i), val) };
}
*offset += size;
vec
}
/// Creates a `CyclicBoundedVec` from the sequence of values provided in
/// `bytes` buffer.
///
/// # Safety
///
/// This is higly unsafe. This function doesn't ensure alignment and
/// correctness of provided buffer. The responsibility of such checks is on
/// the caller.
pub unsafe fn read_cyclic_bounded_vec_at<T>(
bytes: &[u8],
offset: &mut usize,
metadata: &CyclicBoundedVecMetadata,
) -> CyclicBoundedVec<T>
where
T: Clone,
{
let size = mem::size_of::<T>() * metadata.capacity();
let src_ptr = bytes[*offset..*offset + size].as_ptr() as *const T;
let mut vec = CyclicBoundedVec::with_metadata(metadata);
let dst_ptr: *mut T = vec.as_mut_ptr();
for i in 0..metadata.length() {
let val = ptr::read(src_ptr.add(i));
// SAFETY: We ensured the bounds.
unsafe { ptr::write(dst_ptr.add(i), val) };
}
*offset += size;
vec
}
#[cfg(test)]
mod test {
use std::slice;
use super::*;
use bytemuck::{Pod, Zeroable};
use memoffset::offset_of;
#[test]
fn test_value_at() {
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
struct TestStruct {
a: isize,
b: usize,
c: i64,
d: u64,
e: i32,
f: u32,
g: i16,
_padding_1: [u8; 2],
h: u16,
_padding_2: [u8; 2],
i: i8,
_padding_3: [i8; 3],
j: u8,
_padding_4: [i8; 3],
}
let mut buf = vec![0_u8; mem::size_of::<TestStruct>()];
let s = buf.as_mut_ptr() as *mut TestStruct;
unsafe {
(*s).a = isize::MIN;
(*s).b = usize::MAX;
(*s).c = i64::MIN;
(*s).d = u64::MAX;
(*s).e = i32::MIN;
(*s).f = u32::MAX;
(*s).g = i16::MIN;
(*s).h = u16::MAX;
(*s).i = i8::MIN;
(*s).j = u8::MAX;
let mut offset = offset_of!(TestStruct, a);
assert_eq!(offset, 0);
assert_eq!(read_value_at::<isize>(&buf, &mut offset), isize::MIN);
assert_eq!(offset, 8);
let mut offset = offset_of!(TestStruct, b);
assert_eq!(offset, 8);
assert_eq!(read_value_at::<usize>(&buf, &mut offset), usize::MAX);
assert_eq!(offset, 16);
let mut offset = offset_of!(TestStruct, c);
assert_eq!(offset, 16);
assert_eq!(read_value_at::<i64>(&buf, &mut offset), i64::MIN);
assert_eq!(offset, 24);
let mut offset = offset_of!(TestStruct, d);
assert_eq!(offset, 24);
assert_eq!(read_value_at::<u64>(&buf, &mut offset), u64::MAX);
assert_eq!(offset, 32);
let mut offset = offset_of!(TestStruct, e);
assert_eq!(offset, 32);
assert_eq!(read_value_at::<i32>(&buf, &mut offset), i32::MIN);
assert_eq!(offset, 36);
let mut offset = offset_of!(TestStruct, f);
assert_eq!(offset, 36);
assert_eq!(read_value_at::<u32>(&buf, &mut offset), u32::MAX);
assert_eq!(offset, 40);
let mut offset = offset_of!(TestStruct, g);
assert_eq!(offset, 40);
assert_eq!(read_value_at::<i16>(&buf, &mut offset), i16::MIN);
assert_eq!(offset, 42);
let mut offset = offset_of!(TestStruct, h);
assert_eq!(offset, 44);
assert_eq!(read_value_at::<u16>(&buf, &mut offset), u16::MAX);
assert_eq!(offset, 46);
let mut offset = offset_of!(TestStruct, i);
assert_eq!(offset, 48);
assert_eq!(read_value_at::<i8>(&buf, &mut offset), i8::MIN);
assert_eq!(offset, 49);
let mut offset = offset_of!(TestStruct, j);
assert_eq!(offset, 52);
assert_eq!(read_value_at::<u8>(&buf, &mut offset), u8::MAX);
assert_eq!(offset, 53);
}
}
#[test]
fn test_read_bounded_vec_at() {
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
struct TestStruct {
a: [i64; 32],
b: [u64; 32],
c: [[u8; 32]; 32],
}
let mut buf = vec![0_u8; mem::size_of::<TestStruct>()];
let s = buf.as_mut_ptr() as *mut TestStruct;
unsafe {
for (i, element) in (*s).a.iter_mut().enumerate() {
*element = -(i as i64);
}
for (i, element) in (*s).b.iter_mut().enumerate() {
*element = i as u64;
}
for (i, element) in (*s).c.iter_mut().enumerate() {
*element = [i as u8; 32];
}
let metadata = BoundedVecMetadata::new_with_length(32, 32);
let mut offset = offset_of!(TestStruct, a);
assert_eq!(offset, 0);
let vec: BoundedVec<i64> = read_bounded_vec_at(&buf, &mut offset, &metadata);
for (i, element) in vec.iter().enumerate() {
assert_eq!(i as i64, -(*element as i64));
}
assert_eq!(offset, 256);
let metadata = BoundedVecMetadata::new_with_length(32, 32);
let mut offset = offset_of!(TestStruct, b);
assert_eq!(offset, 256);
let vec: BoundedVec<u64> = read_bounded_vec_at(&buf, &mut offset, &metadata);
for (i, element) in vec.iter().enumerate() {
assert_eq!(i as u64, *element as u64);
}
assert_eq!(offset, 512);
let metadata = BoundedVecMetadata::new_with_length(32, 32);
let mut offset = offset_of!(TestStruct, c);
assert_eq!(offset, 512);
let vec: BoundedVec<[u8; 32]> = read_bounded_vec_at(&buf, &mut offset, &metadata);
for (i, element) in vec.iter().enumerate() {
assert_eq!(&[i as u8; 32], element);
}
assert_eq!(offset, 1536);
}
}
#[test]
fn test_read_cyclic_bounded_vec_at() {
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
struct TestStruct {
a: [i64; 32],
b: [u64; 32],
c: [[u8; 32]; 32],
}
let mut buf = vec![0_u8; mem::size_of::<TestStruct>()];
let s = buf.as_mut_ptr() as *mut TestStruct;
unsafe {
for (i, element) in (*s).a.iter_mut().enumerate() {
*element = -(i as i64);
}
for (i, element) in (*s).b.iter_mut().enumerate() {
*element = i as u64;
}
for (i, element) in (*s).c.iter_mut().enumerate() {
*element = [i as u8; 32];
}
// Start the cyclic vecs from the middle.
let metadata = CyclicBoundedVecMetadata::new_with_indices(32, 32, 14, 13);
let mut offset = offset_of!(TestStruct, a);
assert_eq!(offset, 0);
let vec: CyclicBoundedVec<i64> =
read_cyclic_bounded_vec_at(&buf, &mut offset, &metadata);
assert_eq!(vec.capacity(), 32);
assert_eq!(vec.len(), 32);
assert_eq!(vec.first_index(), 14);
assert_eq!(vec.last_index(), 13);
assert_eq!(
vec.iter().collect::<Vec<_>>().as_slice(),
&[
&-14, &-15, &-16, &-17, &-18, &-19, &-20, &-21, &-22, &-23, &-24, &-25, &-26,
&-27, &-28, &-29, &-30, &-31, &-0, &-1, &-2, &-3, &-4, &-5, &-6, &-7, &-8, &-9,
&-10, &-11, &-12, &-13
]
);
assert_eq!(offset, 256);
let metadata = CyclicBoundedVecMetadata::new_with_indices(32, 32, 14, 13);
let mut offset = offset_of!(TestStruct, b);
assert_eq!(offset, 256);
let vec: CyclicBoundedVec<u64> =
read_cyclic_bounded_vec_at(&buf, &mut offset, &metadata);
assert_eq!(vec.capacity(), 32);
assert_eq!(vec.len(), 32);
assert_eq!(vec.first_index(), 14);
assert_eq!(vec.last_index(), 13);
assert_eq!(
vec.iter().collect::<Vec<_>>().as_slice(),
&[
&14, &15, &16, &17, &18, &19, &20, &21, &22, &23, &24, &25, &26, &27, &28, &29,
&30, &31, &0, &1, &2, &3, &4, &5, &6, &7, &8, &9, &10, &11, &12, &13
]
);
assert_eq!(offset, 512);
let metadata = CyclicBoundedVecMetadata::new_with_indices(32, 32, 14, 13);
let mut offset = offset_of!(TestStruct, c);
assert_eq!(offset, 512);
let vec: CyclicBoundedVec<[u8; 32]> =
read_cyclic_bounded_vec_at(&buf, &mut offset, &metadata);
assert_eq!(vec.capacity(), 32);
assert_eq!(vec.len(), 32);
assert_eq!(vec.first_index(), 14);
assert_eq!(vec.last_index(), 13);
assert_eq!(
vec.iter().collect::<Vec<_>>().as_slice(),
&[
&[14_u8; 32],
&[15_u8; 32],
&[16_u8; 32],
&[17_u8; 32],
&[18_u8; 32],
&[19_u8; 32],
&[20_u8; 32],
&[21_u8; 32],
&[22_u8; 32],
&[23_u8; 32],
&[24_u8; 32],
&[25_u8; 32],
&[26_u8; 32],
&[27_u8; 32],
&[28_u8; 32],
&[29_u8; 32],
&[30_u8; 32],
&[31_u8; 32],
&[0_u8; 32],
&[1_u8; 32],
&[2_u8; 32],
&[3_u8; 32],
&[4_u8; 32],
&[5_u8; 32],
&[6_u8; 32],
&[7_u8; 32],
&[8_u8; 32],
&[9_u8; 32],
&[10_u8; 32],
&[11_u8; 32],
&[12_u8; 32],
&[13_u8; 32],
]
);
assert_eq!(offset, 1536);
}
}
#[test]
fn test_read_cyclic_bounded_vec_first_last() {
let mut vec = CyclicBoundedVec::<u32>::with_capacity(2);
vec.push(0);
vec.push(37);
vec.push(49);
let metadata_bytes = vec.metadata().to_le_bytes();
let metadata = CyclicBoundedVecMetadata::from_le_bytes(metadata_bytes);
let bytes = unsafe {
slice::from_raw_parts(
vec.as_mut_ptr() as *mut u8,
mem::size_of::<u32>() * vec.capacity(),
)
};
let mut offset = 0;
let vec_copy: CyclicBoundedVec<u32> =
unsafe { read_cyclic_bounded_vec_at(bytes, &mut offset, &metadata) };
assert_eq!(*vec.first().unwrap(), 37);
assert_eq!(vec.first(), vec_copy.first()); // Fails. Both should be 37
assert_eq!(*vec.last().unwrap(), 49);
assert_eq!(vec.last(), vec_copy.last()); // Fails. Both should be 49
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils/src
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/offset/zero_copy.rs
|
use std::mem;
/// Casts a part of provided `bytes` buffer with the given `offset` to a
/// mutable pointer to `T`.
///
/// Should be used for single values.
///
/// # Safety
///
/// This is higly unsafe. This function doesn't ensure alignment and
/// correctness of provided buffer. The responsibility of such checks is on
/// the caller.
pub unsafe fn read_ptr_at<T>(bytes: &[u8], offset: &mut usize) -> *mut T {
let size = mem::size_of::<T>();
let ptr = bytes[*offset..*offset + size].as_ptr() as *mut T;
*offset += size;
ptr
}
/// Casts a part of provided `bytes` buffer with the given `offset` to a
/// mutable pointer to `T`.
///
/// Should be used for array-type sequences.
///
/// # Safety
///
/// This is higly unsafe. This function doesn't ensure alignment and
/// correctness of provided buffer. The responsibility of such checks is on
/// the caller.
pub unsafe fn read_array_like_ptr_at<T>(bytes: &[u8], offset: &mut usize, len: usize) -> *mut T {
let size = mem::size_of::<T>() * len;
let ptr = bytes[*offset..*offset + size].as_ptr() as *mut T;
*offset += size;
ptr
}
/// Writes provided `data` into provided `bytes` buffer with the given
/// `offset`.
pub fn write_at<T>(bytes: &mut [u8], data: &[u8], offset: &mut usize) {
let size = mem::size_of::<T>();
bytes[*offset..*offset + size].copy_from_slice(data);
*offset += size;
}
#[cfg(test)]
mod test {
use super::*;
use bytemuck::{Pod, Zeroable};
use memoffset::offset_of;
#[test]
fn test_read_ptr_at() {
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
struct TestStruct {
a: isize,
b: usize,
c: i64,
d: u64,
e: i32,
f: u32,
g: i16,
_padding_1: [u8; 2],
h: u16,
_padding_2: [u8; 2],
i: i8,
_padding_3: [i8; 3],
j: u8,
_padding_4: [i8; 3],
}
let mut buf = vec![0_u8; mem::size_of::<TestStruct>()];
let s = buf.as_mut_ptr() as *mut TestStruct;
unsafe {
(*s).a = isize::MIN;
(*s).b = usize::MAX;
(*s).c = i64::MIN;
(*s).d = u64::MAX;
(*s).e = i32::MIN;
(*s).f = u32::MAX;
(*s).g = i16::MIN;
(*s).h = u16::MAX;
(*s).i = i8::MIN;
(*s).j = u8::MAX;
let mut offset = offset_of!(TestStruct, a);
assert_eq!(offset, 0);
assert_eq!(*read_ptr_at::<isize>(&buf, &mut offset), isize::MIN);
assert_eq!(offset, 8);
let mut offset = offset_of!(TestStruct, b);
assert_eq!(offset, 8);
assert_eq!(*read_ptr_at::<usize>(&buf, &mut offset), usize::MAX);
assert_eq!(offset, 16);
let mut offset = offset_of!(TestStruct, c);
assert_eq!(offset, 16);
assert_eq!(*read_ptr_at::<i64>(&buf, &mut offset), i64::MIN);
assert_eq!(offset, 24);
let mut offset = offset_of!(TestStruct, d);
assert_eq!(offset, 24);
assert_eq!(*read_ptr_at::<u64>(&buf, &mut offset), u64::MAX);
assert_eq!(offset, 32);
let mut offset = offset_of!(TestStruct, e);
assert_eq!(offset, 32);
assert_eq!(*read_ptr_at::<i32>(&buf, &mut offset), i32::MIN);
assert_eq!(offset, 36);
let mut offset = offset_of!(TestStruct, f);
assert_eq!(offset, 36);
assert_eq!(*read_ptr_at::<u32>(&buf, &mut offset), u32::MAX);
assert_eq!(offset, 40);
let mut offset = offset_of!(TestStruct, g);
assert_eq!(offset, 40);
assert_eq!(*read_ptr_at::<i16>(&buf, &mut offset), i16::MIN);
assert_eq!(offset, 42);
let mut offset = offset_of!(TestStruct, h);
assert_eq!(offset, 44);
assert_eq!(*read_ptr_at::<u16>(&buf, &mut offset), u16::MAX);
assert_eq!(offset, 46);
let mut offset = offset_of!(TestStruct, i);
assert_eq!(offset, 48);
assert_eq!(*read_ptr_at::<i8>(&buf, &mut offset), i8::MIN);
assert_eq!(offset, 49);
let mut offset = offset_of!(TestStruct, j);
assert_eq!(offset, 52);
assert_eq!(*read_ptr_at::<u8>(&buf, &mut offset), u8::MAX);
assert_eq!(offset, 53);
}
}
#[test]
fn test_read_array_like_ptr_at() {
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
struct TestStruct {
a: [i64; 32],
b: [u64; 32],
}
let mut buf = vec![0_u8; mem::size_of::<TestStruct>()];
let s = buf.as_mut_ptr() as *mut TestStruct;
unsafe {
for (i, element) in (*s).a.iter_mut().enumerate() {
*element = -(i as i64);
}
for (i, element) in (*s).b.iter_mut().enumerate() {
*element = i as u64;
}
let mut offset = offset_of!(TestStruct, a);
assert_eq!(offset, 0);
let ptr: *mut i64 = read_array_like_ptr_at(&buf, &mut offset, 32);
for i in 0..32 {
assert_eq!(*(ptr.add(i)), -(i as i64));
}
assert_eq!(offset, 256);
let mut offset = offset_of!(TestStruct, b);
assert_eq!(offset, 256);
let ptr: *mut u64 = read_array_like_ptr_at(&buf, &mut offset, 32);
for i in 0..32 {
assert_eq!(*(ptr.add(i)), i as u64);
}
assert_eq!(offset, 512);
}
}
#[test]
fn test_write_at() {
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
struct TestStruct {
a: isize,
b: usize,
c: i64,
d: u64,
e: i32,
f: u32,
g: i16,
_padding_1: [u8; 2],
h: u16,
_padding_2: [u8; 2],
i: i8,
_padding_3: [i8; 3],
j: u8,
_padding_4: [i8; 3],
}
let mut buf = vec![0_u8; mem::size_of::<TestStruct>()];
let a: isize = isize::MIN;
let b: usize = usize::MAX;
let c: i64 = i64::MIN;
let d: u64 = u64::MAX;
let e: i32 = i32::MIN;
let f: u32 = u32::MAX;
let g: i16 = i16::MIN;
let h: u16 = u16::MAX;
let i: i8 = i8::MIN;
let j: u8 = u8::MAX;
let mut offset = offset_of!(TestStruct, a);
assert_eq!(offset, 0);
write_at::<isize>(&mut buf, &a.to_le_bytes(), &mut offset);
assert_eq!(offset, 8);
let mut offset = offset_of!(TestStruct, b);
assert_eq!(offset, 8);
write_at::<usize>(&mut buf, &b.to_le_bytes(), &mut offset);
assert_eq!(offset, 16);
let mut offset = offset_of!(TestStruct, c);
assert_eq!(offset, 16);
write_at::<i64>(&mut buf, &c.to_le_bytes(), &mut offset);
assert_eq!(offset, 24);
let mut offset = offset_of!(TestStruct, d);
assert_eq!(offset, 24);
write_at::<u64>(&mut buf, &d.to_le_bytes(), &mut offset);
assert_eq!(offset, 32);
let mut offset = offset_of!(TestStruct, e);
assert_eq!(offset, 32);
write_at::<i32>(&mut buf, &e.to_le_bytes(), &mut offset);
assert_eq!(offset, 36);
let mut offset = offset_of!(TestStruct, f);
assert_eq!(offset, 36);
write_at::<u32>(&mut buf, &f.to_le_bytes(), &mut offset);
assert_eq!(offset, 40);
let mut offset = offset_of!(TestStruct, g);
assert_eq!(offset, 40);
write_at::<i16>(&mut buf, &g.to_le_bytes(), &mut offset);
assert_eq!(offset, 42);
let mut offset = offset_of!(TestStruct, h);
assert_eq!(offset, 44);
write_at::<u16>(&mut buf, &h.to_le_bytes(), &mut offset);
assert_eq!(offset, 46);
let mut offset = offset_of!(TestStruct, i);
assert_eq!(offset, 48);
write_at::<i8>(&mut buf, &i.to_le_bytes(), &mut offset);
assert_eq!(offset, 49);
let mut offset = offset_of!(TestStruct, j);
assert_eq!(offset, 52);
write_at::<u8>(&mut buf, &j.to_le_bytes(), &mut offset);
assert_eq!(offset, 53);
let s = buf.as_mut_ptr() as *mut TestStruct;
unsafe {
assert_eq!((*s).a, a);
assert_eq!((*s).b, b);
assert_eq!((*s).c, c);
assert_eq!((*s).d, d);
assert_eq!((*s).e, e);
assert_eq!((*s).f, f);
assert_eq!((*s).g, g);
assert_eq!((*s).h, h);
assert_eq!((*s).i, i);
assert_eq!((*s).j, j);
}
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/utils/src
|
solana_public_repos/Lightprotocol/light-protocol/utils/src/offset/mod.rs
|
pub mod copy;
pub mod zero_copy;
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/Cargo.toml
|
[package]
name = "light-prover-client"
version = "1.2.0"
description = "Crate for interacting with Light Protocol circuits"
repository = "https://github.com/Lightprotocol/light-protocol"
license = "Apache-2.0"
edition = "2021"
[features]
gnark = ["tokio", "reqwest"]
default = ["gnark", "devenv"]
devenv = []
[dependencies]
# light local deps
light-merkle-tree-reference = { path = "../../merkle-tree/reference", version = "1.1.0" }
light-hasher = { path = "../../merkle-tree/hasher", version = "1.1.0" }
light-indexed-merkle-tree = { path = "../../merkle-tree/indexed", version = "1.1.0" }
light-concurrent-merkle-tree = { path = "../../merkle-tree/concurrent", version = "1.1.0" }
light-bounded-vec = { path = "../../merkle-tree/bounded-vec", version = "1.1.0" }
light-utils = { path = "../../utils", version = "1.1.0" }
# ark dependencies
ark-serialize = "0.4.2"
ark-ec = "0.5.0"
ark-ff = "0.4.2"
ark-relations = "0.4"
ark-bn254 = { version = "0.4" }
ark-std = { version = "0.4", default-features = false, features = ["parallel"] }
ark-groth16 = { version = "0.4", default-features = false, features = ["parallel"] }
ark-crypto-primitives = { version = "0.4" }
bytemuck = "1.17.0"
# solana
groth16-solana = "0.0.3"
solana-program = { workspace = true }
num-bigint = { version = "0.4.6", features = ["serde"] }
once_cell = "1.8"
thiserror = "1.0"
color-eyre = "=0.6.3"
log = "0.4"
env_logger = "0.11.2"
# 1.3.0 required by package `aes-gcm-siv v0.10.3`
zeroize = "=1.3.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.133"
num-traits = "0.2.19"
tokio = { workspace = true, optional = true }
reqwest = { version = "0.11.24", features = ["json", "rustls-tls"], optional = true }
sysinfo = "0.33"
borsh = ">=0.9, <0.11"
[dev-dependencies]
duct = "0.13.7"
serial_test = "3.2.0"
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/tests/gnark.rs
|
use light_hasher::{Hasher, Poseidon};
use light_merkle_tree_reference::MerkleTree;
use light_prover_client::batch_append_with_proofs::get_batch_append_with_proofs_inputs;
use light_prover_client::batch_append_with_subtrees::{
calculate_hash_chain, get_batch_append_with_subtrees_inputs,
};
use light_prover_client::batch_update::get_batch_update_inputs;
use light_prover_client::gnark::batch_append_with_proofs_json_formatter::BatchAppendWithProofsInputsJson;
use light_prover_client::gnark::batch_append_with_subtrees_json_formatter::append_inputs_string;
use light_prover_client::gnark::batch_update_json_formatter::update_inputs_string;
use light_prover_client::{
batch_address_append::{
get_batch_address_append_inputs_from_tree, get_test_batch_address_append_inputs,
},
gnark::batch_address_append_json_formatter::to_json,
};
use light_prover_client::gnark::helpers::{spawn_prover, ProofType, ProverConfig};
use light_prover_client::{
gnark::{
constants::{PROVE_PATH, SERVER_ADDRESS},
inclusion_json_formatter::inclusion_inputs_string,
},
helpers::init_logger,
};
use light_utils::bigint::bigint_to_be_bytes_array;
use log::info;
use num_bigint::ToBigUint;
use reqwest::Client;
use serial_test::serial;
#[tokio::test]
#[ignore]
async fn prove_inclusion_full() {
init_logger();
spawn_prover(
false,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::Inclusion, { ProofType::BatchUpdateTest }],
},
)
.await;
let client = Client::new();
for number_of_utxos in &[1, 2, 3, 4, 8] {
let (inputs, _) = inclusion_inputs_string(*number_of_utxos as usize);
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs)
.send()
.await
.expect("Failed to execute request.");
assert!(response_result.status().is_success());
}
}
#[serial]
#[tokio::test]
async fn prove_inclusion() {
init_logger();
spawn_prover(
true,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::Inclusion],
},
)
.await;
let client = Client::new();
let (inputs, _) = inclusion_inputs_string(1);
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs)
.send()
.await
.expect("Failed to execute request.");
assert!(response_result.status().is_success());
}
#[serial]
#[tokio::test]
async fn prove_batch_update() {
init_logger();
spawn_prover(
true,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::BatchUpdateTest],
},
)
.await;
const HEIGHT: usize = 26;
const CANOPY: usize = 0;
let num_insertions = 10;
let tx_hash = [0u8; 32];
info!("initializing merkle tree");
let mut merkle_tree = MerkleTree::<Poseidon>::new(HEIGHT, CANOPY);
for _ in 0..2 {
let mut leaves = vec![];
let mut old_leaves = vec![];
let mut nullifiers = vec![];
for i in 0..num_insertions {
let mut bn: [u8; 32] = [0; 32];
bn[31] = i as u8;
let leaf: [u8; 32] = Poseidon::hash(&bn).unwrap();
leaves.push(leaf);
old_leaves.push(leaf);
merkle_tree.append(&leaf).unwrap();
let nullifier =
Poseidon::hashv(&[&leaf, &(i as usize).to_be_bytes(), &tx_hash]).unwrap();
nullifiers.push(nullifier);
}
let mut merkle_proofs = vec![];
let mut path_indices = vec![];
for index in 0..leaves.len() {
let proof = merkle_tree.get_proof_of_leaf(index, true).unwrap();
merkle_proofs.push(proof.to_vec());
path_indices.push(index as u32);
}
let root = merkle_tree.root();
let leaves_hashchain = calculate_hash_chain(&nullifiers);
let inputs = get_batch_update_inputs::<HEIGHT>(
root,
vec![tx_hash; num_insertions],
leaves,
leaves_hashchain,
old_leaves,
merkle_proofs,
path_indices,
num_insertions as u32,
);
let client = Client::new();
let inputs = update_inputs_string(&inputs);
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs)
.send()
.await
.expect("Failed to execute request.");
let status = response_result.status();
let body = response_result.text().await.unwrap();
assert!(
status.is_success(),
"Batch append proof generation failed. Status: {}, Body: {}",
status,
body
);
}
}
#[serial]
#[tokio::test]
async fn prove_batch_append() {
init_logger();
println!("spawning prover");
spawn_prover(
true,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::BatchAppendWithSubtreesTest],
},
)
.await;
println!("prover spawned");
const HEIGHT: usize = 26;
const CANOPY: usize = 0;
let num_insertions = 10;
// Do multiple rounds of batch appends
for _ in 0..2 {
info!("initializing merkle tree for append.");
let merkle_tree = MerkleTree::<Poseidon>::new(HEIGHT, CANOPY);
let old_subtrees = merkle_tree.get_subtrees();
let mut leaves = vec![];
// Create leaves for this batch append
for i in 0..num_insertions {
let mut bn: [u8; 32] = [0; 32];
bn[31] = i as u8;
let leaf: [u8; 32] = Poseidon::hash(&bn).unwrap();
leaves.push(leaf);
}
let leaves_hashchain = calculate_hash_chain(&leaves);
// Generate inputs for batch append operation
let inputs = get_batch_append_with_subtrees_inputs::<HEIGHT>(
merkle_tree.layers[0].len(),
old_subtrees.try_into().unwrap(),
leaves,
leaves_hashchain,
);
// Send proof request to the server
let client = Client::new();
let inputs = append_inputs_string(&inputs);
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs)
.send()
.await
.expect("Failed to execute request.");
let status = response_result.status();
let body = response_result.text().await.unwrap();
assert!(
status.is_success(),
"Batch append proof generation failed. Status: {}, Body: {}",
status,
body
);
}
}
#[serial]
#[tokio::test]
async fn prove_batch_two_append() {
init_logger();
// Spawn the prover with specific configuration
spawn_prover(
true,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::BatchAppendWithProofsTest],
},
)
.await;
const HEIGHT: usize = 26;
const CANOPY: usize = 0;
let num_insertions = 10;
info!("Initializing Merkle tree for append.");
let mut merkle_tree = MerkleTree::<Poseidon>::new(HEIGHT, CANOPY);
let mut current_index = 0;
for i in 0..2 {
let mut leaves = vec![];
let mut old_leaves = vec![];
// Create leaves and append them to the Merkle tree
for i in 0..num_insertions {
let mut bn: [u8; 32] = [0; 32];
bn[31] = i as u8;
let leaf: [u8; 32] = Poseidon::hash(&bn).unwrap();
// assuming old leaves are all zero (not nullified)
leaves.push(leaf);
// Append nullifier or ero value
if i % 2 == 0 {
let nullifier = Poseidon::hashv(&[&leaf, &[0u8; 32]]).unwrap();
merkle_tree.append(&nullifier).unwrap();
} else {
merkle_tree.append(&[0u8; 32]).unwrap();
}
}
// Generate Merkle proofs and prepare path indices
let mut merkle_proofs = vec![];
for index in current_index..current_index + num_insertions {
let proof = merkle_tree.get_proof_of_leaf(index, true).unwrap();
let leaf = merkle_tree.get_leaf(index);
old_leaves.push(leaf);
merkle_proofs.push(proof.to_vec());
}
// Retrieve tree root and compute leaves hash chain
let root = merkle_tree.root();
let leaves_hashchain = calculate_hash_chain(&leaves);
// Generate inputs for BatchAppendWithProofsCircuit
let inputs = get_batch_append_with_proofs_inputs::<HEIGHT>(
root,
(i * num_insertions) as u32,
leaves.clone(),
leaves_hashchain,
old_leaves.clone(),
merkle_proofs.clone(),
num_insertions as u32,
);
// Serialize inputs to JSON
let client = Client::new();
let inputs_json = BatchAppendWithProofsInputsJson::from_inputs(&inputs).to_string();
// Send proof request to server
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs_json)
.send()
.await
.expect("Failed to execute request.");
let status = response_result.status();
let body = response_result.text().await.unwrap();
assert!(
status.is_success(),
"Batch append proof generation failed. Status: {}, Body: {}",
status,
body
);
current_index += num_insertions;
}
}
#[test]
pub fn print_circuit_test_data_json_formatted() {
let addresses = vec![31_u32.to_biguint().unwrap(), 30_u32.to_biguint().unwrap()];
let start_index = 2;
let tree_height = 4;
let inputs = get_test_batch_address_append_inputs(addresses, start_index, tree_height);
let json_output = to_json(&inputs);
println!("{}", json_output);
}
#[test]
pub fn print_circuit_test_data_with_existing_tree() {
use light_hasher::Poseidon;
use light_indexed_merkle_tree::{array::IndexedArray, reference::IndexedMerkleTree};
const TREE_HEIGHT: usize = 4;
let new_element_values = vec![31_u32.to_biguint().unwrap(), 30_u32.to_biguint().unwrap()];
let mut relayer_indexing_array = IndexedArray::<Poseidon, usize>::default();
relayer_indexing_array.init().unwrap();
let mut relayer_merkle_tree =
IndexedMerkleTree::<Poseidon, usize>::new(TREE_HEIGHT, 0).unwrap();
relayer_merkle_tree.init().unwrap();
let start_index = relayer_merkle_tree.merkle_tree.rightmost_index;
let current_root = relayer_merkle_tree.root();
let mut low_element_values = Vec::new();
let mut low_element_indices = Vec::new();
let mut low_element_next_indices = Vec::new();
let mut low_element_next_values = Vec::new();
let mut low_element_proofs: Vec<Vec<[u8; 32]>> = Vec::new();
for new_element_value in &new_element_values {
let non_inclusion_proof = relayer_merkle_tree
.get_non_inclusion_proof(new_element_value, &relayer_indexing_array)
.unwrap();
low_element_values.push(non_inclusion_proof.leaf_lower_range_value);
low_element_indices.push(non_inclusion_proof.leaf_index);
low_element_next_indices.push(non_inclusion_proof.next_index);
low_element_next_values.push(non_inclusion_proof.leaf_higher_range_value);
low_element_proofs.push(non_inclusion_proof.merkle_proof.as_slice().to_vec());
}
let new_element_values = new_element_values
.iter()
.map(|v| bigint_to_be_bytes_array::<32>(&v).unwrap())
.collect();
let inputs = get_batch_address_append_inputs_from_tree::<TREE_HEIGHT>(
start_index,
current_root,
low_element_values,
low_element_next_values,
low_element_indices,
low_element_next_indices,
low_element_proofs,
new_element_values,
relayer_merkle_tree
.merkle_tree
.get_subtrees()
.try_into()
.unwrap(),
);
let json_output = to_json(&inputs);
let reference_output = r#"{
"BatchSize": 2,
"HashchainHash": "0x1e94e9fed8440d50ff872bedcc6a6c460f9c6688ac167f68e288057e63109410",
"LowElementIndices": [
"0x0",
"0x0"
],
"LowElementNextIndices": [
"0x1",
"0x2"
],
"LowElementNextValues": [
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"0x1f"
],
"LowElementProofs": [
[
"0x1ea416eeb40218b540c1cfb8dbe91f6d54e8a29edc30a39e326b4057a7d963f5",
"0x2098f5fb9e239eab3ceac3f27b81e481dc3124d55ffed523a839ee8446b64864",
"0x1069673dcdb12263df301a6ff584a7ec261a44cb9dc68df067a4774460b1f1e1",
"0x18f43331537ee2af2e3d758d50f72106467c6eea50371dd528d57eb2b856d238"
],
[
"0x1ea416eeb40218b540c1cfb8dbe91f6d54e8a29edc30a39e326b4057a7d963f5",
"0x864f3eb12bb83a5cdc9ff6fdc8b985aa4b87292c5eef49201065277170e8c51",
"0x1069673dcdb12263df301a6ff584a7ec261a44cb9dc68df067a4774460b1f1e1",
"0x18f43331537ee2af2e3d758d50f72106467c6eea50371dd528d57eb2b856d238"
]
],
"LowElementValues": [
"0x0",
"0x0"
],
"NewElementProofs": [
[
"0x0",
"0x2cfd59ee6c304f7f1e82d9e7e857a380e991fb02728f09324baffef2807e74fa",
"0x1069673dcdb12263df301a6ff584a7ec261a44cb9dc68df067a4774460b1f1e1",
"0x18f43331537ee2af2e3d758d50f72106467c6eea50371dd528d57eb2b856d238"
],
[
"0x29794d28dddbdb020ec3974ecc41bcf64fb695eb222bde71f2a130e92852c0eb",
"0x15920e98b921491171b9b2b0a8ac1545e10b58e9c058822b6de9f4179bbd2e7c",
"0x1069673dcdb12263df301a6ff584a7ec261a44cb9dc68df067a4774460b1f1e1",
"0x18f43331537ee2af2e3d758d50f72106467c6eea50371dd528d57eb2b856d238"
]
],
"NewElementValues": [
"0x1f",
"0x1e"
],
"NewRoot": "0x2a62d5241a6d3659df612b996ad729abe32f425bfec249f060983013ba2cfdb8",
"OldRoot": "0x909e8762fb09c626001b19f6441a2cd2da21b1622c6970ec9c4863ec9c09855",
"PublicInputHash": "0x31a64ce5adc664d1092fd7353a76b4fe0a3e63ad0cf313d66a6bc89e5e4a840",
"StartIndex": 2,
"TreeHeight": 4
}"#;
println!("{}", json_output);
assert_eq!(json_output, reference_output);
}
#[serial]
#[tokio::test]
async fn prove_batch_address_append() {
use light_hasher::Poseidon;
use light_indexed_merkle_tree::{array::IndexedArray, reference::IndexedMerkleTree};
init_logger();
// Spawn the prover with specific configuration
spawn_prover(
true,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::BatchAddressAppendTest],
},
)
.await;
const TREE_HEIGHT: usize = 26;
// Initialize test data
let new_element_values = vec![31_u32.to_biguint().unwrap()];
// Initialize indexing structures
let mut relayer_indexing_array = IndexedArray::<Poseidon, usize>::default();
relayer_indexing_array.init().unwrap();
let mut relayer_merkle_tree =
IndexedMerkleTree::<Poseidon, usize>::new(TREE_HEIGHT, 0).unwrap();
relayer_merkle_tree.init().unwrap();
let start_index = relayer_merkle_tree.merkle_tree.rightmost_index;
let current_root = relayer_merkle_tree.root();
// Prepare proof components
let mut low_element_values = Vec::new();
let mut low_element_indices = Vec::new();
let mut low_element_next_indices = Vec::new();
let mut low_element_next_values = Vec::new();
let mut low_element_proofs: Vec<Vec<[u8; 32]>> = Vec::new();
// Generate non-inclusion proofs for each element
for new_element_value in &new_element_values {
let non_inclusion_proof = relayer_merkle_tree
.get_non_inclusion_proof(new_element_value, &relayer_indexing_array)
.unwrap();
low_element_values.push(non_inclusion_proof.leaf_lower_range_value);
low_element_indices.push(non_inclusion_proof.leaf_index);
low_element_next_indices.push(non_inclusion_proof.next_index);
low_element_next_values.push(non_inclusion_proof.leaf_higher_range_value);
low_element_proofs.push(non_inclusion_proof.merkle_proof.as_slice().to_vec());
}
// Convert big integers to byte arrays
let new_element_values = new_element_values
.iter()
.map(|v| bigint_to_be_bytes_array::<32>(v).unwrap())
.collect();
// Generate circuit inputs
let inputs = get_batch_address_append_inputs_from_tree::<TREE_HEIGHT>(
start_index,
current_root,
low_element_values,
low_element_next_values,
low_element_indices,
low_element_next_indices,
low_element_proofs,
new_element_values,
relayer_merkle_tree
.merkle_tree
.get_subtrees()
.try_into()
.unwrap(),
);
// Convert inputs to JSON format
let inputs_json = to_json(&inputs);
// Send proof request to server
let client = Client::new();
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs_json)
.send()
.await
.expect("Failed to execute request.");
// Verify response
let status = response_result.status();
let body = response_result.text().await.unwrap();
assert!(
status.is_success(),
"Batch address append proof generation failed. Status: {}, Body: {}",
status,
body
);
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/scripts/rapidsnark_bench.sh
|
#!/bin/bash
LOG_FILE="execution_times.log"
echo "Benchmarking started..." >> $LOG_FILE
for ((i=1; i<10; i++))
do
echo "Running iteration $i"
work_dir="test-data/merkle22_$i"
start_time=$(date +%s%6N)
prover "$work_dir/circuit.zkey" "$work_dir/22_$i.wtns" "$work_dir/proof_merkle22_$i.json" "$work_dir/public_inputs_merkle22_$i.json"
sleep 1
end_time=$(date +%s%6N)
execution_time=$(echo "scale=3; ($end_time - $start_time) / 1000 - 1000" | bc)
echo "Iteration $i took $execution_time milliseconds" >> $LOG_FILE
done
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/prove_utils.rs
|
use groth16_solana::decompression::{decompress_g1, decompress_g2};
use crate::errors::CircuitsError;
pub struct ProofResult {
pub proof: ProofCompressed,
pub public_inputs: Vec<[u8; 32]>,
}
#[derive(Debug)]
pub struct ProofCompressed {
pub a: [u8; 32],
pub b: [u8; 64],
pub c: [u8; 32],
}
impl ProofCompressed {
pub fn try_decompress(&self) -> Result<Proof, CircuitsError> {
let proof_a = decompress_g1(&self.a)?;
let proof_b = decompress_g2(&self.b)?;
let proof_c = decompress_g1(&self.c)?;
Ok(Proof {
a: proof_a,
b: proof_b,
c: proof_c,
})
}
}
pub struct Proof {
pub a: [u8; 64],
pub b: [u8; 128],
pub c: [u8; 64],
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/mock_batched_forester.rs
|
use std::fmt::Error;
use light_hasher::{Hasher, Poseidon};
use light_merkle_tree_reference::MerkleTree;
use light_utils::bigint::bigint_to_be_bytes_array;
use reqwest::Client;
use crate::{
batch_append::calculate_hash_chain,
batch_append_2::get_batch_append2_inputs,
batch_update::get_batch_update_inputs,
gnark::{
batch_append_2_json_formatter::BatchAppend2ProofInputsJson,
batch_update_json_formatter::update_inputs_string,
constants::{PROVE_PATH, SERVER_ADDRESS},
proof_helpers::{compress_proof, deserialize_gnark_proof_json, proof_from_json_struct},
},
};
// TODO: rename to MockBatchedForester
pub struct MockBatchedForester<const HEIGHT: usize> {
pub merkle_tree: MerkleTree<Poseidon>,
pub input_queue_leaves: Vec<[u8; 32]>,
/// Indices of leaves which in merkle tree which are active.
pub output_queue_leaves: Vec<[u8; 32]>,
pub active_leaves: Vec<[u8; 32]>,
pub tx_events: Vec<MockTxEvent>,
}
#[derive(Debug, Clone)]
pub struct MockTxEvent {
pub tx_hash: [u8; 32],
pub inputs: Vec<[u8; 32]>,
pub outputs: Vec<[u8; 32]>,
}
impl<const HEIGHT: usize> Default for MockBatchedForester<HEIGHT> {
fn default() -> Self {
let merkle_tree = MerkleTree::<Poseidon>::new(HEIGHT, 0);
let input_queue_leaves = vec![];
Self {
merkle_tree,
input_queue_leaves,
output_queue_leaves: vec![],
active_leaves: vec![],
tx_events: vec![],
}
}
}
impl<const HEIGHT: usize> MockBatchedForester<HEIGHT> {
pub async fn get_batched_append_proof(
&mut self,
account_next_index: usize,
leaves: Vec<[u8; 32]>,
num_zkp_updates: u32,
batch_size: u32,
) -> Result<(CompressedProof, [u8; 32]), Error> {
let start = num_zkp_updates as usize * batch_size as usize;
let end = start + batch_size as usize;
let leaves = leaves[start..end].to_vec();
// let sub_trees = self.merkle_tree.get_subtrees().try_into().unwrap();
let local_leaves_hashchain = calculate_hash_chain(&leaves);
let old_root = self.merkle_tree.root();
let start_index = self.merkle_tree.get_next_index().saturating_sub(1);
let mut old_leaves = vec![];
let mut merkle_proofs = vec![];
for i in account_next_index..account_next_index + batch_size as usize {
if account_next_index > i {
} else {
self.merkle_tree.append(&[0u8; 32]).unwrap();
}
let old_leaf = self.merkle_tree.get_leaf(i).unwrap();
old_leaves.push(old_leaf);
let proof = self.merkle_tree.get_proof_of_leaf(i, true).unwrap();
merkle_proofs.push(proof.to_vec());
}
// Insert new leaves into the merkle tree. Every leaf which is not [0u8;
// 32] has already been nullified hence shouldn't be updated.
for (i, leaf) in leaves.iter().enumerate() {
if old_leaves[i] == [0u8; 32] {
let index = account_next_index + i;
self.merkle_tree.update(&leaf, index).unwrap();
}
}
let circuit_inputs = get_batch_append2_inputs::<HEIGHT>(
old_root,
start_index as u32,
leaves,
local_leaves_hashchain,
old_leaves,
merkle_proofs,
batch_size,
);
assert_eq!(
bigint_to_be_bytes_array::<32>(&circuit_inputs.new_root.to_biguint().unwrap()).unwrap(),
self.merkle_tree.root()
);
let client = Client::new();
let inputs_json = BatchAppend2ProofInputsJson::from_inputs(&circuit_inputs).to_string();
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs_json)
.send()
.await
.expect("Failed to execute request.");
if response_result.status().is_success() {
let body = response_result.text().await.unwrap();
let proof_json = deserialize_gnark_proof_json(&body).unwrap();
let (proof_a, proof_b, proof_c) = proof_from_json_struct(proof_json);
let (proof_a, proof_b, proof_c) = compress_proof(&proof_a, &proof_b, &proof_c);
return Ok((
CompressedProof {
a: proof_a,
b: proof_b,
c: proof_c,
},
bigint_to_be_bytes_array::<32>(&circuit_inputs.new_root.to_biguint().unwrap())
.unwrap(),
));
}
Err(Error)
}
pub async fn get_batched_update_proof(
&mut self,
batch_size: u32,
leaves_hashchain: [u8; 32],
) -> Result<(CompressedProof, [u8; 32]), Error> {
let mut merkle_proofs = vec![];
let mut path_indices = vec![];
let leaves = self.input_queue_leaves[..batch_size as usize].to_vec();
let old_root = self.merkle_tree.root();
let mut nullifiers = Vec::new();
let mut tx_hashes = Vec::new();
let mut old_leaves = Vec::new();
for leaf in leaves.iter() {
let index = self.merkle_tree.get_leaf_index(leaf).unwrap();
if self.merkle_tree.get_next_index() <= index {
old_leaves.push([0u8; 32]);
} else {
old_leaves.push(leaf.clone());
}
// Handle case that we nullify a leaf which has not been inserted yet.
while self.merkle_tree.get_next_index() <= index {
self.merkle_tree.append(&[0u8; 32]).unwrap();
}
let proof = self.merkle_tree.get_proof_of_leaf(index, true).unwrap();
merkle_proofs.push(proof.to_vec());
path_indices.push(index as u32);
self.input_queue_leaves.remove(0);
let event = self
.tx_events
.iter()
.find(|tx_event| tx_event.inputs.contains(leaf))
.expect("No event for leaf found.");
let index_bytes = index.to_be_bytes();
let nullifier = Poseidon::hashv(&[leaf, &index_bytes, &event.tx_hash]).unwrap();
println!("leaf: {:?}", leaf);
println!("index: {:?}", index);
println!("index_bytes: {:?}", index_bytes);
println!("tx_hash: {:?}", event.tx_hash);
println!("nullifier: {:?}", nullifier);
tx_hashes.push(event.tx_hash);
nullifiers.push(nullifier);
self.merkle_tree.update(&nullifier, index).unwrap();
}
// local_leaves_hashchain is only used for a test assertion.
let local_nullifier_hashchain = calculate_hash_chain(&nullifiers);
assert_eq!(leaves_hashchain, local_nullifier_hashchain);
// TODO: adapt update circuit to allow for non-zero updates
let inputs = get_batch_update_inputs::<HEIGHT>(
old_root,
tx_hashes,
leaves,
leaves_hashchain,
old_leaves,
merkle_proofs,
path_indices,
batch_size,
);
let client = Client::new();
let circuit_inputs_new_root =
bigint_to_be_bytes_array::<32>(&inputs.new_root.to_biguint().unwrap()).unwrap();
let inputs = update_inputs_string(&inputs);
let new_root = self.merkle_tree.root();
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs)
.send()
.await
.expect("Failed to execute request.");
assert_eq!(circuit_inputs_new_root, new_root);
if response_result.status().is_success() {
let body = response_result.text().await.unwrap();
let proof_json = deserialize_gnark_proof_json(&body).unwrap();
let (proof_a, proof_b, proof_c) = proof_from_json_struct(proof_json);
let (proof_a, proof_b, proof_c) = compress_proof(&proof_a, &proof_b, &proof_c);
return Ok((
CompressedProof {
a: proof_a,
b: proof_b,
c: proof_c,
},
new_root,
));
}
Err(Error)
}
}
pub struct CompressedProof {
pub a: [u8; 32],
pub b: [u8; 64],
pub c: [u8; 32],
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/lib.rs
|
pub mod batch_address_append;
pub mod batch_append_with_proofs;
pub mod batch_append_with_subtrees;
pub mod batch_update;
pub mod combined;
pub mod errors;
#[cfg(feature = "gnark")]
pub mod gnark;
pub mod groth16_solana_verifier;
pub mod helpers;
pub mod inclusion;
pub mod init_merkle_tree;
pub mod non_inclusion;
pub mod prove_utils;
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/batch_append_with_proofs.rs
|
use light_bounded_vec::BoundedVec;
use light_concurrent_merkle_tree::changelog::ChangelogEntry;
use num_bigint::{BigInt, Sign};
use serde::Serialize;
use crate::helpers::compute_root_from_merkle_proof;
use crate::{batch_append_with_subtrees::calculate_hash_chain, helpers::bigint_to_u8_32};
#[derive(Debug, Clone, Serialize)]
pub struct BatchAppendWithProofsCircuitInputs {
pub public_input_hash: BigInt,
pub old_root: BigInt,
pub new_root: BigInt,
pub leaves_hashchain_hash: BigInt,
pub start_index: u32,
pub old_leaves: Vec<BigInt>,
pub leaves: Vec<BigInt>,
pub merkle_proofs: Vec<Vec<BigInt>>,
pub height: u32,
pub batch_size: u32,
}
impl BatchAppendWithProofsCircuitInputs {
pub fn public_inputs_arr(&self) -> [u8; 32] {
bigint_to_u8_32(&self.public_input_hash).unwrap()
}
}
pub fn get_batch_append_with_proofs_inputs<const HEIGHT: usize>(
// get this from Merkle tree account
current_root: [u8; 32],
// get this from Merkle tree account
start_index: u32,
// get this from output queue account
leaves: Vec<[u8; 32]>,
// get this from output queue account
leaves_hashchain: [u8; 32],
// get old_leaves and merkle_proofs from indexer by requesting Merkle proofs
// by indices
old_leaves: Vec<[u8; 32]>,
merkle_proofs: Vec<Vec<[u8; 32]>>,
batch_size: u32,
) -> BatchAppendWithProofsCircuitInputs {
let mut new_root = [0u8; 32];
let mut changelog: Vec<ChangelogEntry<HEIGHT>> = Vec::new();
let mut circuit_merkle_proofs = Vec::with_capacity(batch_size as usize);
for (i, (old_leaf, (new_leaf, merkle_proof))) in old_leaves
.iter()
.zip(leaves.iter().zip(merkle_proofs.iter()))
.enumerate()
{
let mut bounded_vec_merkle_proof = BoundedVec::from_slice(merkle_proof.as_slice());
let current_index = start_index as usize + i;
// Apply previous changes to keep proofs consistent.
if i > 0 {
for change_log_entry in changelog.iter() {
change_log_entry
.update_proof(current_index, &mut bounded_vec_merkle_proof)
.unwrap();
}
}
let merkle_proof_array = bounded_vec_merkle_proof.to_array().unwrap();
// Determine if we use the old or new leaf based on whether the old leaf is nullified (zeroed).
let is_old_leaf_zero = old_leaf.iter().all(|&byte| byte == 0);
let final_leaf = if is_old_leaf_zero {
*new_leaf
} else {
*old_leaf
};
// Update the root based on the current proof and nullifier
let (updated_root, changelog_entry) =
compute_root_from_merkle_proof(final_leaf, &merkle_proof_array, start_index + i as u32);
new_root = updated_root;
changelog.push(changelog_entry);
circuit_merkle_proofs.push(
merkle_proof_array
.iter()
.map(|hash| BigInt::from_bytes_be(Sign::Plus, hash))
.collect(),
);
}
let mut start_index_bytes = [0u8; 32];
start_index_bytes[28..].copy_from_slice(start_index.to_be_bytes().as_slice());
// Calculate the public input hash chain with old root, new root, and leaves hash chain
let public_input_hash =
calculate_hash_chain(&[current_root, new_root, leaves_hashchain, start_index_bytes]);
println!("public_input_hash: {:?}", public_input_hash);
println!("current root {:?}", current_root);
println!("new root {:?}", new_root);
println!("leaves hashchain {:?}", leaves_hashchain);
println!("start index {:?}", start_index_bytes);
BatchAppendWithProofsCircuitInputs {
public_input_hash: BigInt::from_bytes_be(Sign::Plus, &public_input_hash),
old_root: BigInt::from_bytes_be(Sign::Plus, ¤t_root),
new_root: BigInt::from_bytes_be(Sign::Plus, &new_root),
leaves_hashchain_hash: BigInt::from_bytes_be(Sign::Plus, &leaves_hashchain),
start_index,
old_leaves: old_leaves
.iter()
.map(|leaf| BigInt::from_bytes_be(Sign::Plus, leaf))
.collect(),
leaves: leaves
.iter()
.map(|leaf| BigInt::from_bytes_be(Sign::Plus, leaf))
.collect(),
merkle_proofs: circuit_merkle_proofs,
height: HEIGHT as u32,
batch_size,
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/batch_update.rs
|
use crate::helpers::compute_root_from_merkle_proof;
use crate::{batch_append_with_subtrees::calculate_hash_chain, helpers::bigint_to_u8_32};
use light_bounded_vec::BoundedVec;
use light_concurrent_merkle_tree::changelog::ChangelogEntry;
use light_hasher::{Hasher, Poseidon};
use num_bigint::{BigInt, Sign};
use num_traits::FromBytes;
#[derive(Clone, Debug)]
pub struct BatchUpdateCircuitInputs {
pub public_input_hash: BigInt,
pub old_root: BigInt,
pub new_root: BigInt,
pub tx_hashes: Vec<BigInt>,
pub leaves_hashchain_hash: BigInt,
pub leaves: Vec<BigInt>,
pub old_leaves: Vec<BigInt>,
pub merkle_proofs: Vec<Vec<BigInt>>,
pub path_indices: Vec<u32>,
pub height: u32,
pub batch_size: u32,
}
impl BatchUpdateCircuitInputs {
pub fn public_inputs_arr(&self) -> [u8; 32] {
bigint_to_u8_32(&self.public_input_hash).unwrap()
}
}
#[derive(Clone, Debug)]
pub struct BatchUpdateInputs<'a>(pub &'a [BatchUpdateCircuitInputs]);
impl BatchUpdateInputs<'_> {
pub fn public_inputs(&self) -> Vec<[u8; 32]> {
// Concatenate all public inputs into a single flat vector
vec![self.0[0].public_inputs_arr()]
}
}
#[allow(clippy::too_many_arguments)]
pub fn get_batch_update_inputs<const HEIGHT: usize>(
// get from photon
current_root: [u8; 32],
// get from photon
tx_hashes: Vec<[u8; 32]>,
// get from photon
leaves: Vec<[u8; 32]>,
// get from account
leaves_hashchain: [u8; 32],
// get from photon
old_leaves: Vec<[u8; 32]>,
// get from photon
merkle_proofs: Vec<Vec<[u8; 32]>>,
// get from photon
path_indices: Vec<u32>,
// get from account (every mt account has a hardcoded batch size)
batch_size: u32,
) -> BatchUpdateCircuitInputs {
let mut new_root = [0u8; 32];
let old_root = current_root;
// We need a changelog because all subsequent proofs change after one update.
// Hence, we patch the proofs with the changelog.
let mut changelog: Vec<ChangelogEntry<HEIGHT>> = Vec::new();
let mut circuit_merkle_proofs = vec![];
let mut nullifiers = vec![];
for (i, (_leaf, (merkle_proof, index))) in leaves
.iter()
.zip(merkle_proofs.iter().zip(path_indices.iter()))
.enumerate()
{
let mut bounded_vec_merkle_proof = BoundedVec::from_slice(merkle_proof.as_slice());
if i > 0 {
for change_log_entry in changelog.iter() {
change_log_entry
.update_proof(*index as usize, &mut bounded_vec_merkle_proof)
.unwrap();
}
}
let merkle_proof = bounded_vec_merkle_proof.to_array().unwrap();
let index_bytes = index.to_be_bytes();
let nullifier = Poseidon::hashv(&[&leaves[i], &index_bytes, &tx_hashes[i]]).unwrap();
nullifiers.push(nullifier);
let (root, changelog_entry) =
compute_root_from_merkle_proof(nullifier, &merkle_proof, *index);
new_root = root;
changelog.push(changelog_entry);
circuit_merkle_proofs.push(merkle_proof);
}
let public_input_hash = calculate_hash_chain(&[old_root, new_root, leaves_hashchain]);
BatchUpdateCircuitInputs {
public_input_hash: BigInt::from_be_bytes(&public_input_hash),
old_root: BigInt::from_be_bytes(&old_root),
new_root: BigInt::from_be_bytes(&new_root),
tx_hashes: tx_hashes
.iter()
.map(|tx_hash| BigInt::from_bytes_be(Sign::Plus, tx_hash))
.collect(),
leaves_hashchain_hash: BigInt::from_be_bytes(&leaves_hashchain),
leaves: leaves
.iter()
.map(|leaf| BigInt::from_bytes_be(Sign::Plus, leaf))
.collect(),
old_leaves: old_leaves
.iter()
.map(|leaf| BigInt::from_bytes_be(Sign::Plus, leaf))
.collect(),
merkle_proofs: circuit_merkle_proofs
.iter()
.map(|proof| {
proof
.iter()
.map(|hash| BigInt::from_bytes_be(Sign::Plus, hash))
.collect()
})
.collect(),
path_indices,
height: HEIGHT as u32,
batch_size,
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/batch_append_with_subtrees.rs
|
use crate::helpers::bigint_to_u8_32;
use light_hasher::{Hasher, Poseidon};
use light_merkle_tree_reference::sparse_merkle_tree::SparseMerkleTree;
use light_utils::bigint::bigint_to_be_bytes_array;
use num_bigint::{BigInt, BigUint, Sign};
use num_traits::FromPrimitive;
#[derive(Clone, Debug, Default)]
pub struct BatchAppendWithSubtreesCircuitInputs {
pub public_input_hash: BigInt,
pub old_sub_tree_hash_chain: BigInt,
pub new_sub_tree_hash_chain: BigInt,
pub new_root: BigInt,
pub hashchain_hash: BigInt,
pub start_index: BigInt,
pub tree_height: BigInt,
pub leaves: Vec<BigInt>,
pub subtrees: Vec<BigInt>,
}
impl BatchAppendWithSubtreesCircuitInputs {
pub fn public_inputs_arr(&self) -> [u8; 32] {
bigint_to_u8_32(&self.public_input_hash).unwrap()
}
}
#[derive(Clone, Debug)]
pub struct BatchAppendInputs<'a>(pub &'a [BatchAppendWithSubtreesCircuitInputs]);
impl BatchAppendInputs<'_> {
pub fn public_inputs(&self) -> Vec<[u8; 32]> {
// Concatenate all public inputs into a single flat vector
vec![self.0[0].public_inputs_arr()]
}
}
pub fn get_batch_append_with_subtrees_inputs<const HEIGHT: usize>(
// get either from photon or mt account
next_index: usize,
// get from photon
sub_trees: [[u8; 32]; HEIGHT],
// get from queue
leaves: Vec<[u8; 32]>,
// get from queue
leaves_hashchain: [u8; 32],
) -> BatchAppendWithSubtreesCircuitInputs {
let mut bigint_leaves = vec![];
let old_subtrees = sub_trees;
let old_subtree_hashchain = calculate_hash_chain(&old_subtrees);
let mut merkle_tree = SparseMerkleTree::<Poseidon, HEIGHT>::new(sub_trees, next_index);
let start_index =
bigint_to_be_bytes_array::<32>(&BigUint::from_usize(next_index).unwrap()).unwrap();
for leaf in leaves.iter() {
merkle_tree.append(*leaf);
bigint_leaves.push(BigInt::from_bytes_be(Sign::Plus, leaf));
}
let new_root = BigInt::from_signed_bytes_be(merkle_tree.root().as_slice());
let new_subtree_hashchain = calculate_hash_chain(&merkle_tree.get_subtrees());
let public_input_hash = calculate_hash_chain(&[
old_subtree_hashchain,
new_subtree_hashchain,
merkle_tree.root(),
leaves_hashchain,
start_index,
]);
BatchAppendWithSubtreesCircuitInputs {
subtrees: old_subtrees
.iter()
.map(|subtree| BigInt::from_bytes_be(Sign::Plus, subtree))
.collect(),
old_sub_tree_hash_chain: BigInt::from_bytes_be(Sign::Plus, &old_subtree_hashchain),
new_sub_tree_hash_chain: BigInt::from_bytes_be(Sign::Plus, &new_subtree_hashchain),
leaves: bigint_leaves,
new_root,
public_input_hash: BigInt::from_bytes_be(Sign::Plus, &public_input_hash),
start_index: BigInt::from_bytes_be(Sign::Plus, &start_index),
hashchain_hash: BigInt::from_bytes_be(Sign::Plus, &leaves_hashchain),
tree_height: BigInt::from_usize(merkle_tree.get_height()).unwrap(),
}
}
pub fn calculate_hash_chain(hashes: &[[u8; 32]]) -> [u8; 32] {
if hashes.is_empty() {
return [0u8; 32];
}
if hashes.len() == 1 {
return hashes[0];
}
let mut hash_chain = hashes[0];
for hash in hashes.iter().skip(1) {
hash_chain = Poseidon::hashv(&[&hash_chain, hash]).unwrap();
}
hash_chain
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/helpers.rs
|
use env_logger::Builder;
use light_concurrent_merkle_tree::changelog::ChangelogEntry;
use light_hasher::{Hasher, Poseidon};
use log::LevelFilter;
use num_bigint::BigInt;
pub fn change_endianness(bytes: &[u8]) -> Vec<u8> {
let mut vec = Vec::new();
for b in bytes.chunks(32) {
for byte in b.iter().rev() {
vec.push(*byte);
}
}
vec
}
pub fn convert_endianness_128(bytes: &[u8]) -> Vec<u8> {
bytes
.chunks(64)
.flat_map(|b| b.iter().copied().rev().collect::<Vec<u8>>())
.collect::<Vec<u8>>()
}
pub fn init_logger() {
let _ = Builder::new()
.filter_module("light_prover_client", LevelFilter::Info)
.try_init();
}
pub fn bigint_to_u8_32(n: &BigInt) -> Result<[u8; 32], Box<dyn std::error::Error>> {
let (_, bytes_be) = n.to_bytes_be();
if bytes_be.len() > 32 {
Err("Number too large to fit in [u8; 32]")?;
}
let mut array = [0; 32];
let bytes = &bytes_be[..bytes_be.len()];
array[(32 - bytes.len())..].copy_from_slice(bytes);
Ok(array)
}
pub fn hash_chain(hashes: &[[u8; 32]]) -> [u8; 32] {
if hashes.is_empty() {
return [0; 32];
}
let mut current_hash = *hashes.first().unwrap();
for hash in hashes.iter().skip(1) {
current_hash = Poseidon::hashv(&[¤t_hash[..], &hash[..]]).unwrap();
}
current_hash
}
pub fn compute_root_from_merkle_proof<const HEIGHT: usize>(
leaf: [u8; 32],
path_elements: &[[u8; 32]; HEIGHT],
path_index: u32,
) -> ([u8; 32], ChangelogEntry<HEIGHT>) {
let mut changelog_entry = ChangelogEntry::default_with_index(path_index as usize);
let mut current_hash = leaf;
let mut current_index = path_index;
for (level, path_element) in path_elements.iter().enumerate() {
changelog_entry.path[level] = Some(current_hash);
if current_index % 2 == 0 {
current_hash = Poseidon::hashv(&[¤t_hash, path_element]).unwrap();
} else {
current_hash = Poseidon::hashv(&[path_element, ¤t_hash]).unwrap();
}
current_index /= 2;
}
(current_hash, changelog_entry)
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/errors.rs
|
use ark_relations::r1cs::SynthesisError;
use ark_serialize::SerializationError;
use color_eyre::Report;
use groth16_solana::errors::Groth16Error;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum CircuitsError {
#[error("Error: {0}")]
GenericError(String),
#[error("Arkworks prover error: {0}")]
ArkworksProverError(String),
#[error("Arkworks serialization error: {0}")]
ArkworksSerializationError(String),
#[error("Groth16-Solana Error: {0}")]
Groth16SolanaError(Groth16Error),
#[error("Cannot change endianness")]
ChangeEndiannessError,
#[error("Cannot parse inputs")]
InputsParsingError,
#[error("Wrong number of UTXO's")]
WrongNumberOfUtxos,
}
impl From<SerializationError> for CircuitsError {
fn from(error: SerializationError) -> Self {
CircuitsError::ArkworksSerializationError(error.to_string())
}
}
impl From<SynthesisError> for CircuitsError {
fn from(error: SynthesisError) -> Self {
CircuitsError::ArkworksProverError(error.to_string())
}
}
impl From<Report> for CircuitsError {
fn from(error: Report) -> Self {
CircuitsError::GenericError(error.to_string())
}
}
impl From<Groth16Error> for CircuitsError {
fn from(error: Groth16Error) -> Self {
CircuitsError::Groth16SolanaError(error)
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/groth16_solana_verifier.rs
|
use groth16_solana::groth16::{Groth16Verifier, Groth16Verifyingkey};
use crate::{errors::CircuitsError, prove_utils::ProofCompressed};
// TODO: move to groth16_solana ?
pub fn groth16_solana_verify<const NR_INPUTS: usize>(
proof: &ProofCompressed,
proof_inputs: &[[u8; 32]; NR_INPUTS],
verifyingkey: Groth16Verifyingkey,
) -> Result<bool, CircuitsError> {
let proof = proof.try_decompress()?;
let mut verifier =
Groth16Verifier::new(&proof.a, &proof.b, &proof.c, proof_inputs, &verifyingkey)?;
let result = verifier.verify()?;
Ok(result)
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/init_merkle_tree.rs
|
use std::sync::Mutex;
use ark_std::Zero;
use light_hasher::{Hasher, Poseidon};
use light_indexed_merkle_tree::{array::IndexedArray, reference::IndexedMerkleTree};
use light_merkle_tree_reference::MerkleTree;
use log::info;
use num_bigint::{BigInt, Sign, ToBigUint};
use once_cell::{self, sync::Lazy};
use crate::{
inclusion::{
merkle_inclusion_proof_inputs::InclusionMerkleProofInputs, merkle_tree_info::MerkleTreeInfo,
},
non_inclusion::merkle_non_inclusion_proof_inputs::NonInclusionMerkleProofInputs,
};
pub static MT_PROOF_INPUTS_26: Lazy<Mutex<InclusionMerkleProofInputs>> =
Lazy::new(|| Mutex::new(inclusion_merkle_tree_inputs_26()));
pub fn inclusion_merkle_tree_inputs(mt_height: MerkleTreeInfo) -> InclusionMerkleProofInputs {
match mt_height {
MerkleTreeInfo::H26 => (*MT_PROOF_INPUTS_26.lock().unwrap()).clone(),
}
}
fn inclusion_merkle_tree_inputs_26() -> InclusionMerkleProofInputs {
const HEIGHT: usize = 26;
const CANOPY: usize = 0;
info!("initializing merkle tree");
// SAFETY: Calling `unwrap()` when the Merkle tree parameters are corect
// should not cause panic. Returning an error would not be compatible with
// usafe of `once_cell::sync::Lazy` as a static variable.
let mut merkle_tree = MerkleTree::<Poseidon>::new(HEIGHT, CANOPY);
info!("merkle tree initialized");
info!("updating merkle tree");
let mut bn_1: [u8; 32] = [0; 32];
bn_1[31] = 1;
let leaf: [u8; 32] = Poseidon::hash(&bn_1).unwrap();
merkle_tree.append(&leaf).unwrap();
let root1 = &merkle_tree.roots[1];
info!("merkle tree updated");
info!("getting proof of leaf");
// SAFETY: Calling `unwrap()` when the Merkle tree parameters are corect
// should not cause panic. Returning an error would not be compatible with
// unsafe of `once_cell::sync::Lazy` as a static variable.
let path_elements = merkle_tree
.get_proof_of_leaf(0, true)
.unwrap()
.iter()
.map(|el| BigInt::from_bytes_be(Sign::Plus, el))
.collect::<Vec<_>>();
info!("proof of leaf calculated");
let leaf_bn = BigInt::from_bytes_be(Sign::Plus, &leaf);
let root_bn = BigInt::from_bytes_be(Sign::Plus, root1);
let path_index = BigInt::zero();
InclusionMerkleProofInputs {
root: root_bn,
leaf: leaf_bn,
path_index,
path_elements,
}
}
pub fn non_inclusion_merkle_tree_inputs_26() -> NonInclusionMerkleProofInputs {
const HEIGHT: usize = 26;
const CANOPY: usize = 0;
let mut indexed_tree = IndexedMerkleTree::<Poseidon, usize>::new(HEIGHT, CANOPY).unwrap();
let mut indexing_array = IndexedArray::<Poseidon, usize>::default();
let bundle1 = indexing_array.append(&1_u32.to_biguint().unwrap()).unwrap();
indexed_tree
.update(
&bundle1.new_low_element,
&bundle1.new_element,
&bundle1.new_element_next_value,
)
.unwrap();
let bundle3 = indexing_array.append(&3_u32.to_biguint().unwrap()).unwrap();
indexed_tree
.update(
&bundle3.new_low_element,
&bundle3.new_element,
&bundle3.new_element_next_value,
)
.unwrap();
let new_low_element = bundle3.new_low_element;
let new_element = bundle3.new_element;
let _new_element_next_value = bundle3.new_element_next_value;
let root = indexed_tree.merkle_tree.roots.last().unwrap();
let mut non_included_value = [0u8; 32];
non_included_value[31] = 2;
let leaf_lower_range_value = new_low_element.value.to_bytes_be();
let next_index = new_element.next_index;
let leaf_higher_range_value = new_element.value.to_bytes_be();
let merkle_proof_hashed_indexed_element_leaf = indexed_tree
.get_proof_of_leaf(new_low_element.index, true)
.ok()
.map(|bounded_vec| {
bounded_vec
.iter()
.map(|item| BigInt::from_bytes_be(Sign::Plus, item))
.collect()
})
.unwrap();
let index_hashed_indexed_element_leaf = new_low_element.index;
NonInclusionMerkleProofInputs {
root: BigInt::from_bytes_be(Sign::Plus, root),
value: BigInt::from_bytes_be(Sign::Plus, &non_included_value),
leaf_lower_range_value: BigInt::from_bytes_be(Sign::Plus, &leaf_lower_range_value),
leaf_higher_range_value: BigInt::from_bytes_be(Sign::Plus, &leaf_higher_range_value),
next_index: BigInt::from(next_index),
merkle_proof_hashed_indexed_element_leaf,
index_hashed_indexed_element_leaf: BigInt::from(index_hashed_indexed_element_leaf),
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/batch_address_append.rs
|
use crate::helpers::{compute_root_from_merkle_proof, hash_chain};
use light_bounded_vec::BoundedVec;
use light_concurrent_merkle_tree::changelog::ChangelogEntry;
use light_concurrent_merkle_tree::event::RawIndexedElement;
use light_hasher::Poseidon;
use light_indexed_merkle_tree::array::IndexedElement;
use light_indexed_merkle_tree::changelog::IndexedChangelogEntry;
use light_indexed_merkle_tree::errors::IndexedMerkleTreeError;
use light_indexed_merkle_tree::{array::IndexedArray, reference::IndexedMerkleTree};
use light_merkle_tree_reference::sparse_merkle_tree::SparseMerkleTree;
use light_utils::bigint::bigint_to_be_bytes_array;
use num_bigint::BigUint;
#[derive(Debug, Clone)]
pub struct BatchAddressAppendInputs {
pub batch_size: usize,
pub hashchain_hash: BigUint,
pub low_element_values: Vec<BigUint>,
pub low_element_indices: Vec<BigUint>,
pub low_element_next_indices: Vec<BigUint>,
pub low_element_next_values: Vec<BigUint>,
pub low_element_proofs: Vec<Vec<BigUint>>,
pub new_element_values: Vec<BigUint>,
pub new_element_proofs: Vec<Vec<BigUint>>,
pub new_root: BigUint,
pub old_root: BigUint,
pub public_input_hash: BigUint,
pub start_index: usize,
pub tree_height: usize,
}
#[allow(clippy::too_many_arguments)]
pub fn get_batch_address_append_inputs_from_tree<const HEIGHT: usize>(
next_index: usize,
current_root: [u8; 32],
low_element_values: Vec<[u8; 32]>,
low_element_next_values: Vec<[u8; 32]>,
low_element_indices: Vec<usize>,
low_element_next_indices: Vec<usize>,
low_element_proofs: Vec<Vec<[u8; 32]>>,
new_element_values: Vec<[u8; 32]>,
subtrees: [[u8; 32]; HEIGHT],
) -> BatchAddressAppendInputs {
let mut new_root = [0u8; 32];
let mut low_element_circuit_merkle_proofs = vec![];
let mut new_element_circuit_merkle_proofs = vec![];
let mut changelog: Vec<ChangelogEntry<HEIGHT>> = Vec::new();
let mut indexed_changelog: Vec<IndexedChangelogEntry<u16, HEIGHT>> = Vec::new();
let mut patched_low_element_next_values: Vec<[u8; 32]> = Vec::new();
let mut patched_low_element_next_indices: Vec<usize> = Vec::new();
let mut merkle_tree = SparseMerkleTree::<Poseidon, HEIGHT>::new(subtrees, next_index);
for i in 0..low_element_values.len() {
let mut changelog_index = 0;
let new_element_index = next_index + i;
let mut low_element: IndexedElement<u16> = IndexedElement {
index: low_element_indices[i] as u16,
value: BigUint::from_bytes_be(&low_element_values[i]),
next_index: low_element_next_indices[i] as u16,
};
let mut new_element: IndexedElement<u16> = IndexedElement {
index: new_element_index as u16,
value: BigUint::from_bytes_be(&new_element_values[i]),
next_index: low_element_next_indices[i] as u16,
};
let mut low_element_proof: BoundedVec<[u8; 32]> =
BoundedVec::from_slice(low_element_proofs[i].as_slice());
let mut low_element_next_value = BigUint::from_bytes_be(&low_element_next_values[i]);
if i > 0 {
patch_indexed_changelogs(
0,
&mut changelog_index,
&mut indexed_changelog,
&mut low_element,
&mut new_element,
&mut low_element_next_value,
&mut low_element_proof,
)
.unwrap();
}
patched_low_element_next_values
.push(bigint_to_be_bytes_array::<32>(&low_element_next_value).unwrap());
patched_low_element_next_indices.push(low_element.next_index as usize);
let new_low_element: IndexedElement<u16> = IndexedElement {
index: low_element.index,
value: low_element.value,
next_index: new_element_index as u16,
};
let new_low_element_raw = RawIndexedElement {
value: bigint_to_be_bytes_array::<32>(&new_low_element.value).unwrap(),
next_index: new_low_element.next_index,
next_value: bigint_to_be_bytes_array::<32>(&new_element.value).unwrap(),
index: new_low_element.index,
};
let low_element_changelog_entry = IndexedChangelogEntry {
element: new_low_element_raw,
proof: low_element_proof.as_slice()[..HEIGHT].try_into().unwrap(),
changelog_index,
};
indexed_changelog.push(low_element_changelog_entry);
{
if i > 0 {
for change_log_entry in changelog.iter().skip(changelog_index + 1) {
change_log_entry
.update_proof(low_element_indices[i], &mut low_element_proof)
.unwrap();
}
}
let merkle_proof = low_element_proof.to_array().unwrap();
let new_low_leaf_hash = new_low_element
.hash::<Poseidon>(&new_element.value)
.unwrap();
let (_, changelog_entry) = compute_root_from_merkle_proof(
new_low_leaf_hash,
&merkle_proof,
new_low_element.index as u32,
);
changelog.push(changelog_entry);
low_element_circuit_merkle_proofs.push(
merkle_proof
.iter()
.map(|hash| BigUint::from_bytes_be(hash))
.collect(),
);
}
{
let new_element_value = low_element_next_value;
let new_element_leaf_hash = new_element.hash::<Poseidon>(&new_element_value).unwrap();
let proof = merkle_tree.append(new_element_leaf_hash);
let mut bounded_vec_merkle_proof = BoundedVec::from_slice(proof.as_slice());
let current_index = next_index + i;
for change_log_entry in changelog.iter() {
change_log_entry
.update_proof(current_index, &mut bounded_vec_merkle_proof)
.unwrap();
}
let reference_root = compute_root_from_merkle_proof(
new_element_leaf_hash,
&proof,
(next_index + i) as u32,
);
assert_eq!(merkle_tree.root(), reference_root.0);
let merkle_proof_array = bounded_vec_merkle_proof.to_array().unwrap();
let (updated_root, changelog_entry) = compute_root_from_merkle_proof(
new_element_leaf_hash,
&merkle_proof_array,
(next_index + i) as u32,
);
new_root = updated_root;
changelog.push(changelog_entry);
new_element_circuit_merkle_proofs.push(
merkle_proof_array
.iter()
.map(|hash| BigUint::from_bytes_be(hash))
.collect(),
);
let new_element_raw = RawIndexedElement {
value: bigint_to_be_bytes_array::<32>(&new_element.value).unwrap(),
next_index: new_element.next_index,
next_value: bigint_to_be_bytes_array::<32>(&new_low_element.value).unwrap(),
index: new_element.index,
};
let new_element_changelog_entry = IndexedChangelogEntry {
element: new_element_raw,
proof: proof.as_slice()[..HEIGHT].try_into().unwrap(),
changelog_index: 0,
};
indexed_changelog.push(new_element_changelog_entry);
}
}
let leaves_hashchain = hash_chain(&new_element_values);
let hash_chain_inputs = vec![
current_root,
new_root,
leaves_hashchain,
bigint_to_be_bytes_array::<32>(&next_index.into()).unwrap(),
];
let public_input_hash = hash_chain(hash_chain_inputs.as_slice());
BatchAddressAppendInputs {
batch_size: new_element_values.len(),
hashchain_hash: BigUint::from_bytes_be(&leaves_hashchain),
low_element_values: low_element_values
.iter()
.map(|v| BigUint::from_bytes_be(v))
.collect(),
low_element_indices: low_element_indices
.iter()
.map(|&i| BigUint::from(i))
.collect(),
low_element_next_indices: patched_low_element_next_indices
.iter()
.map(|&i| BigUint::from(i))
.collect(),
low_element_next_values: patched_low_element_next_values
.iter()
.map(|v| BigUint::from_bytes_be(v))
.collect(),
low_element_proofs: low_element_circuit_merkle_proofs,
new_element_values: new_element_values
.iter()
.map(|v| BigUint::from_bytes_be(v))
.collect(),
new_element_proofs: new_element_circuit_merkle_proofs,
new_root: BigUint::from_bytes_be(&new_root),
old_root: BigUint::from_bytes_be(¤t_root),
public_input_hash: BigUint::from_bytes_be(&public_input_hash),
start_index: next_index,
tree_height: HEIGHT,
}
}
// Keep this for testing purposes
pub fn get_test_batch_address_append_inputs(
addresses: Vec<BigUint>,
start_index: usize,
tree_height: usize,
) -> BatchAddressAppendInputs {
let mut relayer_indexing_array = IndexedArray::<Poseidon, usize>::default();
relayer_indexing_array.init().unwrap();
let mut relayer_merkle_tree =
IndexedMerkleTree::<Poseidon, usize>::new(tree_height, 0).unwrap();
relayer_merkle_tree.init().unwrap();
let old_root = relayer_merkle_tree.root();
let mut low_element_values = Vec::new();
let mut low_element_indices = Vec::new();
let mut low_element_next_indices = Vec::new();
let mut low_element_next_values = Vec::new();
let mut low_element_proofs = Vec::new();
let mut new_element_values = Vec::new();
let mut new_element_proofs = Vec::new();
for address in &addresses {
let non_inclusion_proof = relayer_merkle_tree
.get_non_inclusion_proof(address, &relayer_indexing_array)
.unwrap();
relayer_merkle_tree
.verify_non_inclusion_proof(&non_inclusion_proof)
.unwrap();
low_element_values.push(BigUint::from_bytes_be(
&non_inclusion_proof.leaf_lower_range_value,
));
low_element_indices.push(non_inclusion_proof.leaf_index.into());
low_element_next_indices.push(non_inclusion_proof.next_index.into());
low_element_next_values.push(BigUint::from_bytes_be(
&non_inclusion_proof.leaf_higher_range_value,
));
let proof: Vec<BigUint> = non_inclusion_proof
.merkle_proof
.iter()
.map(|proof| BigUint::from_bytes_be(proof))
.collect();
low_element_proofs.push(proof);
relayer_merkle_tree
.append(address, &mut relayer_indexing_array)
.unwrap();
let new_proof = relayer_merkle_tree
.get_proof_of_leaf(relayer_merkle_tree.merkle_tree.rightmost_index - 1, true)
.unwrap();
let new_proof: Vec<BigUint> = new_proof
.iter()
.map(|proof| BigUint::from_bytes_be(proof))
.collect();
new_element_proofs.push(new_proof);
new_element_values.push(address.clone());
}
let new_root = relayer_merkle_tree.root();
// Create hashchain
let addresses_bytes = addresses
.iter()
.map(|x| bigint_to_be_bytes_array::<32>(x).unwrap())
.collect::<Vec<_>>();
let leaves_hashchain = hash_chain(&addresses_bytes);
let hash_chain_inputs = vec![
old_root,
new_root,
leaves_hashchain,
bigint_to_be_bytes_array::<32>(&start_index.into()).unwrap(),
];
let public_input_hash = hash_chain(hash_chain_inputs.as_slice());
BatchAddressAppendInputs {
batch_size: addresses.len(),
hashchain_hash: BigUint::from_bytes_be(&leaves_hashchain),
low_element_values,
low_element_indices,
low_element_next_indices,
low_element_next_values,
low_element_proofs,
new_element_values,
new_element_proofs,
new_root: BigUint::from_bytes_be(&new_root),
old_root: BigUint::from_bytes_be(&old_root),
public_input_hash: BigUint::from_bytes_be(&public_input_hash),
start_index,
tree_height,
}
}
pub fn patch_indexed_changelogs<const HEIGHT: usize>(
indexed_changelog_index: usize,
changelog_index: &mut usize,
indexed_changelogs: &mut Vec<IndexedChangelogEntry<u16, HEIGHT>>,
low_element: &mut IndexedElement<u16>,
new_element: &mut IndexedElement<u16>,
low_element_next_value: &mut BigUint,
low_leaf_proof: &mut BoundedVec<[u8; 32]>,
) -> Result<(), IndexedMerkleTreeError> {
let next_indexed_changelog_indices: Vec<usize> = (*indexed_changelogs)
.iter()
.enumerate()
.filter_map(|(index, changelog_entry)| {
if changelog_entry.element.index == low_element.index {
Some((indexed_changelog_index + index) % indexed_changelogs.len())
} else {
None
}
})
.collect();
let mut new_low_element = None;
for next_indexed_changelog_index in next_indexed_changelog_indices {
let changelog_entry = &mut indexed_changelogs[next_indexed_changelog_index];
let next_element_value = BigUint::from_bytes_be(&changelog_entry.element.next_value);
if next_element_value < new_element.value {
// If the next element is lower than the current element, it means
// that it should become the low element.
//
// Save it and break the loop.
new_low_element = Some((
(next_indexed_changelog_index + 1) % indexed_changelogs.len(),
next_element_value,
));
break;
}
// Patch the changelog index.
*changelog_index = changelog_entry.changelog_index;
// Patch the `next_index` of `new_element`.
new_element.next_index = changelog_entry.element.next_index;
// Patch the element.
low_element.update_from_raw_element(&changelog_entry.element);
// Patch the next value.
*low_element_next_value = BigUint::from_bytes_be(&changelog_entry.element.next_value);
// Patch the proof.
for i in 0..low_leaf_proof.len() {
low_leaf_proof[i] = changelog_entry.proof[i];
}
}
// If we found a new low element.
if let Some((new_low_element_changelog_index, new_low_element)) = new_low_element {
let new_low_element_changelog_entry = &indexed_changelogs[new_low_element_changelog_index];
*changelog_index = new_low_element_changelog_entry.changelog_index;
*low_element = IndexedElement {
index: new_low_element_changelog_entry.element.index,
value: new_low_element.clone(),
next_index: new_low_element_changelog_entry.element.next_index,
};
for i in 0..low_leaf_proof.len() {
low_leaf_proof[i] = new_low_element_changelog_entry.proof[i];
}
new_element.next_index = low_element.next_index;
// Start the patching process from scratch for the new low element.
patch_indexed_changelogs(
new_low_element_changelog_index,
changelog_index,
indexed_changelogs,
new_element,
low_element,
low_element_next_value,
low_leaf_proof,
)?
}
Ok(())
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/non_inclusion_json_formatter.rs
|
use crate::gnark::helpers::big_int_to_string;
use crate::{
gnark::helpers::create_json_from_struct,
init_merkle_tree::non_inclusion_merkle_tree_inputs_26,
non_inclusion::merkle_non_inclusion_proof_inputs::{
NonInclusionMerkleProofInputs, NonInclusionProofInputs,
},
};
use num_traits::ToPrimitive;
use serde::Serialize;
#[derive(Serialize, Debug)]
pub struct BatchNonInclusionJsonStruct {
#[serde(rename(serialize = "new-addresses"))]
pub inputs: Vec<NonInclusionJsonStruct>,
}
#[derive(Serialize, Clone, Debug)]
pub struct NonInclusionJsonStruct {
root: String,
value: String,
#[serde(rename(serialize = "pathIndex"))]
path_index: u32,
#[serde(rename(serialize = "pathElements"))]
path_elements: Vec<String>,
#[serde(rename(serialize = "leafLowerRangeValue"))]
leaf_lower_range_value: String,
#[serde(rename(serialize = "leafHigherRangeValue"))]
leaf_higher_range_value: String,
#[serde(rename(serialize = "nextIndex"))]
next_index: u32,
}
impl BatchNonInclusionJsonStruct {
fn new_with_public_inputs(number_of_utxos: usize) -> (Self, NonInclusionMerkleProofInputs) {
let merkle_inputs = non_inclusion_merkle_tree_inputs_26();
let input = NonInclusionJsonStruct {
root: big_int_to_string(&merkle_inputs.root),
value: big_int_to_string(&merkle_inputs.value),
path_elements: merkle_inputs
.merkle_proof_hashed_indexed_element_leaf
.iter()
.map(big_int_to_string)
.collect(),
path_index: merkle_inputs
.index_hashed_indexed_element_leaf
.to_u32()
.unwrap(),
next_index: merkle_inputs.next_index.to_u32().unwrap(),
leaf_lower_range_value: big_int_to_string(&merkle_inputs.leaf_lower_range_value),
leaf_higher_range_value: big_int_to_string(&merkle_inputs.leaf_higher_range_value),
};
let inputs = vec![input; number_of_utxos];
(Self { inputs }, merkle_inputs)
}
#[allow(clippy::inherent_to_string)]
pub fn to_string(&self) -> String {
create_json_from_struct(&self)
}
pub fn from_non_inclusion_proof_inputs(inputs: &NonInclusionProofInputs) -> Self {
let mut proof_inputs: Vec<NonInclusionJsonStruct> = Vec::new();
for input in inputs.0 {
let prof_input = NonInclusionJsonStruct {
root: big_int_to_string(&input.root),
value: big_int_to_string(&input.value),
path_index: input.index_hashed_indexed_element_leaf.to_u32().unwrap(),
path_elements: input
.merkle_proof_hashed_indexed_element_leaf
.iter()
.map(big_int_to_string)
.collect(),
next_index: input.next_index.to_u32().unwrap(),
leaf_lower_range_value: big_int_to_string(&input.leaf_lower_range_value),
leaf_higher_range_value: big_int_to_string(&input.leaf_higher_range_value),
};
proof_inputs.push(prof_input);
}
Self {
inputs: proof_inputs,
}
}
}
pub fn inclusion_inputs_string(number_of_utxos: usize) -> (String, NonInclusionMerkleProofInputs) {
let (json_struct, public_inputs) =
BatchNonInclusionJsonStruct::new_with_public_inputs(number_of_utxos);
(json_struct.to_string(), public_inputs)
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/constants.rs
|
pub const SERVER_ADDRESS: &str = "http://localhost:3001";
pub const HEALTH_CHECK: &str = "/health";
pub const PROVE_PATH: &str = "/prove";
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/proof_helpers.rs
|
use serde::{Deserialize, Serialize};
type G1 = ark_bn254::g1::G1Affine;
use std::ops::Neg;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Compress, Validate};
use num_traits::Num;
use solana_program::alt_bn128::compression::prelude::{
alt_bn128_g1_compress, alt_bn128_g2_compress, convert_endianness,
};
#[derive(Serialize, Deserialize, Debug)]
pub struct GnarkProofJson {
pub ar: Vec<String>,
pub bs: Vec<Vec<String>>,
pub krs: Vec<String>,
}
pub fn deserialize_gnark_proof_json(json_data: &str) -> serde_json::Result<GnarkProofJson> {
let deserialized_data: GnarkProofJson = serde_json::from_str(json_data)?;
Ok(deserialized_data)
}
pub fn deserialize_hex_string_to_be_bytes(hex_str: &str) -> [u8; 32] {
let trimmed_str = hex_str.trim_start_matches("0x");
let big_int = num_bigint::BigInt::from_str_radix(trimmed_str, 16).unwrap();
let big_int_bytes = big_int.to_bytes_be().1;
if big_int_bytes.len() < 32 {
let mut result = [0u8; 32];
result[32 - big_int_bytes.len()..].copy_from_slice(&big_int_bytes);
result
} else {
big_int_bytes.try_into().unwrap()
}
}
pub fn compress_proof(
proof_a: &[u8; 64],
proof_b: &[u8; 128],
proof_c: &[u8; 64],
) -> ([u8; 32], [u8; 64], [u8; 32]) {
let proof_a = alt_bn128_g1_compress(proof_a).unwrap();
let proof_b = alt_bn128_g2_compress(proof_b).unwrap();
let proof_c = alt_bn128_g1_compress(proof_c).unwrap();
(proof_a, proof_b, proof_c)
}
pub fn proof_from_json_struct(json: GnarkProofJson) -> ([u8; 64], [u8; 128], [u8; 64]) {
let proof_a_x = deserialize_hex_string_to_be_bytes(&json.ar[0]);
let proof_a_y = deserialize_hex_string_to_be_bytes(&json.ar[1]);
let proof_a: [u8; 64] = [proof_a_x, proof_a_y].concat().try_into().unwrap();
let proof_a = negate_g1(&proof_a);
let proof_b_x_0 = deserialize_hex_string_to_be_bytes(&json.bs[0][0]);
let proof_b_x_1 = deserialize_hex_string_to_be_bytes(&json.bs[0][1]);
let proof_b_y_0 = deserialize_hex_string_to_be_bytes(&json.bs[1][0]);
let proof_b_y_1 = deserialize_hex_string_to_be_bytes(&json.bs[1][1]);
let proof_b: [u8; 128] = [proof_b_x_0, proof_b_x_1, proof_b_y_0, proof_b_y_1]
.concat()
.try_into()
.unwrap();
let proof_c_x = deserialize_hex_string_to_be_bytes(&json.krs[0]);
let proof_c_y = deserialize_hex_string_to_be_bytes(&json.krs[1]);
let proof_c: [u8; 64] = [proof_c_x, proof_c_y].concat().try_into().unwrap();
(proof_a, proof_b, proof_c)
}
pub fn negate_g1(g1_be: &[u8; 64]) -> [u8; 64] {
let g1_le = convert_endianness::<32, 64>(g1_be);
let g1: G1 = G1::deserialize_with_mode(g1_le.as_slice(), Compress::No, Validate::No).unwrap();
let g1_neg = g1.neg();
let mut g1_neg_be = [0u8; 64];
g1_neg
.x
.serialize_with_mode(&mut g1_neg_be[..32], Compress::No)
.unwrap();
g1_neg
.y
.serialize_with_mode(&mut g1_neg_be[32..], Compress::No)
.unwrap();
let g1_neg_be: [u8; 64] = convert_endianness::<32, 64>(&g1_neg_be);
g1_neg_be
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/batch_address_append_json_formatter.rs
|
use crate::batch_address_append::BatchAddressAppendInputs;
use crate::gnark::helpers::{big_uint_to_string, create_json_from_struct};
use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct BatchAddressAppendInputsJson {
#[serde(rename = "BatchSize")]
pub batch_size: usize,
#[serde(rename = "HashchainHash")]
pub hashchain_hash: String,
#[serde(rename = "LowElementValues")]
pub low_element_values: Vec<String>,
#[serde(rename = "LowElementIndices")]
pub low_element_indices: Vec<String>,
#[serde(rename = "LowElementNextIndices")]
pub low_element_next_indices: Vec<String>,
#[serde(rename = "LowElementNextValues")]
pub low_element_next_values: Vec<String>,
#[serde(rename = "LowElementProofs")]
pub low_element_proofs: Vec<Vec<String>>,
#[serde(rename = "NewElementValues")]
pub new_element_values: Vec<String>,
#[serde(rename = "NewElementProofs")]
pub new_element_proofs: Vec<Vec<String>>,
#[serde(rename = "NewRoot")]
pub new_root: String,
#[serde(rename = "OldRoot")]
pub old_root: String,
#[serde(rename = "PublicInputHash")]
pub public_input_hash: String,
#[serde(rename = "StartIndex")]
pub start_index: usize,
#[serde(rename = "TreeHeight")]
pub tree_height: usize,
}
impl BatchAddressAppendInputsJson {
pub fn from_inputs(inputs: &BatchAddressAppendInputs) -> Self {
Self {
batch_size: inputs.batch_size,
hashchain_hash: big_uint_to_string(&inputs.hashchain_hash),
low_element_values: inputs
.low_element_values
.iter()
.map(big_uint_to_string)
.collect(),
low_element_indices: inputs
.low_element_indices
.iter()
.map(big_uint_to_string)
.collect(),
low_element_next_indices: inputs
.low_element_next_indices
.iter()
.map(big_uint_to_string)
.collect(),
low_element_next_values: inputs
.low_element_next_values
.iter()
.map(big_uint_to_string)
.collect(),
low_element_proofs: inputs
.low_element_proofs
.iter()
.map(|proof| proof.iter().map(big_uint_to_string).collect())
.collect(),
new_element_values: inputs
.new_element_values
.iter()
.map(big_uint_to_string)
.collect(),
new_element_proofs: inputs
.new_element_proofs
.iter()
.map(|proof| proof.iter().map(big_uint_to_string).collect())
.collect(),
new_root: big_uint_to_string(&inputs.new_root),
old_root: big_uint_to_string(&inputs.old_root),
public_input_hash: big_uint_to_string(&inputs.public_input_hash),
start_index: inputs.start_index,
tree_height: inputs.tree_height,
}
}
#[allow(clippy::inherent_to_string)]
pub fn to_string(&self) -> String {
create_json_from_struct(&self)
}
}
pub fn to_json(inputs: &BatchAddressAppendInputs) -> String {
let json_struct = BatchAddressAppendInputsJson::from_inputs(inputs);
json_struct.to_string()
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/batch_append_with_subtrees_json_formatter.rs
|
use crate::batch_append_with_subtrees::BatchAppendWithSubtreesCircuitInputs;
use crate::gnark::helpers::{big_int_to_string, create_json_from_struct};
use num_traits::ToPrimitive;
use serde::Serialize;
#[derive(Serialize, Debug)]
pub struct BatchAppendWithSubtreesJsonStruct {
#[serde(rename(serialize = "publicInputHash"))]
pub public_input_hash: String,
#[serde(rename(serialize = "oldSubTreeHashChain"))]
pub old_sub_tree_hash_chain: String,
#[serde(rename(serialize = "newSubTreeHashChain"))]
pub new_sub_tree_hash_chain: String,
#[serde(rename(serialize = "newRoot"))]
pub new_root: String,
#[serde(rename(serialize = "hashchainHash"))]
pub hashchain_hash: String,
#[serde(rename(serialize = "startIndex"))]
pub start_index: u32,
#[serde(rename(serialize = "treeHeight"))]
pub tree_height: u32,
#[serde(rename(serialize = "leaves"))]
pub leaves: Vec<String>,
#[serde(rename(serialize = "subtrees"))]
pub subtrees: Vec<String>,
}
impl BatchAppendWithSubtreesJsonStruct {
pub fn from_append_inputs(inputs: &BatchAppendWithSubtreesCircuitInputs) -> Self {
let public_input_hash = big_int_to_string(&inputs.public_input_hash);
let old_sub_tree_hash_chain = big_int_to_string(&inputs.old_sub_tree_hash_chain);
let new_sub_tree_hash_chain = big_int_to_string(&inputs.new_sub_tree_hash_chain);
let new_root = big_int_to_string(&inputs.new_root);
let hashchain_hash = big_int_to_string(&inputs.hashchain_hash);
let start_index = inputs.start_index.to_u32().unwrap();
let tree_height = inputs.tree_height.to_u32().unwrap();
let leaves = inputs
.leaves
.iter()
.map(big_int_to_string)
.collect::<Vec<String>>();
let subtrees = inputs
.subtrees
.iter()
.map(big_int_to_string)
.collect::<Vec<String>>();
Self {
public_input_hash,
old_sub_tree_hash_chain,
new_sub_tree_hash_chain,
new_root,
hashchain_hash,
start_index,
tree_height,
leaves,
subtrees,
}
}
#[allow(clippy::inherent_to_string)]
pub fn to_string(&self) -> String {
create_json_from_struct(&self)
}
}
pub fn append_inputs_string(inputs: &BatchAppendWithSubtreesCircuitInputs) -> String {
let json_struct = BatchAppendWithSubtreesJsonStruct::from_append_inputs(inputs);
json_struct.to_string()
}
pub fn new_with_append_inputs() -> (
BatchAppendWithSubtreesJsonStruct,
BatchAppendWithSubtreesCircuitInputs,
) {
let append_inputs = BatchAppendWithSubtreesCircuitInputs::default();
let json_struct = BatchAppendWithSubtreesJsonStruct {
public_input_hash: big_int_to_string(&append_inputs.public_input_hash),
old_sub_tree_hash_chain: big_int_to_string(&append_inputs.old_sub_tree_hash_chain),
new_sub_tree_hash_chain: big_int_to_string(&append_inputs.new_sub_tree_hash_chain),
new_root: big_int_to_string(&append_inputs.new_root),
hashchain_hash: big_int_to_string(&append_inputs.hashchain_hash),
start_index: append_inputs.start_index.to_u32().unwrap(),
tree_height: append_inputs.tree_height.to_u32().unwrap(),
leaves: append_inputs
.leaves
.iter()
.map(big_int_to_string)
.collect::<Vec<String>>(),
subtrees: append_inputs
.subtrees
.iter()
.map(big_int_to_string)
.collect::<Vec<String>>(),
};
(json_struct, append_inputs)
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/batch_append_with_proofs_json_formatter.rs
|
use serde::Serialize;
use crate::batch_append_with_proofs::BatchAppendWithProofsCircuitInputs;
use super::helpers::{big_int_to_string, create_json_from_struct};
#[derive(Debug, Clone, Serialize)]
pub struct BatchAppendWithProofsInputsJson {
#[serde(rename = "publicInputHash")]
public_input_hash: String,
#[serde(rename = "oldRoot")]
old_root: String,
#[serde(rename = "newRoot")]
new_root: String,
#[serde(rename = "leavesHashchainHash")]
leaves_hashchain_hash: String,
#[serde(rename = "startIndex")]
start_index: u32,
#[serde(rename = "oldLeaves")]
old_leaves: Vec<String>,
#[serde(rename = "leaves")]
leaves: Vec<String>,
#[serde(rename = "merkleProofs")]
merkle_proofs: Vec<Vec<String>>,
#[serde(rename = "height")]
height: u32,
#[serde(rename = "batchSize")]
batch_size: u32,
}
impl BatchAppendWithProofsInputsJson {
pub fn from_inputs(inputs: &BatchAppendWithProofsCircuitInputs) -> Self {
Self {
public_input_hash: big_int_to_string(&inputs.public_input_hash),
old_root: big_int_to_string(&inputs.old_root),
new_root: big_int_to_string(&inputs.new_root),
leaves_hashchain_hash: big_int_to_string(&inputs.leaves_hashchain_hash),
start_index: inputs.start_index,
old_leaves: inputs.old_leaves.iter().map(big_int_to_string).collect(),
leaves: inputs.leaves.iter().map(big_int_to_string).collect(),
merkle_proofs: inputs
.merkle_proofs
.iter()
.map(|proof| proof.iter().map(big_int_to_string).collect())
.collect(),
height: inputs.height,
batch_size: inputs.batch_size,
}
}
#[allow(clippy::inherent_to_string)]
pub fn to_string(&self) -> String {
create_json_from_struct(&self)
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/inclusion_json_formatter.rs
|
use crate::gnark::helpers::{big_int_to_string, create_json_from_struct};
use crate::{
inclusion::{
merkle_inclusion_proof_inputs::{InclusionMerkleProofInputs, InclusionProofInputs},
merkle_tree_info::MerkleTreeInfo,
},
init_merkle_tree::inclusion_merkle_tree_inputs,
};
use num_traits::ToPrimitive;
use serde::Serialize;
#[derive(Serialize, Debug)]
pub struct BatchInclusionJsonStruct {
#[serde(rename(serialize = "input-compressed-accounts"))]
pub inputs: Vec<InclusionJsonStruct>,
}
#[allow(non_snake_case)]
#[derive(Serialize, Clone, Debug)]
pub struct InclusionJsonStruct {
root: String,
leaf: String,
pathIndex: u32,
pathElements: Vec<String>,
}
impl BatchInclusionJsonStruct {
fn new_with_public_inputs(number_of_utxos: usize) -> (Self, InclusionMerkleProofInputs) {
let merkle_inputs = inclusion_merkle_tree_inputs(MerkleTreeInfo::H26);
let input = InclusionJsonStruct {
root: big_int_to_string(&merkle_inputs.root),
leaf: big_int_to_string(&merkle_inputs.leaf),
pathElements: merkle_inputs
.path_elements
.iter()
.map(big_int_to_string)
.collect(),
pathIndex: merkle_inputs.path_index.to_u32().unwrap(),
};
let inputs = vec![input; number_of_utxos];
(Self { inputs }, merkle_inputs)
}
#[allow(clippy::inherent_to_string)]
pub fn to_string(&self) -> String {
create_json_from_struct(&self)
}
pub fn from_inclusion_proof_inputs(inputs: &InclusionProofInputs) -> Self {
let mut proof_inputs: Vec<InclusionJsonStruct> = Vec::new();
for input in inputs.0 {
let prof_input = InclusionJsonStruct {
root: big_int_to_string(&input.root),
leaf: big_int_to_string(&input.leaf),
pathIndex: input.path_index.to_u32().unwrap(),
pathElements: input.path_elements.iter().map(big_int_to_string).collect(),
};
proof_inputs.push(prof_input);
}
Self {
inputs: proof_inputs,
}
}
}
pub fn inclusion_inputs_string(number_of_utxos: usize) -> (String, InclusionMerkleProofInputs) {
let (json_struct, public_inputs) =
BatchInclusionJsonStruct::new_with_public_inputs(number_of_utxos);
(json_struct.to_string(), public_inputs)
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/helpers.rs
|
use log::info;
use std::{
ffi::OsStr,
fmt::{Display, Formatter},
process::Command,
sync::atomic::{AtomicBool, Ordering},
time::Duration,
};
use crate::gnark::constants::{HEALTH_CHECK, SERVER_ADDRESS};
use num_bigint::{BigInt, BigUint};
use num_traits::ToPrimitive;
use serde::Serialize;
use serde_json::json;
use sysinfo::{Signal, System};
static IS_LOADING: AtomicBool = AtomicBool::new(false);
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ProverMode {
Rpc,
Forester,
ForesterTest,
Full,
FullTest,
}
impl Display for ProverMode {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
ProverMode::Rpc => "rpc",
ProverMode::Forester => "forester",
ProverMode::ForesterTest => "forester-test",
ProverMode::Full => "full",
ProverMode::FullTest => "full-test",
}
)
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ProofType {
Inclusion,
NonInclusion,
Combined,
BatchAppend,
BatchUpdate,
BatchAddressAppend,
BatchAppendWithSubtreesTest,
BatchUpdateTest,
BatchAppendWithProofsTest,
BatchAddressAppendTest,
}
impl Display for ProofType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
ProofType::Inclusion => "inclusion",
ProofType::NonInclusion => "non-inclusion",
ProofType::Combined => "combined",
ProofType::BatchAppend => "append",
ProofType::BatchUpdate => "update",
ProofType::BatchAppendWithSubtreesTest => "append-with-subtrees-test",
ProofType::BatchUpdateTest => "update-test",
ProofType::BatchAppendWithProofsTest => "append-with-proofs-test",
ProofType::BatchAddressAppend => "address-append",
ProofType::BatchAddressAppendTest => "address-append-test",
}
)
}
}
#[derive(Debug, Clone)]
pub struct ProverConfig {
pub run_mode: Option<ProverMode>,
pub circuits: Vec<ProofType>,
}
pub async fn spawn_prover(restart: bool, config: ProverConfig) {
if let Some(_project_root) = get_project_root() {
let prover_path: &str = {
#[cfg(feature = "devenv")]
{
&format!("{}/{}", _project_root.trim(), "cli/test_bin/run")
}
#[cfg(not(feature = "devenv"))]
{
"light"
}
};
if restart {
println!("Killing prover...");
kill_prover();
}
if !health_check(1, 3).await && !IS_LOADING.load(Ordering::Relaxed) {
IS_LOADING.store(true, Ordering::Relaxed);
let mut command = Command::new(prover_path);
command.arg("start-prover");
if let Some(ref mode) = config.run_mode {
command.arg("--run-mode").arg(mode.to_string());
}
for circuit in config.circuits.clone() {
command.arg("--circuit").arg(circuit.to_string());
}
println!("Starting prover with command: {:?}", command);
let _ = command.spawn().expect("Failed to start prover process");
let health_result = health_check(20, 5).await;
if health_result {
info!("Prover started successfully");
} else {
panic!("Prover failed to start");
}
IS_LOADING.store(false, Ordering::Relaxed);
}
} else {
panic!("Failed to determine the project root directory");
}
}
pub fn kill_process(process_name: &str) {
let mut system = System::new_all();
system.refresh_all();
for process in system.processes().values() {
let process_name_str = process.name().to_string_lossy();
let process_cmd = process.cmd().join(OsStr::new(" "));
let process_cmd_str = process_cmd.to_string_lossy();
// Match the exact process name
if process_name_str.contains(process_name) {
println!(
"Attempting to kill process: PID={}, Name={}, Cmd={}",
process.pid(),
process_name_str,
process_cmd_str
);
if process.kill_with(Signal::Kill).is_some() {
println!("Successfully killed process: PID={}", process.pid());
} else {
eprintln!("Failed to kill process: PID={}", process.pid());
}
}
}
// Double-check if processes are still running
system.refresh_all();
let remaining_processes: Vec<_> = system
.processes()
.values()
.filter(|process| {
let process_name_str = process.name().to_string_lossy();
process_name_str == process_name
})
.collect();
if !remaining_processes.is_empty() {
eprintln!(
"Warning: {} processes still running after kill attempt",
remaining_processes.len()
);
for process in remaining_processes {
eprintln!(
"Remaining process: PID={}, Name={}, Cmd={}",
process.pid(),
process.name().to_string_lossy(),
process.cmd().join(OsStr::new(" ")).to_string_lossy()
);
}
}
}
pub fn kill_prover() {
kill_process("prover");
}
pub async fn health_check(retries: usize, timeout: usize) -> bool {
let client = reqwest::Client::new();
let mut result = false;
for _ in 0..retries {
match client
.get(&format!("{}{}", SERVER_ADDRESS, HEALTH_CHECK))
.send()
.await
{
Ok(_) => {
result = true;
break;
}
Err(_) => {
tokio::time::sleep(Duration::from_secs(timeout as u64)).await;
}
}
}
result
}
pub fn get_project_root() -> Option<String> {
let output = Command::new("git")
.args(["rev-parse", "--show-toplevel"])
.output()
.ok()?;
if output.status.success() {
String::from_utf8(output.stdout).ok()
} else {
None
}
}
pub fn big_uint_to_string(big_uint: &BigUint) -> String {
format!("0x{}", big_uint.to_str_radix(16))
}
pub fn big_int_to_string(big_int: &BigInt) -> String {
format!("0x{}", big_int.to_str_radix(16))
}
pub fn create_vec_of_string(number_of_utxos: usize, element: &BigInt) -> Vec<String> {
vec![big_int_to_string(element); number_of_utxos]
}
pub fn create_vec_of_u32(number_of_utxos: usize, element: &BigInt) -> Vec<u32> {
vec![element.to_u32().unwrap(); number_of_utxos]
}
pub fn create_vec_of_vec_of_string(
number_of_utxos: usize,
elements: &[BigInt],
) -> Vec<Vec<String>> {
let vec: Vec<String> = elements
.iter()
.map(|e| format!("0x{}", e.to_str_radix(16)))
.collect();
vec![vec; number_of_utxos]
}
pub fn create_json_from_struct<T>(json_struct: &T) -> String
where
T: Serialize,
{
let json = json!(json_struct);
match serde_json::to_string_pretty(&json) {
Ok(json) => json,
Err(_) => panic!("Merkle tree data invalid"),
}
}
#[derive(Debug)]
pub struct LightValidatorConfig {
pub enable_indexer: bool,
pub prover_config: Option<ProverConfig>,
pub wait_time: u64,
}
impl Default for LightValidatorConfig {
fn default() -> Self {
Self {
enable_indexer: false,
prover_config: None,
wait_time: 35,
}
}
}
pub async fn spawn_validator(config: LightValidatorConfig) {
if let Some(project_root) = get_project_root() {
let path = "cli/test_bin/run test-validator";
let mut path = format!("{}/{}", project_root.trim(), path);
if !config.enable_indexer {
path.push_str(" --skip-indexer");
}
if let Some(prover_config) = config.prover_config {
prover_config.circuits.iter().for_each(|circuit| {
path.push_str(&format!(" --circuit {}", circuit));
});
if let Some(prover_mode) = prover_config.run_mode {
path.push_str(&format!(" --prover-run-mode {}", prover_mode));
}
} else {
path.push_str(" --skip-prover");
}
println!("Starting validator with command: {}", path);
Command::new("sh")
.arg("-c")
.arg(path)
.spawn()
.expect("Failed to start server process");
tokio::time::sleep(tokio::time::Duration::from_secs(config.wait_time)).await;
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/mod.rs
|
pub mod batch_address_append_json_formatter;
pub mod batch_append_with_proofs_json_formatter;
pub mod batch_append_with_subtrees_json_formatter;
pub mod batch_update_json_formatter;
pub mod combined_json_formatter;
pub mod constants;
pub mod helpers;
pub mod inclusion_json_formatter;
pub mod non_inclusion_json_formatter;
pub mod proof_helpers;
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/gnark/batch_update_json_formatter.rs
|
use crate::{
batch_update::BatchUpdateCircuitInputs,
gnark::helpers::{big_int_to_string, create_json_from_struct},
};
use serde::Serialize;
#[derive(Serialize, Debug)]
pub struct BatchUpdateProofInputsJson {
#[serde(rename(serialize = "publicInputHash"))]
pub public_input_hash: String,
#[serde(rename(serialize = "oldRoot"))]
pub old_root: String,
#[serde(rename(serialize = "newRoot"))]
pub new_root: String,
#[serde(rename(serialize = "leavesHashchainHash"))]
pub leaves_hashchain_hash: String,
#[serde(rename(serialize = "leaves"))]
pub leaves: Vec<String>,
#[serde(rename(serialize = "oldLeaves"))]
pub old_leaves: Vec<String>,
#[serde(rename(serialize = "newMerkleProofs"))]
pub merkle_proofs: Vec<Vec<String>>,
#[serde(rename(serialize = "pathIndices"))]
pub path_indices: Vec<u32>,
#[serde(rename(serialize = "height"))]
pub height: u32,
#[serde(rename(serialize = "batchSize"))]
pub batch_size: u32,
#[serde(rename(serialize = "txHashes"))]
pub tx_hashes: Vec<String>,
}
#[derive(Serialize, Debug)]
pub struct BatchUpdateParametersJson {
#[serde(rename(serialize = "batch-update-inputs"))]
pub inputs: BatchUpdateProofInputsJson,
}
impl BatchUpdateProofInputsJson {
pub fn from_update_inputs(inputs: &BatchUpdateCircuitInputs) -> Self {
let public_input_hash = big_int_to_string(&inputs.public_input_hash);
let old_root = big_int_to_string(&inputs.old_root);
let new_root = big_int_to_string(&inputs.new_root);
let leaves_hashchain_hash = big_int_to_string(&inputs.leaves_hashchain_hash);
let leaves = inputs
.leaves
.iter()
.map(big_int_to_string)
.collect::<Vec<String>>();
let old_leaves = inputs.old_leaves.iter().map(big_int_to_string).collect();
let merkle_proofs = inputs
.merkle_proofs
.iter()
.map(|proof| proof.iter().map(big_int_to_string).collect())
.collect();
let path_indices = inputs.path_indices.clone();
let height = inputs.height;
let batch_size = inputs.batch_size;
let tx_hashes = inputs
.tx_hashes
.iter()
.map(big_int_to_string)
.collect::<Vec<String>>();
Self {
public_input_hash,
old_root,
new_root,
leaves_hashchain_hash,
leaves,
old_leaves,
merkle_proofs,
path_indices,
height,
batch_size,
tx_hashes,
}
}
#[allow(clippy::inherent_to_string)]
pub fn to_string(&self) -> String {
create_json_from_struct(&self)
}
}
pub fn update_inputs_string(inputs: &BatchUpdateCircuitInputs) -> String {
let json_struct = BatchUpdateProofInputsJson::from_update_inputs(inputs);
json_struct.to_string()
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/inclusion/merkle_inclusion_proof_inputs.rs
|
use crate::helpers::bigint_to_u8_32;
use num_bigint::BigInt;
#[derive(Clone, Debug)]
pub struct InclusionMerkleProofInputs {
pub root: BigInt,
pub leaf: BigInt,
pub path_index: BigInt,
pub path_elements: Vec<BigInt>,
}
impl InclusionMerkleProofInputs {
pub fn public_inputs_arr(&self) -> [[u8; 32]; 2] {
let root = bigint_to_u8_32(&self.root).unwrap();
let leaf = bigint_to_u8_32(&self.leaf).unwrap();
[root, leaf]
}
}
#[derive(Clone, Debug)]
pub struct InclusionProofInputs<'a>(pub &'a [InclusionMerkleProofInputs]);
impl InclusionProofInputs<'_> {
pub fn public_inputs(&self) -> Vec<[u8; 32]> {
let mut roots = Vec::new();
let mut leaves = Vec::new();
for input in self.0 {
let input_arr = input.public_inputs_arr();
roots.push(input_arr[0]);
leaves.push(input_arr[1]);
}
[roots, leaves].concat()
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/inclusion/mod.rs
|
pub mod merkle_inclusion_proof_inputs;
pub mod merkle_tree_info;
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/inclusion/merkle_tree_info.rs
|
use std::fmt;
#[derive(Clone, Debug)]
pub enum MerkleTreeInfo {
H26,
}
impl MerkleTreeInfo {
pub fn height(&self) -> u8 {
match self {
MerkleTreeInfo::H26 => 26,
}
}
pub fn test_zk_path(&self, num_of_utxos: usize) -> String {
format!(
"test-data/i_{}_{}/i_{}_{}.zkey",
self.height(),
num_of_utxos,
self.height(),
num_of_utxos
)
}
pub fn test_wasm_path(&self, num_of_utxos: usize) -> String {
format!(
"test-data/i_{}_{}/i_{}_{}.wasm",
self.height(),
num_of_utxos,
self.height(),
num_of_utxos
)
}
}
impl fmt::Display for MerkleTreeInfo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.height())
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/non_inclusion/mod.rs
|
pub mod merkle_non_inclusion_proof_inputs;
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/non_inclusion/merkle_non_inclusion_proof_inputs.rs
|
use crate::helpers::bigint_to_u8_32;
use light_indexed_merkle_tree::array::IndexedArray;
use num_bigint::{BigInt, BigUint};
use num_traits::ops::bytes::FromBytes;
#[derive(Clone, Debug)]
pub struct NonInclusionMerkleProofInputs {
pub root: BigInt,
pub value: BigInt,
pub leaf_lower_range_value: BigInt,
pub leaf_higher_range_value: BigInt,
pub next_index: BigInt,
pub merkle_proof_hashed_indexed_element_leaf: Vec<BigInt>,
pub index_hashed_indexed_element_leaf: BigInt,
}
impl NonInclusionMerkleProofInputs {
pub fn public_inputs_arr(&self) -> [[u8; 32]; 2] {
let root = bigint_to_u8_32(&self.root).unwrap();
let value = bigint_to_u8_32(&self.value).unwrap();
[root, value]
}
}
#[derive(Clone, Debug)]
pub struct NonInclusionProofInputs<'a>(pub &'a [NonInclusionMerkleProofInputs]);
// TODO: eliminate use of BigInt in favor of BigUint
pub fn get_non_inclusion_proof_inputs(
value: &[u8; 32],
merkle_tree: &light_indexed_merkle_tree::reference::IndexedMerkleTree<
light_hasher::Poseidon,
usize,
>,
indexed_array: &IndexedArray<light_hasher::Poseidon, usize>,
) -> NonInclusionMerkleProofInputs {
let non_inclusion_proof = merkle_tree
.get_non_inclusion_proof(&BigUint::from_be_bytes(value), indexed_array)
.unwrap();
let proof = non_inclusion_proof
.merkle_proof
.iter()
.map(|x| BigInt::from_be_bytes(x))
.collect();
NonInclusionMerkleProofInputs {
root: BigInt::from_be_bytes(merkle_tree.root().as_slice()),
value: BigInt::from_be_bytes(value),
leaf_lower_range_value: BigInt::from_be_bytes(&non_inclusion_proof.leaf_lower_range_value),
leaf_higher_range_value: BigInt::from_be_bytes(
&non_inclusion_proof.leaf_higher_range_value,
),
next_index: BigInt::from(non_inclusion_proof.next_index),
merkle_proof_hashed_indexed_element_leaf: proof,
index_hashed_indexed_element_leaf: BigInt::from(non_inclusion_proof.leaf_index),
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/Cargo.toml
|
[package]
name = "light-verifier"
version = "1.1.0"
description = "ZKP proof verifier used in Light Protocol"
repository = "https://github.com/Lightprotocol/light-protocol"
license = "Apache-2.0"
edition = "2021"
[features]
solana = ["solana-program"]
[dependencies]
groth16-solana = "0.0.3"
thiserror = "1.0"
borsh = "0.10"
solana-program = { workspace = true, optional = true }
[dev-dependencies]
tokio = { workspace = true }
reqwest = { version = "0.11.24", features = ["json", "rustls-tls"] }
light-prover-client = { path = "../light-prover-client", version = "1.2.0" }
serial_test = "3.2.0"
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/tests/test.rs
|
#[cfg(test)]
mod test {
use light_prover_client::gnark::helpers::{ProofType, ProverConfig};
use light_prover_client::{
gnark::{
constants::{PROVE_PATH, SERVER_ADDRESS},
helpers::{kill_prover, spawn_prover},
inclusion_json_formatter::inclusion_inputs_string,
proof_helpers::{compress_proof, deserialize_gnark_proof_json, proof_from_json_struct},
},
helpers::init_logger,
};
use light_verifier::{verify_merkle_proof_zkp, CompressedProof};
use reqwest::Client;
use serial_test::serial;
#[serial]
#[tokio::test]
async fn prove_inclusion() {
init_logger();
spawn_prover(
true,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::Inclusion],
},
)
.await;
let client = Client::new();
for number_of_compressed_accounts in &[1usize, 2, 3] {
let (inputs, big_int_inputs) = inclusion_inputs_string(*number_of_compressed_accounts);
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs)
.send()
.await
.expect("Failed to execute request.");
assert!(response_result.status().is_success());
let body = response_result.text().await.unwrap();
let proof_json = deserialize_gnark_proof_json(&body).unwrap();
let (proof_a, proof_b, proof_c) = proof_from_json_struct(proof_json);
let (proof_a, proof_b, proof_c) = compress_proof(&proof_a, &proof_b, &proof_c);
let mut roots = Vec::<[u8; 32]>::new();
let mut leaves = Vec::<[u8; 32]>::new();
for _ in 0..*number_of_compressed_accounts {
roots.push(big_int_inputs.root.to_bytes_be().1.try_into().unwrap());
leaves.push(big_int_inputs.leaf.to_bytes_be().1.try_into().unwrap());
}
verify_merkle_proof_zkp(
&roots,
&leaves,
&CompressedProof {
a: proof_a,
b: proof_b,
c: proof_c,
},
)
.unwrap();
}
kill_prover();
}
#[tokio::test]
#[ignore]
async fn prove_inclusion_full() {
init_logger();
spawn_prover(
false,
ProverConfig {
run_mode: None,
circuits: vec![ProofType::Inclusion],
},
)
.await;
let client = Client::new();
for number_of_compressed_accounts in &[1usize, 2, 3, 4, 8] {
let (inputs, big_int_inputs) = inclusion_inputs_string(*number_of_compressed_accounts);
let response_result = client
.post(&format!("{}{}", SERVER_ADDRESS, PROVE_PATH))
.header("Content-Type", "text/plain; charset=utf-8")
.body(inputs)
.send()
.await
.expect("Failed to execute request.");
assert!(response_result.status().is_success());
let body = response_result.text().await.unwrap();
let proof_json = deserialize_gnark_proof_json(&body).unwrap();
let (proof_a, proof_b, proof_c) = proof_from_json_struct(proof_json);
let (proof_a, proof_b, proof_c) = compress_proof(&proof_a, &proof_b, &proof_c);
let mut roots = Vec::<[u8; 32]>::new();
let mut leaves = Vec::<[u8; 32]>::new();
for _ in 0..*number_of_compressed_accounts {
roots.push(big_int_inputs.root.to_bytes_be().1.try_into().unwrap());
leaves.push(big_int_inputs.leaf.to_bytes_be().1.try_into().unwrap());
}
verify_merkle_proof_zkp(
&roots,
&leaves,
&CompressedProof {
a: proof_a,
b: proof_b,
c: proof_c,
},
)
.unwrap();
}
kill_prover();
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/lib.rs
|
use borsh::{BorshDeserialize, BorshSerialize};
use groth16_solana::decompression::{decompress_g1, decompress_g2};
use groth16_solana::groth16::{Groth16Verifier, Groth16Verifyingkey};
use thiserror::Error;
pub mod verifying_keys;
#[derive(Debug, Error)]
pub enum VerifierError {
#[error("PublicInputsTryIntoFailed")]
PublicInputsTryIntoFailed,
#[error("DecompressG1Failed")]
DecompressG1Failed,
#[error("DecompressG2Failed")]
DecompressG2Failed,
#[error("InvalidPublicInputsLength")]
InvalidPublicInputsLength,
#[error("CreateGroth16VerifierFailed")]
CreateGroth16VerifierFailed,
#[error("ProofVerificationFailed")]
ProofVerificationFailed,
}
#[cfg(feature = "solana")]
impl From<VerifierError> for u32 {
fn from(e: VerifierError) -> u32 {
match e {
VerifierError::PublicInputsTryIntoFailed => 13001,
VerifierError::DecompressG1Failed => 13002,
VerifierError::DecompressG2Failed => 13003,
VerifierError::InvalidPublicInputsLength => 13004,
VerifierError::CreateGroth16VerifierFailed => 13005,
VerifierError::ProofVerificationFailed => 13006,
}
}
}
#[cfg(feature = "solana")]
impl From<VerifierError> for solana_program::program_error::ProgramError {
fn from(e: VerifierError) -> Self {
solana_program::program_error::ProgramError::Custom(e.into())
}
}
use VerifierError::*;
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
pub struct CompressedProof {
pub a: [u8; 32],
pub b: [u8; 64],
pub c: [u8; 32],
}
impl Default for CompressedProof {
fn default() -> Self {
Self {
a: [0; 32],
b: [0; 64],
c: [0; 32],
}
}
}
pub fn verify_create_addresses_zkp(
address_roots: &[[u8; 32]],
addresses: &[[u8; 32]],
compressed_proof: &CompressedProof,
) -> Result<(), VerifierError> {
let public_inputs = [address_roots, addresses].concat();
match addresses.len() {
1 => verify::<2>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::non_inclusion_26_1::VERIFYINGKEY,
),
2 => verify::<4>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::non_inclusion_26_2::VERIFYINGKEY,
),
_ => Err(InvalidPublicInputsLength),
}
}
#[inline(never)]
pub fn verify_create_addresses_and_merkle_proof_zkp(
roots: &[[u8; 32]],
leaves: &[[u8; 32]],
address_roots: &[[u8; 32]],
addresses: &[[u8; 32]],
compressed_proof: &CompressedProof,
) -> Result<(), VerifierError> {
let public_inputs = [roots, leaves, address_roots, addresses].concat();
// The public inputs are expected to be a multiple of 2
// 4 inputs means 1 inclusion proof (1 root, 1 leaf, 1 address root, 1 created address)
// 6 inputs means 1 inclusion proof (1 root, 1 leaf, 2 address roots, 2 created address) or
// 6 inputs means 2 inclusion proofs (2 roots and 2 leaves, 1 address root, 1 created address)
// 8 inputs means 2 inclusion proofs (2 roots and 2 leaves, 2 address roots, 2 created address) or
// 8 inputs means 3 inclusion proofs (3 roots and 3 leaves, 1 address root, 1 created address)
// 10 inputs means 3 inclusion proofs (3 roots and 3 leaves, 2 address roots, 2 created address) or
// 10 inputs means 4 inclusion proofs (4 roots and 4 leaves, 1 address root, 1 created address)
// 12 inputs means 4 inclusion proofs (4 roots and 4 leaves, 2 address roots, 2 created address)
match public_inputs.len() {
4 => verify::<4>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::combined_26_1_1::VERIFYINGKEY,
),
6 => {
let verifying_key = if address_roots.len() == 1 {
&crate::verifying_keys::combined_26_2_1::VERIFYINGKEY
} else {
&crate::verifying_keys::combined_26_1_2::VERIFYINGKEY
};
verify::<6>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
verifying_key,
)
}
8 => {
let verifying_key = if address_roots.len() == 1 {
&crate::verifying_keys::combined_26_3_1::VERIFYINGKEY
} else {
&crate::verifying_keys::combined_26_2_2::VERIFYINGKEY
};
verify::<8>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
verifying_key,
)
}
10 => {
let verifying_key = if address_roots.len() == 1 {
&crate::verifying_keys::combined_26_4_1::VERIFYINGKEY
} else {
&crate::verifying_keys::combined_26_3_2::VERIFYINGKEY
};
verify::<10>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
verifying_key,
)
}
12 => verify::<12>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::combined_26_4_2::VERIFYINGKEY,
),
_ => Err(crate::InvalidPublicInputsLength),
}
}
#[inline(never)]
pub fn verify_merkle_proof_zkp(
roots: &[[u8; 32]],
leaves: &[[u8; 32]],
compressed_proof: &CompressedProof,
) -> Result<(), VerifierError> {
let public_inputs = [roots, leaves].concat();
// The public inputs are expected to be a multiple of 2
// 2 inputs means 1 inclusion proof (1 root and 1 leaf)
// 4 inputs means 2 inclusion proofs (2 roots and 2 leaves)
// 6 inputs means 3 inclusion proofs (3 roots and 3 leaves)
// 8 inputs means 4 inclusion proofs (4 roots and 4 leaves)
// 16 inputs means 8 inclusion proofs (8 roots and 8 leaves)
match public_inputs.len() {
2 => verify::<2>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::inclusion_26_1::VERIFYINGKEY,
),
4 => verify::<4>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::inclusion_26_2::VERIFYINGKEY,
),
6 => verify::<6>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::inclusion_26_3::VERIFYINGKEY,
),
8 => verify::<8>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::inclusion_26_4::VERIFYINGKEY,
),
16 => verify::<16>(
&public_inputs
.try_into()
.map_err(|_| PublicInputsTryIntoFailed)?,
compressed_proof,
&crate::verifying_keys::inclusion_26_8::VERIFYINGKEY,
),
_ => Err(crate::InvalidPublicInputsLength),
}
}
#[inline(never)]
fn verify<const N: usize>(
public_inputs: &[[u8; 32]; N],
proof: &CompressedProof,
vk: &Groth16Verifyingkey,
) -> Result<(), VerifierError> {
let proof_a = decompress_g1(&proof.a).map_err(|_| crate::DecompressG1Failed)?;
let proof_b = decompress_g2(&proof.b).map_err(|_| crate::DecompressG2Failed)?;
let proof_c = decompress_g1(&proof.c).map_err(|_| crate::DecompressG1Failed)?;
let mut verifier = Groth16Verifier::new(&proof_a, &proof_b, &proof_c, public_inputs, vk)
.map_err(|_| CreateGroth16VerifierFailed)?;
verifier.verify().map_err(|_| {
#[cfg(target_os = "solana")]
{
use solana_program::msg;
msg!("Proof verification failed");
msg!("Public inputs: {:?}", public_inputs);
msg!("Proof A: {:?}", proof_a);
msg!("Proof B: {:?}", proof_b);
msg!("Proof C: {:?}", proof_c);
}
ProofVerificationFailed
})?;
Ok(())
}
#[inline(never)]
pub fn verify_batch_append(
batch_size: usize,
public_input_hash: [u8; 32],
compressed_proof: &CompressedProof,
) -> Result<(), VerifierError> {
match batch_size {
1 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_subtrees_26_1::VERIFYINGKEY,
),
10 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_subtrees_26_10::VERIFYINGKEY,
),
100 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_subtrees_26_100::VERIFYINGKEY,
),
500 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_subtrees_26_500::VERIFYINGKEY,
),
1000 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_subtrees_26_1000::VERIFYINGKEY,
),
_ => Err(crate::InvalidPublicInputsLength),
}
}
#[inline(never)]
pub fn verify_batch_append2(
batch_size: usize,
public_input_hash: [u8; 32],
compressed_proof: &CompressedProof,
) -> Result<(), VerifierError> {
match batch_size {
1 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_proofs_26_1::VERIFYINGKEY,
),
10 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_proofs_26_10::VERIFYINGKEY,
),
100 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_proofs_26_100::VERIFYINGKEY,
),
500 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_proofs_26_500::VERIFYINGKEY,
),
1000 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::append_with_proofs_26_1000::VERIFYINGKEY,
),
_ => Err(crate::InvalidPublicInputsLength),
}
}
#[inline(never)]
pub fn verify_batch_update(
batch_size: usize,
public_input_hash: [u8; 32],
compressed_proof: &CompressedProof,
) -> Result<(), VerifierError> {
match batch_size {
1 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::update_26_1::VERIFYINGKEY,
),
10 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::update_26_10::VERIFYINGKEY,
),
100 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::update_26_100::VERIFYINGKEY,
),
500 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::update_26_500::VERIFYINGKEY,
),
1000 => verify::<1>(
&[public_input_hash],
compressed_proof,
&crate::verifying_keys::update_26_1000::VERIFYINGKEY,
),
_ => Err(crate::InvalidPublicInputsLength),
}
}
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/address_append_26_1.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
6u8, 11u8, 13u8, 147u8, 169u8, 154u8, 25u8, 26u8, 169u8, 97u8, 199u8, 74u8, 47u8, 169u8,
168u8, 176u8, 198u8, 109u8, 216u8, 248u8, 208u8, 21u8, 44u8, 131u8, 119u8, 133u8, 97u8,
225u8, 87u8, 21u8, 104u8, 96u8, 29u8, 169u8, 99u8, 31u8, 69u8, 166u8, 27u8, 47u8, 69u8,
96u8, 72u8, 78u8, 232u8, 204u8, 189u8, 114u8, 182u8, 21u8, 143u8, 202u8, 120u8, 54u8, 84u8,
34u8, 92u8, 244u8, 98u8, 94u8, 222u8, 236u8, 106u8, 214u8,
],
vk_beta_g2: [
19u8, 96u8, 125u8, 156u8, 68u8, 219u8, 220u8, 138u8, 249u8, 236u8, 56u8, 181u8, 204u8,
102u8, 232u8, 36u8, 97u8, 174u8, 238u8, 246u8, 219u8, 40u8, 255u8, 246u8, 214u8, 133u8,
117u8, 111u8, 233u8, 140u8, 200u8, 7u8, 40u8, 242u8, 215u8, 111u8, 229u8, 12u8, 236u8,
113u8, 9u8, 192u8, 106u8, 64u8, 170u8, 122u8, 136u8, 215u8, 80u8, 27u8, 125u8, 250u8,
101u8, 126u8, 47u8, 75u8, 244u8, 248u8, 153u8, 129u8, 82u8, 181u8, 176u8, 56u8, 35u8,
136u8, 36u8, 174u8, 13u8, 67u8, 176u8, 115u8, 50u8, 24u8, 30u8, 156u8, 123u8, 169u8, 63u8,
208u8, 194u8, 121u8, 61u8, 20u8, 120u8, 123u8, 148u8, 30u8, 104u8, 241u8, 37u8, 178u8,
114u8, 9u8, 217u8, 223u8, 44u8, 117u8, 53u8, 61u8, 148u8, 201u8, 176u8, 15u8, 136u8, 196u8,
204u8, 29u8, 243u8, 202u8, 34u8, 164u8, 121u8, 154u8, 174u8, 18u8, 98u8, 94u8, 179u8,
255u8, 169u8, 27u8, 203u8, 184u8, 185u8, 107u8, 72u8, 198u8,
],
vk_gamme_g2: [
29u8, 87u8, 152u8, 38u8, 120u8, 30u8, 152u8, 25u8, 184u8, 80u8, 234u8, 56u8, 96u8, 235u8,
95u8, 206u8, 63u8, 134u8, 38u8, 44u8, 66u8, 76u8, 100u8, 26u8, 47u8, 101u8, 200u8, 63u8,
59u8, 146u8, 119u8, 209u8, 42u8, 78u8, 203u8, 135u8, 13u8, 72u8, 20u8, 200u8, 151u8, 183u8,
112u8, 21u8, 6u8, 107u8, 100u8, 127u8, 59u8, 64u8, 56u8, 76u8, 40u8, 219u8, 193u8, 68u8,
144u8, 87u8, 149u8, 17u8, 53u8, 233u8, 161u8, 203u8, 10u8, 98u8, 68u8, 125u8, 22u8, 21u8,
97u8, 22u8, 129u8, 183u8, 118u8, 128u8, 177u8, 203u8, 165u8, 45u8, 97u8, 100u8, 222u8,
131u8, 1u8, 72u8, 96u8, 152u8, 157u8, 45u8, 127u8, 232u8, 21u8, 109u8, 132u8, 55u8, 18u8,
26u8, 215u8, 5u8, 197u8, 76u8, 125u8, 218u8, 162u8, 235u8, 182u8, 149u8, 97u8, 142u8,
238u8, 213u8, 121u8, 211u8, 19u8, 230u8, 72u8, 43u8, 23u8, 12u8, 59u8, 52u8, 255u8, 53u8,
179u8, 30u8, 46u8, 120u8,
],
vk_delta_g2: [
13u8, 137u8, 193u8, 187u8, 249u8, 206u8, 34u8, 204u8, 224u8, 126u8, 161u8, 1u8, 253u8,
90u8, 32u8, 170u8, 115u8, 41u8, 194u8, 173u8, 72u8, 174u8, 180u8, 236u8, 155u8, 14u8,
236u8, 42u8, 186u8, 117u8, 83u8, 13u8, 36u8, 227u8, 248u8, 176u8, 223u8, 174u8, 69u8,
118u8, 102u8, 224u8, 154u8, 5u8, 103u8, 172u8, 110u8, 227u8, 227u8, 103u8, 13u8, 170u8,
130u8, 36u8, 70u8, 254u8, 99u8, 69u8, 102u8, 26u8, 63u8, 179u8, 125u8, 207u8, 33u8, 127u8,
179u8, 133u8, 104u8, 0u8, 236u8, 49u8, 92u8, 51u8, 149u8, 193u8, 87u8, 62u8, 214u8, 206u8,
45u8, 242u8, 191u8, 35u8, 209u8, 32u8, 131u8, 150u8, 105u8, 194u8, 187u8, 138u8, 92u8,
228u8, 23u8, 162u8, 30u8, 225u8, 66u8, 110u8, 53u8, 199u8, 225u8, 254u8, 33u8, 25u8, 18u8,
184u8, 97u8, 82u8, 96u8, 25u8, 57u8, 79u8, 104u8, 3u8, 32u8, 103u8, 82u8, 35u8, 98u8,
191u8, 173u8, 152u8, 28u8, 5u8, 91u8, 230u8,
],
vk_ic: &[
[
2u8, 86u8, 48u8, 197u8, 63u8, 189u8, 160u8, 216u8, 183u8, 53u8, 8u8, 119u8, 93u8,
147u8, 124u8, 162u8, 166u8, 59u8, 175u8, 146u8, 87u8, 210u8, 234u8, 111u8, 52u8, 210u8,
245u8, 0u8, 106u8, 90u8, 9u8, 144u8, 30u8, 36u8, 234u8, 77u8, 221u8, 162u8, 86u8,
141u8, 62u8, 250u8, 236u8, 39u8, 57u8, 201u8, 238u8, 135u8, 94u8, 18u8, 95u8, 234u8,
126u8, 168u8, 172u8, 233u8, 81u8, 131u8, 133u8, 214u8, 48u8, 174u8, 82u8, 163u8,
],
[
10u8, 57u8, 105u8, 46u8, 216u8, 140u8, 24u8, 3u8, 193u8, 168u8, 201u8, 63u8, 29u8,
169u8, 124u8, 28u8, 247u8, 242u8, 187u8, 211u8, 146u8, 64u8, 2u8, 141u8, 182u8, 109u8,
87u8, 127u8, 139u8, 184u8, 182u8, 140u8, 7u8, 204u8, 12u8, 144u8, 8u8, 242u8, 95u8,
193u8, 230u8, 105u8, 95u8, 178u8, 43u8, 3u8, 197u8, 128u8, 133u8, 235u8, 240u8, 243u8,
170u8, 81u8, 22u8, 251u8, 168u8, 251u8, 7u8, 162u8, 42u8, 106u8, 235u8, 125u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_proofs_26_10.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
45u8, 48u8, 253u8, 51u8, 251u8, 66u8, 133u8, 85u8, 0u8, 102u8, 246u8, 219u8, 118u8, 107u8,
239u8, 10u8, 74u8, 252u8, 127u8, 162u8, 247u8, 116u8, 105u8, 17u8, 167u8, 2u8, 200u8, 12u8,
215u8, 86u8, 203u8, 54u8, 31u8, 204u8, 64u8, 107u8, 141u8, 173u8, 16u8, 158u8, 94u8, 69u8,
97u8, 253u8, 86u8, 210u8, 132u8, 18u8, 0u8, 232u8, 119u8, 58u8, 185u8, 188u8, 120u8, 105u8,
8u8, 82u8, 98u8, 102u8, 56u8, 17u8, 74u8, 91u8,
],
vk_beta_g2: [
46u8, 237u8, 55u8, 238u8, 243u8, 233u8, 182u8, 120u8, 120u8, 109u8, 216u8, 233u8, 20u8,
218u8, 150u8, 12u8, 237u8, 78u8, 237u8, 207u8, 232u8, 57u8, 185u8, 84u8, 224u8, 25u8, 52u8,
3u8, 232u8, 254u8, 175u8, 127u8, 18u8, 149u8, 225u8, 241u8, 225u8, 64u8, 86u8, 103u8, 24u8,
196u8, 159u8, 227u8, 132u8, 136u8, 119u8, 175u8, 111u8, 123u8, 116u8, 24u8, 200u8, 237u8,
151u8, 221u8, 176u8, 38u8, 55u8, 14u8, 204u8, 185u8, 176u8, 42u8, 30u8, 84u8, 77u8, 5u8,
203u8, 111u8, 97u8, 200u8, 229u8, 6u8, 150u8, 199u8, 137u8, 249u8, 105u8, 239u8, 55u8,
239u8, 6u8, 220u8, 33u8, 0u8, 13u8, 152u8, 174u8, 231u8, 119u8, 249u8, 233u8, 45u8, 14u8,
0u8, 11u8, 48u8, 55u8, 204u8, 186u8, 60u8, 160u8, 126u8, 192u8, 8u8, 86u8, 119u8, 235u8,
34u8, 178u8, 111u8, 120u8, 161u8, 12u8, 36u8, 203u8, 34u8, 23u8, 196u8, 76u8, 20u8, 211u8,
129u8, 50u8, 13u8, 195u8, 34u8,
],
vk_gamme_g2: [
37u8, 182u8, 104u8, 117u8, 107u8, 87u8, 15u8, 242u8, 199u8, 217u8, 45u8, 187u8, 94u8,
231u8, 107u8, 49u8, 44u8, 69u8, 254u8, 202u8, 43u8, 180u8, 32u8, 196u8, 80u8, 5u8, 152u8,
25u8, 82u8, 8u8, 36u8, 224u8, 16u8, 195u8, 204u8, 193u8, 208u8, 108u8, 41u8, 1u8, 136u8,
239u8, 168u8, 231u8, 29u8, 46u8, 179u8, 68u8, 210u8, 235u8, 233u8, 47u8, 75u8, 182u8, 45u8,
75u8, 117u8, 163u8, 14u8, 139u8, 94u8, 3u8, 99u8, 15u8, 14u8, 218u8, 183u8, 42u8, 83u8,
38u8, 140u8, 82u8, 218u8, 156u8, 140u8, 65u8, 64u8, 213u8, 136u8, 231u8, 94u8, 114u8, 12u8,
204u8, 77u8, 14u8, 128u8, 245u8, 238u8, 165u8, 215u8, 224u8, 218u8, 142u8, 104u8, 58u8,
2u8, 15u8, 239u8, 78u8, 75u8, 28u8, 220u8, 104u8, 145u8, 252u8, 7u8, 14u8, 254u8, 57u8,
113u8, 174u8, 11u8, 156u8, 190u8, 139u8, 90u8, 186u8, 203u8, 103u8, 32u8, 191u8, 199u8,
114u8, 247u8, 70u8, 92u8, 20u8,
],
vk_delta_g2: [
25u8, 249u8, 90u8, 181u8, 209u8, 214u8, 230u8, 176u8, 125u8, 63u8, 185u8, 223u8, 106u8,
177u8, 38u8, 249u8, 120u8, 34u8, 238u8, 122u8, 30u8, 183u8, 114u8, 115u8, 6u8, 60u8, 136u8,
52u8, 237u8, 90u8, 50u8, 216u8, 19u8, 111u8, 156u8, 60u8, 70u8, 17u8, 203u8, 135u8, 61u8,
76u8, 241u8, 235u8, 54u8, 131u8, 198u8, 103u8, 48u8, 172u8, 151u8, 69u8, 82u8, 202u8,
135u8, 195u8, 0u8, 76u8, 88u8, 3u8, 87u8, 62u8, 94u8, 177u8, 32u8, 183u8, 194u8, 244u8,
127u8, 4u8, 52u8, 189u8, 75u8, 59u8, 161u8, 167u8, 57u8, 45u8, 42u8, 144u8, 114u8, 37u8,
122u8, 137u8, 192u8, 32u8, 253u8, 249u8, 247u8, 163u8, 80u8, 133u8, 15u8, 194u8, 70u8,
50u8, 47u8, 69u8, 7u8, 181u8, 16u8, 197u8, 109u8, 150u8, 59u8, 250u8, 138u8, 121u8, 148u8,
239u8, 23u8, 27u8, 232u8, 140u8, 27u8, 153u8, 193u8, 56u8, 250u8, 183u8, 143u8, 75u8,
232u8, 43u8, 88u8, 244u8, 188u8, 20u8,
],
vk_ic: &[
[
25u8, 195u8, 12u8, 208u8, 208u8, 175u8, 57u8, 45u8, 250u8, 131u8, 79u8, 162u8, 146u8,
240u8, 103u8, 194u8, 114u8, 197u8, 230u8, 101u8, 70u8, 209u8, 35u8, 84u8, 224u8, 240u8,
30u8, 243u8, 158u8, 173u8, 64u8, 20u8, 12u8, 242u8, 243u8, 49u8, 118u8, 57u8, 138u8,
26u8, 221u8, 227u8, 150u8, 216u8, 186u8, 169u8, 132u8, 154u8, 203u8, 153u8, 201u8,
182u8, 188u8, 61u8, 41u8, 127u8, 152u8, 32u8, 82u8, 235u8, 110u8, 79u8, 67u8, 246u8,
],
[
39u8, 69u8, 180u8, 195u8, 168u8, 241u8, 73u8, 98u8, 144u8, 34u8, 44u8, 43u8, 150u8,
218u8, 220u8, 210u8, 224u8, 71u8, 59u8, 13u8, 177u8, 88u8, 64u8, 185u8, 128u8, 101u8,
61u8, 252u8, 236u8, 235u8, 82u8, 108u8, 43u8, 199u8, 104u8, 139u8, 49u8, 253u8, 224u8,
207u8, 133u8, 240u8, 249u8, 216u8, 3u8, 237u8, 61u8, 213u8, 91u8, 52u8, 4u8, 17u8,
229u8, 252u8, 117u8, 132u8, 100u8, 82u8, 108u8, 23u8, 171u8, 160u8, 54u8, 136u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/update_26_10.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
27u8, 56u8, 202u8, 199u8, 115u8, 62u8, 110u8, 106u8, 51u8, 137u8, 156u8, 16u8, 221u8,
177u8, 156u8, 130u8, 15u8, 148u8, 111u8, 6u8, 170u8, 62u8, 50u8, 127u8, 43u8, 233u8, 225u8,
149u8, 5u8, 45u8, 15u8, 45u8, 35u8, 63u8, 96u8, 165u8, 191u8, 198u8, 252u8, 142u8, 66u8,
141u8, 8u8, 85u8, 129u8, 105u8, 13u8, 253u8, 236u8, 171u8, 179u8, 130u8, 62u8, 192u8,
148u8, 97u8, 161u8, 124u8, 237u8, 189u8, 61u8, 136u8, 238u8, 2u8,
],
vk_beta_g2: [
26u8, 169u8, 183u8, 132u8, 67u8, 71u8, 200u8, 175u8, 153u8, 247u8, 130u8, 241u8, 36u8,
14u8, 125u8, 205u8, 142u8, 185u8, 246u8, 220u8, 91u8, 240u8, 239u8, 203u8, 84u8, 114u8,
162u8, 172u8, 253u8, 174u8, 20u8, 231u8, 29u8, 120u8, 162u8, 202u8, 180u8, 180u8, 149u8,
150u8, 210u8, 232u8, 27u8, 72u8, 10u8, 113u8, 123u8, 174u8, 66u8, 94u8, 238u8, 11u8, 203u8,
202u8, 191u8, 133u8, 35u8, 179u8, 66u8, 78u8, 22u8, 7u8, 209u8, 109u8, 33u8, 190u8, 119u8,
70u8, 132u8, 201u8, 150u8, 162u8, 68u8, 188u8, 18u8, 128u8, 36u8, 253u8, 73u8, 87u8, 12u8,
68u8, 254u8, 156u8, 47u8, 116u8, 137u8, 229u8, 142u8, 139u8, 194u8, 47u8, 33u8, 183u8,
221u8, 237u8, 42u8, 71u8, 50u8, 177u8, 184u8, 74u8, 34u8, 104u8, 229u8, 195u8, 205u8,
248u8, 31u8, 122u8, 46u8, 232u8, 214u8, 226u8, 153u8, 133u8, 141u8, 212u8, 233u8, 96u8,
224u8, 71u8, 194u8, 179u8, 23u8, 55u8, 102u8, 4u8,
],
vk_gamme_g2: [
32u8, 184u8, 237u8, 192u8, 115u8, 16u8, 128u8, 115u8, 158u8, 250u8, 157u8, 191u8, 176u8,
102u8, 250u8, 33u8, 203u8, 158u8, 216u8, 86u8, 28u8, 230u8, 213u8, 132u8, 1u8, 168u8,
190u8, 8u8, 98u8, 61u8, 233u8, 135u8, 26u8, 204u8, 253u8, 45u8, 32u8, 73u8, 62u8, 180u8,
52u8, 11u8, 30u8, 21u8, 6u8, 100u8, 86u8, 20u8, 59u8, 172u8, 195u8, 172u8, 99u8, 216u8,
133u8, 235u8, 128u8, 214u8, 36u8, 22u8, 2u8, 113u8, 137u8, 246u8, 32u8, 154u8, 227u8,
246u8, 83u8, 157u8, 222u8, 82u8, 163u8, 9u8, 96u8, 100u8, 60u8, 241u8, 164u8, 17u8, 1u8,
203u8, 2u8, 218u8, 197u8, 223u8, 241u8, 140u8, 39u8, 29u8, 229u8, 106u8, 237u8, 201u8,
188u8, 82u8, 33u8, 84u8, 182u8, 202u8, 130u8, 177u8, 225u8, 60u8, 251u8, 77u8, 199u8,
136u8, 186u8, 12u8, 76u8, 223u8, 7u8, 145u8, 252u8, 61u8, 27u8, 124u8, 123u8, 118u8, 44u8,
148u8, 29u8, 217u8, 103u8, 93u8, 30u8, 26u8,
],
vk_delta_g2: [
44u8, 222u8, 101u8, 97u8, 25u8, 174u8, 75u8, 109u8, 243u8, 125u8, 181u8, 95u8, 82u8, 97u8,
21u8, 221u8, 98u8, 85u8, 37u8, 145u8, 233u8, 161u8, 201u8, 221u8, 215u8, 85u8, 89u8, 34u8,
50u8, 165u8, 34u8, 122u8, 30u8, 94u8, 104u8, 139u8, 37u8, 128u8, 3u8, 53u8, 45u8, 80u8,
208u8, 110u8, 152u8, 193u8, 216u8, 57u8, 154u8, 105u8, 84u8, 118u8, 187u8, 242u8, 120u8,
105u8, 88u8, 235u8, 110u8, 208u8, 17u8, 172u8, 59u8, 151u8, 44u8, 218u8, 208u8, 50u8,
115u8, 195u8, 51u8, 174u8, 130u8, 172u8, 103u8, 207u8, 219u8, 173u8, 57u8, 86u8, 171u8,
248u8, 87u8, 67u8, 6u8, 177u8, 17u8, 255u8, 218u8, 243u8, 107u8, 45u8, 178u8, 107u8, 60u8,
49u8, 29u8, 0u8, 130u8, 51u8, 31u8, 56u8, 123u8, 104u8, 30u8, 109u8, 12u8, 95u8, 225u8,
11u8, 21u8, 185u8, 243u8, 252u8, 49u8, 147u8, 185u8, 248u8, 161u8, 154u8, 109u8, 22u8,
237u8, 224u8, 205u8, 58u8, 2u8, 227u8,
],
vk_ic: &[
[
10u8, 94u8, 5u8, 61u8, 65u8, 247u8, 208u8, 142u8, 13u8, 125u8, 151u8, 236u8, 213u8,
33u8, 57u8, 165u8, 102u8, 240u8, 105u8, 233u8, 164u8, 129u8, 249u8, 170u8, 119u8,
136u8, 25u8, 193u8, 83u8, 2u8, 55u8, 176u8, 43u8, 111u8, 196u8, 26u8, 74u8, 213u8,
23u8, 107u8, 173u8, 119u8, 18u8, 234u8, 30u8, 194u8, 84u8, 7u8, 128u8, 185u8, 247u8,
31u8, 24u8, 75u8, 155u8, 186u8, 59u8, 41u8, 138u8, 160u8, 63u8, 116u8, 175u8, 174u8,
],
[
7u8, 141u8, 252u8, 76u8, 163u8, 143u8, 105u8, 149u8, 229u8, 152u8, 167u8, 93u8, 111u8,
216u8, 181u8, 89u8, 204u8, 88u8, 75u8, 196u8, 149u8, 33u8, 34u8, 177u8, 134u8, 232u8,
157u8, 98u8, 160u8, 220u8, 82u8, 182u8, 32u8, 190u8, 145u8, 174u8, 195u8, 102u8, 77u8,
22u8, 98u8, 133u8, 92u8, 40u8, 185u8, 151u8, 137u8, 195u8, 163u8, 3u8, 157u8, 236u8,
238u8, 118u8, 74u8, 255u8, 19u8, 49u8, 216u8, 138u8, 171u8, 167u8, 1u8, 134u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/address_append_40_1000.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
4u8, 67u8, 20u8, 95u8, 45u8, 234u8, 124u8, 192u8, 255u8, 67u8, 186u8, 52u8, 124u8, 241u8,
2u8, 115u8, 26u8, 148u8, 204u8, 198u8, 115u8, 51u8, 62u8, 134u8, 246u8, 135u8, 166u8,
142u8, 192u8, 126u8, 139u8, 17u8, 11u8, 49u8, 134u8, 171u8, 227u8, 199u8, 173u8, 102u8,
116u8, 73u8, 133u8, 194u8, 139u8, 19u8, 49u8, 156u8, 136u8, 155u8, 1u8, 189u8, 47u8, 124u8,
191u8, 223u8, 58u8, 249u8, 137u8, 244u8, 169u8, 81u8, 84u8, 202u8,
],
vk_beta_g2: [
45u8, 187u8, 244u8, 42u8, 75u8, 107u8, 62u8, 89u8, 170u8, 5u8, 146u8, 62u8, 190u8, 103u8,
110u8, 87u8, 4u8, 18u8, 187u8, 204u8, 208u8, 12u8, 164u8, 207u8, 15u8, 199u8, 109u8, 76u8,
161u8, 104u8, 97u8, 27u8, 34u8, 22u8, 77u8, 68u8, 178u8, 106u8, 77u8, 251u8, 164u8, 136u8,
49u8, 250u8, 51u8, 13u8, 84u8, 162u8, 13u8, 170u8, 222u8, 129u8, 216u8, 178u8, 75u8, 22u8,
36u8, 82u8, 251u8, 201u8, 12u8, 6u8, 99u8, 93u8, 45u8, 188u8, 150u8, 35u8, 2u8, 154u8,
216u8, 203u8, 120u8, 14u8, 213u8, 217u8, 62u8, 221u8, 2u8, 163u8, 218u8, 138u8, 182u8,
192u8, 137u8, 22u8, 12u8, 112u8, 27u8, 103u8, 239u8, 3u8, 56u8, 109u8, 135u8, 163u8, 17u8,
123u8, 0u8, 177u8, 171u8, 86u8, 201u8, 154u8, 81u8, 71u8, 107u8, 154u8, 123u8, 4u8, 227u8,
248u8, 18u8, 57u8, 223u8, 146u8, 219u8, 190u8, 202u8, 158u8, 215u8, 46u8, 167u8, 51u8, 3u8,
155u8, 102u8, 253u8,
],
vk_gamme_g2: [
23u8, 116u8, 100u8, 249u8, 78u8, 37u8, 177u8, 152u8, 118u8, 92u8, 129u8, 118u8, 42u8, 14u8,
217u8, 12u8, 15u8, 130u8, 163u8, 252u8, 142u8, 12u8, 151u8, 17u8, 185u8, 49u8, 252u8, 99u8,
93u8, 104u8, 239u8, 72u8, 20u8, 150u8, 148u8, 111u8, 90u8, 102u8, 58u8, 143u8, 136u8, 17u8,
14u8, 154u8, 191u8, 154u8, 168u8, 73u8, 57u8, 5u8, 88u8, 20u8, 40u8, 126u8, 153u8, 228u8,
189u8, 46u8, 222u8, 230u8, 184u8, 72u8, 211u8, 249u8, 6u8, 140u8, 147u8, 108u8, 138u8,
233u8, 93u8, 73u8, 11u8, 25u8, 147u8, 167u8, 197u8, 43u8, 103u8, 157u8, 122u8, 14u8, 39u8,
251u8, 80u8, 30u8, 47u8, 99u8, 142u8, 115u8, 251u8, 172u8, 105u8, 36u8, 52u8, 197u8, 19u8,
183u8, 111u8, 72u8, 181u8, 47u8, 26u8, 152u8, 241u8, 28u8, 198u8, 234u8, 242u8, 235u8,
82u8, 32u8, 116u8, 83u8, 36u8, 113u8, 38u8, 144u8, 39u8, 42u8, 240u8, 131u8, 39u8, 104u8,
36u8, 238u8, 161u8, 232u8,
],
vk_delta_g2: [
40u8, 44u8, 36u8, 221u8, 8u8, 125u8, 64u8, 191u8, 70u8, 149u8, 120u8, 35u8, 149u8, 149u8,
231u8, 18u8, 152u8, 146u8, 204u8, 235u8, 57u8, 9u8, 159u8, 164u8, 137u8, 49u8, 72u8, 234u8,
43u8, 74u8, 72u8, 136u8, 20u8, 54u8, 157u8, 52u8, 207u8, 19u8, 4u8, 206u8, 115u8, 157u8,
72u8, 60u8, 212u8, 84u8, 48u8, 244u8, 237u8, 31u8, 60u8, 139u8, 12u8, 243u8, 185u8, 104u8,
0u8, 13u8, 125u8, 31u8, 85u8, 1u8, 146u8, 242u8, 19u8, 239u8, 90u8, 233u8, 171u8, 219u8,
161u8, 19u8, 187u8, 64u8, 42u8, 134u8, 255u8, 165u8, 170u8, 219u8, 1u8, 132u8, 67u8, 118u8,
244u8, 216u8, 95u8, 212u8, 17u8, 201u8, 74u8, 227u8, 24u8, 66u8, 28u8, 58u8, 19u8, 243u8,
46u8, 221u8, 182u8, 130u8, 13u8, 230u8, 13u8, 14u8, 200u8, 190u8, 76u8, 250u8, 108u8, 60u8,
140u8, 22u8, 142u8, 50u8, 186u8, 142u8, 94u8, 72u8, 1u8, 81u8, 28u8, 81u8, 16u8, 214u8,
186u8, 83u8,
],
vk_ic: &[
[
32u8, 221u8, 189u8, 240u8, 100u8, 116u8, 10u8, 18u8, 219u8, 51u8, 201u8, 191u8, 147u8,
49u8, 43u8, 208u8, 213u8, 213u8, 63u8, 8u8, 17u8, 69u8, 208u8, 164u8, 76u8, 14u8, 64u8,
68u8, 112u8, 227u8, 188u8, 185u8, 0u8, 40u8, 127u8, 133u8, 7u8, 86u8, 182u8, 170u8,
32u8, 92u8, 89u8, 213u8, 144u8, 94u8, 211u8, 88u8, 56u8, 16u8, 65u8, 230u8, 101u8,
64u8, 46u8, 216u8, 180u8, 159u8, 85u8, 24u8, 89u8, 65u8, 215u8, 152u8,
],
[
12u8, 26u8, 235u8, 151u8, 63u8, 186u8, 45u8, 10u8, 106u8, 133u8, 175u8, 179u8, 70u8,
250u8, 252u8, 200u8, 221u8, 19u8, 143u8, 165u8, 234u8, 165u8, 17u8, 24u8, 30u8, 105u8,
250u8, 201u8, 227u8, 92u8, 198u8, 66u8, 0u8, 19u8, 61u8, 176u8, 168u8, 79u8, 118u8,
81u8, 7u8, 213u8, 122u8, 243u8, 185u8, 253u8, 253u8, 29u8, 167u8, 73u8, 91u8, 186u8,
5u8, 92u8, 196u8, 50u8, 193u8, 91u8, 156u8, 3u8, 26u8, 53u8, 42u8, 1u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/address_append_40_100.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
11u8, 179u8, 191u8, 18u8, 84u8, 83u8, 208u8, 56u8, 44u8, 223u8, 176u8, 136u8, 5u8, 209u8,
26u8, 40u8, 152u8, 171u8, 133u8, 154u8, 141u8, 20u8, 101u8, 155u8, 76u8, 253u8, 148u8,
79u8, 22u8, 128u8, 8u8, 196u8, 21u8, 122u8, 44u8, 241u8, 225u8, 194u8, 189u8, 61u8, 31u8,
26u8, 37u8, 25u8, 212u8, 159u8, 182u8, 47u8, 200u8, 48u8, 49u8, 83u8, 140u8, 186u8, 111u8,
231u8, 213u8, 21u8, 247u8, 239u8, 243u8, 147u8, 6u8, 115u8,
],
vk_beta_g2: [
30u8, 8u8, 18u8, 250u8, 61u8, 116u8, 97u8, 0u8, 43u8, 237u8, 192u8, 83u8, 242u8, 54u8,
199u8, 216u8, 236u8, 98u8, 239u8, 60u8, 236u8, 69u8, 158u8, 56u8, 84u8, 70u8, 48u8, 15u8,
101u8, 162u8, 137u8, 51u8, 36u8, 44u8, 28u8, 122u8, 148u8, 143u8, 152u8, 8u8, 82u8, 65u8,
65u8, 58u8, 177u8, 255u8, 61u8, 227u8, 80u8, 123u8, 176u8, 142u8, 191u8, 92u8, 181u8,
241u8, 207u8, 116u8, 172u8, 34u8, 201u8, 96u8, 198u8, 185u8, 39u8, 208u8, 85u8, 215u8,
245u8, 244u8, 109u8, 89u8, 58u8, 181u8, 188u8, 154u8, 119u8, 249u8, 238u8, 104u8, 135u8,
241u8, 66u8, 153u8, 128u8, 167u8, 84u8, 30u8, 170u8, 229u8, 76u8, 253u8, 212u8, 58u8,
162u8, 252u8, 4u8, 149u8, 197u8, 141u8, 249u8, 49u8, 229u8, 61u8, 193u8, 45u8, 197u8,
187u8, 154u8, 139u8, 186u8, 175u8, 68u8, 104u8, 101u8, 26u8, 230u8, 237u8, 5u8, 224u8,
222u8, 129u8, 119u8, 105u8, 124u8, 21u8, 164u8, 196u8,
],
vk_gamme_g2: [
42u8, 15u8, 180u8, 234u8, 209u8, 47u8, 61u8, 82u8, 47u8, 66u8, 250u8, 79u8, 92u8, 111u8,
199u8, 250u8, 253u8, 69u8, 160u8, 172u8, 218u8, 103u8, 215u8, 117u8, 255u8, 50u8, 158u8,
184u8, 168u8, 15u8, 149u8, 67u8, 37u8, 107u8, 194u8, 127u8, 228u8, 191u8, 91u8, 3u8, 102u8,
11u8, 115u8, 88u8, 101u8, 195u8, 43u8, 155u8, 104u8, 145u8, 158u8, 166u8, 223u8, 91u8,
202u8, 233u8, 242u8, 147u8, 208u8, 246u8, 100u8, 32u8, 253u8, 74u8, 43u8, 244u8, 34u8,
94u8, 74u8, 144u8, 137u8, 82u8, 169u8, 33u8, 156u8, 113u8, 170u8, 241u8, 239u8, 169u8,
90u8, 244u8, 72u8, 0u8, 221u8, 152u8, 168u8, 85u8, 45u8, 0u8, 112u8, 154u8, 37u8, 232u8,
113u8, 8u8, 3u8, 190u8, 240u8, 169u8, 126u8, 110u8, 13u8, 148u8, 29u8, 172u8, 180u8, 176u8,
56u8, 129u8, 238u8, 234u8, 158u8, 13u8, 2u8, 75u8, 30u8, 15u8, 91u8, 188u8, 111u8, 205u8,
255u8, 164u8, 169u8, 63u8, 193u8, 244u8,
],
vk_delta_g2: [
4u8, 187u8, 169u8, 163u8, 91u8, 82u8, 87u8, 16u8, 99u8, 33u8, 44u8, 165u8, 179u8, 88u8,
2u8, 188u8, 70u8, 124u8, 128u8, 209u8, 6u8, 159u8, 209u8, 41u8, 220u8, 129u8, 215u8, 209u8,
48u8, 236u8, 71u8, 128u8, 31u8, 52u8, 170u8, 17u8, 250u8, 54u8, 253u8, 81u8, 231u8, 66u8,
151u8, 207u8, 169u8, 152u8, 88u8, 202u8, 76u8, 189u8, 205u8, 59u8, 109u8, 106u8, 208u8,
53u8, 175u8, 149u8, 190u8, 0u8, 125u8, 28u8, 248u8, 52u8, 16u8, 47u8, 20u8, 128u8, 217u8,
242u8, 184u8, 204u8, 90u8, 117u8, 78u8, 94u8, 10u8, 201u8, 76u8, 168u8, 223u8, 204u8,
127u8, 169u8, 221u8, 195u8, 107u8, 141u8, 66u8, 135u8, 142u8, 31u8, 230u8, 74u8, 113u8,
60u8, 13u8, 122u8, 4u8, 145u8, 185u8, 74u8, 55u8, 172u8, 185u8, 249u8, 15u8, 241u8, 216u8,
111u8, 146u8, 128u8, 8u8, 134u8, 61u8, 142u8, 138u8, 241u8, 147u8, 51u8, 42u8, 70u8, 1u8,
127u8, 203u8, 74u8, 58u8, 95u8,
],
vk_ic: &[
[
21u8, 254u8, 60u8, 58u8, 72u8, 129u8, 181u8, 137u8, 183u8, 44u8, 111u8, 0u8, 211u8,
177u8, 105u8, 37u8, 22u8, 2u8, 53u8, 127u8, 97u8, 146u8, 249u8, 71u8, 7u8, 201u8,
232u8, 131u8, 33u8, 235u8, 70u8, 194u8, 12u8, 113u8, 89u8, 148u8, 44u8, 67u8, 219u8,
241u8, 100u8, 221u8, 91u8, 122u8, 103u8, 108u8, 153u8, 81u8, 147u8, 206u8, 140u8, 97u8,
13u8, 191u8, 229u8, 113u8, 35u8, 72u8, 1u8, 8u8, 103u8, 83u8, 41u8, 1u8,
],
[
26u8, 8u8, 23u8, 193u8, 246u8, 101u8, 126u8, 139u8, 160u8, 9u8, 16u8, 147u8, 102u8,
241u8, 154u8, 162u8, 154u8, 165u8, 25u8, 178u8, 65u8, 170u8, 203u8, 29u8, 190u8, 14u8,
57u8, 243u8, 173u8, 120u8, 7u8, 84u8, 20u8, 157u8, 135u8, 230u8, 57u8, 243u8, 41u8,
180u8, 70u8, 180u8, 47u8, 242u8, 101u8, 78u8, 119u8, 74u8, 215u8, 157u8, 220u8, 52u8,
202u8, 197u8, 214u8, 166u8, 108u8, 63u8, 155u8, 197u8, 240u8, 46u8, 40u8, 71u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/inclusion_26_8.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 16usize,
vk_alpha_g1: [
21u8, 70u8, 109u8, 120u8, 120u8, 101u8, 224u8, 33u8, 35u8, 112u8, 134u8, 152u8, 227u8,
97u8, 154u8, 16u8, 214u8, 223u8, 178u8, 81u8, 190u8, 106u8, 151u8, 218u8, 128u8, 145u8,
159u8, 226u8, 86u8, 95u8, 216u8, 158u8, 16u8, 42u8, 159u8, 215u8, 214u8, 229u8, 66u8,
202u8, 244u8, 17u8, 166u8, 241u8, 108u8, 239u8, 143u8, 35u8, 107u8, 30u8, 236u8, 127u8,
245u8, 55u8, 51u8, 213u8, 215u8, 216u8, 82u8, 82u8, 94u8, 28u8, 30u8, 66u8,
],
vk_beta_g2: [
27u8, 134u8, 207u8, 54u8, 222u8, 116u8, 108u8, 26u8, 117u8, 125u8, 196u8, 208u8, 136u8,
30u8, 72u8, 191u8, 202u8, 56u8, 48u8, 21u8, 228u8, 73u8, 139u8, 6u8, 153u8, 128u8, 45u8,
55u8, 228u8, 196u8, 162u8, 133u8, 7u8, 129u8, 183u8, 133u8, 240u8, 100u8, 222u8, 25u8,
253u8, 86u8, 243u8, 153u8, 73u8, 46u8, 69u8, 86u8, 251u8, 110u8, 134u8, 121u8, 58u8, 113u8,
110u8, 124u8, 38u8, 232u8, 209u8, 45u8, 201u8, 210u8, 83u8, 69u8, 0u8, 169u8, 230u8, 107u8,
218u8, 20u8, 9u8, 98u8, 97u8, 171u8, 64u8, 49u8, 37u8, 93u8, 98u8, 201u8, 114u8, 238u8,
61u8, 174u8, 175u8, 230u8, 62u8, 234u8, 35u8, 255u8, 202u8, 93u8, 85u8, 168u8, 151u8,
218u8, 13u8, 178u8, 33u8, 66u8, 198u8, 32u8, 59u8, 25u8, 225u8, 166u8, 66u8, 79u8, 76u8,
34u8, 211u8, 98u8, 249u8, 69u8, 236u8, 186u8, 27u8, 250u8, 26u8, 110u8, 243u8, 55u8, 198u8,
161u8, 179u8, 15u8, 114u8, 178u8,
],
vk_gamme_g2: [
4u8, 132u8, 100u8, 232u8, 41u8, 32u8, 57u8, 28u8, 250u8, 14u8, 104u8, 209u8, 71u8, 70u8,
156u8, 80u8, 150u8, 54u8, 248u8, 44u8, 86u8, 126u8, 25u8, 101u8, 97u8, 19u8, 133u8, 63u8,
177u8, 8u8, 208u8, 239u8, 19u8, 252u8, 6u8, 1u8, 40u8, 156u8, 236u8, 88u8, 172u8, 17u8,
242u8, 103u8, 22u8, 69u8, 62u8, 158u8, 250u8, 24u8, 227u8, 65u8, 101u8, 219u8, 252u8,
149u8, 92u8, 42u8, 181u8, 175u8, 168u8, 88u8, 194u8, 129u8, 34u8, 136u8, 10u8, 141u8,
200u8, 198u8, 50u8, 128u8, 128u8, 40u8, 32u8, 72u8, 35u8, 21u8, 67u8, 134u8, 190u8, 179u8,
192u8, 226u8, 156u8, 195u8, 185u8, 73u8, 182u8, 126u8, 129u8, 40u8, 184u8, 46u8, 53u8, 7u8,
29u8, 233u8, 91u8, 139u8, 37u8, 122u8, 251u8, 168u8, 126u8, 47u8, 207u8, 26u8, 57u8, 34u8,
84u8, 75u8, 182u8, 102u8, 252u8, 174u8, 40u8, 87u8, 102u8, 88u8, 249u8, 29u8, 10u8, 205u8,
69u8, 100u8, 135u8, 86u8,
],
vk_delta_g2: [
5u8, 172u8, 77u8, 57u8, 15u8, 122u8, 35u8, 190u8, 193u8, 31u8, 159u8, 101u8, 11u8, 8u8,
208u8, 186u8, 7u8, 8u8, 71u8, 82u8, 164u8, 98u8, 234u8, 189u8, 0u8, 209u8, 25u8, 30u8,
40u8, 124u8, 69u8, 145u8, 1u8, 103u8, 212u8, 141u8, 15u8, 203u8, 46u8, 70u8, 59u8, 86u8,
31u8, 188u8, 225u8, 74u8, 199u8, 73u8, 34u8, 1u8, 180u8, 226u8, 250u8, 99u8, 146u8, 63u8,
78u8, 148u8, 81u8, 36u8, 46u8, 252u8, 62u8, 0u8, 25u8, 50u8, 17u8, 168u8, 59u8, 114u8,
29u8, 90u8, 29u8, 37u8, 197u8, 106u8, 131u8, 201u8, 34u8, 119u8, 249u8, 29u8, 79u8, 72u8,
40u8, 51u8, 50u8, 80u8, 27u8, 125u8, 18u8, 74u8, 49u8, 184u8, 115u8, 72u8, 4u8, 241u8,
190u8, 111u8, 214u8, 10u8, 6u8, 112u8, 34u8, 241u8, 217u8, 171u8, 117u8, 207u8, 236u8,
190u8, 36u8, 206u8, 32u8, 13u8, 48u8, 76u8, 43u8, 203u8, 219u8, 162u8, 14u8, 50u8, 39u8,
180u8, 220u8, 81u8,
],
vk_ic: &[
[
0u8, 58u8, 162u8, 187u8, 200u8, 44u8, 229u8, 70u8, 99u8, 53u8, 146u8, 9u8, 94u8, 165u8,
52u8, 153u8, 121u8, 151u8, 228u8, 227u8, 3u8, 184u8, 162u8, 253u8, 233u8, 235u8, 233u8,
96u8, 177u8, 0u8, 138u8, 69u8, 27u8, 56u8, 9u8, 219u8, 174u8, 220u8, 237u8, 249u8,
126u8, 218u8, 208u8, 132u8, 108u8, 193u8, 24u8, 53u8, 92u8, 66u8, 65u8, 128u8, 87u8,
140u8, 128u8, 255u8, 253u8, 144u8, 29u8, 75u8, 99u8, 141u8, 138u8, 58u8,
],
[
38u8, 239u8, 242u8, 219u8, 130u8, 231u8, 12u8, 139u8, 88u8, 13u8, 20u8, 165u8, 102u8,
83u8, 82u8, 85u8, 139u8, 31u8, 187u8, 131u8, 148u8, 164u8, 234u8, 166u8, 188u8, 21u8,
0u8, 221u8, 10u8, 104u8, 18u8, 44u8, 9u8, 135u8, 166u8, 107u8, 87u8, 16u8, 122u8,
248u8, 34u8, 77u8, 141u8, 152u8, 104u8, 246u8, 51u8, 31u8, 71u8, 108u8, 131u8, 84u8,
195u8, 79u8, 215u8, 176u8, 215u8, 29u8, 31u8, 190u8, 135u8, 12u8, 40u8, 149u8,
],
[
3u8, 30u8, 211u8, 30u8, 242u8, 193u8, 224u8, 254u8, 202u8, 208u8, 113u8, 142u8, 222u8,
81u8, 169u8, 150u8, 251u8, 248u8, 116u8, 81u8, 229u8, 9u8, 184u8, 249u8, 35u8, 84u8,
22u8, 112u8, 147u8, 41u8, 117u8, 43u8, 38u8, 211u8, 222u8, 15u8, 10u8, 111u8, 41u8,
4u8, 193u8, 170u8, 119u8, 239u8, 144u8, 213u8, 170u8, 208u8, 235u8, 232u8, 4u8, 51u8,
69u8, 87u8, 28u8, 217u8, 181u8, 231u8, 197u8, 144u8, 26u8, 40u8, 219u8, 74u8,
],
[
18u8, 43u8, 225u8, 107u8, 220u8, 139u8, 112u8, 12u8, 66u8, 30u8, 14u8, 6u8, 113u8,
89u8, 51u8, 108u8, 77u8, 16u8, 136u8, 111u8, 191u8, 26u8, 14u8, 63u8, 43u8, 201u8,
79u8, 85u8, 255u8, 228u8, 99u8, 248u8, 0u8, 113u8, 9u8, 190u8, 64u8, 59u8, 153u8,
227u8, 238u8, 80u8, 1u8, 41u8, 196u8, 65u8, 3u8, 17u8, 165u8, 87u8, 224u8, 4u8, 158u8,
211u8, 1u8, 235u8, 81u8, 117u8, 193u8, 116u8, 140u8, 178u8, 232u8, 81u8,
],
[
42u8, 72u8, 250u8, 32u8, 167u8, 236u8, 205u8, 122u8, 188u8, 227u8, 18u8, 233u8, 22u8,
192u8, 169u8, 100u8, 22u8, 136u8, 194u8, 246u8, 30u8, 239u8, 233u8, 95u8, 91u8, 101u8,
157u8, 97u8, 147u8, 137u8, 1u8, 199u8, 30u8, 39u8, 14u8, 107u8, 66u8, 172u8, 54u8,
199u8, 36u8, 179u8, 96u8, 64u8, 116u8, 111u8, 194u8, 7u8, 69u8, 210u8, 236u8, 73u8,
136u8, 78u8, 80u8, 174u8, 145u8, 71u8, 123u8, 6u8, 108u8, 25u8, 75u8, 228u8,
],
[
29u8, 246u8, 151u8, 128u8, 130u8, 110u8, 93u8, 232u8, 251u8, 202u8, 209u8, 212u8, 32u8,
28u8, 132u8, 3u8, 50u8, 100u8, 205u8, 100u8, 67u8, 123u8, 248u8, 39u8, 17u8, 85u8,
44u8, 31u8, 154u8, 62u8, 247u8, 195u8, 39u8, 93u8, 211u8, 68u8, 189u8, 148u8, 107u8,
148u8, 158u8, 81u8, 238u8, 229u8, 76u8, 149u8, 43u8, 82u8, 153u8, 188u8, 111u8, 151u8,
143u8, 239u8, 30u8, 124u8, 93u8, 78u8, 167u8, 176u8, 238u8, 220u8, 14u8, 255u8,
],
[
11u8, 65u8, 93u8, 142u8, 58u8, 30u8, 150u8, 51u8, 230u8, 133u8, 35u8, 174u8, 107u8,
127u8, 50u8, 169u8, 106u8, 59u8, 130u8, 234u8, 98u8, 232u8, 122u8, 138u8, 13u8, 36u8,
138u8, 214u8, 30u8, 234u8, 4u8, 171u8, 30u8, 63u8, 170u8, 73u8, 147u8, 42u8, 255u8,
79u8, 122u8, 133u8, 254u8, 195u8, 17u8, 203u8, 170u8, 29u8, 62u8, 171u8, 248u8, 170u8,
238u8, 91u8, 176u8, 250u8, 48u8, 187u8, 64u8, 158u8, 160u8, 82u8, 234u8, 129u8,
],
[
37u8, 64u8, 234u8, 21u8, 171u8, 159u8, 22u8, 25u8, 157u8, 133u8, 243u8, 171u8, 247u8,
174u8, 124u8, 50u8, 218u8, 242u8, 252u8, 242u8, 214u8, 189u8, 75u8, 12u8, 1u8, 195u8,
232u8, 36u8, 28u8, 5u8, 10u8, 41u8, 22u8, 205u8, 251u8, 167u8, 104u8, 220u8, 42u8,
101u8, 125u8, 91u8, 177u8, 82u8, 120u8, 142u8, 154u8, 5u8, 148u8, 99u8, 153u8, 157u8,
143u8, 146u8, 47u8, 144u8, 73u8, 166u8, 246u8, 112u8, 151u8, 83u8, 128u8, 76u8,
],
[
43u8, 117u8, 116u8, 180u8, 197u8, 58u8, 111u8, 157u8, 195u8, 39u8, 10u8, 185u8, 104u8,
83u8, 181u8, 185u8, 77u8, 175u8, 42u8, 67u8, 238u8, 18u8, 99u8, 186u8, 45u8, 194u8,
215u8, 80u8, 21u8, 49u8, 184u8, 141u8, 22u8, 245u8, 55u8, 94u8, 24u8, 45u8, 230u8,
15u8, 14u8, 163u8, 194u8, 219u8, 33u8, 207u8, 114u8, 128u8, 73u8, 12u8, 159u8, 46u8,
133u8, 139u8, 117u8, 76u8, 1u8, 76u8, 251u8, 135u8, 24u8, 119u8, 231u8, 146u8,
],
[
47u8, 108u8, 212u8, 203u8, 105u8, 109u8, 87u8, 207u8, 227u8, 216u8, 95u8, 246u8, 58u8,
253u8, 74u8, 227u8, 212u8, 137u8, 98u8, 87u8, 145u8, 195u8, 76u8, 65u8, 244u8, 247u8,
234u8, 119u8, 212u8, 217u8, 192u8, 45u8, 36u8, 74u8, 169u8, 88u8, 145u8, 137u8, 149u8,
91u8, 203u8, 8u8, 77u8, 158u8, 232u8, 189u8, 39u8, 24u8, 248u8, 93u8, 27u8, 116u8, 2u8,
200u8, 27u8, 163u8, 155u8, 25u8, 174u8, 134u8, 31u8, 188u8, 203u8, 194u8,
],
[
40u8, 128u8, 221u8, 83u8, 188u8, 86u8, 138u8, 165u8, 189u8, 248u8, 160u8, 186u8, 69u8,
1u8, 223u8, 49u8, 11u8, 53u8, 251u8, 175u8, 207u8, 236u8, 102u8, 184u8, 206u8, 70u8,
191u8, 124u8, 26u8, 134u8, 131u8, 65u8, 13u8, 248u8, 86u8, 229u8, 55u8, 233u8, 2u8,
208u8, 169u8, 205u8, 212u8, 113u8, 42u8, 47u8, 13u8, 84u8, 33u8, 106u8, 105u8, 218u8,
112u8, 204u8, 47u8, 194u8, 181u8, 18u8, 102u8, 77u8, 135u8, 26u8, 242u8, 84u8,
],
[
3u8, 57u8, 169u8, 71u8, 141u8, 108u8, 243u8, 69u8, 33u8, 122u8, 122u8, 123u8, 56u8,
207u8, 234u8, 100u8, 148u8, 51u8, 47u8, 211u8, 105u8, 87u8, 107u8, 171u8, 18u8, 70u8,
247u8, 94u8, 184u8, 96u8, 35u8, 85u8, 15u8, 231u8, 245u8, 98u8, 115u8, 205u8, 54u8,
42u8, 46u8, 17u8, 236u8, 67u8, 42u8, 134u8, 224u8, 24u8, 86u8, 123u8, 159u8, 236u8,
85u8, 139u8, 183u8, 36u8, 169u8, 255u8, 91u8, 237u8, 136u8, 14u8, 25u8, 247u8,
],
[
7u8, 79u8, 1u8, 76u8, 172u8, 88u8, 49u8, 102u8, 238u8, 82u8, 61u8, 174u8, 170u8, 26u8,
120u8, 188u8, 14u8, 174u8, 255u8, 95u8, 69u8, 84u8, 211u8, 240u8, 184u8, 24u8, 30u8,
237u8, 143u8, 254u8, 163u8, 240u8, 48u8, 67u8, 157u8, 159u8, 65u8, 53u8, 127u8, 28u8,
26u8, 137u8, 153u8, 147u8, 219u8, 221u8, 172u8, 122u8, 174u8, 62u8, 201u8, 132u8, 29u8,
218u8, 5u8, 167u8, 124u8, 114u8, 79u8, 252u8, 219u8, 196u8, 115u8, 248u8,
],
[
31u8, 223u8, 58u8, 132u8, 102u8, 122u8, 165u8, 104u8, 74u8, 8u8, 40u8, 147u8, 39u8,
123u8, 99u8, 219u8, 129u8, 67u8, 207u8, 34u8, 235u8, 28u8, 87u8, 62u8, 226u8, 40u8,
72u8, 103u8, 209u8, 234u8, 149u8, 127u8, 44u8, 242u8, 27u8, 226u8, 4u8, 255u8, 19u8,
199u8, 201u8, 35u8, 246u8, 39u8, 220u8, 70u8, 119u8, 204u8, 10u8, 45u8, 179u8, 184u8,
206u8, 150u8, 110u8, 15u8, 153u8, 169u8, 119u8, 165u8, 52u8, 73u8, 231u8, 220u8,
],
[
18u8, 166u8, 146u8, 255u8, 62u8, 23u8, 253u8, 73u8, 209u8, 80u8, 50u8, 212u8, 114u8,
157u8, 51u8, 245u8, 41u8, 59u8, 161u8, 135u8, 230u8, 22u8, 66u8, 220u8, 151u8, 170u8,
135u8, 160u8, 92u8, 174u8, 187u8, 123u8, 34u8, 3u8, 215u8, 239u8, 150u8, 249u8, 234u8,
232u8, 117u8, 52u8, 163u8, 160u8, 200u8, 204u8, 117u8, 11u8, 13u8, 136u8, 69u8, 239u8,
136u8, 150u8, 213u8, 32u8, 185u8, 143u8, 214u8, 166u8, 154u8, 150u8, 157u8, 186u8,
],
[
3u8, 28u8, 49u8, 50u8, 62u8, 38u8, 35u8, 119u8, 183u8, 183u8, 80u8, 220u8, 24u8, 140u8,
221u8, 119u8, 243u8, 37u8, 31u8, 169u8, 215u8, 81u8, 19u8, 99u8, 126u8, 242u8, 178u8,
48u8, 50u8, 204u8, 98u8, 3u8, 30u8, 175u8, 132u8, 121u8, 60u8, 229u8, 96u8, 51u8,
228u8, 2u8, 115u8, 40u8, 202u8, 127u8, 78u8, 203u8, 5u8, 248u8, 156u8, 212u8, 199u8,
18u8, 241u8, 97u8, 12u8, 25u8, 88u8, 62u8, 179u8, 207u8, 190u8, 113u8,
],
[
17u8, 25u8, 73u8, 73u8, 212u8, 80u8, 200u8, 153u8, 13u8, 124u8, 184u8, 59u8, 140u8,
220u8, 220u8, 76u8, 150u8, 203u8, 7u8, 116u8, 50u8, 251u8, 180u8, 16u8, 164u8, 224u8,
235u8, 244u8, 48u8, 235u8, 2u8, 2u8, 27u8, 50u8, 186u8, 66u8, 160u8, 116u8, 236u8,
58u8, 244u8, 57u8, 27u8, 177u8, 3u8, 94u8, 166u8, 238u8, 11u8, 37u8, 131u8, 218u8,
167u8, 247u8, 182u8, 117u8, 9u8, 186u8, 94u8, 214u8, 233u8, 19u8, 147u8, 130u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_subtrees_26_100.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
13u8, 125u8, 112u8, 105u8, 97u8, 112u8, 181u8, 170u8, 70u8, 59u8, 221u8, 160u8, 141u8,
124u8, 68u8, 23u8, 228u8, 115u8, 84u8, 221u8, 102u8, 61u8, 216u8, 185u8, 166u8, 192u8,
186u8, 199u8, 102u8, 108u8, 153u8, 63u8, 23u8, 120u8, 6u8, 46u8, 130u8, 104u8, 24u8, 28u8,
87u8, 53u8, 116u8, 112u8, 39u8, 154u8, 222u8, 221u8, 43u8, 62u8, 171u8, 35u8, 55u8, 137u8,
30u8, 17u8, 165u8, 190u8, 130u8, 222u8, 21u8, 243u8, 98u8, 147u8,
],
vk_beta_g2: [
34u8, 9u8, 159u8, 38u8, 22u8, 9u8, 183u8, 56u8, 159u8, 17u8, 6u8, 50u8, 72u8, 53u8, 103u8,
21u8, 6u8, 31u8, 104u8, 5u8, 203u8, 134u8, 71u8, 231u8, 215u8, 222u8, 46u8, 73u8, 76u8,
250u8, 108u8, 84u8, 26u8, 80u8, 5u8, 186u8, 182u8, 170u8, 92u8, 132u8, 13u8, 175u8, 32u8,
105u8, 93u8, 212u8, 236u8, 0u8, 186u8, 8u8, 8u8, 82u8, 161u8, 19u8, 249u8, 243u8, 199u8,
61u8, 129u8, 16u8, 211u8, 247u8, 173u8, 78u8, 12u8, 74u8, 24u8, 178u8, 233u8, 217u8, 92u8,
79u8, 223u8, 61u8, 61u8, 25u8, 107u8, 21u8, 120u8, 18u8, 134u8, 198u8, 122u8, 151u8, 32u8,
152u8, 107u8, 169u8, 39u8, 222u8, 252u8, 1u8, 99u8, 63u8, 171u8, 17u8, 2u8, 143u8, 195u8,
170u8, 158u8, 89u8, 67u8, 112u8, 223u8, 23u8, 131u8, 219u8, 38u8, 31u8, 173u8, 63u8, 226u8,
203u8, 185u8, 136u8, 44u8, 58u8, 7u8, 1u8, 152u8, 208u8, 198u8, 198u8, 34u8, 177u8, 88u8,
57u8,
],
vk_gamme_g2: [
38u8, 150u8, 47u8, 56u8, 44u8, 141u8, 12u8, 144u8, 221u8, 115u8, 88u8, 57u8, 231u8, 230u8,
112u8, 165u8, 216u8, 12u8, 136u8, 153u8, 123u8, 35u8, 54u8, 95u8, 82u8, 27u8, 185u8, 115u8,
236u8, 156u8, 139u8, 150u8, 20u8, 187u8, 161u8, 156u8, 49u8, 146u8, 14u8, 48u8, 143u8,
131u8, 109u8, 98u8, 53u8, 204u8, 94u8, 54u8, 215u8, 178u8, 42u8, 146u8, 125u8, 62u8, 65u8,
11u8, 159u8, 30u8, 54u8, 95u8, 42u8, 56u8, 175u8, 154u8, 48u8, 75u8, 8u8, 88u8, 113u8,
203u8, 185u8, 122u8, 98u8, 197u8, 153u8, 245u8, 12u8, 154u8, 167u8, 68u8, 155u8, 191u8,
42u8, 81u8, 87u8, 44u8, 173u8, 81u8, 160u8, 81u8, 219u8, 95u8, 85u8, 85u8, 234u8, 66u8,
29u8, 74u8, 203u8, 14u8, 250u8, 222u8, 61u8, 209u8, 243u8, 238u8, 54u8, 235u8, 107u8,
139u8, 158u8, 204u8, 75u8, 199u8, 45u8, 76u8, 212u8, 253u8, 179u8, 19u8, 146u8, 202u8,
93u8, 39u8, 55u8, 222u8, 137u8, 229u8,
],
vk_delta_g2: [
6u8, 206u8, 171u8, 251u8, 197u8, 122u8, 91u8, 24u8, 124u8, 47u8, 90u8, 68u8, 246u8, 108u8,
120u8, 41u8, 143u8, 7u8, 144u8, 146u8, 158u8, 119u8, 116u8, 44u8, 213u8, 149u8, 178u8,
51u8, 10u8, 152u8, 56u8, 180u8, 19u8, 251u8, 130u8, 110u8, 137u8, 94u8, 15u8, 65u8, 181u8,
192u8, 124u8, 250u8, 94u8, 132u8, 162u8, 212u8, 93u8, 188u8, 215u8, 62u8, 254u8, 177u8,
252u8, 174u8, 196u8, 145u8, 183u8, 222u8, 209u8, 34u8, 138u8, 249u8, 2u8, 244u8, 134u8,
224u8, 52u8, 234u8, 71u8, 5u8, 27u8, 145u8, 101u8, 189u8, 56u8, 162u8, 211u8, 135u8, 158u8,
53u8, 81u8, 122u8, 109u8, 182u8, 105u8, 101u8, 77u8, 58u8, 191u8, 68u8, 112u8, 172u8,
135u8, 93u8, 12u8, 61u8, 90u8, 137u8, 31u8, 149u8, 63u8, 125u8, 60u8, 179u8, 216u8, 237u8,
103u8, 252u8, 156u8, 234u8, 196u8, 209u8, 88u8, 232u8, 231u8, 133u8, 61u8, 95u8, 105u8,
243u8, 103u8, 238u8, 74u8, 91u8, 23u8, 182u8,
],
vk_ic: &[
[
30u8, 212u8, 253u8, 203u8, 57u8, 27u8, 39u8, 210u8, 97u8, 148u8, 225u8, 47u8, 125u8,
55u8, 214u8, 90u8, 246u8, 43u8, 246u8, 13u8, 5u8, 50u8, 221u8, 149u8, 150u8, 247u8,
26u8, 64u8, 3u8, 46u8, 69u8, 40u8, 1u8, 41u8, 90u8, 18u8, 106u8, 17u8, 228u8, 106u8,
219u8, 255u8, 1u8, 76u8, 114u8, 146u8, 217u8, 13u8, 226u8, 195u8, 137u8, 33u8, 249u8,
125u8, 187u8, 218u8, 246u8, 182u8, 71u8, 70u8, 250u8, 126u8, 64u8, 191u8,
],
[
15u8, 7u8, 46u8, 229u8, 197u8, 252u8, 32u8, 212u8, 99u8, 80u8, 228u8, 58u8, 36u8, 12u8,
183u8, 124u8, 114u8, 173u8, 230u8, 75u8, 220u8, 237u8, 216u8, 235u8, 190u8, 47u8, 7u8,
42u8, 235u8, 155u8, 22u8, 78u8, 10u8, 89u8, 209u8, 250u8, 222u8, 191u8, 236u8, 144u8,
169u8, 210u8, 199u8, 159u8, 252u8, 39u8, 59u8, 165u8, 191u8, 233u8, 29u8, 158u8, 70u8,
170u8, 235u8, 177u8, 147u8, 113u8, 167u8, 240u8, 248u8, 81u8, 11u8, 206u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/non_inclusion_26_1.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 2usize,
vk_alpha_g1: [
42u8, 175u8, 167u8, 170u8, 106u8, 79u8, 89u8, 23u8, 163u8, 201u8, 208u8, 224u8, 240u8,
31u8, 127u8, 123u8, 79u8, 158u8, 6u8, 131u8, 203u8, 166u8, 103u8, 145u8, 185u8, 161u8,
249u8, 178u8, 83u8, 236u8, 241u8, 103u8, 45u8, 250u8, 73u8, 207u8, 221u8, 22u8, 43u8, 76u8,
144u8, 204u8, 230u8, 63u8, 48u8, 21u8, 253u8, 77u8, 127u8, 158u8, 118u8, 4u8, 183u8, 114u8,
135u8, 197u8, 20u8, 203u8, 25u8, 127u8, 183u8, 207u8, 208u8, 204u8,
],
vk_beta_g2: [
23u8, 213u8, 194u8, 106u8, 33u8, 93u8, 252u8, 10u8, 30u8, 225u8, 191u8, 247u8, 194u8, 79u8,
66u8, 237u8, 0u8, 112u8, 60u8, 94u8, 47u8, 10u8, 161u8, 127u8, 213u8, 112u8, 51u8, 209u8,
201u8, 9u8, 171u8, 160u8, 23u8, 180u8, 144u8, 2u8, 245u8, 73u8, 165u8, 131u8, 199u8, 13u8,
184u8, 186u8, 180u8, 24u8, 41u8, 238u8, 219u8, 118u8, 169u8, 25u8, 89u8, 225u8, 131u8,
252u8, 207u8, 243u8, 75u8, 241u8, 72u8, 179u8, 45u8, 179u8, 34u8, 129u8, 180u8, 149u8,
50u8, 69u8, 215u8, 203u8, 231u8, 18u8, 225u8, 122u8, 209u8, 53u8, 202u8, 218u8, 22u8,
167u8, 254u8, 24u8, 182u8, 63u8, 173u8, 47u8, 231u8, 163u8, 61u8, 26u8, 202u8, 191u8, 19u8,
188u8, 11u8, 226u8, 146u8, 163u8, 107u8, 104u8, 217u8, 138u8, 196u8, 160u8, 202u8, 61u8,
220u8, 206u8, 14u8, 38u8, 38u8, 48u8, 212u8, 91u8, 85u8, 29u8, 7u8, 35u8, 136u8, 186u8,
187u8, 242u8, 72u8, 202u8, 89u8, 69u8,
],
vk_gamme_g2: [
18u8, 105u8, 145u8, 176u8, 242u8, 190u8, 135u8, 140u8, 233u8, 52u8, 41u8, 82u8, 170u8,
191u8, 45u8, 199u8, 70u8, 133u8, 208u8, 62u8, 141u8, 232u8, 152u8, 10u8, 28u8, 95u8, 194u8,
106u8, 242u8, 150u8, 142u8, 161u8, 36u8, 71u8, 159u8, 45u8, 31u8, 96u8, 113u8, 247u8,
227u8, 79u8, 254u8, 47u8, 125u8, 210u8, 150u8, 50u8, 190u8, 91u8, 23u8, 173u8, 37u8, 38u8,
15u8, 90u8, 127u8, 127u8, 129u8, 105u8, 22u8, 64u8, 62u8, 155u8, 26u8, 156u8, 156u8, 40u8,
227u8, 156u8, 208u8, 218u8, 193u8, 220u8, 42u8, 1u8, 28u8, 110u8, 96u8, 220u8, 43u8, 48u8,
36u8, 199u8, 72u8, 224u8, 24u8, 112u8, 64u8, 117u8, 89u8, 247u8, 13u8, 38u8, 247u8, 166u8,
28u8, 246u8, 147u8, 251u8, 70u8, 18u8, 238u8, 205u8, 208u8, 147u8, 180u8, 112u8, 12u8,
59u8, 5u8, 88u8, 140u8, 235u8, 119u8, 178u8, 143u8, 249u8, 113u8, 173u8, 81u8, 48u8, 143u8,
110u8, 96u8, 97u8, 222u8, 236u8,
],
vk_delta_g2: [
6u8, 70u8, 227u8, 177u8, 17u8, 43u8, 23u8, 229u8, 252u8, 150u8, 226u8, 56u8, 82u8, 98u8,
130u8, 113u8, 169u8, 244u8, 193u8, 145u8, 78u8, 251u8, 200u8, 106u8, 139u8, 13u8, 85u8,
50u8, 204u8, 214u8, 188u8, 30u8, 33u8, 133u8, 58u8, 61u8, 219u8, 6u8, 207u8, 197u8, 229u8,
124u8, 225u8, 138u8, 144u8, 224u8, 135u8, 2u8, 174u8, 139u8, 214u8, 56u8, 96u8, 183u8,
228u8, 154u8, 137u8, 17u8, 163u8, 216u8, 212u8, 199u8, 29u8, 49u8, 32u8, 73u8, 235u8,
151u8, 143u8, 154u8, 127u8, 71u8, 163u8, 214u8, 69u8, 53u8, 72u8, 235u8, 88u8, 166u8, 12u8,
196u8, 147u8, 22u8, 17u8, 236u8, 144u8, 187u8, 72u8, 45u8, 29u8, 24u8, 114u8, 144u8, 147u8,
252u8, 5u8, 168u8, 220u8, 68u8, 215u8, 193u8, 32u8, 118u8, 114u8, 142u8, 217u8, 3u8, 151u8,
216u8, 119u8, 135u8, 90u8, 69u8, 177u8, 215u8, 176u8, 55u8, 245u8, 38u8, 241u8, 97u8, 18u8,
193u8, 11u8, 55u8, 138u8, 96u8,
],
vk_ic: &[
[
26u8, 115u8, 63u8, 54u8, 36u8, 4u8, 8u8, 60u8, 3u8, 27u8, 136u8, 163u8, 230u8, 185u8,
88u8, 89u8, 172u8, 246u8, 226u8, 154u8, 234u8, 17u8, 132u8, 22u8, 56u8, 52u8, 141u8,
35u8, 69u8, 174u8, 145u8, 76u8, 11u8, 127u8, 202u8, 130u8, 163u8, 97u8, 227u8, 180u8,
16u8, 149u8, 218u8, 2u8, 156u8, 24u8, 83u8, 225u8, 252u8, 246u8, 161u8, 244u8, 129u8,
95u8, 143u8, 152u8, 144u8, 228u8, 131u8, 29u8, 155u8, 55u8, 113u8, 74u8,
],
[
24u8, 178u8, 143u8, 230u8, 40u8, 24u8, 59u8, 47u8, 201u8, 127u8, 37u8, 249u8, 50u8,
12u8, 121u8, 61u8, 236u8, 60u8, 30u8, 3u8, 195u8, 178u8, 158u8, 73u8, 88u8, 178u8,
157u8, 214u8, 31u8, 59u8, 172u8, 213u8, 18u8, 143u8, 11u8, 105u8, 102u8, 115u8, 186u8,
128u8, 181u8, 230u8, 152u8, 32u8, 133u8, 27u8, 195u8, 65u8, 106u8, 138u8, 22u8, 128u8,
236u8, 9u8, 141u8, 80u8, 22u8, 175u8, 146u8, 166u8, 20u8, 148u8, 152u8, 157u8,
],
[
38u8, 182u8, 177u8, 20u8, 136u8, 171u8, 239u8, 159u8, 8u8, 164u8, 145u8, 140u8, 254u8,
181u8, 125u8, 190u8, 229u8, 204u8, 47u8, 47u8, 109u8, 43u8, 43u8, 121u8, 156u8, 122u8,
160u8, 254u8, 129u8, 8u8, 21u8, 116u8, 4u8, 82u8, 72u8, 155u8, 94u8, 126u8, 41u8,
153u8, 147u8, 14u8, 145u8, 129u8, 87u8, 75u8, 89u8, 202u8, 13u8, 68u8, 98u8, 219u8,
184u8, 192u8, 58u8, 183u8, 252u8, 212u8, 92u8, 33u8, 152u8, 135u8, 96u8, 153u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/update_26_100.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
31u8, 23u8, 168u8, 177u8, 63u8, 206u8, 117u8, 49u8, 144u8, 106u8, 76u8, 11u8, 187u8, 122u8,
188u8, 158u8, 210u8, 132u8, 141u8, 37u8, 53u8, 172u8, 112u8, 111u8, 115u8, 53u8, 112u8,
6u8, 227u8, 121u8, 23u8, 156u8, 14u8, 116u8, 159u8, 132u8, 134u8, 3u8, 89u8, 156u8, 171u8,
180u8, 71u8, 0u8, 68u8, 192u8, 12u8, 129u8, 198u8, 219u8, 171u8, 45u8, 163u8, 148u8, 146u8,
96u8, 39u8, 157u8, 172u8, 17u8, 57u8, 190u8, 168u8, 48u8,
],
vk_beta_g2: [
33u8, 99u8, 26u8, 162u8, 20u8, 175u8, 46u8, 195u8, 65u8, 230u8, 34u8, 165u8, 84u8, 93u8,
31u8, 48u8, 221u8, 139u8, 14u8, 66u8, 237u8, 225u8, 138u8, 26u8, 7u8, 44u8, 255u8, 80u8,
7u8, 175u8, 113u8, 183u8, 20u8, 188u8, 232u8, 10u8, 253u8, 146u8, 240u8, 243u8, 214u8,
186u8, 248u8, 11u8, 219u8, 161u8, 105u8, 55u8, 6u8, 43u8, 117u8, 143u8, 229u8, 24u8, 134u8,
194u8, 14u8, 64u8, 130u8, 204u8, 4u8, 80u8, 210u8, 117u8, 38u8, 228u8, 141u8, 205u8, 114u8,
66u8, 108u8, 194u8, 177u8, 50u8, 231u8, 235u8, 237u8, 3u8, 199u8, 189u8, 58u8, 14u8, 21u8,
127u8, 15u8, 71u8, 6u8, 98u8, 95u8, 212u8, 87u8, 237u8, 106u8, 22u8, 161u8, 237u8, 13u8,
11u8, 90u8, 202u8, 6u8, 13u8, 135u8, 218u8, 34u8, 20u8, 240u8, 230u8, 174u8, 121u8, 198u8,
4u8, 122u8, 136u8, 112u8, 182u8, 27u8, 69u8, 54u8, 65u8, 169u8, 44u8, 52u8, 156u8, 182u8,
100u8, 113u8, 171u8,
],
vk_gamme_g2: [
47u8, 47u8, 101u8, 131u8, 248u8, 162u8, 254u8, 85u8, 138u8, 191u8, 109u8, 209u8, 9u8, 56u8,
158u8, 127u8, 105u8, 243u8, 226u8, 47u8, 0u8, 26u8, 100u8, 162u8, 232u8, 25u8, 7u8, 122u8,
2u8, 122u8, 125u8, 224u8, 28u8, 115u8, 210u8, 6u8, 194u8, 65u8, 57u8, 231u8, 71u8, 176u8,
233u8, 248u8, 82u8, 85u8, 217u8, 87u8, 10u8, 204u8, 175u8, 230u8, 192u8, 150u8, 36u8, 26u8,
46u8, 89u8, 116u8, 126u8, 17u8, 242u8, 155u8, 127u8, 24u8, 134u8, 226u8, 12u8, 123u8,
136u8, 236u8, 184u8, 111u8, 242u8, 97u8, 26u8, 194u8, 236u8, 108u8, 157u8, 102u8, 120u8,
15u8, 181u8, 73u8, 220u8, 181u8, 18u8, 205u8, 174u8, 62u8, 40u8, 95u8, 46u8, 215u8, 141u8,
31u8, 6u8, 111u8, 163u8, 22u8, 169u8, 97u8, 125u8, 30u8, 141u8, 101u8, 206u8, 157u8, 38u8,
169u8, 19u8, 169u8, 62u8, 11u8, 142u8, 148u8, 185u8, 31u8, 103u8, 218u8, 226u8, 191u8,
72u8, 156u8, 205u8, 212u8, 254u8,
],
vk_delta_g2: [
17u8, 219u8, 206u8, 202u8, 112u8, 22u8, 77u8, 160u8, 74u8, 224u8, 213u8, 169u8, 200u8,
127u8, 87u8, 167u8, 185u8, 248u8, 47u8, 107u8, 8u8, 174u8, 165u8, 219u8, 37u8, 106u8, 50u8,
151u8, 101u8, 38u8, 162u8, 83u8, 45u8, 142u8, 113u8, 200u8, 70u8, 161u8, 244u8, 183u8,
165u8, 44u8, 161u8, 104u8, 121u8, 227u8, 243u8, 202u8, 117u8, 127u8, 90u8, 167u8, 152u8,
141u8, 151u8, 244u8, 2u8, 80u8, 104u8, 100u8, 37u8, 192u8, 2u8, 79u8, 33u8, 60u8, 238u8,
228u8, 235u8, 170u8, 127u8, 115u8, 247u8, 59u8, 63u8, 178u8, 187u8, 7u8, 253u8, 253u8,
233u8, 233u8, 181u8, 233u8, 50u8, 62u8, 126u8, 196u8, 0u8, 32u8, 49u8, 22u8, 32u8, 242u8,
53u8, 24u8, 30u8, 50u8, 169u8, 112u8, 111u8, 166u8, 95u8, 45u8, 133u8, 244u8, 56u8, 155u8,
153u8, 126u8, 91u8, 169u8, 73u8, 12u8, 68u8, 167u8, 240u8, 220u8, 254u8, 250u8, 106u8,
13u8, 23u8, 26u8, 211u8, 225u8, 4u8, 192u8,
],
vk_ic: &[
[
34u8, 255u8, 236u8, 246u8, 107u8, 63u8, 242u8, 248u8, 243u8, 13u8, 252u8, 136u8, 205u8,
220u8, 1u8, 48u8, 98u8, 236u8, 82u8, 146u8, 110u8, 58u8, 163u8, 0u8, 121u8, 54u8,
171u8, 38u8, 85u8, 197u8, 197u8, 54u8, 37u8, 245u8, 222u8, 49u8, 126u8, 242u8, 143u8,
249u8, 148u8, 197u8, 63u8, 8u8, 60u8, 182u8, 24u8, 176u8, 220u8, 31u8, 102u8, 131u8,
19u8, 252u8, 126u8, 195u8, 250u8, 234u8, 65u8, 16u8, 176u8, 186u8, 52u8, 7u8,
],
[
45u8, 231u8, 113u8, 191u8, 144u8, 131u8, 66u8, 18u8, 5u8, 255u8, 148u8, 88u8, 243u8,
42u8, 146u8, 48u8, 230u8, 231u8, 235u8, 187u8, 111u8, 188u8, 85u8, 208u8, 14u8, 157u8,
140u8, 242u8, 91u8, 68u8, 247u8, 153u8, 4u8, 2u8, 20u8, 182u8, 72u8, 85u8, 35u8, 74u8,
200u8, 107u8, 90u8, 163u8, 66u8, 236u8, 174u8, 138u8, 205u8, 128u8, 150u8, 244u8,
238u8, 126u8, 178u8, 241u8, 84u8, 142u8, 29u8, 164u8, 205u8, 238u8, 157u8, 218u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_proofs_26_1000.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
29u8, 50u8, 106u8, 16u8, 161u8, 120u8, 3u8, 219u8, 189u8, 249u8, 158u8, 9u8, 2u8, 98u8,
63u8, 3u8, 113u8, 235u8, 107u8, 152u8, 49u8, 251u8, 163u8, 44u8, 130u8, 23u8, 238u8, 16u8,
100u8, 222u8, 222u8, 52u8, 15u8, 35u8, 203u8, 26u8, 255u8, 240u8, 37u8, 17u8, 144u8, 25u8,
224u8, 176u8, 100u8, 104u8, 62u8, 159u8, 55u8, 221u8, 10u8, 153u8, 122u8, 134u8, 199u8,
129u8, 106u8, 211u8, 232u8, 38u8, 12u8, 103u8, 215u8, 129u8,
],
vk_beta_g2: [
13u8, 169u8, 230u8, 39u8, 203u8, 105u8, 119u8, 151u8, 213u8, 17u8, 133u8, 91u8, 7u8, 92u8,
9u8, 253u8, 4u8, 215u8, 81u8, 97u8, 80u8, 231u8, 77u8, 181u8, 198u8, 46u8, 10u8, 175u8,
154u8, 84u8, 179u8, 98u8, 30u8, 236u8, 134u8, 201u8, 17u8, 190u8, 195u8, 18u8, 148u8,
202u8, 83u8, 86u8, 56u8, 102u8, 227u8, 181u8, 183u8, 95u8, 62u8, 162u8, 205u8, 25u8, 147u8,
140u8, 198u8, 121u8, 243u8, 228u8, 23u8, 235u8, 222u8, 125u8, 0u8, 199u8, 213u8, 158u8,
70u8, 153u8, 165u8, 223u8, 85u8, 87u8, 38u8, 23u8, 208u8, 193u8, 104u8, 37u8, 111u8, 33u8,
204u8, 157u8, 95u8, 58u8, 231u8, 192u8, 41u8, 27u8, 159u8, 194u8, 136u8, 81u8, 26u8, 30u8,
8u8, 17u8, 199u8, 248u8, 109u8, 122u8, 4u8, 38u8, 204u8, 239u8, 240u8, 17u8, 133u8, 7u8,
185u8, 115u8, 193u8, 27u8, 10u8, 57u8, 117u8, 100u8, 165u8, 23u8, 84u8, 208u8, 49u8, 77u8,
189u8, 8u8, 189u8, 153u8,
],
vk_gamme_g2: [
30u8, 52u8, 136u8, 151u8, 80u8, 3u8, 109u8, 219u8, 218u8, 250u8, 41u8, 30u8, 207u8, 153u8,
124u8, 191u8, 189u8, 213u8, 24u8, 133u8, 190u8, 212u8, 147u8, 84u8, 126u8, 116u8, 164u8,
172u8, 213u8, 168u8, 1u8, 124u8, 1u8, 95u8, 115u8, 233u8, 252u8, 140u8, 209u8, 153u8,
188u8, 103u8, 26u8, 161u8, 87u8, 187u8, 91u8, 209u8, 141u8, 120u8, 92u8, 35u8, 20u8, 21u8,
63u8, 67u8, 139u8, 152u8, 13u8, 148u8, 14u8, 242u8, 192u8, 127u8, 29u8, 215u8, 196u8,
107u8, 46u8, 140u8, 204u8, 143u8, 253u8, 176u8, 92u8, 32u8, 80u8, 249u8, 233u8, 52u8,
187u8, 96u8, 78u8, 221u8, 67u8, 119u8, 82u8, 163u8, 73u8, 38u8, 80u8, 211u8, 83u8, 82u8,
8u8, 241u8, 10u8, 175u8, 210u8, 28u8, 204u8, 254u8, 163u8, 24u8, 8u8, 5u8, 110u8, 174u8,
76u8, 171u8, 203u8, 164u8, 159u8, 196u8, 211u8, 154u8, 245u8, 131u8, 136u8, 46u8, 207u8,
7u8, 253u8, 231u8, 225u8, 176u8, 33u8, 42u8,
],
vk_delta_g2: [
17u8, 129u8, 145u8, 253u8, 205u8, 197u8, 38u8, 238u8, 82u8, 174u8, 185u8, 98u8, 230u8,
235u8, 184u8, 33u8, 20u8, 197u8, 228u8, 236u8, 94u8, 13u8, 117u8, 46u8, 156u8, 170u8, 84u8,
129u8, 30u8, 146u8, 34u8, 253u8, 31u8, 67u8, 150u8, 100u8, 104u8, 236u8, 2u8, 174u8, 60u8,
88u8, 169u8, 254u8, 37u8, 225u8, 240u8, 50u8, 168u8, 206u8, 75u8, 177u8, 182u8, 55u8, 7u8,
162u8, 50u8, 2u8, 248u8, 198u8, 11u8, 235u8, 165u8, 65u8, 8u8, 210u8, 129u8, 8u8, 176u8,
100u8, 11u8, 51u8, 0u8, 74u8, 235u8, 164u8, 240u8, 84u8, 27u8, 188u8, 18u8, 29u8, 162u8,
8u8, 176u8, 41u8, 151u8, 31u8, 237u8, 80u8, 37u8, 173u8, 188u8, 13u8, 222u8, 175u8, 16u8,
252u8, 107u8, 42u8, 232u8, 51u8, 158u8, 153u8, 183u8, 162u8, 6u8, 148u8, 229u8, 155u8,
212u8, 109u8, 154u8, 5u8, 170u8, 71u8, 123u8, 110u8, 94u8, 12u8, 180u8, 128u8, 9u8, 255u8,
25u8, 150u8, 187u8, 233u8,
],
vk_ic: &[
[
1u8, 222u8, 3u8, 47u8, 245u8, 90u8, 107u8, 211u8, 60u8, 196u8, 158u8, 38u8, 47u8, 85u8,
38u8, 231u8, 47u8, 155u8, 151u8, 246u8, 20u8, 231u8, 26u8, 242u8, 39u8, 121u8, 78u8,
115u8, 30u8, 34u8, 245u8, 116u8, 32u8, 224u8, 94u8, 112u8, 71u8, 53u8, 166u8, 137u8,
9u8, 40u8, 197u8, 229u8, 240u8, 185u8, 72u8, 168u8, 131u8, 123u8, 102u8, 200u8, 184u8,
67u8, 136u8, 16u8, 49u8, 118u8, 148u8, 175u8, 209u8, 44u8, 120u8, 249u8,
],
[
1u8, 203u8, 187u8, 202u8, 212u8, 167u8, 10u8, 26u8, 255u8, 166u8, 174u8, 129u8, 77u8,
158u8, 96u8, 231u8, 252u8, 125u8, 37u8, 117u8, 138u8, 56u8, 252u8, 27u8, 138u8, 156u8,
94u8, 9u8, 81u8, 222u8, 138u8, 253u8, 11u8, 159u8, 142u8, 229u8, 234u8, 245u8, 214u8,
99u8, 119u8, 42u8, 249u8, 28u8, 204u8, 127u8, 73u8, 93u8, 195u8, 236u8, 97u8, 31u8,
68u8, 43u8, 79u8, 254u8, 194u8, 50u8, 240u8, 78u8, 171u8, 48u8, 199u8, 142u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_proofs_26_100.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
11u8, 53u8, 20u8, 59u8, 41u8, 250u8, 224u8, 239u8, 14u8, 207u8, 32u8, 94u8, 180u8, 214u8,
99u8, 135u8, 25u8, 100u8, 160u8, 124u8, 219u8, 221u8, 144u8, 211u8, 108u8, 250u8, 59u8,
62u8, 96u8, 105u8, 162u8, 93u8, 21u8, 72u8, 144u8, 236u8, 73u8, 103u8, 187u8, 22u8, 46u8,
145u8, 78u8, 189u8, 18u8, 94u8, 192u8, 228u8, 203u8, 4u8, 119u8, 240u8, 84u8, 49u8, 148u8,
219u8, 205u8, 30u8, 106u8, 165u8, 220u8, 116u8, 165u8, 61u8,
],
vk_beta_g2: [
26u8, 116u8, 148u8, 220u8, 121u8, 227u8, 212u8, 107u8, 215u8, 30u8, 74u8, 52u8, 16u8,
178u8, 84u8, 32u8, 133u8, 98u8, 3u8, 238u8, 228u8, 240u8, 180u8, 54u8, 27u8, 52u8, 44u8,
75u8, 189u8, 61u8, 23u8, 198u8, 18u8, 223u8, 98u8, 203u8, 167u8, 219u8, 164u8, 55u8, 62u8,
162u8, 180u8, 165u8, 109u8, 241u8, 144u8, 140u8, 194u8, 87u8, 24u8, 112u8, 250u8, 113u8,
158u8, 125u8, 103u8, 104u8, 140u8, 232u8, 218u8, 38u8, 34u8, 32u8, 5u8, 101u8, 144u8, 93u8,
45u8, 6u8, 140u8, 174u8, 209u8, 182u8, 171u8, 215u8, 66u8, 212u8, 252u8, 196u8, 230u8,
45u8, 64u8, 30u8, 83u8, 91u8, 250u8, 44u8, 195u8, 245u8, 252u8, 232u8, 26u8, 254u8, 118u8,
6u8, 8u8, 160u8, 162u8, 63u8, 93u8, 239u8, 51u8, 67u8, 132u8, 193u8, 36u8, 63u8, 132u8,
125u8, 148u8, 182u8, 244u8, 41u8, 17u8, 223u8, 221u8, 142u8, 123u8, 78u8, 36u8, 177u8,
55u8, 26u8, 162u8, 193u8, 129u8, 149u8,
],
vk_gamme_g2: [
45u8, 125u8, 104u8, 40u8, 44u8, 201u8, 62u8, 253u8, 134u8, 2u8, 253u8, 90u8, 9u8, 209u8,
15u8, 236u8, 250u8, 154u8, 50u8, 218u8, 81u8, 102u8, 13u8, 16u8, 198u8, 86u8, 160u8, 131u8,
6u8, 246u8, 23u8, 207u8, 46u8, 154u8, 33u8, 155u8, 144u8, 152u8, 205u8, 150u8, 206u8, 28u8,
158u8, 187u8, 172u8, 72u8, 38u8, 246u8, 129u8, 116u8, 27u8, 39u8, 21u8, 153u8, 206u8, 78u8,
124u8, 64u8, 120u8, 10u8, 51u8, 173u8, 199u8, 137u8, 30u8, 211u8, 214u8, 72u8, 233u8,
163u8, 123u8, 184u8, 144u8, 117u8, 88u8, 131u8, 239u8, 19u8, 143u8, 172u8, 5u8, 106u8,
224u8, 14u8, 69u8, 254u8, 163u8, 140u8, 235u8, 22u8, 213u8, 190u8, 201u8, 1u8, 75u8, 47u8,
40u8, 182u8, 244u8, 86u8, 180u8, 248u8, 222u8, 78u8, 215u8, 160u8, 81u8, 205u8, 192u8,
90u8, 143u8, 215u8, 130u8, 43u8, 176u8, 253u8, 104u8, 24u8, 89u8, 75u8, 128u8, 114u8,
107u8, 2u8, 164u8, 172u8, 61u8, 178u8,
],
vk_delta_g2: [
45u8, 37u8, 73u8, 121u8, 119u8, 230u8, 113u8, 28u8, 100u8, 43u8, 58u8, 67u8, 90u8, 61u8,
182u8, 249u8, 232u8, 201u8, 112u8, 251u8, 191u8, 186u8, 121u8, 148u8, 96u8, 180u8, 227u8,
2u8, 135u8, 169u8, 110u8, 58u8, 30u8, 95u8, 225u8, 17u8, 134u8, 116u8, 80u8, 91u8, 159u8,
163u8, 180u8, 251u8, 76u8, 100u8, 163u8, 15u8, 139u8, 195u8, 90u8, 237u8, 113u8, 233u8,
151u8, 70u8, 194u8, 83u8, 140u8, 174u8, 184u8, 70u8, 57u8, 152u8, 5u8, 138u8, 207u8, 180u8,
137u8, 131u8, 94u8, 109u8, 200u8, 240u8, 50u8, 91u8, 188u8, 125u8, 188u8, 225u8, 143u8,
3u8, 181u8, 195u8, 92u8, 170u8, 200u8, 117u8, 66u8, 231u8, 210u8, 147u8, 15u8, 164u8,
200u8, 40u8, 7u8, 9u8, 183u8, 243u8, 164u8, 181u8, 133u8, 228u8, 172u8, 30u8, 210u8, 50u8,
50u8, 12u8, 161u8, 89u8, 103u8, 125u8, 111u8, 55u8, 182u8, 58u8, 38u8, 104u8, 196u8, 175u8,
128u8, 241u8, 235u8, 245u8, 54u8, 189u8,
],
vk_ic: &[
[
6u8, 224u8, 19u8, 85u8, 133u8, 60u8, 44u8, 25u8, 244u8, 133u8, 211u8, 28u8, 164u8,
190u8, 62u8, 184u8, 43u8, 45u8, 30u8, 73u8, 16u8, 180u8, 90u8, 66u8, 174u8, 103u8,
167u8, 59u8, 185u8, 243u8, 139u8, 119u8, 29u8, 156u8, 243u8, 220u8, 238u8, 81u8, 228u8,
127u8, 24u8, 202u8, 92u8, 84u8, 187u8, 23u8, 118u8, 161u8, 76u8, 142u8, 106u8, 209u8,
119u8, 229u8, 241u8, 19u8, 162u8, 161u8, 145u8, 68u8, 52u8, 137u8, 147u8, 12u8,
],
[
2u8, 122u8, 74u8, 7u8, 251u8, 49u8, 23u8, 84u8, 174u8, 112u8, 75u8, 203u8, 227u8, 37u8,
120u8, 144u8, 207u8, 248u8, 17u8, 11u8, 113u8, 157u8, 68u8, 135u8, 117u8, 144u8, 153u8,
150u8, 142u8, 104u8, 140u8, 233u8, 7u8, 102u8, 185u8, 178u8, 40u8, 196u8, 51u8, 141u8,
64u8, 142u8, 226u8, 115u8, 186u8, 133u8, 119u8, 79u8, 252u8, 162u8, 214u8, 167u8,
214u8, 93u8, 198u8, 44u8, 240u8, 196u8, 167u8, 121u8, 70u8, 246u8, 63u8, 177u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_proofs_26_1.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
18u8, 39u8, 46u8, 163u8, 160u8, 133u8, 40u8, 109u8, 164u8, 99u8, 108u8, 95u8, 207u8, 68u8,
116u8, 32u8, 207u8, 128u8, 13u8, 164u8, 50u8, 40u8, 206u8, 141u8, 224u8, 107u8, 109u8,
232u8, 209u8, 99u8, 201u8, 167u8, 27u8, 50u8, 119u8, 87u8, 156u8, 158u8, 188u8, 254u8,
51u8, 157u8, 15u8, 96u8, 142u8, 38u8, 101u8, 128u8, 135u8, 246u8, 31u8, 1u8, 45u8, 212u8,
216u8, 151u8, 9u8, 229u8, 110u8, 197u8, 175u8, 1u8, 49u8, 60u8,
],
vk_beta_g2: [
37u8, 89u8, 226u8, 228u8, 155u8, 219u8, 107u8, 211u8, 221u8, 5u8, 113u8, 16u8, 32u8, 157u8,
106u8, 143u8, 95u8, 98u8, 102u8, 24u8, 238u8, 201u8, 19u8, 62u8, 8u8, 44u8, 167u8, 218u8,
253u8, 119u8, 49u8, 170u8, 35u8, 150u8, 136u8, 40u8, 149u8, 231u8, 115u8, 124u8, 248u8,
172u8, 103u8, 120u8, 186u8, 83u8, 192u8, 38u8, 155u8, 88u8, 199u8, 79u8, 220u8, 162u8,
133u8, 197u8, 239u8, 243u8, 42u8, 10u8, 112u8, 3u8, 57u8, 240u8, 18u8, 9u8, 151u8, 14u8,
46u8, 146u8, 22u8, 195u8, 192u8, 237u8, 179u8, 232u8, 88u8, 191u8, 30u8, 86u8, 190u8,
197u8, 6u8, 21u8, 189u8, 70u8, 110u8, 232u8, 71u8, 161u8, 70u8, 123u8, 219u8, 107u8, 118u8,
92u8, 1u8, 162u8, 170u8, 251u8, 40u8, 25u8, 35u8, 237u8, 165u8, 11u8, 227u8, 202u8, 143u8,
27u8, 63u8, 78u8, 91u8, 87u8, 80u8, 253u8, 123u8, 245u8, 45u8, 144u8, 71u8, 142u8, 226u8,
240u8, 55u8, 226u8, 108u8, 253u8,
],
vk_gamme_g2: [
35u8, 62u8, 207u8, 9u8, 74u8, 43u8, 69u8, 60u8, 208u8, 12u8, 150u8, 245u8, 250u8, 105u8,
172u8, 78u8, 61u8, 122u8, 120u8, 222u8, 237u8, 226u8, 150u8, 241u8, 108u8, 206u8, 30u8,
252u8, 75u8, 31u8, 98u8, 152u8, 29u8, 143u8, 65u8, 173u8, 63u8, 120u8, 89u8, 144u8, 34u8,
77u8, 248u8, 132u8, 159u8, 23u8, 83u8, 232u8, 92u8, 36u8, 42u8, 92u8, 184u8, 94u8, 8u8,
205u8, 9u8, 196u8, 25u8, 234u8, 118u8, 141u8, 227u8, 102u8, 26u8, 76u8, 33u8, 48u8, 3u8,
221u8, 97u8, 188u8, 97u8, 232u8, 224u8, 16u8, 145u8, 176u8, 214u8, 118u8, 98u8, 48u8,
201u8, 145u8, 208u8, 113u8, 67u8, 155u8, 161u8, 197u8, 135u8, 202u8, 119u8, 128u8, 86u8,
163u8, 39u8, 38u8, 106u8, 176u8, 190u8, 202u8, 174u8, 137u8, 199u8, 215u8, 171u8, 64u8,
107u8, 216u8, 123u8, 249u8, 85u8, 202u8, 110u8, 115u8, 71u8, 100u8, 126u8, 200u8, 130u8,
205u8, 139u8, 14u8, 174u8, 59u8, 8u8, 37u8,
],
vk_delta_g2: [
18u8, 184u8, 241u8, 242u8, 84u8, 62u8, 16u8, 7u8, 184u8, 241u8, 2u8, 69u8, 16u8, 58u8,
230u8, 28u8, 115u8, 227u8, 190u8, 59u8, 146u8, 82u8, 32u8, 14u8, 11u8, 166u8, 140u8, 105u8,
214u8, 226u8, 165u8, 244u8, 25u8, 130u8, 54u8, 74u8, 58u8, 116u8, 12u8, 254u8, 142u8,
217u8, 201u8, 241u8, 222u8, 13u8, 190u8, 209u8, 179u8, 1u8, 8u8, 237u8, 30u8, 49u8, 125u8,
245u8, 156u8, 117u8, 131u8, 129u8, 14u8, 68u8, 229u8, 228u8, 46u8, 94u8, 94u8, 82u8, 171u8,
88u8, 89u8, 70u8, 166u8, 251u8, 163u8, 38u8, 185u8, 243u8, 186u8, 59u8, 96u8, 37u8, 158u8,
16u8, 70u8, 56u8, 93u8, 23u8, 245u8, 213u8, 39u8, 105u8, 17u8, 84u8, 8u8, 4u8, 21u8, 3u8,
138u8, 164u8, 69u8, 28u8, 215u8, 250u8, 109u8, 218u8, 28u8, 235u8, 122u8, 245u8, 105u8,
2u8, 41u8, 221u8, 196u8, 41u8, 46u8, 192u8, 244u8, 116u8, 194u8, 50u8, 132u8, 125u8, 57u8,
219u8, 191u8, 4u8,
],
vk_ic: &[
[
28u8, 173u8, 137u8, 91u8, 69u8, 169u8, 7u8, 115u8, 22u8, 156u8, 8u8, 157u8, 156u8,
245u8, 68u8, 48u8, 100u8, 68u8, 72u8, 65u8, 108u8, 130u8, 194u8, 126u8, 225u8, 105u8,
182u8, 44u8, 101u8, 151u8, 40u8, 217u8, 4u8, 244u8, 7u8, 83u8, 10u8, 174u8, 64u8,
149u8, 184u8, 192u8, 56u8, 164u8, 151u8, 186u8, 27u8, 173u8, 177u8, 107u8, 176u8, 30u8,
163u8, 229u8, 54u8, 121u8, 111u8, 51u8, 21u8, 230u8, 15u8, 53u8, 80u8, 157u8,
],
[
42u8, 235u8, 30u8, 69u8, 236u8, 238u8, 29u8, 149u8, 179u8, 10u8, 157u8, 245u8, 220u8,
157u8, 252u8, 38u8, 161u8, 107u8, 17u8, 181u8, 64u8, 97u8, 62u8, 59u8, 194u8, 99u8,
40u8, 124u8, 134u8, 40u8, 34u8, 148u8, 3u8, 53u8, 13u8, 177u8, 46u8, 110u8, 66u8,
142u8, 128u8, 167u8, 249u8, 125u8, 212u8, 165u8, 202u8, 125u8, 226u8, 227u8, 125u8,
115u8, 145u8, 192u8, 75u8, 18u8, 10u8, 140u8, 81u8, 35u8, 208u8, 18u8, 98u8, 161u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/inclusion_26_2.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 4usize,
vk_alpha_g1: [
34u8, 48u8, 79u8, 167u8, 205u8, 132u8, 123u8, 27u8, 236u8, 30u8, 59u8, 227u8, 223u8, 105u8,
45u8, 243u8, 252u8, 137u8, 215u8, 19u8, 230u8, 88u8, 139u8, 218u8, 24u8, 60u8, 62u8, 161u8,
3u8, 255u8, 102u8, 233u8, 46u8, 239u8, 105u8, 121u8, 133u8, 208u8, 44u8, 103u8, 17u8,
214u8, 102u8, 212u8, 207u8, 106u8, 228u8, 130u8, 50u8, 35u8, 13u8, 168u8, 29u8, 96u8, 77u8,
74u8, 163u8, 228u8, 219u8, 37u8, 63u8, 160u8, 69u8, 90u8,
],
vk_beta_g2: [
27u8, 68u8, 25u8, 55u8, 21u8, 255u8, 115u8, 132u8, 103u8, 10u8, 149u8, 196u8, 99u8, 96u8,
196u8, 221u8, 44u8, 80u8, 53u8, 87u8, 4u8, 96u8, 232u8, 121u8, 125u8, 234u8, 63u8, 156u8,
17u8, 143u8, 38u8, 141u8, 13u8, 229u8, 178u8, 9u8, 80u8, 203u8, 238u8, 154u8, 57u8, 43u8,
182u8, 9u8, 41u8, 110u8, 77u8, 140u8, 20u8, 24u8, 244u8, 215u8, 188u8, 48u8, 120u8, 71u8,
114u8, 102u8, 175u8, 239u8, 156u8, 255u8, 6u8, 149u8, 43u8, 239u8, 123u8, 88u8, 59u8,
226u8, 74u8, 112u8, 23u8, 53u8, 158u8, 224u8, 11u8, 138u8, 132u8, 39u8, 255u8, 2u8, 97u8,
45u8, 111u8, 59u8, 101u8, 59u8, 26u8, 46u8, 0u8, 82u8, 125u8, 236u8, 174u8, 19u8, 7u8,
158u8, 230u8, 116u8, 20u8, 84u8, 106u8, 126u8, 105u8, 43u8, 41u8, 142u8, 111u8, 181u8,
154u8, 7u8, 206u8, 139u8, 134u8, 109u8, 88u8, 180u8, 69u8, 128u8, 212u8, 36u8, 174u8, 33u8,
178u8, 11u8, 212u8, 88u8,
],
vk_gamme_g2: [
38u8, 184u8, 104u8, 179u8, 116u8, 49u8, 114u8, 154u8, 190u8, 38u8, 213u8, 72u8, 130u8,
102u8, 138u8, 58u8, 206u8, 242u8, 171u8, 129u8, 133u8, 195u8, 81u8, 247u8, 30u8, 46u8,
240u8, 189u8, 175u8, 78u8, 200u8, 38u8, 41u8, 67u8, 46u8, 128u8, 156u8, 1u8, 97u8, 212u8,
166u8, 44u8, 45u8, 228u8, 243u8, 221u8, 50u8, 247u8, 200u8, 61u8, 213u8, 1u8, 203u8, 85u8,
100u8, 91u8, 133u8, 244u8, 119u8, 3u8, 27u8, 229u8, 248u8, 166u8, 39u8, 193u8, 93u8, 213u8,
33u8, 189u8, 231u8, 205u8, 136u8, 57u8, 20u8, 104u8, 130u8, 162u8, 39u8, 81u8, 1u8, 223u8,
112u8, 37u8, 178u8, 187u8, 195u8, 73u8, 9u8, 255u8, 109u8, 201u8, 145u8, 119u8, 91u8,
189u8, 44u8, 185u8, 88u8, 156u8, 195u8, 156u8, 82u8, 165u8, 236u8, 208u8, 29u8, 165u8,
13u8, 223u8, 21u8, 170u8, 52u8, 128u8, 22u8, 185u8, 41u8, 11u8, 186u8, 213u8, 247u8, 126u8,
218u8, 109u8, 172u8, 231u8, 100u8, 93u8,
],
vk_delta_g2: [
41u8, 231u8, 160u8, 5u8, 83u8, 157u8, 8u8, 89u8, 118u8, 1u8, 246u8, 29u8, 198u8, 97u8,
130u8, 221u8, 92u8, 148u8, 39u8, 120u8, 203u8, 159u8, 61u8, 210u8, 58u8, 7u8, 123u8, 51u8,
178u8, 26u8, 23u8, 188u8, 19u8, 178u8, 213u8, 207u8, 54u8, 16u8, 241u8, 97u8, 56u8, 186u8,
89u8, 52u8, 157u8, 71u8, 175u8, 35u8, 187u8, 199u8, 43u8, 136u8, 79u8, 96u8, 140u8, 91u8,
220u8, 159u8, 44u8, 54u8, 217u8, 19u8, 3u8, 157u8, 33u8, 11u8, 128u8, 54u8, 40u8, 68u8,
164u8, 156u8, 225u8, 96u8, 186u8, 24u8, 154u8, 70u8, 116u8, 182u8, 11u8, 97u8, 146u8,
235u8, 217u8, 237u8, 162u8, 245u8, 142u8, 204u8, 247u8, 175u8, 70u8, 2u8, 210u8, 29u8,
31u8, 35u8, 234u8, 206u8, 136u8, 157u8, 121u8, 235u8, 90u8, 226u8, 131u8, 187u8, 200u8,
78u8, 109u8, 245u8, 188u8, 195u8, 29u8, 5u8, 227u8, 168u8, 187u8, 216u8, 231u8, 47u8,
224u8, 175u8, 95u8, 167u8, 206u8, 206u8,
],
vk_ic: &[
[
8u8, 251u8, 14u8, 225u8, 229u8, 26u8, 14u8, 108u8, 11u8, 40u8, 7u8, 135u8, 174u8,
110u8, 120u8, 5u8, 226u8, 66u8, 108u8, 158u8, 93u8, 105u8, 155u8, 167u8, 25u8, 129u8,
120u8, 135u8, 210u8, 58u8, 149u8, 71u8, 10u8, 219u8, 86u8, 33u8, 158u8, 168u8, 189u8,
14u8, 135u8, 90u8, 118u8, 157u8, 196u8, 178u8, 246u8, 140u8, 241u8, 7u8, 39u8, 189u8,
10u8, 72u8, 87u8, 255u8, 183u8, 154u8, 232u8, 22u8, 65u8, 114u8, 134u8, 247u8,
],
[
45u8, 79u8, 236u8, 74u8, 248u8, 66u8, 146u8, 59u8, 193u8, 254u8, 22u8, 231u8, 63u8,
52u8, 251u8, 182u8, 165u8, 250u8, 152u8, 92u8, 238u8, 219u8, 8u8, 231u8, 91u8, 147u8,
49u8, 85u8, 190u8, 87u8, 196u8, 91u8, 43u8, 66u8, 86u8, 5u8, 81u8, 56u8, 108u8, 157u8,
79u8, 130u8, 42u8, 7u8, 212u8, 168u8, 39u8, 200u8, 16u8, 96u8, 238u8, 88u8, 22u8,
176u8, 182u8, 26u8, 158u8, 163u8, 205u8, 65u8, 47u8, 6u8, 214u8, 144u8,
],
[
21u8, 41u8, 144u8, 58u8, 224u8, 70u8, 112u8, 123u8, 133u8, 246u8, 82u8, 99u8, 196u8,
82u8, 73u8, 86u8, 183u8, 87u8, 72u8, 230u8, 118u8, 219u8, 53u8, 165u8, 235u8, 136u8,
140u8, 46u8, 189u8, 104u8, 112u8, 3u8, 22u8, 15u8, 70u8, 7u8, 64u8, 227u8, 119u8,
141u8, 148u8, 124u8, 228u8, 67u8, 139u8, 193u8, 126u8, 94u8, 103u8, 153u8, 127u8,
181u8, 3u8, 124u8, 65u8, 132u8, 154u8, 23u8, 209u8, 106u8, 121u8, 207u8, 110u8, 8u8,
],
[
24u8, 159u8, 228u8, 92u8, 198u8, 112u8, 159u8, 81u8, 237u8, 247u8, 212u8, 195u8, 25u8,
177u8, 213u8, 223u8, 134u8, 123u8, 115u8, 3u8, 96u8, 193u8, 51u8, 120u8, 28u8, 208u8,
182u8, 214u8, 157u8, 249u8, 73u8, 16u8, 5u8, 182u8, 189u8, 178u8, 210u8, 75u8, 88u8,
129u8, 143u8, 226u8, 217u8, 233u8, 232u8, 42u8, 181u8, 110u8, 196u8, 183u8, 200u8,
150u8, 91u8, 57u8, 19u8, 22u8, 6u8, 31u8, 62u8, 16u8, 163u8, 88u8, 77u8, 13u8,
],
[
22u8, 95u8, 27u8, 70u8, 206u8, 18u8, 234u8, 134u8, 172u8, 202u8, 213u8, 215u8, 3u8,
53u8, 170u8, 220u8, 201u8, 138u8, 16u8, 192u8, 110u8, 156u8, 227u8, 25u8, 124u8, 112u8,
124u8, 127u8, 16u8, 148u8, 175u8, 203u8, 13u8, 35u8, 136u8, 177u8, 57u8, 16u8, 98u8,
8u8, 160u8, 137u8, 58u8, 56u8, 8u8, 167u8, 230u8, 173u8, 166u8, 101u8, 232u8, 216u8,
189u8, 218u8, 159u8, 117u8, 15u8, 194u8, 197u8, 112u8, 71u8, 68u8, 234u8, 94u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/inclusion_26_3.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 6usize,
vk_alpha_g1: [
31u8, 68u8, 56u8, 3u8, 17u8, 93u8, 98u8, 70u8, 252u8, 44u8, 85u8, 66u8, 82u8, 45u8, 81u8,
222u8, 97u8, 198u8, 71u8, 60u8, 121u8, 252u8, 194u8, 35u8, 130u8, 7u8, 152u8, 199u8, 70u8,
89u8, 212u8, 89u8, 21u8, 186u8, 132u8, 225u8, 181u8, 220u8, 53u8, 8u8, 184u8, 58u8, 11u8,
94u8, 124u8, 122u8, 196u8, 202u8, 149u8, 205u8, 115u8, 42u8, 220u8, 121u8, 235u8, 157u8,
131u8, 27u8, 207u8, 98u8, 229u8, 156u8, 35u8, 255u8,
],
vk_beta_g2: [
46u8, 172u8, 120u8, 29u8, 137u8, 113u8, 253u8, 84u8, 255u8, 225u8, 94u8, 155u8, 237u8,
152u8, 230u8, 136u8, 166u8, 90u8, 4u8, 147u8, 196u8, 102u8, 16u8, 147u8, 6u8, 239u8, 218u8,
114u8, 103u8, 104u8, 236u8, 106u8, 36u8, 171u8, 15u8, 155u8, 92u8, 79u8, 139u8, 167u8,
147u8, 154u8, 10u8, 106u8, 250u8, 72u8, 226u8, 200u8, 120u8, 56u8, 109u8, 185u8, 21u8,
188u8, 12u8, 120u8, 236u8, 164u8, 207u8, 141u8, 214u8, 35u8, 50u8, 60u8, 25u8, 46u8, 248u8,
176u8, 227u8, 207u8, 225u8, 228u8, 180u8, 230u8, 232u8, 248u8, 3u8, 135u8, 216u8, 177u8,
90u8, 246u8, 88u8, 229u8, 110u8, 68u8, 182u8, 126u8, 92u8, 60u8, 198u8, 111u8, 151u8, 49u8,
118u8, 181u8, 24u8, 4u8, 121u8, 113u8, 91u8, 161u8, 91u8, 82u8, 54u8, 79u8, 185u8, 41u8,
54u8, 251u8, 38u8, 196u8, 55u8, 204u8, 230u8, 26u8, 102u8, 227u8, 118u8, 163u8, 250u8,
169u8, 0u8, 150u8, 161u8, 105u8, 227u8, 7u8,
],
vk_gamme_g2: [
12u8, 13u8, 64u8, 59u8, 33u8, 219u8, 116u8, 122u8, 168u8, 91u8, 191u8, 179u8, 11u8, 52u8,
29u8, 63u8, 40u8, 4u8, 117u8, 124u8, 232u8, 236u8, 202u8, 226u8, 151u8, 199u8, 247u8,
236u8, 241u8, 248u8, 98u8, 21u8, 37u8, 229u8, 95u8, 254u8, 132u8, 206u8, 171u8, 157u8,
152u8, 248u8, 214u8, 165u8, 217u8, 196u8, 229u8, 114u8, 164u8, 8u8, 54u8, 101u8, 100u8,
249u8, 122u8, 72u8, 76u8, 183u8, 73u8, 238u8, 116u8, 118u8, 160u8, 9u8, 5u8, 200u8, 134u8,
116u8, 156u8, 145u8, 13u8, 222u8, 166u8, 47u8, 182u8, 214u8, 164u8, 59u8, 57u8, 199u8,
103u8, 234u8, 3u8, 99u8, 72u8, 148u8, 67u8, 141u8, 9u8, 77u8, 251u8, 180u8, 37u8, 28u8,
214u8, 143u8, 16u8, 193u8, 166u8, 207u8, 107u8, 124u8, 162u8, 171u8, 142u8, 41u8, 41u8,
211u8, 74u8, 144u8, 37u8, 91u8, 162u8, 192u8, 44u8, 213u8, 18u8, 5u8, 154u8, 110u8, 85u8,
213u8, 234u8, 226u8, 119u8, 210u8, 42u8, 123u8,
],
vk_delta_g2: [
1u8, 30u8, 13u8, 60u8, 25u8, 97u8, 237u8, 107u8, 222u8, 16u8, 201u8, 86u8, 17u8, 195u8,
184u8, 150u8, 165u8, 75u8, 6u8, 166u8, 229u8, 68u8, 18u8, 149u8, 43u8, 142u8, 25u8, 119u8,
208u8, 57u8, 245u8, 142u8, 14u8, 138u8, 129u8, 18u8, 42u8, 133u8, 231u8, 110u8, 67u8,
123u8, 243u8, 23u8, 114u8, 237u8, 48u8, 59u8, 127u8, 182u8, 17u8, 128u8, 193u8, 241u8,
162u8, 157u8, 122u8, 72u8, 61u8, 84u8, 81u8, 70u8, 143u8, 52u8, 43u8, 171u8, 192u8, 186u8,
1u8, 226u8, 255u8, 145u8, 13u8, 223u8, 110u8, 255u8, 176u8, 168u8, 117u8, 184u8, 64u8,
30u8, 122u8, 125u8, 52u8, 73u8, 205u8, 247u8, 190u8, 189u8, 128u8, 66u8, 24u8, 246u8, 49u8,
41u8, 33u8, 165u8, 117u8, 37u8, 20u8, 0u8, 37u8, 83u8, 183u8, 42u8, 89u8, 44u8, 238u8,
166u8, 108u8, 251u8, 255u8, 76u8, 68u8, 118u8, 67u8, 153u8, 63u8, 108u8, 127u8, 253u8,
11u8, 162u8, 193u8, 149u8, 58u8, 185u8,
],
vk_ic: &[
[
28u8, 118u8, 69u8, 238u8, 5u8, 131u8, 130u8, 125u8, 245u8, 184u8, 107u8, 74u8, 192u8,
223u8, 106u8, 15u8, 150u8, 47u8, 218u8, 147u8, 161u8, 17u8, 54u8, 59u8, 210u8, 22u8,
17u8, 83u8, 254u8, 172u8, 139u8, 225u8, 44u8, 180u8, 214u8, 116u8, 181u8, 56u8, 218u8,
251u8, 204u8, 143u8, 226u8, 55u8, 145u8, 139u8, 73u8, 61u8, 243u8, 255u8, 230u8, 245u8,
84u8, 248u8, 20u8, 12u8, 83u8, 57u8, 205u8, 18u8, 251u8, 241u8, 65u8, 97u8,
],
[
34u8, 140u8, 152u8, 205u8, 145u8, 17u8, 149u8, 157u8, 151u8, 250u8, 189u8, 68u8, 23u8,
115u8, 162u8, 120u8, 105u8, 171u8, 35u8, 236u8, 118u8, 36u8, 58u8, 120u8, 106u8, 186u8,
155u8, 166u8, 102u8, 9u8, 196u8, 145u8, 22u8, 66u8, 244u8, 19u8, 72u8, 157u8, 72u8,
250u8, 1u8, 190u8, 179u8, 132u8, 72u8, 137u8, 169u8, 46u8, 11u8, 72u8, 195u8, 186u8,
151u8, 58u8, 1u8, 136u8, 164u8, 142u8, 122u8, 27u8, 98u8, 135u8, 199u8, 221u8,
],
[
39u8, 71u8, 126u8, 189u8, 95u8, 129u8, 53u8, 110u8, 163u8, 130u8, 68u8, 20u8, 39u8,
124u8, 62u8, 78u8, 36u8, 150u8, 106u8, 240u8, 27u8, 3u8, 247u8, 141u8, 51u8, 245u8,
24u8, 238u8, 59u8, 152u8, 174u8, 30u8, 18u8, 24u8, 4u8, 226u8, 10u8, 114u8, 94u8, 46u8,
105u8, 78u8, 45u8, 182u8, 66u8, 108u8, 239u8, 181u8, 174u8, 248u8, 44u8, 164u8, 126u8,
38u8, 91u8, 50u8, 86u8, 117u8, 57u8, 180u8, 235u8, 150u8, 186u8, 19u8,
],
[
11u8, 217u8, 126u8, 55u8, 98u8, 38u8, 230u8, 248u8, 53u8, 169u8, 63u8, 150u8, 62u8,
208u8, 74u8, 89u8, 239u8, 20u8, 133u8, 252u8, 197u8, 179u8, 222u8, 184u8, 184u8, 164u8,
150u8, 39u8, 117u8, 4u8, 234u8, 136u8, 12u8, 10u8, 89u8, 150u8, 215u8, 231u8, 40u8,
148u8, 72u8, 33u8, 159u8, 123u8, 28u8, 27u8, 3u8, 217u8, 207u8, 223u8, 83u8, 88u8,
47u8, 209u8, 222u8, 100u8, 225u8, 235u8, 98u8, 81u8, 2u8, 234u8, 234u8, 138u8,
],
[
30u8, 78u8, 85u8, 234u8, 109u8, 228u8, 164u8, 108u8, 92u8, 197u8, 159u8, 84u8, 138u8,
1u8, 114u8, 244u8, 209u8, 11u8, 201u8, 227u8, 90u8, 123u8, 58u8, 206u8, 17u8, 248u8,
146u8, 254u8, 181u8, 193u8, 22u8, 18u8, 37u8, 41u8, 60u8, 86u8, 205u8, 56u8, 243u8,
238u8, 219u8, 254u8, 3u8, 179u8, 13u8, 178u8, 45u8, 22u8, 27u8, 203u8, 22u8, 115u8,
137u8, 115u8, 102u8, 170u8, 41u8, 223u8, 77u8, 231u8, 241u8, 225u8, 85u8, 235u8,
],
[
25u8, 125u8, 235u8, 100u8, 163u8, 28u8, 75u8, 15u8, 92u8, 20u8, 184u8, 169u8, 88u8,
107u8, 69u8, 116u8, 67u8, 111u8, 201u8, 3u8, 107u8, 216u8, 49u8, 29u8, 103u8, 69u8,
23u8, 214u8, 254u8, 16u8, 116u8, 42u8, 34u8, 31u8, 124u8, 176u8, 249u8, 92u8, 203u8,
98u8, 190u8, 245u8, 1u8, 177u8, 251u8, 196u8, 9u8, 132u8, 64u8, 181u8, 141u8, 11u8,
123u8, 205u8, 197u8, 255u8, 115u8, 194u8, 150u8, 153u8, 33u8, 16u8, 143u8, 115u8,
],
[
24u8, 191u8, 155u8, 0u8, 112u8, 83u8, 179u8, 182u8, 147u8, 114u8, 112u8, 46u8, 248u8,
121u8, 105u8, 72u8, 80u8, 159u8, 84u8, 62u8, 79u8, 202u8, 98u8, 42u8, 52u8, 231u8,
49u8, 141u8, 107u8, 33u8, 161u8, 89u8, 31u8, 82u8, 214u8, 10u8, 72u8, 42u8, 197u8,
62u8, 184u8, 83u8, 194u8, 9u8, 90u8, 220u8, 213u8, 213u8, 137u8, 197u8, 204u8, 28u8,
181u8, 104u8, 67u8, 154u8, 122u8, 155u8, 150u8, 73u8, 137u8, 107u8, 57u8, 189u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/address_append_26_500.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
44u8, 254u8, 117u8, 148u8, 225u8, 45u8, 180u8, 255u8, 45u8, 42u8, 139u8, 228u8, 41u8,
227u8, 175u8, 123u8, 238u8, 232u8, 51u8, 198u8, 1u8, 114u8, 80u8, 30u8, 43u8, 78u8, 200u8,
45u8, 161u8, 236u8, 38u8, 83u8, 30u8, 6u8, 54u8, 79u8, 98u8, 214u8, 43u8, 243u8, 112u8,
90u8, 252u8, 34u8, 254u8, 199u8, 71u8, 188u8, 137u8, 165u8, 69u8, 216u8, 110u8, 141u8,
168u8, 239u8, 124u8, 247u8, 125u8, 83u8, 78u8, 253u8, 139u8, 221u8,
],
vk_beta_g2: [
32u8, 101u8, 195u8, 43u8, 98u8, 8u8, 189u8, 14u8, 253u8, 96u8, 104u8, 217u8, 130u8, 16u8,
99u8, 15u8, 61u8, 250u8, 13u8, 30u8, 39u8, 51u8, 222u8, 13u8, 250u8, 237u8, 11u8, 93u8,
95u8, 211u8, 99u8, 225u8, 32u8, 19u8, 247u8, 149u8, 153u8, 83u8, 162u8, 128u8, 52u8, 198u8,
110u8, 238u8, 155u8, 15u8, 100u8, 86u8, 79u8, 231u8, 77u8, 79u8, 43u8, 230u8, 204u8, 106u8,
3u8, 41u8, 132u8, 33u8, 5u8, 246u8, 72u8, 124u8, 20u8, 123u8, 60u8, 90u8, 157u8, 72u8,
228u8, 97u8, 26u8, 173u8, 57u8, 211u8, 27u8, 23u8, 109u8, 172u8, 155u8, 208u8, 101u8,
114u8, 190u8, 250u8, 253u8, 71u8, 80u8, 92u8, 152u8, 177u8, 8u8, 5u8, 203u8, 191u8, 25u8,
15u8, 229u8, 152u8, 102u8, 96u8, 26u8, 43u8, 30u8, 99u8, 1u8, 157u8, 186u8, 197u8, 111u8,
35u8, 175u8, 253u8, 4u8, 249u8, 89u8, 216u8, 5u8, 12u8, 220u8, 28u8, 227u8, 67u8, 234u8,
222u8, 83u8, 220u8,
],
vk_gamme_g2: [
39u8, 242u8, 73u8, 50u8, 109u8, 248u8, 228u8, 34u8, 199u8, 179u8, 37u8, 223u8, 99u8, 29u8,
111u8, 119u8, 232u8, 48u8, 45u8, 145u8, 249u8, 197u8, 92u8, 21u8, 50u8, 213u8, 52u8, 82u8,
225u8, 31u8, 0u8, 131u8, 21u8, 66u8, 46u8, 94u8, 172u8, 220u8, 218u8, 190u8, 42u8, 241u8,
51u8, 176u8, 180u8, 102u8, 27u8, 78u8, 68u8, 164u8, 165u8, 97u8, 116u8, 19u8, 9u8, 70u8,
120u8, 87u8, 194u8, 191u8, 239u8, 229u8, 159u8, 110u8, 25u8, 67u8, 104u8, 199u8, 11u8, 0u8,
219u8, 207u8, 237u8, 197u8, 25u8, 213u8, 244u8, 58u8, 239u8, 8u8, 60u8, 72u8, 238u8, 71u8,
153u8, 243u8, 128u8, 57u8, 186u8, 73u8, 252u8, 49u8, 81u8, 226u8, 83u8, 231u8, 41u8, 177u8,
160u8, 144u8, 135u8, 41u8, 150u8, 163u8, 2u8, 27u8, 236u8, 244u8, 82u8, 67u8, 171u8, 75u8,
112u8, 11u8, 133u8, 65u8, 9u8, 52u8, 72u8, 184u8, 46u8, 47u8, 242u8, 182u8, 80u8, 59u8,
220u8, 62u8,
],
vk_delta_g2: [
42u8, 202u8, 87u8, 62u8, 38u8, 184u8, 244u8, 217u8, 29u8, 128u8, 219u8, 253u8, 176u8, 58u8,
130u8, 44u8, 246u8, 216u8, 2u8, 221u8, 227u8, 81u8, 41u8, 197u8, 113u8, 139u8, 36u8, 26u8,
194u8, 168u8, 25u8, 53u8, 19u8, 6u8, 151u8, 43u8, 194u8, 192u8, 63u8, 199u8, 34u8, 227u8,
229u8, 119u8, 123u8, 86u8, 206u8, 125u8, 38u8, 46u8, 71u8, 28u8, 67u8, 179u8, 73u8, 64u8,
226u8, 225u8, 27u8, 59u8, 125u8, 5u8, 53u8, 88u8, 6u8, 205u8, 114u8, 217u8, 208u8, 102u8,
247u8, 233u8, 83u8, 149u8, 141u8, 144u8, 154u8, 18u8, 204u8, 112u8, 171u8, 172u8, 235u8,
214u8, 176u8, 237u8, 92u8, 114u8, 80u8, 208u8, 185u8, 190u8, 123u8, 11u8, 180u8, 253u8,
25u8, 96u8, 248u8, 181u8, 108u8, 107u8, 167u8, 47u8, 145u8, 8u8, 84u8, 206u8, 152u8, 135u8,
92u8, 251u8, 80u8, 66u8, 86u8, 164u8, 204u8, 96u8, 160u8, 152u8, 93u8, 81u8, 65u8, 83u8,
229u8, 151u8, 244u8, 73u8,
],
vk_ic: &[
[
37u8, 134u8, 15u8, 204u8, 30u8, 19u8, 57u8, 134u8, 98u8, 51u8, 13u8, 140u8, 173u8,
67u8, 243u8, 8u8, 200u8, 40u8, 150u8, 175u8, 104u8, 152u8, 211u8, 203u8, 11u8, 231u8,
112u8, 82u8, 62u8, 251u8, 79u8, 73u8, 41u8, 215u8, 227u8, 104u8, 108u8, 175u8, 34u8,
24u8, 216u8, 90u8, 193u8, 223u8, 24u8, 26u8, 175u8, 1u8, 228u8, 120u8, 0u8, 113u8,
46u8, 44u8, 99u8, 118u8, 237u8, 244u8, 108u8, 51u8, 200u8, 218u8, 188u8, 145u8,
],
[
27u8, 106u8, 215u8, 184u8, 31u8, 169u8, 219u8, 123u8, 83u8, 1u8, 25u8, 0u8, 183u8,
220u8, 147u8, 83u8, 89u8, 21u8, 74u8, 124u8, 135u8, 131u8, 147u8, 161u8, 217u8, 81u8,
205u8, 82u8, 108u8, 84u8, 64u8, 214u8, 17u8, 132u8, 154u8, 240u8, 124u8, 141u8, 184u8,
246u8, 211u8, 232u8, 193u8, 210u8, 190u8, 186u8, 83u8, 4u8, 41u8, 220u8, 119u8, 189u8,
7u8, 185u8, 77u8, 188u8, 212u8, 111u8, 251u8, 252u8, 245u8, 93u8, 138u8, 135u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/address_append_40_1.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
47u8, 210u8, 83u8, 92u8, 199u8, 97u8, 152u8, 7u8, 13u8, 40u8, 30u8, 9u8, 112u8, 89u8, 28u8,
48u8, 138u8, 45u8, 25u8, 119u8, 197u8, 114u8, 5u8, 120u8, 114u8, 122u8, 38u8, 153u8, 184u8,
238u8, 66u8, 22u8, 13u8, 169u8, 91u8, 37u8, 26u8, 197u8, 171u8, 59u8, 221u8, 122u8, 180u8,
195u8, 8u8, 176u8, 219u8, 77u8, 151u8, 100u8, 198u8, 250u8, 171u8, 246u8, 240u8, 191u8,
247u8, 65u8, 60u8, 240u8, 233u8, 38u8, 118u8, 83u8,
],
vk_beta_g2: [
19u8, 10u8, 74u8, 195u8, 27u8, 165u8, 203u8, 159u8, 129u8, 45u8, 244u8, 126u8, 155u8,
202u8, 172u8, 184u8, 62u8, 27u8, 81u8, 148u8, 237u8, 189u8, 92u8, 243u8, 32u8, 166u8, 63u8,
5u8, 54u8, 91u8, 67u8, 157u8, 29u8, 53u8, 39u8, 41u8, 5u8, 100u8, 192u8, 53u8, 239u8,
187u8, 136u8, 91u8, 74u8, 81u8, 213u8, 160u8, 61u8, 81u8, 159u8, 73u8, 79u8, 234u8, 96u8,
77u8, 199u8, 155u8, 64u8, 163u8, 33u8, 81u8, 154u8, 86u8, 43u8, 110u8, 101u8, 118u8, 189u8,
192u8, 178u8, 222u8, 164u8, 234u8, 177u8, 232u8, 36u8, 36u8, 187u8, 17u8, 150u8, 242u8,
109u8, 26u8, 159u8, 183u8, 76u8, 186u8, 242u8, 98u8, 251u8, 90u8, 137u8, 38u8, 116u8, 13u8,
2u8, 16u8, 52u8, 74u8, 196u8, 147u8, 45u8, 255u8, 66u8, 221u8, 166u8, 173u8, 55u8, 129u8,
87u8, 187u8, 143u8, 251u8, 97u8, 161u8, 51u8, 47u8, 130u8, 14u8, 76u8, 247u8, 144u8, 246u8,
245u8, 209u8, 26u8, 105u8,
],
vk_gamme_g2: [
33u8, 236u8, 76u8, 252u8, 212u8, 255u8, 50u8, 21u8, 134u8, 7u8, 192u8, 46u8, 135u8, 39u8,
137u8, 219u8, 22u8, 90u8, 233u8, 199u8, 173u8, 154u8, 9u8, 239u8, 236u8, 201u8, 13u8,
173u8, 201u8, 7u8, 101u8, 98u8, 40u8, 95u8, 221u8, 82u8, 125u8, 216u8, 108u8, 223u8, 188u8,
254u8, 90u8, 92u8, 199u8, 53u8, 175u8, 247u8, 213u8, 108u8, 164u8, 137u8, 40u8, 2u8, 255u8,
110u8, 238u8, 38u8, 125u8, 188u8, 247u8, 207u8, 130u8, 26u8, 28u8, 251u8, 151u8, 244u8,
110u8, 229u8, 97u8, 222u8, 203u8, 84u8, 20u8, 100u8, 84u8, 196u8, 206u8, 227u8, 125u8,
47u8, 160u8, 152u8, 62u8, 62u8, 28u8, 7u8, 78u8, 86u8, 116u8, 63u8, 15u8, 54u8, 223u8,
71u8, 39u8, 224u8, 226u8, 4u8, 55u8, 223u8, 12u8, 209u8, 163u8, 226u8, 101u8, 54u8, 174u8,
151u8, 168u8, 232u8, 180u8, 240u8, 37u8, 45u8, 233u8, 177u8, 167u8, 2u8, 246u8, 115u8,
23u8, 162u8, 233u8, 94u8, 58u8, 72u8,
],
vk_delta_g2: [
20u8, 112u8, 52u8, 195u8, 193u8, 113u8, 204u8, 169u8, 176u8, 131u8, 81u8, 216u8, 87u8,
122u8, 50u8, 180u8, 220u8, 176u8, 103u8, 32u8, 222u8, 219u8, 166u8, 37u8, 87u8, 243u8,
12u8, 151u8, 225u8, 116u8, 166u8, 181u8, 15u8, 199u8, 50u8, 53u8, 84u8, 237u8, 9u8, 108u8,
153u8, 28u8, 32u8, 246u8, 96u8, 33u8, 155u8, 191u8, 29u8, 52u8, 151u8, 143u8, 185u8, 7u8,
27u8, 33u8, 189u8, 114u8, 66u8, 98u8, 107u8, 153u8, 240u8, 126u8, 1u8, 196u8, 23u8, 149u8,
64u8, 142u8, 234u8, 182u8, 51u8, 169u8, 36u8, 133u8, 26u8, 219u8, 241u8, 182u8, 10u8, 94u8,
131u8, 224u8, 10u8, 25u8, 151u8, 90u8, 74u8, 124u8, 44u8, 92u8, 111u8, 169u8, 89u8, 209u8,
14u8, 14u8, 184u8, 202u8, 227u8, 105u8, 230u8, 146u8, 123u8, 211u8, 8u8, 112u8, 111u8,
211u8, 253u8, 20u8, 220u8, 243u8, 72u8, 12u8, 171u8, 237u8, 115u8, 45u8, 46u8, 166u8,
115u8, 30u8, 252u8, 54u8, 195u8, 29u8,
],
vk_ic: &[
[
4u8, 72u8, 249u8, 173u8, 194u8, 192u8, 141u8, 214u8, 245u8, 214u8, 38u8, 216u8, 136u8,
124u8, 188u8, 238u8, 66u8, 75u8, 123u8, 166u8, 183u8, 162u8, 156u8, 213u8, 155u8, 32u8,
36u8, 150u8, 84u8, 100u8, 98u8, 204u8, 15u8, 243u8, 225u8, 107u8, 221u8, 253u8, 43u8,
145u8, 152u8, 17u8, 80u8, 6u8, 145u8, 157u8, 199u8, 66u8, 170u8, 16u8, 21u8, 27u8,
111u8, 136u8, 225u8, 23u8, 175u8, 59u8, 92u8, 161u8, 83u8, 138u8, 194u8, 101u8,
],
[
19u8, 216u8, 201u8, 61u8, 125u8, 191u8, 182u8, 0u8, 211u8, 43u8, 251u8, 29u8, 65u8,
211u8, 209u8, 107u8, 138u8, 144u8, 28u8, 117u8, 185u8, 151u8, 11u8, 42u8, 238u8, 130u8,
5u8, 184u8, 229u8, 33u8, 250u8, 9u8, 18u8, 57u8, 95u8, 126u8, 20u8, 176u8, 33u8, 181u8,
177u8, 208u8, 74u8, 242u8, 149u8, 220u8, 153u8, 213u8, 70u8, 168u8, 240u8, 163u8,
184u8, 48u8, 1u8, 47u8, 204u8, 213u8, 159u8, 82u8, 187u8, 20u8, 174u8, 139u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_subtrees_26_500.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
24u8, 119u8, 80u8, 206u8, 169u8, 86u8, 100u8, 55u8, 148u8, 186u8, 197u8, 158u8, 24u8, 15u8,
149u8, 202u8, 185u8, 161u8, 38u8, 182u8, 163u8, 214u8, 117u8, 82u8, 12u8, 52u8, 221u8,
108u8, 87u8, 244u8, 36u8, 142u8, 0u8, 208u8, 101u8, 21u8, 55u8, 178u8, 65u8, 176u8, 151u8,
34u8, 187u8, 103u8, 238u8, 91u8, 209u8, 2u8, 224u8, 40u8, 194u8, 93u8, 51u8, 80u8, 142u8,
156u8, 165u8, 157u8, 163u8, 27u8, 81u8, 150u8, 164u8, 141u8,
],
vk_beta_g2: [
42u8, 6u8, 114u8, 159u8, 97u8, 192u8, 104u8, 164u8, 215u8, 127u8, 34u8, 147u8, 6u8, 19u8,
2u8, 99u8, 175u8, 98u8, 36u8, 191u8, 64u8, 35u8, 185u8, 162u8, 119u8, 102u8, 168u8, 49u8,
136u8, 179u8, 149u8, 4u8, 22u8, 202u8, 181u8, 177u8, 79u8, 145u8, 18u8, 244u8, 67u8, 240u8,
18u8, 49u8, 51u8, 194u8, 160u8, 101u8, 240u8, 149u8, 170u8, 188u8, 92u8, 204u8, 112u8,
75u8, 176u8, 75u8, 214u8, 30u8, 239u8, 104u8, 6u8, 65u8, 36u8, 83u8, 231u8, 239u8, 45u8,
33u8, 67u8, 155u8, 66u8, 88u8, 198u8, 84u8, 5u8, 86u8, 94u8, 68u8, 156u8, 156u8, 178u8,
117u8, 116u8, 188u8, 20u8, 195u8, 38u8, 212u8, 170u8, 135u8, 115u8, 77u8, 200u8, 90u8,
41u8, 233u8, 9u8, 154u8, 179u8, 79u8, 215u8, 130u8, 181u8, 90u8, 48u8, 253u8, 118u8, 188u8,
229u8, 51u8, 250u8, 133u8, 204u8, 238u8, 179u8, 56u8, 224u8, 147u8, 208u8, 115u8, 0u8,
90u8, 85u8, 60u8, 122u8, 218u8,
],
vk_gamme_g2: [
12u8, 43u8, 16u8, 154u8, 137u8, 15u8, 71u8, 97u8, 3u8, 78u8, 58u8, 129u8, 221u8, 117u8,
211u8, 241u8, 133u8, 4u8, 154u8, 121u8, 180u8, 40u8, 65u8, 74u8, 246u8, 2u8, 28u8, 67u8,
128u8, 92u8, 254u8, 118u8, 16u8, 51u8, 204u8, 58u8, 90u8, 77u8, 51u8, 112u8, 24u8, 69u8,
7u8, 129u8, 138u8, 238u8, 69u8, 254u8, 160u8, 209u8, 1u8, 186u8, 83u8, 118u8, 115u8, 223u8,
155u8, 176u8, 83u8, 115u8, 224u8, 146u8, 213u8, 108u8, 17u8, 195u8, 34u8, 36u8, 122u8,
15u8, 87u8, 70u8, 76u8, 95u8, 125u8, 44u8, 50u8, 23u8, 212u8, 200u8, 51u8, 26u8, 69u8,
65u8, 223u8, 57u8, 132u8, 156u8, 0u8, 250u8, 142u8, 12u8, 199u8, 241u8, 227u8, 117u8, 36u8,
250u8, 82u8, 139u8, 27u8, 132u8, 16u8, 175u8, 66u8, 94u8, 86u8, 54u8, 240u8, 69u8, 3u8,
159u8, 8u8, 177u8, 59u8, 135u8, 188u8, 116u8, 2u8, 235u8, 175u8, 28u8, 116u8, 102u8, 73u8,
209u8, 95u8, 137u8,
],
vk_delta_g2: [
4u8, 230u8, 138u8, 96u8, 103u8, 50u8, 4u8, 145u8, 111u8, 43u8, 44u8, 49u8, 97u8, 199u8,
56u8, 21u8, 104u8, 102u8, 80u8, 148u8, 45u8, 65u8, 75u8, 68u8, 17u8, 198u8, 92u8, 222u8,
0u8, 133u8, 44u8, 169u8, 17u8, 7u8, 74u8, 212u8, 204u8, 238u8, 52u8, 159u8, 131u8, 45u8,
218u8, 77u8, 21u8, 25u8, 157u8, 195u8, 148u8, 151u8, 186u8, 209u8, 48u8, 226u8, 33u8,
172u8, 24u8, 155u8, 56u8, 205u8, 172u8, 207u8, 116u8, 110u8, 44u8, 186u8, 86u8, 166u8,
131u8, 109u8, 133u8, 225u8, 121u8, 181u8, 19u8, 31u8, 105u8, 185u8, 32u8, 29u8, 251u8,
123u8, 34u8, 104u8, 210u8, 94u8, 171u8, 77u8, 217u8, 203u8, 88u8, 58u8, 63u8, 59u8, 223u8,
92u8, 47u8, 22u8, 80u8, 228u8, 8u8, 71u8, 81u8, 114u8, 20u8, 197u8, 229u8, 27u8, 107u8,
153u8, 206u8, 121u8, 67u8, 185u8, 169u8, 122u8, 71u8, 55u8, 231u8, 83u8, 43u8, 236u8,
126u8, 131u8, 18u8, 168u8, 108u8, 216u8,
],
vk_ic: &[
[
17u8, 189u8, 85u8, 227u8, 93u8, 255u8, 110u8, 149u8, 123u8, 108u8, 166u8, 90u8, 241u8,
255u8, 180u8, 162u8, 193u8, 47u8, 7u8, 66u8, 26u8, 215u8, 212u8, 169u8, 57u8, 180u8,
14u8, 37u8, 90u8, 209u8, 37u8, 84u8, 43u8, 4u8, 114u8, 60u8, 88u8, 17u8, 43u8, 226u8,
130u8, 27u8, 92u8, 43u8, 152u8, 121u8, 245u8, 26u8, 167u8, 38u8, 134u8, 154u8, 100u8,
36u8, 234u8, 196u8, 132u8, 110u8, 73u8, 132u8, 166u8, 217u8, 226u8, 152u8,
],
[
15u8, 136u8, 95u8, 116u8, 255u8, 125u8, 173u8, 166u8, 13u8, 68u8, 249u8, 92u8, 152u8,
103u8, 242u8, 229u8, 81u8, 23u8, 130u8, 44u8, 19u8, 133u8, 166u8, 71u8, 140u8, 208u8,
101u8, 82u8, 204u8, 229u8, 152u8, 5u8, 33u8, 238u8, 205u8, 150u8, 159u8, 178u8, 207u8,
183u8, 86u8, 124u8, 101u8, 229u8, 172u8, 89u8, 89u8, 231u8, 172u8, 132u8, 67u8, 234u8,
83u8, 115u8, 237u8, 234u8, 113u8, 226u8, 141u8, 8u8, 121u8, 154u8, 135u8, 195u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/update_10_10.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
30u8, 119u8, 230u8, 5u8, 142u8, 169u8, 127u8, 79u8, 133u8, 69u8, 185u8, 219u8, 240u8, 96u8,
18u8, 100u8, 62u8, 159u8, 233u8, 130u8, 37u8, 150u8, 52u8, 200u8, 122u8, 233u8, 165u8,
53u8, 41u8, 188u8, 14u8, 145u8, 0u8, 157u8, 88u8, 195u8, 32u8, 173u8, 42u8, 51u8, 44u8,
163u8, 96u8, 255u8, 152u8, 13u8, 13u8, 101u8, 126u8, 159u8, 26u8, 139u8, 172u8, 220u8,
63u8, 229u8, 136u8, 164u8, 169u8, 175u8, 169u8, 237u8, 44u8, 171u8,
],
vk_beta_g2: [
0u8, 95u8, 66u8, 106u8, 121u8, 6u8, 69u8, 15u8, 221u8, 61u8, 24u8, 218u8, 128u8, 164u8,
129u8, 197u8, 125u8, 30u8, 252u8, 3u8, 160u8, 83u8, 160u8, 33u8, 202u8, 218u8, 185u8,
133u8, 103u8, 43u8, 225u8, 187u8, 34u8, 228u8, 61u8, 19u8, 29u8, 68u8, 16u8, 141u8, 29u8,
19u8, 223u8, 7u8, 8u8, 86u8, 142u8, 212u8, 3u8, 135u8, 23u8, 74u8, 162u8, 61u8, 247u8,
44u8, 166u8, 224u8, 15u8, 131u8, 206u8, 113u8, 65u8, 156u8, 11u8, 78u8, 253u8, 236u8,
213u8, 49u8, 88u8, 217u8, 252u8, 172u8, 61u8, 174u8, 162u8, 251u8, 195u8, 32u8, 7u8, 67u8,
56u8, 10u8, 72u8, 56u8, 163u8, 180u8, 79u8, 4u8, 78u8, 196u8, 127u8, 120u8, 161u8, 117u8,
18u8, 86u8, 5u8, 31u8, 125u8, 125u8, 184u8, 49u8, 15u8, 49u8, 82u8, 191u8, 130u8, 30u8,
100u8, 15u8, 208u8, 202u8, 93u8, 56u8, 160u8, 136u8, 143u8, 172u8, 58u8, 65u8, 118u8,
220u8, 254u8, 171u8, 122u8, 80u8,
],
vk_gamme_g2: [
6u8, 231u8, 11u8, 40u8, 29u8, 208u8, 243u8, 130u8, 77u8, 195u8, 121u8, 181u8, 185u8, 170u8,
55u8, 102u8, 105u8, 15u8, 215u8, 161u8, 33u8, 66u8, 122u8, 205u8, 221u8, 6u8, 99u8, 79u8,
180u8, 114u8, 172u8, 35u8, 3u8, 68u8, 57u8, 151u8, 45u8, 65u8, 180u8, 81u8, 10u8, 124u8,
110u8, 2u8, 65u8, 140u8, 24u8, 124u8, 147u8, 214u8, 134u8, 239u8, 35u8, 85u8, 241u8, 27u8,
116u8, 114u8, 77u8, 114u8, 251u8, 18u8, 96u8, 130u8, 25u8, 0u8, 20u8, 76u8, 167u8, 165u8,
25u8, 180u8, 130u8, 248u8, 133u8, 50u8, 226u8, 245u8, 9u8, 75u8, 10u8, 33u8, 11u8, 216u8,
110u8, 158u8, 47u8, 59u8, 136u8, 195u8, 139u8, 236u8, 172u8, 42u8, 74u8, 67u8, 30u8, 39u8,
46u8, 20u8, 202u8, 5u8, 197u8, 164u8, 204u8, 180u8, 39u8, 15u8, 177u8, 158u8, 82u8, 46u8,
42u8, 87u8, 100u8, 14u8, 215u8, 95u8, 51u8, 63u8, 87u8, 136u8, 248u8, 36u8, 228u8, 11u8,
93u8, 52u8,
],
vk_delta_g2: [
47u8, 178u8, 32u8, 119u8, 34u8, 221u8, 131u8, 152u8, 19u8, 33u8, 152u8, 77u8, 87u8, 118u8,
159u8, 9u8, 204u8, 171u8, 11u8, 97u8, 84u8, 126u8, 119u8, 89u8, 194u8, 31u8, 211u8, 88u8,
39u8, 59u8, 195u8, 26u8, 18u8, 165u8, 118u8, 19u8, 173u8, 237u8, 133u8, 167u8, 64u8, 163u8,
56u8, 127u8, 62u8, 204u8, 198u8, 69u8, 240u8, 178u8, 136u8, 118u8, 109u8, 118u8, 35u8,
253u8, 145u8, 130u8, 67u8, 28u8, 169u8, 164u8, 38u8, 235u8, 5u8, 96u8, 81u8, 181u8, 15u8,
161u8, 3u8, 104u8, 20u8, 155u8, 45u8, 93u8, 67u8, 236u8, 37u8, 190u8, 78u8, 4u8, 214u8,
49u8, 37u8, 154u8, 129u8, 74u8, 139u8, 223u8, 74u8, 242u8, 172u8, 235u8, 118u8, 251u8,
40u8, 36u8, 149u8, 63u8, 103u8, 187u8, 1u8, 221u8, 33u8, 170u8, 28u8, 74u8, 217u8, 20u8,
78u8, 144u8, 122u8, 123u8, 234u8, 92u8, 221u8, 225u8, 8u8, 84u8, 233u8, 210u8, 89u8, 191u8,
123u8, 141u8, 133u8, 106u8,
],
vk_ic: &[
[
18u8, 33u8, 84u8, 28u8, 99u8, 235u8, 113u8, 135u8, 140u8, 5u8, 110u8, 208u8, 171u8,
239u8, 237u8, 185u8, 61u8, 178u8, 187u8, 123u8, 167u8, 220u8, 32u8, 156u8, 150u8,
207u8, 82u8, 214u8, 14u8, 246u8, 187u8, 222u8, 7u8, 58u8, 237u8, 253u8, 153u8, 236u8,
93u8, 235u8, 193u8, 43u8, 207u8, 222u8, 216u8, 67u8, 221u8, 6u8, 94u8, 152u8, 134u8,
162u8, 185u8, 71u8, 115u8, 203u8, 236u8, 153u8, 141u8, 175u8, 1u8, 188u8, 158u8, 147u8,
],
[
37u8, 10u8, 234u8, 217u8, 186u8, 61u8, 129u8, 255u8, 36u8, 241u8, 15u8, 147u8, 38u8,
203u8, 251u8, 65u8, 194u8, 80u8, 50u8, 64u8, 132u8, 180u8, 33u8, 248u8, 150u8, 99u8,
122u8, 25u8, 208u8, 75u8, 109u8, 55u8, 23u8, 90u8, 130u8, 110u8, 122u8, 37u8, 137u8,
157u8, 5u8, 146u8, 237u8, 139u8, 233u8, 62u8, 102u8, 45u8, 124u8, 5u8, 76u8, 234u8,
5u8, 97u8, 114u8, 235u8, 112u8, 87u8, 0u8, 90u8, 30u8, 131u8, 41u8, 213u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/mod.rs
|
pub mod inclusion_26_1;
pub mod inclusion_26_2;
pub mod inclusion_26_3;
pub mod inclusion_26_4;
pub mod inclusion_26_8;
pub mod non_inclusion_26_1;
pub mod non_inclusion_26_2;
pub mod combined_26_1_1;
pub mod combined_26_1_2;
pub mod combined_26_2_1;
pub mod combined_26_2_2;
pub mod combined_26_3_1;
pub mod combined_26_3_2;
pub mod combined_26_4_1;
pub mod combined_26_4_2;
pub mod append_with_proofs_26_1;
pub mod append_with_proofs_26_10;
pub mod append_with_proofs_26_100;
pub mod append_with_proofs_26_1000;
pub mod append_with_proofs_26_500;
pub mod append_with_subtrees_26_1;
pub mod append_with_subtrees_26_10;
pub mod append_with_subtrees_26_100;
pub mod append_with_subtrees_26_1000;
pub mod append_with_subtrees_26_500;
pub mod update_26_1;
pub mod update_26_10;
pub mod update_26_100;
pub mod update_26_1000;
pub mod update_26_500;
pub mod address_append_26_1;
pub mod address_append_26_10;
pub mod address_append_26_100;
pub mod address_append_26_1000;
pub mod address_append_26_500;
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/address_append_40_500.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
7u8, 126u8, 52u8, 91u8, 216u8, 164u8, 175u8, 249u8, 113u8, 125u8, 29u8, 208u8, 206u8,
102u8, 35u8, 111u8, 138u8, 65u8, 249u8, 139u8, 177u8, 37u8, 7u8, 172u8, 155u8, 131u8, 3u8,
123u8, 84u8, 30u8, 99u8, 124u8, 22u8, 45u8, 4u8, 109u8, 201u8, 217u8, 119u8, 181u8, 193u8,
119u8, 34u8, 168u8, 228u8, 100u8, 34u8, 141u8, 238u8, 97u8, 81u8, 63u8, 196u8, 4u8, 49u8,
246u8, 203u8, 222u8, 160u8, 107u8, 28u8, 174u8, 162u8, 121u8,
],
vk_beta_g2: [
9u8, 130u8, 182u8, 87u8, 93u8, 227u8, 254u8, 111u8, 57u8, 163u8, 253u8, 89u8, 196u8, 184u8,
107u8, 137u8, 238u8, 208u8, 183u8, 186u8, 83u8, 216u8, 2u8, 248u8, 157u8, 226u8, 75u8,
95u8, 189u8, 154u8, 255u8, 177u8, 42u8, 101u8, 68u8, 29u8, 252u8, 99u8, 183u8, 116u8, 84u8,
69u8, 176u8, 0u8, 193u8, 227u8, 231u8, 128u8, 90u8, 230u8, 53u8, 9u8, 36u8, 249u8, 64u8,
68u8, 31u8, 10u8, 51u8, 62u8, 194u8, 235u8, 186u8, 216u8, 37u8, 74u8, 34u8, 35u8, 75u8,
72u8, 64u8, 60u8, 127u8, 88u8, 56u8, 197u8, 3u8, 23u8, 84u8, 16u8, 28u8, 5u8, 113u8, 147u8,
164u8, 123u8, 196u8, 192u8, 42u8, 181u8, 255u8, 48u8, 135u8, 139u8, 160u8, 251u8, 16u8,
129u8, 233u8, 71u8, 204u8, 102u8, 199u8, 78u8, 121u8, 36u8, 167u8, 223u8, 100u8, 241u8,
58u8, 233u8, 77u8, 180u8, 212u8, 164u8, 95u8, 215u8, 33u8, 231u8, 191u8, 99u8, 11u8, 216u8,
71u8, 18u8, 141u8, 254u8,
],
vk_gamme_g2: [
11u8, 22u8, 62u8, 127u8, 24u8, 246u8, 144u8, 153u8, 200u8, 46u8, 70u8, 50u8, 77u8, 194u8,
217u8, 76u8, 65u8, 174u8, 12u8, 50u8, 34u8, 231u8, 98u8, 72u8, 27u8, 170u8, 88u8, 243u8,
154u8, 64u8, 151u8, 84u8, 44u8, 58u8, 188u8, 97u8, 248u8, 48u8, 86u8, 217u8, 25u8, 144u8,
62u8, 54u8, 27u8, 15u8, 189u8, 235u8, 73u8, 22u8, 78u8, 193u8, 134u8, 62u8, 158u8, 19u8,
246u8, 192u8, 199u8, 215u8, 217u8, 48u8, 158u8, 218u8, 44u8, 175u8, 87u8, 213u8, 93u8,
220u8, 59u8, 223u8, 188u8, 159u8, 215u8, 194u8, 149u8, 39u8, 105u8, 191u8, 169u8, 181u8,
86u8, 242u8, 44u8, 26u8, 0u8, 25u8, 49u8, 127u8, 28u8, 225u8, 171u8, 178u8, 111u8, 110u8,
20u8, 179u8, 73u8, 75u8, 22u8, 201u8, 148u8, 2u8, 74u8, 169u8, 138u8, 47u8, 59u8, 208u8,
81u8, 146u8, 240u8, 160u8, 146u8, 168u8, 202u8, 47u8, 154u8, 253u8, 78u8, 65u8, 149u8,
233u8, 28u8, 131u8, 221u8, 26u8,
],
vk_delta_g2: [
13u8, 57u8, 136u8, 27u8, 126u8, 161u8, 156u8, 26u8, 69u8, 78u8, 204u8, 10u8, 44u8, 54u8,
211u8, 110u8, 83u8, 23u8, 114u8, 119u8, 236u8, 137u8, 180u8, 41u8, 118u8, 204u8, 45u8,
236u8, 135u8, 81u8, 108u8, 189u8, 5u8, 40u8, 168u8, 141u8, 4u8, 91u8, 197u8, 198u8, 54u8,
142u8, 68u8, 88u8, 171u8, 75u8, 112u8, 187u8, 23u8, 133u8, 61u8, 170u8, 114u8, 184u8,
220u8, 182u8, 201u8, 84u8, 144u8, 183u8, 7u8, 42u8, 58u8, 241u8, 0u8, 206u8, 174u8, 239u8,
75u8, 223u8, 230u8, 82u8, 226u8, 159u8, 10u8, 247u8, 107u8, 113u8, 137u8, 223u8, 184u8,
116u8, 80u8, 255u8, 109u8, 123u8, 219u8, 59u8, 98u8, 230u8, 125u8, 50u8, 123u8, 250u8,
211u8, 137u8, 16u8, 165u8, 43u8, 139u8, 49u8, 253u8, 183u8, 246u8, 113u8, 173u8, 114u8,
194u8, 71u8, 253u8, 33u8, 219u8, 158u8, 10u8, 203u8, 154u8, 199u8, 103u8, 118u8, 63u8,
100u8, 199u8, 201u8, 185u8, 152u8, 228u8, 250u8, 240u8,
],
vk_ic: &[
[
24u8, 244u8, 68u8, 162u8, 151u8, 148u8, 83u8, 235u8, 186u8, 58u8, 221u8, 111u8, 17u8,
2u8, 167u8, 157u8, 19u8, 49u8, 177u8, 45u8, 66u8, 113u8, 129u8, 97u8, 138u8, 20u8,
157u8, 213u8, 96u8, 188u8, 209u8, 35u8, 31u8, 102u8, 185u8, 89u8, 59u8, 176u8, 97u8,
192u8, 244u8, 98u8, 118u8, 8u8, 133u8, 25u8, 165u8, 115u8, 152u8, 236u8, 184u8, 103u8,
234u8, 253u8, 48u8, 95u8, 36u8, 166u8, 154u8, 43u8, 39u8, 153u8, 83u8, 14u8,
],
[
19u8, 55u8, 191u8, 89u8, 139u8, 0u8, 2u8, 140u8, 96u8, 226u8, 83u8, 233u8, 119u8,
218u8, 189u8, 7u8, 95u8, 182u8, 134u8, 6u8, 118u8, 98u8, 2u8, 43u8, 39u8, 161u8, 249u8,
51u8, 225u8, 176u8, 55u8, 103u8, 32u8, 199u8, 164u8, 174u8, 32u8, 70u8, 110u8, 161u8,
170u8, 217u8, 8u8, 25u8, 229u8, 208u8, 132u8, 59u8, 67u8, 83u8, 71u8, 196u8, 11u8,
223u8, 136u8, 171u8, 72u8, 254u8, 253u8, 251u8, 43u8, 64u8, 215u8, 51u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/inclusion_26_4.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 8usize,
vk_alpha_g1: [
14u8, 106u8, 49u8, 124u8, 243u8, 77u8, 216u8, 138u8, 32u8, 107u8, 75u8, 171u8, 209u8,
128u8, 184u8, 232u8, 154u8, 20u8, 74u8, 253u8, 67u8, 217u8, 252u8, 130u8, 130u8, 228u8,
168u8, 80u8, 162u8, 240u8, 146u8, 65u8, 5u8, 171u8, 199u8, 137u8, 180u8, 156u8, 116u8,
19u8, 199u8, 207u8, 143u8, 195u8, 203u8, 206u8, 79u8, 234u8, 179u8, 168u8, 200u8, 52u8,
32u8, 1u8, 176u8, 233u8, 155u8, 212u8, 15u8, 82u8, 103u8, 142u8, 199u8, 46u8,
],
vk_beta_g2: [
24u8, 9u8, 76u8, 10u8, 97u8, 219u8, 150u8, 200u8, 248u8, 138u8, 241u8, 205u8, 214u8, 116u8,
188u8, 181u8, 9u8, 118u8, 245u8, 174u8, 36u8, 249u8, 182u8, 177u8, 5u8, 60u8, 242u8, 113u8,
188u8, 29u8, 190u8, 216u8, 21u8, 207u8, 92u8, 199u8, 92u8, 234u8, 162u8, 250u8, 210u8,
247u8, 196u8, 248u8, 73u8, 84u8, 55u8, 152u8, 191u8, 65u8, 45u8, 83u8, 149u8, 42u8, 31u8,
156u8, 74u8, 40u8, 115u8, 176u8, 142u8, 203u8, 202u8, 216u8, 16u8, 91u8, 29u8, 233u8,
170u8, 38u8, 217u8, 155u8, 173u8, 15u8, 84u8, 247u8, 9u8, 124u8, 154u8, 190u8, 125u8,
215u8, 94u8, 105u8, 132u8, 115u8, 167u8, 18u8, 26u8, 70u8, 142u8, 69u8, 185u8, 160u8,
181u8, 104u8, 28u8, 39u8, 108u8, 182u8, 80u8, 153u8, 83u8, 215u8, 100u8, 138u8, 149u8,
140u8, 163u8, 30u8, 182u8, 125u8, 234u8, 10u8, 215u8, 105u8, 179u8, 239u8, 49u8, 218u8,
251u8, 8u8, 104u8, 15u8, 216u8, 191u8, 141u8, 34u8,
],
vk_gamme_g2: [
48u8, 34u8, 8u8, 228u8, 41u8, 30u8, 65u8, 69u8, 26u8, 88u8, 173u8, 63u8, 186u8, 100u8,
179u8, 87u8, 24u8, 1u8, 38u8, 57u8, 22u8, 228u8, 159u8, 3u8, 127u8, 3u8, 125u8, 52u8,
222u8, 194u8, 231u8, 1u8, 25u8, 243u8, 106u8, 35u8, 139u8, 8u8, 237u8, 228u8, 71u8, 106u8,
207u8, 203u8, 56u8, 77u8, 248u8, 7u8, 200u8, 74u8, 54u8, 245u8, 113u8, 119u8, 177u8, 232u8,
125u8, 3u8, 16u8, 54u8, 159u8, 104u8, 227u8, 151u8, 36u8, 61u8, 121u8, 39u8, 157u8, 231u8,
68u8, 239u8, 142u8, 255u8, 246u8, 220u8, 162u8, 69u8, 171u8, 166u8, 80u8, 45u8, 248u8,
163u8, 210u8, 74u8, 74u8, 6u8, 41u8, 216u8, 20u8, 120u8, 117u8, 184u8, 165u8, 63u8, 36u8,
51u8, 252u8, 212u8, 48u8, 151u8, 204u8, 126u8, 141u8, 144u8, 131u8, 138u8, 196u8, 80u8,
236u8, 12u8, 174u8, 97u8, 126u8, 238u8, 103u8, 116u8, 79u8, 237u8, 162u8, 235u8, 130u8,
205u8, 190u8, 0u8, 136u8, 129u8,
],
vk_delta_g2: [
12u8, 19u8, 223u8, 199u8, 34u8, 145u8, 26u8, 215u8, 109u8, 32u8, 221u8, 2u8, 100u8, 85u8,
240u8, 236u8, 0u8, 141u8, 66u8, 10u8, 224u8, 176u8, 5u8, 201u8, 66u8, 43u8, 151u8, 129u8,
51u8, 85u8, 46u8, 18u8, 7u8, 39u8, 248u8, 161u8, 168u8, 133u8, 11u8, 97u8, 189u8, 145u8,
171u8, 32u8, 167u8, 58u8, 209u8, 223u8, 198u8, 13u8, 138u8, 5u8, 49u8, 111u8, 178u8, 49u8,
234u8, 108u8, 174u8, 233u8, 136u8, 217u8, 213u8, 148u8, 19u8, 60u8, 97u8, 48u8, 127u8,
72u8, 156u8, 217u8, 217u8, 189u8, 12u8, 97u8, 180u8, 57u8, 83u8, 145u8, 114u8, 26u8, 249u8,
120u8, 69u8, 200u8, 236u8, 58u8, 66u8, 56u8, 51u8, 187u8, 74u8, 203u8, 40u8, 60u8, 11u8,
226u8, 151u8, 233u8, 0u8, 169u8, 127u8, 10u8, 7u8, 197u8, 250u8, 4u8, 239u8, 232u8, 214u8,
190u8, 138u8, 0u8, 32u8, 52u8, 141u8, 71u8, 242u8, 156u8, 43u8, 142u8, 236u8, 177u8, 79u8,
198u8, 180u8, 108u8,
],
vk_ic: &[
[
46u8, 6u8, 119u8, 98u8, 45u8, 126u8, 249u8, 39u8, 114u8, 67u8, 111u8, 229u8, 57u8,
130u8, 221u8, 34u8, 116u8, 195u8, 116u8, 163u8, 9u8, 104u8, 160u8, 75u8, 112u8, 253u8,
79u8, 178u8, 139u8, 208u8, 42u8, 187u8, 41u8, 255u8, 199u8, 147u8, 130u8, 52u8, 75u8,
21u8, 246u8, 141u8, 179u8, 204u8, 75u8, 203u8, 38u8, 254u8, 11u8, 144u8, 99u8, 12u8,
32u8, 136u8, 211u8, 199u8, 228u8, 50u8, 158u8, 92u8, 112u8, 28u8, 50u8, 143u8,
],
[
5u8, 40u8, 68u8, 129u8, 229u8, 237u8, 210u8, 8u8, 69u8, 243u8, 7u8, 58u8, 183u8, 71u8,
2u8, 131u8, 145u8, 6u8, 109u8, 70u8, 66u8, 118u8, 223u8, 117u8, 142u8, 217u8, 8u8,
114u8, 123u8, 185u8, 249u8, 69u8, 9u8, 7u8, 8u8, 153u8, 89u8, 69u8, 225u8, 149u8, 63u8,
220u8, 30u8, 149u8, 3u8, 107u8, 238u8, 126u8, 2u8, 213u8, 253u8, 222u8, 8u8, 110u8,
251u8, 124u8, 104u8, 235u8, 181u8, 247u8, 6u8, 134u8, 84u8, 27u8,
],
[
43u8, 123u8, 126u8, 182u8, 11u8, 77u8, 66u8, 82u8, 186u8, 93u8, 240u8, 89u8, 101u8,
0u8, 57u8, 197u8, 196u8, 228u8, 68u8, 96u8, 233u8, 100u8, 122u8, 222u8, 18u8, 233u8,
211u8, 147u8, 244u8, 246u8, 218u8, 216u8, 43u8, 123u8, 60u8, 145u8, 129u8, 183u8,
134u8, 226u8, 30u8, 171u8, 182u8, 151u8, 40u8, 173u8, 248u8, 105u8, 183u8, 37u8, 146u8,
14u8, 79u8, 6u8, 100u8, 199u8, 183u8, 43u8, 176u8, 73u8, 186u8, 72u8, 23u8, 242u8,
],
[
27u8, 84u8, 212u8, 57u8, 212u8, 178u8, 44u8, 210u8, 225u8, 109u8, 231u8, 15u8, 118u8,
172u8, 187u8, 192u8, 207u8, 230u8, 92u8, 123u8, 130u8, 67u8, 142u8, 23u8, 161u8, 212u8,
143u8, 246u8, 34u8, 59u8, 158u8, 70u8, 18u8, 165u8, 185u8, 86u8, 154u8, 95u8, 138u8,
224u8, 149u8, 136u8, 215u8, 124u8, 76u8, 121u8, 51u8, 142u8, 75u8, 110u8, 168u8, 198u8,
173u8, 141u8, 128u8, 131u8, 177u8, 238u8, 36u8, 27u8, 54u8, 25u8, 94u8, 68u8,
],
[
9u8, 222u8, 205u8, 125u8, 22u8, 202u8, 249u8, 27u8, 43u8, 35u8, 181u8, 132u8, 136u8,
241u8, 150u8, 50u8, 176u8, 88u8, 200u8, 1u8, 219u8, 184u8, 201u8, 95u8, 21u8, 97u8,
125u8, 174u8, 88u8, 114u8, 163u8, 62u8, 45u8, 146u8, 216u8, 109u8, 146u8, 101u8, 191u8,
17u8, 66u8, 193u8, 90u8, 63u8, 122u8, 122u8, 140u8, 149u8, 176u8, 102u8, 178u8, 85u8,
157u8, 219u8, 213u8, 53u8, 7u8, 31u8, 99u8, 102u8, 76u8, 62u8, 107u8, 92u8,
],
[
14u8, 171u8, 110u8, 159u8, 244u8, 43u8, 180u8, 175u8, 215u8, 97u8, 182u8, 99u8, 73u8,
151u8, 199u8, 16u8, 94u8, 96u8, 147u8, 5u8, 202u8, 92u8, 93u8, 156u8, 14u8, 190u8,
43u8, 155u8, 227u8, 23u8, 72u8, 18u8, 0u8, 180u8, 17u8, 127u8, 217u8, 141u8, 248u8,
168u8, 39u8, 168u8, 81u8, 116u8, 208u8, 241u8, 212u8, 39u8, 15u8, 238u8, 9u8, 57u8,
57u8, 63u8, 130u8, 84u8, 127u8, 206u8, 147u8, 11u8, 246u8, 171u8, 168u8, 47u8,
],
[
33u8, 42u8, 30u8, 91u8, 166u8, 195u8, 210u8, 47u8, 29u8, 156u8, 12u8, 172u8, 125u8,
29u8, 53u8, 210u8, 33u8, 202u8, 104u8, 18u8, 99u8, 123u8, 212u8, 156u8, 228u8, 220u8,
239u8, 85u8, 210u8, 254u8, 38u8, 56u8, 27u8, 22u8, 3u8, 237u8, 162u8, 0u8, 220u8,
119u8, 234u8, 178u8, 136u8, 237u8, 234u8, 61u8, 47u8, 227u8, 48u8, 201u8, 6u8, 251u8,
92u8, 111u8, 50u8, 245u8, 127u8, 91u8, 117u8, 245u8, 252u8, 248u8, 6u8, 77u8,
],
[
11u8, 17u8, 232u8, 56u8, 80u8, 155u8, 148u8, 160u8, 207u8, 48u8, 92u8, 98u8, 239u8,
190u8, 89u8, 162u8, 23u8, 17u8, 182u8, 112u8, 185u8, 117u8, 169u8, 5u8, 34u8, 76u8,
122u8, 234u8, 2u8, 117u8, 37u8, 117u8, 4u8, 227u8, 1u8, 193u8, 47u8, 107u8, 117u8,
246u8, 28u8, 84u8, 150u8, 53u8, 25u8, 174u8, 47u8, 122u8, 230u8, 225u8, 170u8, 130u8,
204u8, 67u8, 230u8, 102u8, 147u8, 3u8, 24u8, 40u8, 245u8, 115u8, 132u8, 87u8,
],
[
4u8, 191u8, 160u8, 114u8, 169u8, 24u8, 93u8, 186u8, 55u8, 210u8, 116u8, 154u8, 252u8,
192u8, 103u8, 140u8, 227u8, 169u8, 237u8, 166u8, 51u8, 163u8, 8u8, 239u8, 12u8, 16u8,
176u8, 74u8, 66u8, 15u8, 14u8, 239u8, 10u8, 242u8, 61u8, 115u8, 249u8, 222u8, 95u8,
56u8, 199u8, 72u8, 225u8, 10u8, 16u8, 38u8, 129u8, 111u8, 27u8, 179u8, 94u8, 54u8,
185u8, 59u8, 50u8, 24u8, 11u8, 83u8, 1u8, 106u8, 220u8, 159u8, 250u8, 194u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_subtrees_26_10.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
33u8, 177u8, 176u8, 53u8, 169u8, 1u8, 35u8, 130u8, 158u8, 228u8, 165u8, 158u8, 113u8, 29u8,
234u8, 194u8, 205u8, 161u8, 123u8, 99u8, 237u8, 114u8, 132u8, 142u8, 87u8, 135u8, 120u8,
12u8, 240u8, 11u8, 225u8, 239u8, 22u8, 80u8, 62u8, 3u8, 196u8, 31u8, 55u8, 24u8, 234u8,
236u8, 53u8, 14u8, 186u8, 67u8, 224u8, 218u8, 179u8, 160u8, 233u8, 249u8, 200u8, 96u8,
31u8, 112u8, 12u8, 191u8, 110u8, 28u8, 211u8, 210u8, 232u8, 217u8,
],
vk_beta_g2: [
24u8, 81u8, 180u8, 25u8, 186u8, 33u8, 186u8, 141u8, 21u8, 24u8, 222u8, 37u8, 36u8, 206u8,
144u8, 249u8, 8u8, 226u8, 56u8, 61u8, 82u8, 154u8, 37u8, 120u8, 37u8, 241u8, 161u8, 199u8,
99u8, 254u8, 32u8, 177u8, 31u8, 255u8, 213u8, 138u8, 246u8, 12u8, 172u8, 15u8, 97u8, 82u8,
159u8, 74u8, 50u8, 23u8, 107u8, 31u8, 249u8, 0u8, 226u8, 244u8, 71u8, 140u8, 143u8, 31u8,
94u8, 125u8, 211u8, 97u8, 126u8, 20u8, 170u8, 149u8, 4u8, 187u8, 31u8, 133u8, 102u8, 68u8,
137u8, 153u8, 117u8, 54u8, 166u8, 198u8, 223u8, 120u8, 186u8, 90u8, 120u8, 38u8, 54u8,
163u8, 228u8, 217u8, 214u8, 48u8, 76u8, 176u8, 209u8, 24u8, 46u8, 199u8, 50u8, 135u8, 2u8,
236u8, 3u8, 43u8, 45u8, 205u8, 32u8, 43u8, 167u8, 214u8, 84u8, 174u8, 122u8, 14u8, 226u8,
242u8, 9u8, 113u8, 219u8, 234u8, 67u8, 200u8, 128u8, 237u8, 243u8, 218u8, 57u8, 112u8,
30u8, 35u8, 68u8, 109u8,
],
vk_gamme_g2: [
15u8, 175u8, 204u8, 231u8, 129u8, 232u8, 190u8, 79u8, 167u8, 143u8, 164u8, 61u8, 100u8,
123u8, 17u8, 197u8, 120u8, 247u8, 213u8, 4u8, 233u8, 39u8, 189u8, 116u8, 86u8, 175u8, 93u8,
17u8, 95u8, 44u8, 11u8, 193u8, 33u8, 123u8, 123u8, 2u8, 23u8, 13u8, 11u8, 85u8, 146u8,
17u8, 37u8, 67u8, 18u8, 38u8, 204u8, 19u8, 9u8, 205u8, 29u8, 78u8, 192u8, 140u8, 201u8,
129u8, 89u8, 126u8, 201u8, 142u8, 202u8, 137u8, 83u8, 52u8, 33u8, 2u8, 147u8, 130u8, 60u8,
132u8, 206u8, 6u8, 200u8, 168u8, 79u8, 103u8, 7u8, 128u8, 227u8, 106u8, 82u8, 25u8, 108u8,
159u8, 52u8, 130u8, 189u8, 202u8, 187u8, 1u8, 130u8, 116u8, 248u8, 88u8, 117u8, 121u8,
43u8, 62u8, 101u8, 182u8, 33u8, 210u8, 121u8, 26u8, 211u8, 48u8, 113u8, 47u8, 202u8, 253u8,
53u8, 114u8, 229u8, 62u8, 236u8, 27u8, 180u8, 127u8, 164u8, 2u8, 73u8, 0u8, 0u8, 114u8,
133u8, 24u8, 63u8, 95u8,
],
vk_delta_g2: [
25u8, 97u8, 254u8, 228u8, 126u8, 117u8, 115u8, 165u8, 3u8, 201u8, 247u8, 131u8, 146u8,
33u8, 191u8, 105u8, 138u8, 28u8, 213u8, 27u8, 16u8, 8u8, 137u8, 113u8, 179u8, 144u8, 230u8,
239u8, 119u8, 123u8, 18u8, 24u8, 10u8, 163u8, 225u8, 91u8, 223u8, 220u8, 76u8, 246u8, 71u8,
40u8, 4u8, 24u8, 241u8, 118u8, 88u8, 52u8, 17u8, 5u8, 107u8, 122u8, 219u8, 179u8, 6u8,
86u8, 14u8, 252u8, 134u8, 155u8, 214u8, 110u8, 105u8, 115u8, 45u8, 195u8, 18u8, 123u8,
218u8, 156u8, 91u8, 247u8, 184u8, 100u8, 119u8, 107u8, 163u8, 108u8, 112u8, 126u8, 57u8,
80u8, 5u8, 234u8, 4u8, 100u8, 8u8, 99u8, 104u8, 115u8, 86u8, 76u8, 203u8, 81u8, 214u8,
40u8, 30u8, 235u8, 10u8, 98u8, 179u8, 238u8, 64u8, 61u8, 37u8, 193u8, 103u8, 200u8, 204u8,
95u8, 183u8, 98u8, 189u8, 221u8, 191u8, 192u8, 58u8, 142u8, 81u8, 93u8, 134u8, 172u8, 54u8,
89u8, 136u8, 150u8, 151u8, 186u8,
],
vk_ic: &[
[
38u8, 25u8, 142u8, 83u8, 214u8, 92u8, 57u8, 48u8, 128u8, 113u8, 100u8, 27u8, 66u8,
210u8, 196u8, 63u8, 71u8, 73u8, 115u8, 88u8, 68u8, 5u8, 140u8, 76u8, 225u8, 140u8,
102u8, 112u8, 96u8, 245u8, 177u8, 78u8, 15u8, 215u8, 67u8, 70u8, 48u8, 201u8, 115u8,
84u8, 251u8, 100u8, 13u8, 241u8, 42u8, 100u8, 24u8, 253u8, 160u8, 199u8, 246u8, 199u8,
235u8, 233u8, 148u8, 196u8, 101u8, 247u8, 94u8, 67u8, 223u8, 244u8, 64u8, 238u8,
],
[
29u8, 49u8, 209u8, 41u8, 52u8, 106u8, 148u8, 134u8, 93u8, 77u8, 98u8, 126u8, 204u8,
182u8, 61u8, 148u8, 172u8, 248u8, 192u8, 157u8, 133u8, 192u8, 148u8, 253u8, 53u8,
219u8, 173u8, 137u8, 95u8, 35u8, 160u8, 102u8, 17u8, 95u8, 175u8, 79u8, 218u8, 9u8,
101u8, 32u8, 211u8, 45u8, 112u8, 219u8, 85u8, 99u8, 93u8, 7u8, 28u8, 17u8, 171u8,
159u8, 231u8, 89u8, 74u8, 29u8, 168u8, 40u8, 85u8, 159u8, 100u8, 93u8, 49u8, 149u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/address_append_26_10.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
15u8, 125u8, 211u8, 223u8, 93u8, 144u8, 94u8, 232u8, 7u8, 113u8, 172u8, 156u8, 72u8, 61u8,
35u8, 20u8, 109u8, 222u8, 218u8, 125u8, 213u8, 11u8, 231u8, 252u8, 141u8, 12u8, 184u8,
106u8, 81u8, 125u8, 95u8, 13u8, 40u8, 125u8, 245u8, 185u8, 108u8, 19u8, 74u8, 109u8, 238u8,
73u8, 203u8, 169u8, 251u8, 109u8, 220u8, 148u8, 46u8, 17u8, 91u8, 5u8, 119u8, 113u8, 206u8,
201u8, 63u8, 124u8, 138u8, 131u8, 181u8, 193u8, 186u8, 241u8,
],
vk_beta_g2: [
36u8, 241u8, 16u8, 247u8, 213u8, 126u8, 158u8, 41u8, 52u8, 255u8, 98u8, 106u8, 33u8, 150u8,
29u8, 182u8, 171u8, 130u8, 226u8, 50u8, 117u8, 26u8, 100u8, 199u8, 229u8, 162u8, 34u8,
31u8, 102u8, 37u8, 35u8, 104u8, 48u8, 15u8, 106u8, 114u8, 53u8, 28u8, 30u8, 220u8, 248u8,
127u8, 77u8, 137u8, 176u8, 12u8, 11u8, 159u8, 0u8, 50u8, 216u8, 246u8, 224u8, 34u8, 90u8,
218u8, 82u8, 235u8, 6u8, 115u8, 69u8, 176u8, 207u8, 243u8, 44u8, 0u8, 29u8, 63u8, 217u8,
89u8, 231u8, 194u8, 30u8, 253u8, 61u8, 53u8, 219u8, 109u8, 3u8, 223u8, 195u8, 131u8, 238u8,
79u8, 194u8, 228u8, 25u8, 250u8, 109u8, 117u8, 17u8, 33u8, 146u8, 78u8, 68u8, 254u8, 19u8,
253u8, 117u8, 109u8, 138u8, 184u8, 177u8, 243u8, 147u8, 84u8, 69u8, 37u8, 114u8, 51u8,
189u8, 115u8, 68u8, 50u8, 252u8, 94u8, 175u8, 57u8, 10u8, 121u8, 136u8, 35u8, 43u8, 5u8,
137u8, 66u8, 92u8, 231u8,
],
vk_gamme_g2: [
12u8, 121u8, 75u8, 4u8, 166u8, 201u8, 74u8, 175u8, 222u8, 234u8, 157u8, 16u8, 128u8, 153u8,
119u8, 137u8, 156u8, 229u8, 56u8, 138u8, 135u8, 148u8, 112u8, 80u8, 118u8, 239u8, 13u8,
25u8, 200u8, 170u8, 227u8, 148u8, 9u8, 66u8, 180u8, 99u8, 246u8, 56u8, 159u8, 169u8, 202u8,
232u8, 13u8, 158u8, 120u8, 36u8, 92u8, 158u8, 103u8, 211u8, 45u8, 38u8, 210u8, 250u8,
221u8, 227u8, 108u8, 207u8, 198u8, 114u8, 232u8, 25u8, 98u8, 218u8, 45u8, 26u8, 21u8, 30u8,
114u8, 135u8, 64u8, 41u8, 134u8, 12u8, 191u8, 33u8, 50u8, 181u8, 65u8, 171u8, 169u8, 75u8,
127u8, 246u8, 42u8, 94u8, 238u8, 185u8, 40u8, 199u8, 228u8, 229u8, 175u8, 236u8, 129u8,
28u8, 11u8, 75u8, 244u8, 149u8, 255u8, 19u8, 33u8, 149u8, 132u8, 39u8, 95u8, 25u8, 78u8,
177u8, 20u8, 164u8, 96u8, 66u8, 109u8, 142u8, 77u8, 149u8, 42u8, 149u8, 150u8, 207u8,
127u8, 81u8, 148u8, 85u8, 137u8, 27u8,
],
vk_delta_g2: [
14u8, 143u8, 91u8, 15u8, 0u8, 121u8, 105u8, 6u8, 161u8, 85u8, 20u8, 69u8, 21u8, 205u8,
135u8, 98u8, 27u8, 74u8, 99u8, 121u8, 190u8, 50u8, 254u8, 183u8, 162u8, 202u8, 94u8, 232u8,
248u8, 33u8, 5u8, 65u8, 5u8, 255u8, 215u8, 132u8, 248u8, 36u8, 18u8, 50u8, 140u8, 131u8,
176u8, 221u8, 165u8, 200u8, 203u8, 175u8, 137u8, 191u8, 148u8, 188u8, 91u8, 117u8, 244u8,
84u8, 154u8, 84u8, 145u8, 227u8, 17u8, 0u8, 195u8, 222u8, 33u8, 166u8, 177u8, 194u8, 184u8,
247u8, 30u8, 144u8, 147u8, 174u8, 79u8, 8u8, 42u8, 19u8, 107u8, 51u8, 26u8, 174u8, 183u8,
96u8, 29u8, 43u8, 232u8, 88u8, 121u8, 121u8, 10u8, 221u8, 113u8, 147u8, 93u8, 117u8, 5u8,
43u8, 157u8, 103u8, 213u8, 210u8, 33u8, 255u8, 97u8, 217u8, 111u8, 154u8, 55u8, 51u8,
210u8, 51u8, 255u8, 89u8, 4u8, 62u8, 255u8, 66u8, 74u8, 115u8, 220u8, 228u8, 36u8, 224u8,
219u8, 228u8, 39u8, 145u8,
],
vk_ic: &[
[
22u8, 39u8, 95u8, 109u8, 205u8, 152u8, 195u8, 139u8, 20u8, 183u8, 73u8, 174u8, 152u8,
40u8, 112u8, 14u8, 160u8, 102u8, 102u8, 41u8, 95u8, 163u8, 6u8, 193u8, 31u8, 250u8,
131u8, 39u8, 129u8, 52u8, 224u8, 145u8, 3u8, 183u8, 44u8, 160u8, 32u8, 207u8, 247u8,
93u8, 147u8, 62u8, 18u8, 91u8, 220u8, 115u8, 49u8, 29u8, 237u8, 93u8, 18u8, 183u8,
13u8, 126u8, 107u8, 175u8, 160u8, 23u8, 200u8, 98u8, 111u8, 130u8, 72u8, 245u8,
],
[
17u8, 125u8, 92u8, 0u8, 128u8, 124u8, 49u8, 56u8, 151u8, 158u8, 105u8, 164u8, 102u8,
67u8, 203u8, 111u8, 47u8, 196u8, 155u8, 142u8, 128u8, 61u8, 43u8, 32u8, 84u8, 129u8,
116u8, 7u8, 143u8, 21u8, 117u8, 173u8, 33u8, 198u8, 188u8, 133u8, 176u8, 50u8, 125u8,
202u8, 246u8, 222u8, 118u8, 39u8, 235u8, 252u8, 232u8, 85u8, 24u8, 168u8, 247u8, 32u8,
223u8, 197u8, 252u8, 79u8, 78u8, 227u8, 75u8, 98u8, 149u8, 156u8, 170u8, 94u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/update_26_1000.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
25u8, 231u8, 121u8, 61u8, 174u8, 206u8, 15u8, 183u8, 198u8, 140u8, 174u8, 102u8, 147u8,
247u8, 61u8, 109u8, 110u8, 203u8, 224u8, 200u8, 29u8, 165u8, 146u8, 22u8, 63u8, 76u8,
105u8, 66u8, 108u8, 161u8, 99u8, 91u8, 39u8, 245u8, 189u8, 78u8, 219u8, 108u8, 35u8, 249u8,
157u8, 174u8, 160u8, 229u8, 135u8, 168u8, 190u8, 245u8, 11u8, 16u8, 166u8, 47u8, 193u8,
244u8, 133u8, 99u8, 158u8, 111u8, 0u8, 113u8, 62u8, 202u8, 239u8, 103u8,
],
vk_beta_g2: [
38u8, 184u8, 216u8, 73u8, 240u8, 251u8, 50u8, 111u8, 146u8, 110u8, 249u8, 177u8, 205u8,
162u8, 111u8, 117u8, 2u8, 221u8, 45u8, 102u8, 140u8, 25u8, 37u8, 54u8, 176u8, 199u8, 144u8,
53u8, 171u8, 177u8, 103u8, 88u8, 26u8, 157u8, 4u8, 240u8, 238u8, 218u8, 178u8, 20u8, 175u8,
64u8, 247u8, 160u8, 31u8, 223u8, 92u8, 123u8, 200u8, 191u8, 193u8, 42u8, 81u8, 19u8, 79u8,
185u8, 184u8, 128u8, 105u8, 130u8, 191u8, 122u8, 103u8, 129u8, 31u8, 85u8, 99u8, 25u8,
214u8, 61u8, 188u8, 63u8, 33u8, 90u8, 145u8, 195u8, 182u8, 170u8, 50u8, 104u8, 188u8,
208u8, 203u8, 197u8, 196u8, 71u8, 54u8, 47u8, 118u8, 46u8, 236u8, 46u8, 221u8, 107u8, 24u8,
98u8, 12u8, 208u8, 51u8, 219u8, 26u8, 250u8, 17u8, 120u8, 250u8, 151u8, 66u8, 119u8, 235u8,
8u8, 128u8, 53u8, 3u8, 153u8, 19u8, 147u8, 127u8, 63u8, 125u8, 197u8, 71u8, 108u8, 163u8,
105u8, 53u8, 212u8, 146u8, 251u8,
],
vk_gamme_g2: [
40u8, 34u8, 56u8, 111u8, 37u8, 192u8, 220u8, 81u8, 179u8, 210u8, 206u8, 146u8, 164u8, 19u8,
80u8, 103u8, 107u8, 60u8, 210u8, 30u8, 96u8, 85u8, 248u8, 33u8, 143u8, 119u8, 172u8, 181u8,
78u8, 124u8, 47u8, 90u8, 3u8, 252u8, 87u8, 187u8, 225u8, 7u8, 221u8, 102u8, 61u8, 30u8,
54u8, 238u8, 181u8, 32u8, 60u8, 163u8, 163u8, 242u8, 211u8, 118u8, 123u8, 13u8, 23u8,
135u8, 208u8, 74u8, 25u8, 144u8, 222u8, 136u8, 165u8, 79u8, 20u8, 18u8, 182u8, 152u8,
217u8, 168u8, 84u8, 39u8, 119u8, 46u8, 13u8, 42u8, 204u8, 242u8, 85u8, 42u8, 99u8, 237u8,
58u8, 22u8, 164u8, 154u8, 124u8, 227u8, 74u8, 216u8, 112u8, 123u8, 94u8, 113u8, 195u8,
63u8, 34u8, 221u8, 41u8, 128u8, 222u8, 58u8, 59u8, 232u8, 185u8, 120u8, 81u8, 14u8, 100u8,
222u8, 237u8, 217u8, 126u8, 33u8, 93u8, 46u8, 86u8, 168u8, 52u8, 68u8, 61u8, 145u8, 40u8,
175u8, 210u8, 226u8, 218u8, 242u8,
],
vk_delta_g2: [
10u8, 48u8, 220u8, 152u8, 13u8, 254u8, 11u8, 143u8, 150u8, 4u8, 223u8, 203u8, 118u8, 248u8,
40u8, 146u8, 213u8, 154u8, 32u8, 50u8, 61u8, 245u8, 1u8, 244u8, 139u8, 225u8, 164u8, 131u8,
2u8, 77u8, 229u8, 185u8, 10u8, 140u8, 19u8, 192u8, 167u8, 106u8, 81u8, 222u8, 145u8, 198u8,
44u8, 50u8, 126u8, 8u8, 239u8, 18u8, 253u8, 109u8, 93u8, 151u8, 45u8, 213u8, 14u8, 223u8,
91u8, 136u8, 248u8, 239u8, 37u8, 232u8, 57u8, 55u8, 9u8, 49u8, 193u8, 227u8, 60u8, 198u8,
205u8, 207u8, 127u8, 214u8, 46u8, 166u8, 59u8, 166u8, 164u8, 119u8, 62u8, 29u8, 177u8,
245u8, 106u8, 11u8, 107u8, 57u8, 63u8, 133u8, 81u8, 194u8, 93u8, 173u8, 196u8, 220u8, 3u8,
226u8, 58u8, 46u8, 173u8, 115u8, 130u8, 192u8, 154u8, 63u8, 126u8, 231u8, 121u8, 158u8,
123u8, 161u8, 128u8, 152u8, 35u8, 160u8, 152u8, 73u8, 103u8, 72u8, 219u8, 25u8, 6u8, 247u8,
243u8, 1u8, 138u8, 98u8,
],
vk_ic: &[
[
9u8, 102u8, 255u8, 192u8, 13u8, 176u8, 89u8, 199u8, 39u8, 117u8, 73u8, 175u8, 139u8,
129u8, 182u8, 21u8, 2u8, 227u8, 10u8, 23u8, 147u8, 136u8, 138u8, 28u8, 132u8, 137u8,
151u8, 8u8, 91u8, 118u8, 148u8, 125u8, 41u8, 5u8, 74u8, 155u8, 174u8, 151u8, 158u8,
246u8, 147u8, 203u8, 227u8, 23u8, 111u8, 150u8, 205u8, 227u8, 79u8, 227u8, 152u8, 33u8,
46u8, 202u8, 191u8, 167u8, 75u8, 145u8, 151u8, 88u8, 192u8, 35u8, 174u8, 231u8,
],
[
5u8, 25u8, 135u8, 241u8, 22u8, 78u8, 218u8, 228u8, 106u8, 86u8, 139u8, 33u8, 28u8,
237u8, 51u8, 121u8, 98u8, 196u8, 3u8, 199u8, 173u8, 151u8, 68u8, 111u8, 194u8, 162u8,
24u8, 204u8, 170u8, 198u8, 211u8, 52u8, 25u8, 176u8, 241u8, 1u8, 120u8, 227u8, 139u8,
209u8, 41u8, 59u8, 25u8, 215u8, 49u8, 61u8, 243u8, 112u8, 57u8, 131u8, 176u8, 224u8,
119u8, 55u8, 220u8, 188u8, 202u8, 199u8, 107u8, 46u8, 71u8, 63u8, 211u8, 149u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_subtrees_26_1000.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
16u8, 205u8, 128u8, 105u8, 82u8, 67u8, 90u8, 237u8, 230u8, 30u8, 214u8, 218u8, 95u8, 216u8,
112u8, 63u8, 246u8, 216u8, 89u8, 173u8, 220u8, 188u8, 241u8, 137u8, 210u8, 59u8, 173u8,
198u8, 133u8, 46u8, 104u8, 94u8, 27u8, 121u8, 67u8, 199u8, 155u8, 119u8, 169u8, 85u8, 68u8,
125u8, 107u8, 107u8, 123u8, 179u8, 155u8, 141u8, 23u8, 210u8, 52u8, 206u8, 118u8, 49u8,
109u8, 96u8, 35u8, 161u8, 139u8, 32u8, 186u8, 99u8, 79u8, 71u8,
],
vk_beta_g2: [
31u8, 142u8, 44u8, 26u8, 19u8, 160u8, 193u8, 189u8, 218u8, 97u8, 176u8, 150u8, 66u8, 34u8,
152u8, 90u8, 110u8, 6u8, 15u8, 167u8, 210u8, 114u8, 1u8, 196u8, 199u8, 101u8, 34u8, 1u8,
161u8, 158u8, 189u8, 78u8, 23u8, 27u8, 78u8, 106u8, 113u8, 90u8, 34u8, 157u8, 41u8, 10u8,
41u8, 82u8, 35u8, 201u8, 134u8, 90u8, 170u8, 192u8, 21u8, 220u8, 198u8, 9u8, 234u8, 127u8,
128u8, 139u8, 25u8, 42u8, 12u8, 57u8, 150u8, 177u8, 34u8, 234u8, 173u8, 79u8, 141u8, 204u8,
26u8, 132u8, 237u8, 236u8, 113u8, 103u8, 225u8, 129u8, 81u8, 116u8, 192u8, 28u8, 42u8,
188u8, 201u8, 162u8, 117u8, 197u8, 241u8, 210u8, 14u8, 252u8, 56u8, 99u8, 122u8, 158u8,
1u8, 148u8, 242u8, 208u8, 68u8, 217u8, 49u8, 106u8, 38u8, 215u8, 82u8, 61u8, 11u8, 50u8,
2u8, 181u8, 192u8, 244u8, 219u8, 202u8, 57u8, 62u8, 220u8, 26u8, 46u8, 239u8, 12u8, 244u8,
134u8, 195u8, 169u8, 20u8,
],
vk_gamme_g2: [
42u8, 124u8, 17u8, 141u8, 139u8, 144u8, 53u8, 207u8, 79u8, 39u8, 59u8, 72u8, 97u8, 103u8,
37u8, 100u8, 79u8, 210u8, 84u8, 108u8, 238u8, 194u8, 135u8, 181u8, 121u8, 250u8, 163u8,
71u8, 200u8, 145u8, 182u8, 54u8, 25u8, 117u8, 179u8, 124u8, 138u8, 228u8, 29u8, 252u8,
166u8, 8u8, 90u8, 0u8, 128u8, 128u8, 143u8, 180u8, 255u8, 1u8, 12u8, 25u8, 108u8, 207u8,
209u8, 144u8, 195u8, 240u8, 41u8, 68u8, 24u8, 86u8, 91u8, 152u8, 1u8, 118u8, 171u8, 161u8,
253u8, 177u8, 7u8, 237u8, 195u8, 161u8, 249u8, 47u8, 61u8, 25u8, 86u8, 15u8, 154u8, 134u8,
135u8, 1u8, 199u8, 192u8, 185u8, 18u8, 127u8, 255u8, 35u8, 193u8, 56u8, 239u8, 95u8, 77u8,
38u8, 142u8, 58u8, 80u8, 31u8, 207u8, 9u8, 104u8, 38u8, 22u8, 24u8, 153u8, 32u8, 230u8,
9u8, 244u8, 75u8, 76u8, 0u8, 216u8, 114u8, 244u8, 184u8, 165u8, 138u8, 252u8, 117u8, 4u8,
177u8, 93u8, 201u8, 179u8,
],
vk_delta_g2: [
22u8, 22u8, 30u8, 218u8, 176u8, 55u8, 57u8, 104u8, 54u8, 40u8, 227u8, 144u8, 68u8, 195u8,
90u8, 169u8, 80u8, 255u8, 123u8, 202u8, 244u8, 31u8, 24u8, 9u8, 54u8, 69u8, 206u8, 26u8,
147u8, 211u8, 187u8, 20u8, 24u8, 69u8, 158u8, 199u8, 109u8, 6u8, 39u8, 143u8, 74u8, 128u8,
9u8, 175u8, 238u8, 145u8, 28u8, 105u8, 160u8, 56u8, 188u8, 63u8, 75u8, 164u8, 212u8, 118u8,
104u8, 132u8, 227u8, 212u8, 99u8, 21u8, 164u8, 93u8, 12u8, 8u8, 69u8, 51u8, 109u8, 96u8,
213u8, 196u8, 113u8, 193u8, 159u8, 126u8, 9u8, 248u8, 123u8, 134u8, 25u8, 75u8, 12u8,
153u8, 74u8, 167u8, 184u8, 120u8, 159u8, 40u8, 143u8, 136u8, 45u8, 212u8, 224u8, 147u8,
19u8, 47u8, 215u8, 246u8, 62u8, 155u8, 230u8, 42u8, 42u8, 35u8, 9u8, 162u8, 149u8, 48u8,
187u8, 169u8, 226u8, 66u8, 234u8, 54u8, 231u8, 64u8, 254u8, 59u8, 117u8, 127u8, 8u8, 239u8,
75u8, 116u8, 80u8, 168u8,
],
vk_ic: &[
[
4u8, 254u8, 110u8, 225u8, 141u8, 166u8, 48u8, 35u8, 153u8, 138u8, 55u8, 124u8, 123u8,
72u8, 97u8, 114u8, 230u8, 95u8, 122u8, 213u8, 235u8, 169u8, 142u8, 161u8, 68u8, 122u8,
141u8, 87u8, 227u8, 23u8, 235u8, 1u8, 1u8, 188u8, 83u8, 112u8, 147u8, 241u8, 221u8,
241u8, 73u8, 203u8, 79u8, 59u8, 216u8, 16u8, 241u8, 23u8, 121u8, 29u8, 242u8, 191u8,
15u8, 101u8, 102u8, 56u8, 18u8, 199u8, 36u8, 114u8, 94u8, 24u8, 97u8, 129u8,
],
[
4u8, 208u8, 70u8, 33u8, 134u8, 115u8, 177u8, 7u8, 209u8, 246u8, 147u8, 11u8, 144u8,
105u8, 247u8, 103u8, 123u8, 104u8, 139u8, 76u8, 169u8, 15u8, 24u8, 239u8, 213u8, 133u8,
123u8, 159u8, 233u8, 2u8, 100u8, 164u8, 41u8, 132u8, 59u8, 175u8, 250u8, 36u8, 25u8,
153u8, 70u8, 61u8, 30u8, 49u8, 118u8, 104u8, 209u8, 202u8, 160u8, 153u8, 73u8, 148u8,
132u8, 74u8, 106u8, 249u8, 18u8, 214u8, 219u8, 165u8, 129u8, 177u8, 39u8, 120u8,
],
],
};
| 0
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src
|
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/verifier/src/verifying_keys/append_with_proofs_26_500.rs
|
// This file is generated by xtask. Do not edit it manually.
use groth16_solana::groth16::Groth16Verifyingkey;
pub const VERIFYINGKEY: Groth16Verifyingkey = Groth16Verifyingkey {
nr_pubinputs: 1usize,
vk_alpha_g1: [
33u8, 198u8, 24u8, 113u8, 74u8, 188u8, 22u8, 212u8, 204u8, 217u8, 228u8, 11u8, 13u8, 20u8,
154u8, 84u8, 128u8, 251u8, 185u8, 243u8, 137u8, 232u8, 10u8, 58u8, 29u8, 195u8, 102u8,
74u8, 91u8, 204u8, 178u8, 232u8, 46u8, 100u8, 217u8, 15u8, 99u8, 86u8, 168u8, 79u8, 145u8,
18u8, 103u8, 184u8, 114u8, 147u8, 147u8, 28u8, 172u8, 156u8, 43u8, 60u8, 238u8, 108u8,
227u8, 205u8, 11u8, 100u8, 71u8, 60u8, 103u8, 43u8, 244u8, 243u8,
],
vk_beta_g2: [
13u8, 89u8, 243u8, 182u8, 77u8, 66u8, 95u8, 22u8, 7u8, 44u8, 12u8, 135u8, 40u8, 37u8,
129u8, 15u8, 237u8, 194u8, 114u8, 49u8, 91u8, 31u8, 173u8, 103u8, 187u8, 44u8, 253u8, 40u8,
83u8, 165u8, 244u8, 81u8, 6u8, 176u8, 173u8, 208u8, 156u8, 173u8, 116u8, 182u8, 141u8,
160u8, 241u8, 29u8, 87u8, 208u8, 25u8, 34u8, 218u8, 82u8, 0u8, 181u8, 29u8, 56u8, 45u8,
191u8, 37u8, 152u8, 53u8, 9u8, 63u8, 48u8, 159u8, 163u8, 1u8, 135u8, 206u8, 132u8, 20u8,
86u8, 25u8, 153u8, 33u8, 232u8, 206u8, 134u8, 88u8, 95u8, 200u8, 136u8, 180u8, 100u8, 19u8,
236u8, 5u8, 86u8, 15u8, 182u8, 115u8, 189u8, 101u8, 233u8, 26u8, 111u8, 202u8, 47u8, 33u8,
131u8, 201u8, 232u8, 175u8, 32u8, 77u8, 233u8, 34u8, 44u8, 138u8, 108u8, 61u8, 150u8,
211u8, 6u8, 11u8, 255u8, 154u8, 142u8, 166u8, 61u8, 197u8, 105u8, 82u8, 121u8, 4u8, 155u8,
171u8, 113u8, 105u8, 118u8,
],
vk_gamme_g2: [
21u8, 42u8, 166u8, 127u8, 190u8, 21u8, 229u8, 129u8, 224u8, 103u8, 142u8, 105u8, 252u8,
34u8, 43u8, 129u8, 191u8, 242u8, 211u8, 122u8, 232u8, 209u8, 47u8, 103u8, 146u8, 216u8,
208u8, 0u8, 197u8, 59u8, 99u8, 210u8, 6u8, 96u8, 80u8, 232u8, 134u8, 195u8, 153u8, 111u8,
129u8, 111u8, 221u8, 44u8, 12u8, 26u8, 151u8, 7u8, 63u8, 86u8, 189u8, 34u8, 38u8, 77u8,
55u8, 212u8, 175u8, 225u8, 29u8, 80u8, 99u8, 127u8, 154u8, 185u8, 17u8, 50u8, 227u8, 43u8,
179u8, 226u8, 234u8, 122u8, 24u8, 241u8, 49u8, 148u8, 142u8, 177u8, 121u8, 59u8, 225u8,
28u8, 80u8, 138u8, 184u8, 87u8, 88u8, 31u8, 196u8, 47u8, 212u8, 75u8, 105u8, 224u8, 180u8,
108u8, 40u8, 97u8, 131u8, 232u8, 4u8, 156u8, 120u8, 224u8, 141u8, 210u8, 184u8, 136u8,
37u8, 60u8, 75u8, 188u8, 252u8, 55u8, 105u8, 114u8, 205u8, 197u8, 231u8, 229u8, 231u8,
33u8, 98u8, 195u8, 182u8, 35u8, 253u8, 45u8,
],
vk_delta_g2: [
23u8, 93u8, 211u8, 59u8, 91u8, 224u8, 167u8, 244u8, 79u8, 107u8, 96u8, 238u8, 130u8, 227u8,
14u8, 162u8, 50u8, 34u8, 118u8, 35u8, 161u8, 189u8, 141u8, 61u8, 171u8, 176u8, 99u8, 3u8,
168u8, 205u8, 174u8, 239u8, 36u8, 114u8, 45u8, 225u8, 246u8, 202u8, 63u8, 26u8, 97u8, 81u8,
75u8, 71u8, 180u8, 238u8, 69u8, 19u8, 189u8, 12u8, 132u8, 102u8, 120u8, 195u8, 248u8, 55u8,
18u8, 241u8, 41u8, 84u8, 253u8, 221u8, 250u8, 156u8, 29u8, 32u8, 232u8, 112u8, 156u8,
130u8, 95u8, 84u8, 252u8, 58u8, 128u8, 162u8, 154u8, 17u8, 47u8, 171u8, 180u8, 34u8, 9u8,
180u8, 209u8, 182u8, 113u8, 231u8, 185u8, 210u8, 164u8, 77u8, 26u8, 76u8, 94u8, 206u8,
20u8, 108u8, 0u8, 187u8, 237u8, 142u8, 251u8, 211u8, 55u8, 159u8, 89u8, 199u8, 34u8, 225u8,
253u8, 203u8, 28u8, 118u8, 170u8, 195u8, 68u8, 191u8, 172u8, 129u8, 253u8, 32u8, 180u8,
187u8, 211u8, 96u8, 0u8, 214u8,
],
vk_ic: &[
[
17u8, 68u8, 13u8, 137u8, 71u8, 89u8, 92u8, 77u8, 153u8, 105u8, 219u8, 137u8, 88u8,
207u8, 241u8, 57u8, 48u8, 142u8, 220u8, 220u8, 162u8, 83u8, 209u8, 190u8, 236u8, 172u8,
122u8, 80u8, 25u8, 206u8, 96u8, 165u8, 39u8, 86u8, 101u8, 163u8, 97u8, 178u8, 84u8,
114u8, 42u8, 179u8, 39u8, 52u8, 17u8, 178u8, 79u8, 53u8, 203u8, 253u8, 128u8, 127u8,
38u8, 65u8, 175u8, 210u8, 117u8, 129u8, 101u8, 62u8, 89u8, 113u8, 37u8, 234u8,
],
[
45u8, 40u8, 246u8, 223u8, 63u8, 6u8, 173u8, 29u8, 207u8, 95u8, 182u8, 184u8, 156u8,
178u8, 105u8, 245u8, 60u8, 99u8, 43u8, 43u8, 135u8, 246u8, 70u8, 110u8, 167u8, 84u8,
45u8, 27u8, 49u8, 182u8, 151u8, 196u8, 6u8, 112u8, 174u8, 44u8, 29u8, 202u8, 125u8,
160u8, 139u8, 124u8, 237u8, 25u8, 84u8, 174u8, 185u8, 77u8, 36u8, 175u8, 0u8, 99u8,
224u8, 23u8, 112u8, 23u8, 83u8, 132u8, 115u8, 231u8, 155u8, 218u8, 127u8, 254u8,
],
],
};
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.