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/macros/aligned-sized
solana_public_repos/Lightprotocol/light-protocol/macros/aligned-sized/src/expand.rs
use proc_macro2::{Ident, Span, TokenStream}; use quote::quote; use syn::{ parse::{Parse, ParseStream}, punctuated::Punctuated, ConstParam, Error, Field, Fields, FieldsNamed, GenericParam, ItemStruct, LifetimeParam, Meta, Result, Token, TypeParam, }; pub(crate) struct AlignedSizedArgs { /// Include ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/programs/package.json
{ "name": "@lightprotocol/programs", "version": "0.3.0", "license": "Apache-2.0", "scripts": { "push-idls": "../scripts/push-stateless-js-idls.sh && ../scripts/push-compressed-token-idl.sh", "build": "anchor build", "build-idls": "anchor build && pnpm build-system && pnpm build-compressed-token && p...
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/system/Cargo.toml
[package] name = "light-system-program" version = "1.2.0" description = "ZK Compression on Solana" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "light_system_program" [features] no-entrypoint = [] no-log-ix-name = [] ...
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/system/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/programs/system
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/constants.rs
pub const CPI_AUTHORITY_PDA_BUMP: u8 = 255;
0
solana_public_repos/Lightprotocol/light-protocol/programs/system
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/lib.rs
use anchor_lang::{prelude::*, solana_program::pubkey::Pubkey}; pub mod invoke; pub use invoke::instruction::*; pub mod invoke_cpi; pub use invoke_cpi::{initialize::*, instruction::*}; pub mod constants; pub mod errors; pub mod sdk; pub mod utils; use errors::SystemProgramError; use sdk::event::PublicTransactionEvent; ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/errors.rs
use anchor_lang::prelude::*; #[error_code] pub enum SystemProgramError { #[msg("Sum check failed")] SumCheckFailed, #[msg("Signer check failed")] SignerCheckFailed, #[msg("Cpi signer check failed")] CpiSignerCheckFailed, #[msg("Computing input sum failed.")] ComputeInputSumFailed, #...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/utils.rs
use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::solana_program::pubkey::Pubkey; pub fn get_registered_program_pda(program_id: &Pubkey) -> Pubkey { Pubkey::find_program_address( &[program_id.to_bytes().as_slice()], &account_compression::ID, ) .0 } pub fn ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/processor.rs
use account_compression::utils::transfer_lamports::transfer_lamports_cpi; use anchor_lang::{prelude::*, Bumps}; use light_heap::{bench_sbf_end, bench_sbf_start}; use light_verifier::CompressedProof as CompressedVerifierProof; use crate::{ errors::SystemProgramError, invoke::{ address::{derive_new_addre...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/nullify_state.rs
use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::{prelude::*, solana_program::pubkey::Pubkey, Bumps, InstructionData}; use light_macros::heap_neutral; use crate::{ constants::CPI_AUTHORITY_PDA_BUMP, invoke::InstructionDataInvoke, invoke_cpi::verify_signer::check_program_o...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/sol_compression.rs
use account_compression::utils::transfer_lamports::transfer_lamports_cpi; use aligned_sized::*; use anchor_lang::{ prelude::*, solana_program::{account_info::AccountInfo, pubkey::Pubkey}, Bumps, }; use crate::{ errors::SystemProgramError, sdk::accounts::{InvokeAccounts, SignerAccounts}, Instruc...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/verify_signer.rs
use anchor_lang::{ err, solana_program::{msg, pubkey::Pubkey}, Result, }; use crate::{ errors::SystemProgramError, sdk::compressed_account::PackedCompressedAccountWithMerkleContext, }; pub fn input_compressed_accounts_signer_check( input_compressed_accounts_with_merkle_context: &[PackedCompressedA...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/address.rs
use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::{prelude::*, Bumps}; use crate::{ constants::CPI_AUTHORITY_PDA_BUMP, invoke_cpi::verify_signer::check_program_owner_address_merkle_tree, sdk::{ accounts::{InvokeAccounts, SignerAccounts}, address::derive_add...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/verify_state_proof.rs
use crate::{ sdk::{accounts::InvokeAccounts, compressed_account::PackedCompressedAccountWithMerkleContext}, NewAddressParamsPacked, }; use account_compression::{ utils::check_discrimininator::check_discriminator, AddressMerkleTreeAccount, StateMerkleTreeAccount, }; use anchor_lang::{prelude::*, Bumps}; ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/mod.rs
pub mod instruction; pub use instruction::*; pub mod address; pub mod append_state; pub mod emit_event; pub mod nullify_state; pub mod processor; pub mod sol_compression; pub mod sum_check; pub mod verify_signer; pub mod verify_state_proof;
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/append_state.rs
use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::{ prelude::*, solana_program::{program::invoke_signed, pubkey::Pubkey}, Bumps, }; use light_hasher::Poseidon; use light_heap::{bench_sbf_end, bench_sbf_start}; use light_macros::heap_neutral; use light_utils::hash_to_bn254_f...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/emit_event.rs
use account_compression::emit_indexer_event; use anchor_lang::{prelude::*, Bumps}; use crate::{ errors::SystemProgramError, sdk::{ accounts::InvokeAccounts, event::{MerkleTreeSequenceNumber, PublicTransactionEvent}, }, InstructionDataInvoke, }; pub fn emit_state_transition_event<'a, 'b...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/sum_check.rs
use crate::{ errors::SystemProgramError, sdk::compressed_account::PackedCompressedAccountWithMerkleContext, OutputCompressedAccountWithPackedContext, }; use anchor_lang::solana_program::program_error::ProgramError; use anchor_lang::Result; use light_macros::heap_neutral; #[inline(never)] #[heap_neutral] pub fn...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke/instruction.rs
use account_compression::{program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED}; use anchor_lang::prelude::*; use super::processor::CompressedProof; use crate::{ invoke::sol_compression::SOL_POOL_PDA_SEED, sdk::{ accounts::{InvokeAccounts, SignerAccounts}, compressed_account::{...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/sdk/accounts.rs
use account_compression::program::AccountCompression; use anchor_lang::prelude::*; pub trait InvokeAccounts<'info> { fn get_registered_program_pda(&self) -> &AccountInfo<'info>; fn get_noop_program(&self) -> &UncheckedAccount<'info>; fn get_account_compression_authority(&self) -> &UncheckedAccount<'info>; ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/sdk/address.rs
use std::collections::HashMap; use anchor_lang::{err, solana_program::pubkey::Pubkey, Result}; use light_utils::hash_to_bn254_field_size_be; use crate::{errors::SystemProgramError, NewAddressParams, NewAddressParamsPacked}; pub fn derive_address(merkle_tree_pubkey: &Pubkey, seed: &[u8; 32]) -> Result<[u8; 32]> { ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/sdk/event.rs
use std::io::Write; use anchor_lang::{ prelude::borsh, solana_program::pubkey::Pubkey, AnchorDeserialize, AnchorSerialize, }; use crate::OutputCompressedAccountWithPackedContext; #[derive(Debug, Clone, AnchorSerialize, AnchorDeserialize, Default, PartialEq)] pub struct MerkleTreeSequenceNumber { pub pubkey: ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/sdk/mod.rs
pub mod accounts; pub mod address; pub mod compressed_account; pub mod event; pub mod invoke; use anchor_lang::prelude::*; #[derive(AnchorSerialize, AnchorDeserialize, Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct CompressedCpiContext { /// Is set by the program that is invoking the CPI to signal that is...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/sdk/invoke.rs
#![cfg(not(target_os = "solana"))] use std::collections::HashMap; use anchor_lang::{AnchorSerialize, InstructionData, ToAccountMetas}; use solana_sdk::{ instruction::{AccountMeta, Instruction}, pubkey::Pubkey, }; use super::compressed_account::{ CompressedAccount, MerkleContext, PackedCompressedAccountWit...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/sdk/compressed_account.rs
use std::collections::HashMap; use anchor_lang::prelude::*; use light_hasher::{Hasher, Poseidon}; use light_utils::hash_to_bn254_field_size_be; #[derive(Debug, PartialEq, Default, Clone, AnchorSerialize, AnchorDeserialize)] pub struct PackedCompressedAccountWithMerkleContext { pub compressed_account: CompressedAc...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke_cpi/processor.rs
pub use anchor_lang::prelude::*; use light_heap::{bench_sbf_end, bench_sbf_start}; use super::verify_signer::cpi_signer_checks; use crate::{ invoke::processor::process, invoke_cpi::instruction::InvokeCpiInstruction, sdk::accounts::SignerAccounts, InstructionDataInvoke, InstructionDataInvokeCpi, }; /// Process...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke_cpi/process_cpi_context.rs
use super::{account::CpiContextAccount, InstructionDataInvokeCpi}; use crate::errors::SystemProgramError; use anchor_lang::prelude::*; /// Cpi context enables the use of input compressed accounts owned by different /// programs. /// /// Example: /// - a transaction calling a pda program needs to transfer tokens and mo...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke_cpi/initialize.rs
use account_compression::StateMerkleTreeAccount; use anchor_lang::prelude::*; use super::account::CpiContextAccount; pub const CPI_SEED: &[u8] = b"cpi_signature_pda"; #[derive(Accounts)] pub struct InitializeCpiContextAccount<'info> { #[account(mut)] pub fee_payer: Signer<'info>, #[account(zero)] pub ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke_cpi/verify_signer.rs
use account_compression::{ utils::{check_discrimininator::check_discriminator, constants::CPI_AUTHORITY_PDA_SEED}, AddressMerkleTreeAccount, StateMerkleTreeAccount, }; use anchor_lang::prelude::*; use light_concurrent_merkle_tree::zero_copy::ConcurrentMerkleTreeZeroCopy; use light_hasher::Poseidon; use light_he...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke_cpi/mod.rs
pub mod instruction; pub use instruction::*; pub mod account; pub mod initialize; pub mod process_cpi_context; pub mod processor; pub mod verify_signer;
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke_cpi/account.rs
use aligned_sized::aligned_sized; use anchor_lang::prelude::*; use crate::InstructionDataInvokeCpi; /// Collects instruction data without executing a compressed transaction. /// Signer checks are performed on instruction data. /// Collected instruction data is combined with the instruction data of the executing cpi, ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/system/src
solana_public_repos/Lightprotocol/light-protocol/programs/system/src/invoke_cpi/instruction.rs
use account_compression::{program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED}; use anchor_lang::{ prelude::*, solana_program::pubkey::Pubkey, system_program::System, AnchorDeserialize, AnchorSerialize, }; use super::account::CpiContextAccount; use crate::{ invoke::{processor::CompressedP...
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/registry/Cargo.toml
[package] name = "light-registry" version = "1.2.0" description = "Light core protocol logic" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "light_registry" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [...
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/registry/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/constants.rs
use anchor_lang::prelude::*; #[constant] pub const FORESTER_SEED: &[u8] = b"forester"; #[constant] pub const FORESTER_EPOCH_SEED: &[u8] = b"forester_epoch"; #[constant] pub const PROTOCOL_CONFIG_PDA_SEED: &[u8] = b"authority";
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/sdk.rs
#![cfg(not(target_os = "solana"))] use crate::{ protocol_config::state::ProtocolConfig, utils::{ get_cpi_authority_pda, get_epoch_pda_address, get_forester_epoch_pda_from_authority, get_forester_epoch_pda_from_derivation, get_forester_pda, get_protocol_config_pda_address, }, ForesterConf...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/lib.rs
#![allow(clippy::too_many_arguments)] use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use account_compression::{AddressMerkleTreeConfig, AddressQueueConfig}; use account_compression::{NullifierQueueConfig, StateMerkleTreeConfig}; use anchor_lang::prelude::*; pub mod account_compression_cpi; pub mod ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/errors.rs
use anchor_lang::prelude::*; #[error_code] pub enum RegistryError { #[msg("InvalidForester")] InvalidForester, NotInReportWorkPhase, StakeAccountAlreadySynced, EpochEnded, ForesterNotEligible, NotInRegistrationPeriod, WeightInsuffient, ForesterAlreadyRegistered, InvalidEpochAcco...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/utils.rs
use anchor_lang::solana_program::pubkey::Pubkey; use crate::constants::{FORESTER_EPOCH_SEED, FORESTER_SEED, PROTOCOL_CONFIG_PDA_SEED}; pub fn get_protocol_config_pda_address() -> (Pubkey, u8) { Pubkey::find_program_address(&[PROTOCOL_CONFIG_PDA_SEED], &crate::ID) } pub fn get_cpi_authority_pda() -> (Pubkey, u8) ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/protocol_config/initialize.rs
use crate::{ constants::PROTOCOL_CONFIG_PDA_SEED, program::LightRegistry, protocol_config::state::ProtocolConfigPda, }; use anchor_lang::prelude::*; #[derive(Accounts)] #[instruction(bump: u8)] pub struct InitializeProtocolConfig<'info> { #[account(mut)] pub fee_payer: Signer<'info>, pub authority:...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/protocol_config/update.rs
use anchor_lang::prelude::*; use crate::errors::RegistryError; use super::state::{ProtocolConfig, ProtocolConfigPda}; #[derive(Accounts)] pub struct UpdateProtocolConfig<'info> { pub fee_payer: Signer<'info>, pub authority: Signer<'info>, /// CHECK: authority is protocol config authority. #[account(m...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/protocol_config/mod.rs
pub mod initialize; pub mod state; pub mod update;
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/protocol_config/state.rs
use crate::errors::RegistryError; use aligned_sized::aligned_sized; use anchor_lang::prelude::*; #[aligned_sized(anchor)] #[derive(Debug)] #[account] pub struct ProtocolConfigPda { pub authority: Pubkey, pub bump: u8, pub config: ProtocolConfig, } /// Epoch Phases: /// 1. Registration /// 2. Active /// 3....
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/epoch/report_work.rs
use crate::errors::RegistryError; use super::register_epoch::{EpochPda, ForesterEpochPda}; use anchor_lang::prelude::*; /// Report work: /// - work is reported so that relative performance of foresters can be assessed /// 1. Check that we are in the report work phase /// 2. Check that forester has registered for the e...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/epoch/finalize_registration.rs
use anchor_lang::prelude::*; use crate::{EpochPda, ForesterEpochPda}; #[derive(Accounts)] pub struct FinalizeRegistration<'info> { pub authority: Signer<'info>, #[account(mut,has_one = authority)] pub forester_epoch_pda: Account<'info, ForesterEpochPda>, /// CHECK: instruction checks that the epoch is...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/epoch/mod.rs
pub mod finalize_registration; pub mod register_epoch; pub mod report_work;
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/epoch/register_epoch.rs
use crate::constants::FORESTER_EPOCH_SEED; use crate::errors::RegistryError; use crate::protocol_config::state::{ProtocolConfig, ProtocolConfigPda}; use crate::selection::forester::{ForesterConfig, ForesterPda}; use aligned_sized::aligned_sized; use anchor_lang::prelude::*; use anchor_lang::solana_program::pubkey::Pubk...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/account_compression_cpi/rollover_state_tree.rs
use account_compression::{ program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED, AddressMerkleTreeAccount, StateMerkleTreeAccount, }; use anchor_lang::prelude::*; use light_system_program::program::LightSystemProgram; use crate::{epoch::register_epoch::ForesterEpochPda, protocol_config::state:...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/account_compression_cpi/register_program.rs
use account_compression::{ program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED, GroupAuthority, }; use anchor_lang::prelude::*; use crate::protocol_config::state::ProtocolConfigPda; #[derive(Accounts)] pub struct RegisterProgram<'info> { /// CHECK: only the protocol authority can register ne...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/account_compression_cpi/initialize_tree_and_queue.rs
use account_compression::{ program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED, AddressMerkleTreeConfig, AddressQueueConfig, NullifierQueueConfig, StateMerkleTreeConfig, }; use anchor_lang::prelude::*; use light_system_program::program::LightSystemProgram; use crate::{ errors::RegistryErr...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/account_compression_cpi/nullify.rs
use account_compression::{ program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED, StateMerkleTreeAccount, }; use anchor_lang::prelude::*; use crate::epoch::register_epoch::ForesterEpochPda; #[derive(Accounts)] pub struct NullifyLeaves<'info> { /// CHECK: only eligible foresters can nullify lea...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/account_compression_cpi/sdk.rs
#![cfg(not(target_os = "solana"))] use crate::utils::{ get_cpi_authority_pda, get_forester_epoch_pda_from_authority, get_protocol_config_pda_address, }; use account_compression::utils::constants::NOOP_PUBKEY; use account_compression::{ AddressMerkleTreeConfig, AddressQueueConfig, NullifierQueueConfig, StateMerk...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/account_compression_cpi/mod.rs
pub mod initialize_tree_and_queue; pub mod nullify; pub mod register_program; pub mod rollover_state_tree; pub mod sdk; pub mod update_address_tree;
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/account_compression_cpi/update_address_tree.rs
use account_compression::{ program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED, AddressMerkleTreeAccount, }; use anchor_lang::prelude::*; use crate::epoch::register_epoch::ForesterEpochPda; #[derive(Accounts)] pub struct UpdateAddressMerkleTree<'info> { /// CHECK: only eligible foresters can...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/selection/forester.rs
use anchor_lang::prelude::*; use anchor_lang::solana_program::pubkey::Pubkey; use crate::constants::FORESTER_SEED; use crate::protocol_config::state::ProtocolConfigPda; use aligned_sized::aligned_sized; #[aligned_sized(anchor)] #[account] #[derive(Debug, Default, Copy, PartialEq, Eq)] pub struct ForesterPda { pub...
0
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src
solana_public_repos/Lightprotocol/light-protocol/programs/registry/src/selection/mod.rs
pub mod forester;
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/Cargo.toml
[package] name = "light-compressed-token" version = "1.2.0" description = "Generalized token compression on Solana" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "light_compressed_token" [features] no-entrypoint = [] ...
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/constants.rs
// 2 in little endian pub const TOKEN_COMPRESSED_ACCOUNT_DISCRIMINATOR: [u8; 8] = [2, 0, 0, 0, 0, 0, 0, 0]; pub const BUMP_CPI_AUTHORITY: u8 = 254; pub const NOT_FROZEN: bool = false;
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/token_data.rs
use std::vec; use anchor_lang::{ prelude::borsh, solana_program::pubkey::Pubkey, AnchorDeserialize, AnchorSerialize, }; use light_hasher::{errors::HasherError, DataHasher}; use light_utils::hash_to_bn254_field_size_be; #[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorSerialize, AnchorDeserialize)] #[repr(u8)] pu...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/lib.rs
use anchor_lang::prelude::*; pub mod constants; pub mod process_compress_spl_token_account; pub mod process_mint; pub mod process_transfer; use process_compress_spl_token_account::process_compress_spl_token_account; pub mod spl_compression; pub use process_mint::*; pub mod token_data; pub use token_data::TokenData; pu...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/process_compress_spl_token_account.rs
use super::TransferInstruction; use crate::{ process_transfer::{ process_transfer, CompressedTokenInstructionDataTransfer, PackedTokenTransferOutputData, }, ErrorCode, }; use anchor_lang::prelude::*; use light_system_program::sdk::CompressedCpiContext; pub fn process_compress_spl_token_account<'inf...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/process_mint.rs
use account_compression::{program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED}; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; use light_system_program::{program::LightSystemProgram, OutputCompressedAccountWithPackedContext}; use crate::{program::L...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/process_transfer.rs
use crate::{ constants::{BUMP_CPI_AUTHORITY, NOT_FROZEN, TOKEN_COMPRESSED_ACCOUNT_DISCRIMINATOR}, spl_compression::process_compression_or_decompression, token_data::{AccountState, TokenData}, ErrorCode, TransferInstruction, }; use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/delegation.rs
use anchor_lang::prelude::*; use light_system_program::{ invoke::processor::CompressedProof, sdk::{compressed_account::PackedCompressedAccountWithMerkleContext, CompressedCpiContext}, OutputCompressedAccountWithPackedContext, }; use light_utils::hash_to_bn254_field_size_be; use crate::{ constants::NOT_...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/spl_compression.rs
#![allow(deprecated)] use anchor_lang::{prelude::*, solana_program::account_info::AccountInfo}; use anchor_spl::token_interface; use crate::{ process_transfer::get_cpi_signer_seeds, CompressedTokenInstructionDataTransfer, TransferInstruction, POOL_SEED, }; pub fn process_compression_or_decompression( inpu...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/burn.rs
use anchor_lang::prelude::*; use anchor_spl::token::TokenAccount; use light_system_program::{ invoke::processor::CompressedProof, sdk::{compressed_account::PackedCompressedAccountWithMerkleContext, CompressedCpiContext}, OutputCompressedAccountWithPackedContext, }; use light_utils::hash_to_bn254_field_size_...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/freeze.rs
use anchor_lang::prelude::*; use light_hasher::DataHasher; use light_hasher::Poseidon; use light_system_program::{ invoke::processor::CompressedProof, sdk::{ compressed_account::{ CompressedAccount, CompressedAccountData, PackedCompressedAccountWithMerkleContext, }, Compresse...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/instructions/generic.rs
use account_compression::{program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED}; use anchor_lang::prelude::*; use light_system_program::{ program::LightSystemProgram, sdk::accounts::{InvokeAccounts, SignerAccounts}, }; use crate::program::LightCompressedToken; #[derive(Accounts)] pub struct G...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/instructions/mod.rs
pub mod burn; pub mod create_token_pool; pub mod freeze; pub mod generic; pub mod transfer; pub use burn::*; pub use create_token_pool::*; pub use freeze::*; pub use generic::*; pub use transfer::*;
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/instructions/create_token_pool.rs
use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; use spl_token_2022::{ extension::{BaseStateWithExtensions, ExtensionType, PodStateWithExtensions}, pod::PodMint, }; pub const POOL_SEED: &[u8] =...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/instructions/burn.rs
use account_compression::{program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED}; use anchor_lang::prelude::*; use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface}; use light_system_program::{ program::LightSystemProgram, sdk::accounts::{InvokeAccounts, SignerAccounts}, }; use ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/instructions/freeze.rs
use account_compression::{program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED}; use anchor_lang::prelude::*; use anchor_spl::token_interface::Mint; use light_system_program::{ program::LightSystemProgram, sdk::accounts::{InvokeAccounts, SignerAccounts}, }; use crate::program::LightCompressedT...
0
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src
solana_public_repos/Lightprotocol/light-protocol/programs/compressed-token/src/instructions/transfer.rs
use account_compression::{program::AccountCompression, utils::constants::CPI_AUTHORITY_PDA_SEED}; use anchor_lang::prelude::*; use anchor_spl::token_interface::{TokenAccount, TokenInterface}; use light_system_program::{ self, program::LightSystemProgram, sdk::accounts::{InvokeAccounts, SignerAccounts}, }; ...
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/Cargo.toml
[package] name = "account-compression" version = "1.2.0" description = "Solana account compression program" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "account_compression" [features] no-entrypoint = [] no-idl = []...
0
solana_public_repos/Lightprotocol/light-protocol/programs
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/sdk.rs
#![cfg(not(target_os = "solana"))] use anchor_lang::{system_program, InstructionData, ToAccountMetas}; use solana_sdk::{ instruction::{AccountMeta, Instruction}, pubkey::Pubkey, }; use crate::{ instruction::{ InitializeAddressMerkleTreeAndQueue, InitializeStateMerkleTreeAndNullifierQueue, }, ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/lib.rs
#![allow(clippy::too_many_arguments)] #![allow(unexpected_cfgs)] pub mod errors; pub mod instructions; pub use instructions::*; pub mod state; pub use state::*; pub mod processor; pub mod utils; pub use processor::*; pub mod sdk; use anchor_lang::prelude::*; declare_id!("compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq"); ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/errors.rs
use anchor_lang::prelude::*; #[error_code] pub enum AccountCompressionErrorCode { #[msg("Integer overflow")] IntegerOverflow, #[msg("InvalidAuthority")] InvalidAuthority, #[msg( "Leaves <> remaining accounts mismatch. The number of remaining accounts must match the number of leaves." )]...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/nullify_leaves.rs
use crate::{ emit_indexer_event, errors::AccountCompressionErrorCode, state::{ queue::{queue_from_bytes_zero_copy_mut, QueueAccount}, StateMerkleTreeAccount, }, state_merkle_tree_from_bytes_zero_copy_mut, utils::check_signer_is_registered_or_authority::{ check_signer_is_r...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/register_program.rs
use aligned_sized::aligned_sized; use anchor_lang::prelude::*; use crate::{errors::AccountCompressionErrorCode, GroupAuthority}; #[derive(Debug)] #[account] #[aligned_sized(anchor)] pub struct RegisteredProgram { pub registered_program_id: Pubkey, pub group_authority_pda: Pubkey, } #[derive(Accounts)] pub st...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/insert_into_queues.rs
use crate::{ check_queue_type, errors::AccountCompressionErrorCode, state::queue::{queue_from_bytes_zero_copy_mut, QueueAccount}, state_merkle_tree_from_bytes_zero_copy, utils::{ check_signer_is_registered_or_authority::check_signer_is_registered_or_authority, queue::{QueueBundle, Qu...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/deregister_program.rs
use anchor_lang::prelude::*; use crate::{errors::AccountCompressionErrorCode, GroupAuthority, RegisteredProgram}; #[derive(Accounts)] pub struct DeregisterProgram<'info> { /// CHECK: Signer is checked according to authority pda in instruction. #[account(mut, constraint= authority.key() == group_authority_pda....
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/rollover_state_merkle_tree_and_queue.rs
use crate::{ processor::{ initialize_concurrent_merkle_tree::process_initialize_state_merkle_tree, initialize_nullifier_queue::process_initialize_nullifier_queue, }, state::{ queue::{queue_from_bytes_zero_copy_mut, QueueAccount}, StateMerkleTreeAccount, }, state_merkl...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/update_group_authority.rs
use crate::GroupAuthority; use anchor_lang::{prelude::*, solana_program::pubkey::Pubkey}; #[derive(Accounts)] pub struct UpdateGroupAuthority<'info> { pub authority: Signer<'info>, #[account( mut, constraint = group_authority.authority == *authority.key, )] pub group_authority: Account<'...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/rollover_address_merkle_tree_and_queue.rs
use crate::{ address_merkle_tree_from_bytes_zero_copy, initialize_address_merkle_tree::process_initialize_address_merkle_tree, initialize_address_queue::process_initialize_address_queue, state::{queue_from_bytes_zero_copy_mut, QueueAccount}, utils::{ check_account::check_account_balance_is_r...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/mod.rs
pub mod initialize_address_merkle_tree_and_queue; pub use initialize_address_merkle_tree_and_queue::*; pub mod update_address_merkle_tree; pub use update_address_merkle_tree::*; pub mod insert_into_queues; pub use insert_into_queues::*; pub mod initialize_state_merkle_tree_and_nullifier_queue; pub use initialize_sta...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/append_leaves.rs
use crate::{ errors::AccountCompressionErrorCode, state::StateMerkleTreeAccount, state_merkle_tree_from_bytes_zero_copy_mut, utils::{ check_signer_is_registered_or_authority::{ check_signer_is_registered_or_authority, GroupAccess, GroupAccounts, }, transfer_lamports::...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/update_address_merkle_tree.rs
use anchor_lang::prelude::*; use light_concurrent_merkle_tree::event::{IndexedMerkleTreeEvent, MerkleTreeEvent}; use light_indexed_merkle_tree::array::IndexedElement; use num_bigint::BigUint; use crate::{ address_merkle_tree_from_bytes_zero_copy_mut, emit_indexer_event, errors::AccountCompressionErrorCode, ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/initialize_state_merkle_tree_and_nullifier_queue.rs
use crate::{ errors::AccountCompressionErrorCode, initialize_concurrent_merkle_tree::process_initialize_state_merkle_tree, initialize_nullifier_queue::process_initialize_nullifier_queue, state::{QueueAccount, StateMerkleTreeAccount}, utils::{ check_account::check_account_balance_is_rent_exem...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/initialize_group_authority.rs
use anchor_lang::{prelude::*, solana_program::pubkey::Pubkey}; use crate::{state::GroupAuthority, utils::constants::GROUP_AUTHORITY_SEED}; #[derive(Accounts)] pub struct InitializeGroupAuthority<'info> { #[account(mut)] pub authority: Signer<'info>, /// Seed public key used to derive the group authority. ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/instructions/initialize_address_merkle_tree_and_queue.rs
use anchor_lang::prelude::*; use crate::{ errors::AccountCompressionErrorCode, initialize_address_merkle_tree::process_initialize_address_merkle_tree, initialize_address_queue::process_initialize_address_queue, state::QueueAccount, utils::{ check_account::check_account_balance_is_rent_exemp...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/processor/initialize_concurrent_merkle_tree.rs
use anchor_lang::prelude::*; use light_utils::fee::compute_rollover_fee; use crate::{ initialize_address_queue::check_rollover_fee_sufficient, state::StateMerkleTreeAccount, state_merkle_tree_from_bytes_zero_copy_init, AccessMetadata, RolloverMetadata, }; #[allow(unused_variables)] pub fn process_initialize_s...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/processor/initialize_nullifier_queue.rs
use crate::{ queue_from_bytes_zero_copy_init, AccessMetadata, QueueAccount, QueueType, RolloverMetadata, }; use anchor_lang::{prelude::*, solana_program::pubkey::Pubkey}; pub fn process_initialize_nullifier_queue<'a, 'b, 'c: 'info, 'info>( nullifier_queue_account_info: AccountInfo<'info>, nullifier_queue_a...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/processor/mod.rs
pub mod initialize_address_merkle_tree; pub mod initialize_address_queue; pub mod initialize_concurrent_merkle_tree; pub mod initialize_nullifier_queue;
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/processor/initialize_address_merkle_tree.rs
use crate::{ address_merkle_tree_from_bytes_zero_copy_init, state::AddressMerkleTreeAccount, AccessMetadata, RolloverMetadata, }; pub use anchor_lang::prelude::*; pub fn process_initialize_address_merkle_tree( address_merkle_tree_loader: &AccountLoader<'_, AddressMerkleTreeAccount>, index: u64, own...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/processor/initialize_address_queue.rs
use anchor_lang::prelude::*; use light_utils::fee::compute_rollover_fee; use crate::{ state::{queue_from_bytes_zero_copy_init, QueueAccount}, AccessMetadata, QueueType, RolloverMetadata, }; pub fn process_initialize_address_queue<'info>( queue_account_info: &AccountInfo<'info>, queue_loader: &AccountL...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/utils/check_account.rs
use crate::errors::AccountCompressionErrorCode; use anchor_lang::prelude::*; use anchor_lang::solana_program::{account_info::AccountInfo, msg, rent::Rent}; /// Checks that the account balance is equal to rent exemption. pub fn check_account_balance_is_rent_exempt( account_info: &AccountInfo, expected_size: usi...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/utils/check_signer_is_registered_or_authority.rs
use crate::{errors::AccountCompressionErrorCode, RegisteredProgram}; use anchor_lang::{prelude::*, solana_program::pubkey::Pubkey}; use super::constants::CPI_AUTHORITY_PDA_SEED; pub trait GroupAccess { fn get_owner(&self) -> &Pubkey; fn get_program_owner(&self) -> &Pubkey; } pub trait GroupAccounts<'info> { ...
0
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src
solana_public_repos/Lightprotocol/light-protocol/programs/account-compression/src/utils/constants.rs
// This file stores constants which do not have to be configured. use anchor_lang::constant; #[constant] pub const CPI_AUTHORITY_PDA_SEED: &[u8] = b"cpi_authority"; #[constant] pub const GROUP_AUTHORITY_SEED: &[u8] = b"group_authority"; #[constant] pub const STATE_MERKLE_TREE_HEIGHT: u64 = 26; #[constant] pub const ...
0