diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 6a6da0580..1840576c6 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -406,7 +406,7 @@ pub fn app() -> Command<'static> { .takes_value(true) .required(false) .help( - "The maximum number of cranks allowed per slot for this thread", + "The maximum number of instructions this thread can execute per slot", ), ) .arg( diff --git a/client/src/thread/instruction/mod.rs b/client/src/thread/instruction/mod.rs index a3cdee121..0e28bf2c4 100644 --- a/client/src/thread/instruction/mod.rs +++ b/client/src/thread/instruction/mod.rs @@ -1,15 +1,15 @@ -mod thread_crank; mod thread_create; mod thread_delete; +mod thread_exec; mod thread_kickoff; mod thread_pause; mod thread_resume; mod thread_stop; mod thread_update; -pub use thread_crank::*; pub use thread_create::*; pub use thread_delete::*; +pub use thread_exec::*; pub use thread_kickoff::*; pub use thread_pause::*; pub use thread_resume::*; diff --git a/client/src/thread/instruction/thread_crank.rs b/client/src/thread/instruction/thread_exec.rs similarity index 80% rename from client/src/thread/instruction/thread_crank.rs rename to client/src/thread/instruction/thread_exec.rs index 44bac6d70..24a7601ec 100644 --- a/client/src/thread/instruction/thread_crank.rs +++ b/client/src/thread/instruction/thread_exec.rs @@ -9,7 +9,7 @@ use { clockwork_network_program::objects::{Fee, Penalty, Pool}, }; -pub fn thread_crank(signatory: Pubkey, thread: Pubkey, worker: Pubkey) -> Instruction { +pub fn thread_exec(signatory: Pubkey, thread: Pubkey, worker: Pubkey) -> Instruction { Instruction { program_id: clockwork_thread_program::ID, accounts: vec![ @@ -20,6 +20,6 @@ pub fn thread_crank(signatory: Pubkey, thread: Pubkey, worker: Pubkey) -> Instru AccountMeta::new(thread, false), AccountMeta::new_readonly(worker, false), ], - data: clockwork_thread_program::instruction::ThreadCrank {}.data(), + data: clockwork_thread_program::instruction::ThreadExec {}.data(), } } diff --git a/plugin/src/builders/mod.rs b/plugin/src/builders/mod.rs index acf263a0d..a0cf122f6 100644 --- a/plugin/src/builders/mod.rs +++ b/plugin/src/builders/mod.rs @@ -1,5 +1,5 @@ mod pool_rotation; -mod thread_crank; +mod thread_exec; pub use pool_rotation::*; -pub use thread_crank::*; +pub use thread_exec::*; diff --git a/plugin/src/builders/thread_crank.rs b/plugin/src/builders/thread_exec.rs similarity index 89% rename from plugin/src/builders/thread_crank.rs rename to plugin/src/builders/thread_exec.rs index f206c0257..1b9b450ee 100644 --- a/plugin/src/builders/thread_crank.rs +++ b/plugin/src/builders/thread_exec.rs @@ -24,28 +24,28 @@ use { static TRANSACTION_SIZE_LIMIT: usize = 1_232; // Max byte size of a serialized transaction -pub async fn build_crank_txs( +pub async fn build_thread_exec_txs( client: Arc, - crankable_threads: DashSet, + executable_threads: DashSet, worker_id: u64, ) -> Vec { - // Build the set of crank transactions + // Build the set of exec transactions // TODO Use rayon to parallelize this operation - let txs = crankable_threads + let txs = executable_threads .iter() .filter_map(|thread_pubkey_ref| { - build_crank_tx(client.clone(), *thread_pubkey_ref.key(), worker_id) + build_thread_exec_tx(client.clone(), *thread_pubkey_ref.key(), worker_id) }) .collect::>(); txs } -fn build_crank_tx( +fn build_thread_exec_tx( client: Arc, thread_pubkey: Pubkey, worker_id: u64, ) -> Option { - // Build the first crank ix + // Build the first ix let thread = match client.get::(&thread_pubkey) { Err(_err) => return None, Ok(thread) => thread, @@ -53,15 +53,15 @@ fn build_crank_tx( let blockhash = client.get_latest_blockhash().unwrap(); let signatory_pubkey = client.payer_pubkey(); - // Pre-simulate crank ixs and pack into tx + // Pre-simulate exec ixs and pack into tx let first_instruction = if thread.next_instruction.is_some() { - build_crank_ix(client.clone(), thread, signatory_pubkey, worker_id) + build_exec_ix(client.clone(), thread, signatory_pubkey, worker_id) } else { build_kickoff_ix(client.clone(), thread, signatory_pubkey, worker_id) }; let mut ixs: Vec = vec![first_instruction]; - // Pre-simulate crank ixs and pack as many as possible into tx. + // Pre-simulate exec ixs and pack as many as possible into tx. let mut tx: Transaction = Transaction::new_with_payer(&vec![], Some(&signatory_pubkey)); let now = std::time::Instant::now(); loop { @@ -87,12 +87,12 @@ fn build_crank_tx( ..RpcSimulateTransactionConfig::default() }, ) { - // If there was an error, stop packing and continue with the cranks up until this one. + // If there was an error, stop packing and continue with the ixs up until this one. Err(_err) => { break; } - // If the simulation was successful, pack the crank ix into the tx. + // If the simulation was successful, pack the ix into the tx. Ok(response) => { // If there was an error, then stop packing. if response.value.err.is_some() { @@ -107,13 +107,13 @@ fn build_crank_tx( // Save the simulated tx. It is okay to submit. tx = sim_tx; - // Parse the resulting thread account for the next crank ix to simulate. + // Parse the resulting thread account for the next ix to simulate. if let Some(ui_accounts) = response.value.accounts { if let Some(Some(ui_account)) = ui_accounts.get(0) { if let Some(account) = ui_account.decode::() { if let Ok(sim_thread) = Thread::try_from(account.data) { if sim_thread.next_instruction.is_some() { - ixs.push(build_crank_ix( + ixs.push(build_exec_ix( client.clone(), sim_thread, signatory_pubkey, @@ -131,7 +131,7 @@ fn build_crank_tx( } info!( - "Time spent packing {} cranks: {:#?}", + "Time spent packing {} instructions: {:#?}", tx.message.instructions.len(), now.elapsed() ); @@ -214,7 +214,7 @@ fn build_kickoff_ix( kickoff_ix } -fn build_crank_ix( +fn build_exec_ix( _client: Arc, thread: Thread, signatory_pubkey: Pubkey, @@ -222,7 +222,7 @@ fn build_crank_ix( ) -> Instruction { // Build the instruction. let thread_pubkey = Thread::pubkey(thread.authority, thread.id); - let mut crank_ix = clockwork_client::thread::instruction::thread_crank( + let mut exec_ix = clockwork_client::thread::instruction::thread_exec( signatory_pubkey, thread_pubkey, Worker::pubkey(worker_id), @@ -230,7 +230,7 @@ fn build_crank_ix( if let Some(next_instruction) = thread.next_instruction { // Inject the target program account to the ix. - crank_ix.accounts.push(AccountMeta::new_readonly( + exec_ix.accounts.push(AccountMeta::new_readonly( next_instruction.program_id, false, )); @@ -242,12 +242,12 @@ fn build_crank_ix( } else { acc.pubkey }; - crank_ix.accounts.push(match acc.is_writable { + exec_ix.accounts.push(match acc.is_writable { true => AccountMeta::new(acc_pubkey, false), false => AccountMeta::new_readonly(acc_pubkey, false), }) } } - crank_ix + exec_ix } diff --git a/plugin/src/executors/tx.rs b/plugin/src/executors/tx.rs index 44822da09..d9622de32 100644 --- a/plugin/src/executors/tx.rs +++ b/plugin/src/executors/tx.rs @@ -50,8 +50,8 @@ impl TxExecutor { // Rotate worker pools this.clone().execute_pool_rotate_txs(slot).await.ok(); - // Thread crank threads - this.clone().execute_thread_crank_txs(slot).await.ok(); + // Thread exec txs + this.clone().execute_thread_exec_txs(slot).await.ok(); // Purge message history that is beyond the dedupe period this.message_history @@ -82,7 +82,7 @@ impl TxExecutor { Ok(()) } - async fn execute_thread_crank_txs(self: Arc, slot: u64) -> PluginResult<()> { + async fn execute_thread_exec_txs(self: Arc, slot: u64) -> PluginResult<()> { // Exit early if we are not in the worker pool. let r_pool_positions = self.observers.network.pool_positions.read().await; let thread_pool = r_pool_positions.thread_pool.clone(); @@ -93,10 +93,10 @@ impl TxExecutor { )); } - // Execute thread_crank txs. - crate::builders::build_crank_txs( + // Execute thread_exec txs. + crate::builders::build_thread_exec_txs( self.client.clone(), - self.observers.thread.crankable_threads.clone(), + self.observers.thread.executable_threads.clone(), self.config.worker_id, ) .await diff --git a/plugin/src/observers/thread.rs b/plugin/src/observers/thread.rs index deee4de80..f120dcb7a 100644 --- a/plugin/src/observers/thread.rs +++ b/plugin/src/observers/thread.rs @@ -19,8 +19,8 @@ pub struct ThreadObserver { // Plugin config values. pub config: PluginConfig, - // The set of the threads that are currently crankable (i.e. have a next_instruction) - pub crankable_threads: DashSet, + // The set of the threads that are currently executable (i.e. have a next_instruction) + pub executable_threads: DashSet, // Map from unix timestamps to the list of threads scheduled for that moment. pub cron_threads: DashMap>, @@ -37,7 +37,7 @@ impl ThreadObserver { Self { clocks: DashMap::new(), config: config.clone(), - crankable_threads: DashSet::new(), + executable_threads: DashSet::new(), cron_threads: DashMap::new(), listener_threads: DashMap::new(), runtime, @@ -60,7 +60,7 @@ impl ThreadObserver { let is_due = clock.unix_timestamp >= *target_timestamp; if is_due { for thread_pubkey_ref in thread_pubkeys.iter() { - this.crankable_threads.insert(*thread_pubkey_ref.key()); + this.executable_threads.insert(*thread_pubkey_ref.key()); } } !is_due @@ -85,11 +85,11 @@ impl ThreadObserver { _account_replica: ReplicaAccountInfo, ) -> PluginResult<()> { self.spawn(|this| async move { - // Move all threads listening to this account into the crankable set. + // Move all threads listening to this account into the executable set. this.listener_threads.retain(|pubkey, thread_pubkeys| { if account_pubkey.eq(pubkey) { for thread_pubkey in thread_pubkeys.iter() { - this.crankable_threads.insert(*thread_pubkey.key()); + this.executable_threads.insert(*thread_pubkey.key()); } false } else { @@ -110,8 +110,8 @@ impl ThreadObserver { thread_pubkey: Pubkey, ) -> PluginResult<()> { self.spawn(|this| async move { - // Remove thread from crankable set - this.crankable_threads.remove(&thread_pubkey); + // Remove thread from executable set + this.executable_threads.remove(&thread_pubkey); // If the thread is paused, just return without indexing if thread.paused { @@ -119,8 +119,8 @@ impl ThreadObserver { } if thread.next_instruction.is_some() { - // If the thread has a next instruction, index it as crankable. - this.crankable_threads.insert(thread_pubkey); + // If the thread has a next instruction, index it as executable. + this.executable_threads.insert(thread_pubkey); } else { // Otherwise, index the thread according to its trigger type. match thread.trigger { @@ -176,7 +176,7 @@ impl ThreadObserver { } } Trigger::Immediate => { - this.crankable_threads.insert(thread_pubkey); + this.executable_threads.insert(thread_pubkey); } } } diff --git a/plugin/src/plugin.rs b/plugin/src/plugin.rs index 320cf3b48..7e38b47eb 100644 --- a/plugin/src/plugin.rs +++ b/plugin/src/plugin.rs @@ -126,9 +126,9 @@ impl GeyserPlugin for ClockworkPlugin { SlotStatus::Processed => match &self.executors { Some(executors) => { info!( - "slot: {} crankable_threads: {} cron_threads: {}", + "slot: {} executable_threads: {} cron_threads: {}", slot, - self.observers.thread.crankable_threads.len(), + self.observers.thread.executable_threads.len(), self.observers.thread.cron_threads.len() ); self.observers.thread.clone().observe_slot(slot)?; diff --git a/programs/network/src/instructions/delegation_stake.rs b/programs/network/src/instructions/delegation_stake.rs index ce6e99ead..f2e61df71 100644 --- a/programs/network/src/instructions/delegation_stake.rs +++ b/programs/network/src/instructions/delegation_stake.rs @@ -5,7 +5,7 @@ use { associated_token::get_associated_token_address, token::{transfer, Token, TokenAccount, Transfer}, }, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, }; #[derive(Accounts)] @@ -53,7 +53,7 @@ pub struct DelegationStake<'info> { pub worker_stake: Account<'info, TokenAccount>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let delegation = &mut ctx.accounts.delegation; @@ -154,8 +154,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/fee_distribute.rs b/programs/network/src/instructions/fee_distribute.rs index 82bc17e45..69a76dc76 100644 --- a/programs/network/src/instructions/fee_distribute.rs +++ b/programs/network/src/instructions/fee_distribute.rs @@ -1,7 +1,7 @@ use { crate::objects::*, anchor_lang::prelude::*, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, }; #[derive(Accounts)] @@ -62,7 +62,7 @@ pub struct FeeDistribute<'info> { pub worker: Account<'info, Worker>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts let config = &ctx.accounts.config; let delegation = &mut ctx.accounts.delegation; @@ -169,8 +169,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/registry_epoch_cutover.rs b/programs/network/src/instructions/registry_epoch_cutover.rs index f3d6624a9..5d55489ee 100644 --- a/programs/network/src/instructions/registry_epoch_cutover.rs +++ b/programs/network/src/instructions/registry_epoch_cutover.rs @@ -1,4 +1,4 @@ -use clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}; +use clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}; use {crate::objects::*, anchor_lang::prelude::*}; @@ -18,7 +18,7 @@ pub struct RegistryEpochCutover<'info> { pub registry: Account<'info, Registry>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let thread = &ctx.accounts.thread; @@ -44,8 +44,8 @@ pub fn handler(ctx: Context) -> Result { data: anchor_sighash("snapshot_delete").to_vec(), }); - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/registry_epoch_kickoff.rs b/programs/network/src/instructions/registry_epoch_kickoff.rs index e5f0c4eab..a71eede47 100644 --- a/programs/network/src/instructions/registry_epoch_kickoff.rs +++ b/programs/network/src/instructions/registry_epoch_kickoff.rs @@ -1,7 +1,7 @@ use { crate::objects::*, anchor_lang::prelude::*, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, }; // DONE Payout yield. @@ -44,7 +44,7 @@ pub struct RegistryEpochKickoff<'info> { pub snapshot: Account<'info, Snapshot>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let thread = &ctx.accounts.thread; @@ -110,7 +110,7 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { kickoff_instruction, next_instruction, }) diff --git a/programs/network/src/instructions/registry_nonce_hash.rs b/programs/network/src/instructions/registry_nonce_hash.rs index 8902dec38..c9df338c6 100644 --- a/programs/network/src/instructions/registry_nonce_hash.rs +++ b/programs/network/src/instructions/registry_nonce_hash.rs @@ -1,4 +1,4 @@ -use clockwork_utils::CrankResponse; +use clockwork_utils::ExecResponse; use {crate::objects::*, anchor_lang::prelude::*}; @@ -18,8 +18,8 @@ pub struct RegistryNonceHash<'info> { pub registry: Account<'info, Registry>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { let registry = &mut ctx.accounts.registry; registry.hash_nonce()?; - Ok(CrankResponse::default()) + Ok(ExecResponse::default()) } diff --git a/programs/network/src/instructions/snapshot_create.rs b/programs/network/src/instructions/snapshot_create.rs index e6076b288..7c5a69426 100644 --- a/programs/network/src/instructions/snapshot_create.rs +++ b/programs/network/src/instructions/snapshot_create.rs @@ -2,7 +2,7 @@ use { crate::objects::*, anchor_lang::{prelude::*, solana_program::system_program}, anchor_spl::associated_token::get_associated_token_address, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, std::mem::size_of, }; @@ -39,7 +39,7 @@ pub struct SnapshotCreate<'info> { pub system_program: Program<'info, System>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts let config = &ctx.accounts.config; let payer = &ctx.accounts.payer; @@ -87,8 +87,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/snapshot_delete.rs b/programs/network/src/instructions/snapshot_delete.rs index 80207cf80..27a71159d 100644 --- a/programs/network/src/instructions/snapshot_delete.rs +++ b/programs/network/src/instructions/snapshot_delete.rs @@ -1,6 +1,6 @@ use clockwork_utils::{anchor_sighash, AccountMetaData, InstructionData}; -use {crate::objects::*, anchor_lang::prelude::*, clockwork_utils::CrankResponse}; +use {crate::objects::*, anchor_lang::prelude::*, clockwork_utils::ExecResponse}; #[derive(Accounts)] pub struct SnapshotDelete<'info> { @@ -31,7 +31,7 @@ pub struct SnapshotDelete<'info> { pub snapshot: Account<'info, Snapshot>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts let config = &ctx.accounts.config; let thread = &mut ctx.accounts.thread; @@ -68,5 +68,5 @@ pub fn handler(ctx: Context) -> Result { None }; - Ok(CrankResponse { next_instruction, ..CrankResponse::default() }) + Ok(ExecResponse { next_instruction, ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/snapshot_entry_create.rs b/programs/network/src/instructions/snapshot_entry_create.rs index dc9850911..14aa80f26 100644 --- a/programs/network/src/instructions/snapshot_entry_create.rs +++ b/programs/network/src/instructions/snapshot_entry_create.rs @@ -2,7 +2,7 @@ use { crate::objects::*, anchor_lang::{prelude::*, solana_program::system_program}, anchor_spl::{associated_token::get_associated_token_address, token::TokenAccount}, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, std::mem::size_of, }; @@ -78,7 +78,7 @@ pub struct SnapshotEntryCreate<'info> { pub worker: Box>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let delegation = &ctx.accounts.delegation; @@ -168,8 +168,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/snapshot_entry_delete.rs b/programs/network/src/instructions/snapshot_entry_delete.rs index cd761df8c..4cc90f475 100644 --- a/programs/network/src/instructions/snapshot_entry_delete.rs +++ b/programs/network/src/instructions/snapshot_entry_delete.rs @@ -1,6 +1,6 @@ use clockwork_utils::{InstructionData, AccountMetaData, anchor_sighash}; -use {crate::objects::*, anchor_lang::prelude::*, clockwork_utils::CrankResponse}; +use {crate::objects::*, anchor_lang::prelude::*, clockwork_utils::ExecResponse}; #[derive(Accounts)] pub struct SnapshotEntryDelete<'info> { @@ -55,7 +55,7 @@ pub struct SnapshotEntryDelete<'info> { pub snapshot_frame: Account<'info, SnapshotFrame>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts let config = &ctx.accounts.config; let thread = &mut ctx.accounts.thread; @@ -129,5 +129,5 @@ pub fn handler(ctx: Context) -> Result { None }; - Ok( CrankResponse { next_instruction, ..CrankResponse::default() } ) + Ok( ExecResponse { next_instruction, ..ExecResponse::default() } ) } diff --git a/programs/network/src/instructions/snapshot_frame_create.rs b/programs/network/src/instructions/snapshot_frame_create.rs index 1dbe64191..99f4d6d3a 100644 --- a/programs/network/src/instructions/snapshot_frame_create.rs +++ b/programs/network/src/instructions/snapshot_frame_create.rs @@ -2,7 +2,7 @@ use { crate::objects::*, anchor_lang::{prelude::*, solana_program::system_program}, anchor_spl::{associated_token::get_associated_token_address, token::TokenAccount}, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, std::mem::size_of, }; @@ -64,7 +64,7 @@ pub struct SnapshotFrameCreate<'info> { pub worker_stake: Account<'info, TokenAccount>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let payer = &ctx.accounts.payer; @@ -153,8 +153,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/snapshot_frame_delete.rs b/programs/network/src/instructions/snapshot_frame_delete.rs index c4cc0b756..acb1095b7 100644 --- a/programs/network/src/instructions/snapshot_frame_delete.rs +++ b/programs/network/src/instructions/snapshot_frame_delete.rs @@ -1,6 +1,6 @@ use clockwork_utils::{InstructionData, AccountMetaData, anchor_sighash}; -use {crate::objects::*, anchor_lang::prelude::*, clockwork_utils::CrankResponse}; +use {crate::objects::*, anchor_lang::prelude::*, clockwork_utils::ExecResponse}; #[derive(Accounts)] pub struct SnapshotFrameDelete<'info> { @@ -43,7 +43,7 @@ pub struct SnapshotFrameDelete<'info> { pub snapshot_frame: Account<'info, SnapshotFrame>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts let config = &ctx.accounts.config; let thread = &mut ctx.accounts.thread; @@ -107,5 +107,5 @@ pub fn handler(ctx: Context) -> Result { None }; - Ok( CrankResponse { next_instruction, ..CrankResponse::default() } ) + Ok( ExecResponse { next_instruction, ..ExecResponse::default() } ) } diff --git a/programs/network/src/instructions/unstake_preprocess.rs b/programs/network/src/instructions/unstake_preprocess.rs index 051f9ae54..b912659ed 100644 --- a/programs/network/src/instructions/unstake_preprocess.rs +++ b/programs/network/src/instructions/unstake_preprocess.rs @@ -3,7 +3,7 @@ use anchor_spl::associated_token::get_associated_token_address; use { crate::objects::*, anchor_lang::prelude::*, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, }; #[derive(Accounts)] @@ -24,7 +24,7 @@ pub struct UnstakePreprocess<'info> { pub unstake: Account<'info, Unstake>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let thread = &ctx.accounts.thread; @@ -32,7 +32,7 @@ pub fn handler(ctx: Context) -> Result { let unstake = &ctx.accounts.unstake; // Return next instruction for thread. - Ok(CrankResponse { + Ok(ExecResponse { next_instruction: Some(InstructionData { program_id: crate::ID, accounts: vec![ @@ -51,6 +51,6 @@ pub fn handler(ctx: Context) -> Result { ], data: anchor_sighash("unstake_process").to_vec(), }), - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/unstake_process.rs b/programs/network/src/instructions/unstake_process.rs index 6bd998953..b12249637 100644 --- a/programs/network/src/instructions/unstake_process.rs +++ b/programs/network/src/instructions/unstake_process.rs @@ -4,7 +4,7 @@ use { crate::{errors::*, objects::*}, anchor_lang::prelude::*, anchor_spl::token::{transfer, Token, TokenAccount, Transfer}, - clockwork_utils::CrankResponse, + clockwork_utils::ExecResponse, }; #[derive(Accounts)] @@ -71,7 +71,7 @@ pub struct UnstakeProcess<'info> { pub worker_tokens: Box>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let authority = &ctx.accounts.authority; let authority_tokens = &ctx.accounts.authority_tokens; @@ -165,8 +165,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/worker_delegations_stake.rs b/programs/network/src/instructions/worker_delegations_stake.rs index 85615e09f..77dcdf7e4 100644 --- a/programs/network/src/instructions/worker_delegations_stake.rs +++ b/programs/network/src/instructions/worker_delegations_stake.rs @@ -2,7 +2,7 @@ use { crate::objects::*, anchor_lang::{prelude::*, solana_program::system_program}, anchor_spl::associated_token::get_associated_token_address, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, }; #[derive(Accounts)] @@ -23,7 +23,7 @@ pub struct WorkerStakeDelegations<'info> { pub worker: Account<'info, Worker>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let thread = &ctx.accounts.thread; @@ -93,8 +93,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/instructions/worker_fees_distribute.rs b/programs/network/src/instructions/worker_fees_distribute.rs index 91cf702b3..71b08ca9a 100644 --- a/programs/network/src/instructions/worker_fees_distribute.rs +++ b/programs/network/src/instructions/worker_fees_distribute.rs @@ -1,7 +1,7 @@ use { crate::objects::*, anchor_lang::prelude::*, - clockwork_utils::{anchor_sighash, AccountMetaData, CrankResponse, InstructionData}, + clockwork_utils::{anchor_sighash, AccountMetaData, ExecResponse, InstructionData}, }; #[derive(Accounts)] @@ -43,7 +43,7 @@ pub struct WorkerDistributeFees<'info> { pub worker: Account<'info, Worker>, } -pub fn handler(ctx: Context) -> Result { +pub fn handler(ctx: Context) -> Result { // Get accounts. let config = &ctx.accounts.config; let fee = &mut ctx.accounts.fee; @@ -157,8 +157,8 @@ pub fn handler(ctx: Context) -> Result { }) }; - Ok(CrankResponse { + Ok(ExecResponse { next_instruction, - ..CrankResponse::default() + ..ExecResponse::default() }) } diff --git a/programs/network/src/lib.rs b/programs/network/src/lib.rs index 86ca5718a..8fb6a2b5f 100644 --- a/programs/network/src/lib.rs +++ b/programs/network/src/lib.rs @@ -35,7 +35,7 @@ pub mod network_program { delegation_deposit::handler(ctx, amount) } - pub fn delegation_stake(ctx: Context) -> Result { + pub fn delegation_stake(ctx: Context) -> Result { delegation_stake::handler(ctx) } @@ -43,7 +43,7 @@ pub mod network_program { delegation_withdraw::handler(ctx, amount) } - pub fn fee_distribute(ctx: Context) -> Result { + pub fn fee_distribute(ctx: Context) -> Result { fee_distribute::handler(ctx) } @@ -67,15 +67,15 @@ pub mod network_program { pool_update::handler(ctx, settings) } - pub fn registry_epoch_cutover(ctx: Context) -> Result { + pub fn registry_epoch_cutover(ctx: Context) -> Result { registry_epoch_cutover::handler(ctx) } - pub fn registry_epoch_kickoff(ctx: Context) -> Result { + pub fn registry_epoch_kickoff(ctx: Context) -> Result { registry_epoch_kickoff::handler(ctx) } - pub fn registry_nonce_hash(ctx: Context) -> Result { + pub fn registry_nonce_hash(ctx: Context) -> Result { registry_nonce_hash::handler(ctx) } @@ -83,27 +83,27 @@ pub mod network_program { registry_unlock::handler(ctx) } - pub fn snapshot_delete(ctx: Context) -> Result { + pub fn snapshot_delete(ctx: Context) -> Result { snapshot_delete::handler(ctx) } - pub fn snapshot_create(ctx: Context) -> Result { + pub fn snapshot_create(ctx: Context) -> Result { snapshot_create::handler(ctx) } - pub fn snapshot_entry_create(ctx: Context) -> Result { + pub fn snapshot_entry_create(ctx: Context) -> Result { snapshot_entry_create::handler(ctx) } - pub fn snapshot_entry_delete(ctx: Context) -> Result { + pub fn snapshot_entry_delete(ctx: Context) -> Result { snapshot_entry_delete::handler(ctx) } - pub fn snapshot_frame_create(ctx: Context) -> Result { + pub fn snapshot_frame_create(ctx: Context) -> Result { snapshot_frame_create::handler(ctx) } - pub fn snapshot_frame_delete(ctx: Context) -> Result { + pub fn snapshot_frame_delete(ctx: Context) -> Result { snapshot_frame_delete::handler(ctx) } @@ -111,11 +111,11 @@ pub mod network_program { unstake_create::handler(ctx, amount) } - pub fn unstake_preprocess(ctx: Context) -> Result { + pub fn unstake_preprocess(ctx: Context) -> Result { unstake_preprocess::handler(ctx) } - pub fn unstake_process(ctx: Context) -> Result { + pub fn unstake_process(ctx: Context) -> Result { unstake_process::handler(ctx) } @@ -127,11 +127,11 @@ pub mod network_program { worker_create::handler(ctx) } - pub fn worker_fees_distribute(ctx: Context) -> Result { + pub fn worker_fees_distribute(ctx: Context) -> Result { worker_fees_distribute::handler(ctx) } - pub fn worker_delegations_stake(ctx: Context) -> Result { + pub fn worker_delegations_stake(ctx: Context) -> Result { worker_delegations_stake::handler(ctx) } diff --git a/programs/thread/src/errors.rs b/programs/thread/src/errors.rs index 0ac1d76bc..baf97ffd7 100644 --- a/programs/thread/src/errors.rs +++ b/programs/thread/src/errors.rs @@ -5,13 +5,13 @@ use anchor_lang::prelude::*; /// Errors for the the Clockwork thread program. #[error_code] pub enum ClockworkError { - /// Thrown if a crank instruction requires a `data_hash` argument and one was not provided by the worker. + /// Thrown if a exec instruction requires a `data_hash` argument and one was not provided by the worker. #[msg("This trigger requires a data hash observation")] DataHashNotPresent, - /// Thrown if a crank response has an invalid program ID or cannot be parsed. - #[msg("The crank response could not be parsed")] - InvalidCrankResponse, + /// Thrown if a exec response has an invalid program ID or cannot be parsed. + #[msg("The exec response could not be parsed")] + InvalidExecResponse, /// Thrown if a thread has an invalid state and cannot complete the operation. #[msg("The thread is in an invalid state")] @@ -21,7 +21,7 @@ pub enum ClockworkError { #[msg("The range is larger than the account size")] RangeOutOfBounds, - /// Thrown if a crank instruction is invalid because the thread's trigger condition has not been met. + /// Thrown if a exec instruction is invalid because the thread's trigger condition has not been met. #[msg("The trigger condition has not been activated")] TriggerNotActive, @@ -32,7 +32,7 @@ pub enum ClockworkError { #[msg("The thread is currently paused")] ThreadPaused, - /// Thrown if a crank instruction would cause a thread to exceed its rate limit. + /// Thrown if a exec instruction would cause a thread to exceed its rate limit. #[msg("The thread's rate limit has been reached")] RateLimitExeceeded, diff --git a/programs/thread/src/instructions/mod.rs b/programs/thread/src/instructions/mod.rs index 0c072b637..6e1f56895 100644 --- a/programs/thread/src/instructions/mod.rs +++ b/programs/thread/src/instructions/mod.rs @@ -1,6 +1,6 @@ -pub mod thread_crank; pub mod thread_create; pub mod thread_delete; +pub mod thread_exec; pub mod thread_kickoff; pub mod thread_pause; pub mod thread_resume; @@ -8,9 +8,9 @@ pub mod thread_stop; pub mod thread_update; pub mod thread_withdraw; -pub use thread_crank::*; pub use thread_create::*; pub use thread_delete::*; +pub use thread_exec::*; pub use thread_kickoff::*; pub use thread_pause::*; pub use thread_resume::*; diff --git a/programs/thread/src/instructions/thread_crank.rs b/programs/thread/src/instructions/thread_exec.rs similarity index 86% rename from programs/thread/src/instructions/thread_crank.rs rename to programs/thread/src/instructions/thread_exec.rs index 672c49c46..0840d0993 100644 --- a/programs/thread/src/instructions/thread_crank.rs +++ b/programs/thread/src/instructions/thread_exec.rs @@ -7,9 +7,9 @@ use { /// The ID of the pool workers must be a member of to collect fees. const POOL_ID: u64 = 0; -/// Accounts required by the `thread_crank` instruction. +/// Accounts required by the `thread_exec` instruction. #[derive(Accounts)] -pub struct ThreadCrank<'info> { +pub struct ThreadExec<'info> { /// The worker's fee account. #[account( mut, @@ -44,7 +44,7 @@ pub struct ThreadCrank<'info> { #[account(mut)] pub signatory: Signer<'info>, - /// The thread to crank. + /// The thread to execute. #[account( mut, seeds = [ @@ -66,7 +66,7 @@ pub struct ThreadCrank<'info> { pub worker: Account<'info, Worker>, } -pub fn handler(ctx: Context) -> Result<()> { +pub fn handler(ctx: Context) -> Result<()> { // Get accounts let fee = &mut ctx.accounts.fee; let penalty = &mut ctx.accounts.penalty; @@ -79,17 +79,17 @@ pub fn handler(ctx: Context) -> Result<()> { match thread.exec_context { None => return Err(ClockworkError::InvalidThreadState.into()), Some(exec_context) => { - if exec_context.last_crank_at == Clock::get().unwrap().slot - && exec_context.cranks_since_slot >= thread.rate_limit + if exec_context.last_exec_at == Clock::get().unwrap().slot + && exec_context.execs_since_slot >= thread.rate_limit { return Err(ClockworkError::RateLimitExeceeded.into()); } } } - // Crank the thread + // Execute the thread let bump = ctx.bumps.get("thread").unwrap(); - thread.crank( + thread.exec( ctx.remaining_accounts, *bump, fee, diff --git a/programs/thread/src/instructions/thread_kickoff.rs b/programs/thread/src/instructions/thread_kickoff.rs index 690a1caad..85419e002 100644 --- a/programs/thread/src/instructions/thread_kickoff.rs +++ b/programs/thread/src/instructions/thread_kickoff.rs @@ -4,7 +4,7 @@ use { clockwork_network_program::objects::{Worker, WorkerAccount}, }; -/// Accounts required by the `thread_crank` instruction. +/// Accounts required by the `thread_kickoff` instruction. #[derive(Accounts)] #[instruction(data_hash: Option)] pub struct ThreadKickoff<'info> { @@ -12,7 +12,7 @@ pub struct ThreadKickoff<'info> { #[account(mut)] pub signatory: Signer<'info>, - /// The thread to crank. + /// The thread to kickoff. #[account( mut, seeds = [ diff --git a/programs/thread/src/lib.rs b/programs/thread/src/lib.rs index d99b19f64..5f1a83198 100644 --- a/programs/thread/src/lib.rs +++ b/programs/thread/src/lib.rs @@ -18,9 +18,9 @@ declare_id!("3XXuUFfweXBwFgFfYaejLvZE4cGZiHgKiGfMtdxNzYmv"); pub mod thread_program { use super::*; - /// Cranks a transaction thread. - pub fn thread_crank(ctx: Context) -> Result<()> { - thread_crank::handler(ctx) + /// Executes the next instruction on thread. + pub fn thread_exec(ctx: Context) -> Result<()> { + thread_exec::handler(ctx) } /// Creates a new transaction thread. diff --git a/programs/thread/src/objects/thread.rs b/programs/thread/src/objects/thread.rs index df48bfabe..9f6639051 100644 --- a/programs/thread/src/objects/thread.rs +++ b/programs/thread/src/objects/thread.rs @@ -28,10 +28,10 @@ const DEFAULT_RATE_LIMIT: u64 = 10; /// The maximum rate limit which may be set on thread. const MAX_RATE_LIMIT: u64 = 32; -/// The Minimum crank fee that may be set on a thread. +/// The minimum exec fee that may be set on a thread. const MINIMUM_FEE: u64 = 1000; -/// The Number of lamports to reimburse the worker with after they've submitted a transaction's worth of cranks. +/// The number of lamports to reimburse the worker with after they've submitted a transaction's worth of exec instructions. const TRANSACTION_BASE_FEE_REIMBURSEMENT: u64 = 5_000; /// Tracks the current state of a transaction thread on Solana. @@ -42,9 +42,9 @@ pub struct Thread { pub authority: Pubkey, /// The cluster clock at the moment the thread was created. pub created_at: ClockData, - /// The context of the current thread execution state. + /// The context of the thread's current execution state. pub exec_context: Option, - /// The number of lamports to payout to workers per crank. + /// The number of lamports to payout to workers per execution. pub fee: u64, /// The id of the thread, given by the authority. pub id: String, @@ -54,7 +54,7 @@ pub struct Thread { pub next_instruction: Option, /// Whether or not the thread is currently paused. pub paused: bool, - /// The maximum number of cranks allowed per slot. + /// The maximum number of execs allowed per slot. pub rate_limit: u64, /// The triggering event to kickoff a thread. pub trigger: Trigger, @@ -116,8 +116,8 @@ pub trait ThreadAccount { trigger: Trigger, ) -> Result<()>; - /// Crank the thread. Call out to the target program and parse the response for a next instruction. - fn crank( + /// Execute the next instruction on the thread. + fn exec( &mut self, account_infos: &[AccountInfo], bump: u8, @@ -162,7 +162,7 @@ impl ThreadAccount for Account<'_, Thread> { Ok(()) } - fn crank( + fn exec( &mut self, account_infos: &[AccountInfo], bump: u8, @@ -175,7 +175,8 @@ impl ThreadAccount for Account<'_, Thread> { // Record the worker's lamports before invoking inner ixs let signatory_lamports_pre = signatory.lamports(); - // Get the instruction to crank + // Get the instruction to execute + // TODO Just grab the next_instruction here. We have already verified that it is not null. let kickoff_instruction: &InstructionData = &self.clone().kickoff_instruction; let next_instruction: &Option = &self.clone().next_instruction; let instruction = next_instruction.as_ref().unwrap_or(kickoff_instruction); @@ -214,7 +215,7 @@ impl ThreadAccount for Account<'_, Thread> { // Verify that the inner ix did not write data to the signatory address require!(signatory.data_is_empty(), ClockworkError::UnauthorizedWrite); - // Parse the crank response + // Parse the exec response match get_return_data() { None => { self.next_instruction = None; @@ -222,36 +223,36 @@ impl ThreadAccount for Account<'_, Thread> { Some((program_id, return_data)) => { require!( program_id.eq(&instruction.program_id), - ClockworkError::InvalidCrankResponse + ClockworkError::InvalidExecResponse ); - let crank_response = CrankResponse::try_from_slice(return_data.as_slice()) - .map_err(|_err| ClockworkError::InvalidCrankResponse)?; + let exec_response = ExecResponse::try_from_slice(return_data.as_slice()) + .map_err(|_err| ClockworkError::InvalidExecResponse)?; - // Update the thread with the crank response. - if let Some(kickoff_instruction) = crank_response.kickoff_instruction { + // Update the thread with the exec response. + if let Some(kickoff_instruction) = exec_response.kickoff_instruction { self.kickoff_instruction = kickoff_instruction; } - self.next_instruction = crank_response.next_instruction; + self.next_instruction = exec_response.next_instruction; } }; - // Increment the crank count + // Increment the exec count let current_slot = Clock::get().unwrap().slot; match self.exec_context { None => return Err(ClockworkError::InvalidThreadState.into()), Some(exec_context) => { // Update the exec context self.exec_context = Some(ExecContext { - cranks_since_reimbursement: exec_context - .cranks_since_reimbursement + execs_since_reimbursement: exec_context + .execs_since_reimbursement .checked_add(1) .unwrap(), - cranks_since_slot: if current_slot == exec_context.last_crank_at { - exec_context.cranks_since_slot.checked_add(1).unwrap() + execs_since_slot: if current_slot == exec_context.last_exec_at { + exec_context.execs_since_slot.checked_add(1).unwrap() } else { 1 }, - last_crank_at: current_slot, + last_exec_at: current_slot, ..exec_context }); } @@ -276,7 +277,7 @@ impl ThreadAccount for Account<'_, Thread> { .checked_add(signatory_reimbursement) .unwrap(); - // Debit the crank fee from the thread account. + // Debit the fee from the thread account. // If the worker is in the pool, pay fee to the worker's fee account. // Otherwise, pay fee to the worker's penalty account. **self.to_account_info().try_borrow_mut_lamports()? = self @@ -298,7 +299,7 @@ impl ThreadAccount for Account<'_, Thread> { .unwrap(); } - // If the self has no more work or the number of cranks since the last payout has reached the rate limit, + // If the self has no more work or the number of execs since the last payout has reached the rate limit, // reimburse the worker for the transaction base fee. match self.exec_context { None => { @@ -306,7 +307,7 @@ impl ThreadAccount for Account<'_, Thread> { } Some(exec_context) => { if self.next_instruction.is_none() - || exec_context.cranks_since_reimbursement >= self.rate_limit + || exec_context.execs_since_reimbursement >= self.rate_limit { // Pay reimbursment for base transaction fee **self.to_account_info().try_borrow_mut_lamports()? = self @@ -322,7 +323,7 @@ impl ThreadAccount for Account<'_, Thread> { // Update the exec context to mark that a reimbursement happened this slot. self.exec_context = Some(ExecContext { - cranks_since_reimbursement: 0, + execs_since_reimbursement: 0, ..exec_context }); } @@ -430,7 +431,7 @@ impl ThreadAccount for Account<'_, Thread> { }; // Verify the data hash provided by the worker is equal to the expected data hash. - // This proves the account has been updated since the last crank and the worker has seen the new data. + // This proves the account has been updated since the last exec and the worker has seen the new data. require!( data_hash.eq(&expected_data_hash), ClockworkError::TriggerNotActive @@ -438,9 +439,9 @@ impl ThreadAccount for Account<'_, Thread> { // Set a new exec context with the new data hash and slot number. self.exec_context = Some(ExecContext { - cranks_since_reimbursement: 0, - cranks_since_slot: 0, - last_crank_at: clock.slot, + execs_since_reimbursement: 0, + execs_since_slot: 0, + last_exec_at: clock.slot, trigger_context: TriggerContext::Account { data_hash }, }) } @@ -477,9 +478,9 @@ impl ThreadAccount for Account<'_, Thread> { // Set the exec context. self.exec_context = Some(ExecContext { - cranks_since_reimbursement: 0, - cranks_since_slot: 0, - last_crank_at: clock.slot, + execs_since_reimbursement: 0, + execs_since_slot: 0, + last_exec_at: clock.slot, trigger_context: TriggerContext::Cron { started_at }, }); } @@ -490,9 +491,9 @@ impl ThreadAccount for Account<'_, Thread> { ClockworkError::InvalidThreadState ); self.exec_context = Some(ExecContext { - cranks_since_reimbursement: 0, - cranks_since_slot: 0, - last_crank_at: clock.slot, + execs_since_reimbursement: 0, + execs_since_slot: 0, + last_exec_at: clock.slot, trigger_context: TriggerContext::Immediate, }); } @@ -521,31 +522,31 @@ pub enum Trigger { size: usize, }, - /// Allows a thread to be cranked according to a one-time or recurring schedule. + /// Allows a thread to be kicked off according to a one-time or recurring schedule. Cron { /// The schedule in cron syntax. Value must be parsable by the `clockwork_cron` package. schedule: String, /// Boolean value indicating whether triggering moments may be skipped if they are missed (e.g. due to network downtime). - /// If false, any "missed" triggering moments will simply be cranked as soon as the network comes back online. + /// If false, any "missed" triggering moments will simply be executed as soon as the network comes back online. skippable: bool, }, - /// Allows a thread to be cranked as soon as it's created. + /// Allows a thread to be kicked off as soon as it's created. Immediate, } /// The execution context of a particular transaction thread. #[derive(AnchorDeserialize, AnchorSerialize, Clone, Copy, Debug, Hash, PartialEq, Eq)] pub struct ExecContext { - /// Number of cranks since the last tx reimbursement. - pub cranks_since_reimbursement: u64, + /// Number of execs since the last tx reimbursement. + pub execs_since_reimbursement: u64, - /// Number of cranks in this slot. - pub cranks_since_slot: u64, + /// Number of execs in this slot. + pub execs_since_slot: u64, - /// Slot of the last crank - pub last_crank_at: u64, + /// Slot of the last exec + pub last_exec_at: u64, /// Context for the triggering condition pub trigger_context: TriggerContext, diff --git a/programs/thread/src/objects/utils.rs b/programs/thread/src/objects/utils.rs index 6cda983b6..5c5cdbc43 100644 --- a/programs/thread/src/objects/utils.rs +++ b/programs/thread/src/objects/utils.rs @@ -79,15 +79,15 @@ impl TryFrom> for ClockData { /// A response value target programs can return to update the thread. #[derive(AnchorDeserialize, AnchorSerialize, Clone, Debug)] -pub struct CrankResponse { +pub struct ExecResponse { /// The kickoff instruction to use on the next triggering of the thread. /// If none, the kickoff instruction remains unchanged. pub kickoff_instruction: Option, - /// The next instruction to use on the next crank of the thread. + /// The next instruction to use on the next execution of the thread. pub next_instruction: Option, } -impl Default for CrankResponse { +impl Default for ExecResponse { fn default() -> Self { return Self { kickoff_instruction: None, diff --git a/utils/src/lib.rs b/utils/src/lib.rs index 6cda983b6..5c5cdbc43 100644 --- a/utils/src/lib.rs +++ b/utils/src/lib.rs @@ -79,15 +79,15 @@ impl TryFrom> for ClockData { /// A response value target programs can return to update the thread. #[derive(AnchorDeserialize, AnchorSerialize, Clone, Debug)] -pub struct CrankResponse { +pub struct ExecResponse { /// The kickoff instruction to use on the next triggering of the thread. /// If none, the kickoff instruction remains unchanged. pub kickoff_instruction: Option, - /// The next instruction to use on the next crank of the thread. + /// The next instruction to use on the next execution of the thread. pub next_instruction: Option, } -impl Default for CrankResponse { +impl Default for ExecResponse { fn default() -> Self { return Self { kickoff_instruction: None,