diff --git a/Cargo.lock b/Cargo.lock index 7ddb592..8e33b2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2472,7 +2472,6 @@ dependencies = [ name = "ore-api" version = "3.7.0" dependencies = [ - "array-const-fn-init", "bytemuck", "const-crypto", "meteora-pools-sdk", diff --git a/Cargo.toml b/Cargo.toml index 91d1532..b2faaa5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ keywords = ["solana", "crypto", "mining"] [workspace.dependencies] anyhow = "1.0" -array-const-fn-init = "0.1.1" bincode = "1.3.3" bytemuck = "1.14.3" bytemuck_derive = "1.7.0" diff --git a/api/Cargo.toml b/api/Cargo.toml index 746e119..e947353 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -10,7 +10,6 @@ repository.workspace = true keywords.workspace = true [dependencies] -array-const-fn-init.workspace = true bytemuck.workspace = true const-crypto.workspace = true meteora-pools-sdk.workspace = true diff --git a/api/src/consts.rs b/api/src/consts.rs index ad91315..006a2a4 100644 --- a/api/src/consts.rs +++ b/api/src/consts.rs @@ -1,57 +1,22 @@ -use array_const_fn_init::array_const_fn_init; use const_crypto::ed25519; use solana_program::{pubkey, pubkey::Pubkey}; /// The authority allowed to initialize the program. -pub const INITIALIZER_ADDRESS: Pubkey = pubkey!("HBUh9g46wk2X89CvaNN15UmsznP59rh6od1h8JwYAopk"); - -/// The base reward rate to intialize the program with. -pub const INITIAL_BASE_REWARD_RATE: u64 = BASE_REWARD_RATE_MIN_THRESHOLD; - -/// The minimum allowed base reward rate, at which point the min difficulty should be increased -pub const BASE_REWARD_RATE_MIN_THRESHOLD: u64 = 2u64.pow(5); - -/// The maximum allowed base reward rate, at which point the min difficulty should be decreased. -pub const BASE_REWARD_RATE_MAX_THRESHOLD: u64 = 2u64.pow(8); - -/// The spam/liveness tolerance in seconds. -pub const TOLERANCE: i64 = 5; - -/// The minimum difficulty to initialize the program with. -pub const INITIAL_MIN_DIFFICULTY: u32 = 1; +pub const ADMIN_ADDRESS: Pubkey = pubkey!("HBUh9g46wk2X89CvaNN15UmsznP59rh6od1h8JwYAopk"); /// The decimal precision of the ORE token. /// There are 100 billion indivisible units per ORE (called "grams"). pub const TOKEN_DECIMALS: u8 = 11; -/// The decimal precision of the ORE v1 token. -pub const TOKEN_DECIMALS_V1: u8 = 9; - /// One ORE token, denominated in indivisible units. pub const ONE_ORE: u64 = 10u64.pow(TOKEN_DECIMALS as u32); /// The duration of one minute, in seconds. pub const ONE_MINUTE: i64 = 60; -/// The number of minutes in a program epoch. -pub const EPOCH_MINUTES: i64 = 15; - -/// The duration of a program epoch, in seconds. -pub const EPOCH_DURATION: i64 = ONE_MINUTE * EPOCH_MINUTES; - /// The maximum token supply (5 million). pub const MAX_SUPPLY: u64 = ONE_ORE * 5_000_000; -/// The number of bus accounts, for parallelizing mine operations. -pub const BUS_COUNT: usize = 8; - -/// The smoothing factor for reward rate changes. The reward rate cannot change by more or less -/// than a factor of this constant from one epoch to the next. -pub const SMOOTHING_FACTOR: u64 = 2; - -/// The seed of the bus account PDA. -pub const BUS: &[u8] = b"bus"; - /// The seed of the block account PDA. pub const BLOCK: &[u8] = b"block"; @@ -90,14 +55,6 @@ pub const METADATA_URI: &str = "https://ore.supply/assets/metadata.json"; /// Program id for const pda derivations const PROGRAM_ID: [u8; 32] = unsafe { *(&crate::id() as *const Pubkey as *const [u8; 32]) }; -/// The addresses of the bus accounts. -pub const BUS_ADDRESSES: [Pubkey; BUS_COUNT] = array_const_fn_init![const_bus_address; 8]; - -/// Function to derive const bus addresses. -const fn const_bus_address(i: usize) -> Pubkey { - Pubkey::new_from_array(ed25519::derive_program_address(&[BUS, &[i as u8]], &PROGRAM_ID).0) -} - /// The address of the config account. pub const CONFIG_ADDRESS: Pubkey = Pubkey::new_from_array(ed25519::derive_program_address(&[CONFIG], &PROGRAM_ID).0); diff --git a/program/src/bury.rs b/program/src/bury.rs index 95b8123..6a77612 100644 --- a/program/src/bury.rs +++ b/program/src/bury.rs @@ -12,7 +12,7 @@ pub fn process_bury(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult else { return Err(ProgramError::NotEnoughAccountKeys); }; - signer_info.is_signer()?; // .has_address(&INITIALIZER_ADDRESS)?; + signer_info.is_signer()?; // .has_address(&ADMIN_ADDRESS)?; block_info.as_account::(&ore_api::ID)?; let block_bets = block_bets_info .is_writable()? diff --git a/program/src/initialize.rs b/program/src/initialize.rs index f016927..c8c5780 100644 --- a/program/src/initialize.rs +++ b/program/src/initialize.rs @@ -9,7 +9,7 @@ pub fn process_initialize(accounts: &[AccountInfo<'_>], _data: &[u8]) -> Program else { return Err(ProgramError::NotEnoughAccountKeys); }; - signer_info.is_signer()?; // .has_address(&INITIALIZER_ADDRESS)?; + signer_info.is_signer()?; // .has_address(&ADMIN_ADDRESS)?; block_info .is_empty()? .is_writable()?