From 4e4a1643c46b98098915206ecbb6da166fb5654d Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Thu, 14 Feb 2019 12:18:36 -0700 Subject: [PATCH] Boot SystemInstruction::Spawn --- book/src/runtime.md | 1 - programs/native/system/src/lib.rs | 5 ----- programs/tests/programs.rs | 3 --- sdk/src/native_program.rs | 4 ---- sdk/src/system_instruction.rs | 3 --- sdk/src/system_transaction.rs | 12 ------------ wallet/src/wallet.rs | 4 ---- 7 files changed, 32 deletions(-) diff --git a/book/src/runtime.md b/book/src/runtime.md index 0881a5bfc5..417aa67a02 100644 --- a/book/src/runtime.md +++ b/book/src/runtime.md @@ -62,7 +62,6 @@ encodes. Program. * `Assign` - allows the user to assign an existing account to a program. * `Move` - moves tokens between accounts. -* `Spawn` - spawns a new program from an account. ## Notes diff --git a/programs/native/system/src/lib.rs b/programs/native/system/src/lib.rs index 0c073acbe0..f85697bbc0 100644 --- a/programs/native/system/src/lib.rs +++ b/programs/native/system/src/lib.rs @@ -80,11 +80,6 @@ pub fn entrypoint( keyed_accounts[from].account.tokens -= tokens; keyed_accounts[to].account.tokens += tokens; } - SystemInstruction::Spawn => { - if !keyed_accounts[from].account.executable { - Err(ProgramError::AccountNotFinalized)?; - } - } } Ok(()) } else { diff --git a/programs/tests/programs.rs b/programs/tests/programs.rs index 25565fe793..724bc0f500 100644 --- a/programs/tests/programs.rs +++ b/programs/tests/programs.rs @@ -39,9 +39,6 @@ fn load_program(bank: &Bank, from: &Keypair, loader_id: Pubkey, program: Vec let tx = LoaderTransaction::new_finalize(&program_account, loader_id, bank.last_id(), 0); bank.process_transaction(&tx).unwrap(); - let tx = SystemTransaction::new_spawn(&program_account, bank.last_id(), 0); - bank.process_transaction(&tx).unwrap(); - program_account.pubkey() } diff --git a/sdk/src/native_program.rs b/sdk/src/native_program.rs index 3d72869386..b03d799d26 100644 --- a/sdk/src/native_program.rs +++ b/sdk/src/native_program.rs @@ -33,10 +33,6 @@ pub enum ProgramError { /// SystemInstruction::Assign was attempted on an account unowned by the system program AssignOfUnownedAccount, - - /// SystemInstruction::Spawn was attempted on an account that was not finalized by - /// LoaderInstruction::Finalize - AccountNotFinalized, } impl std::fmt::Display for ProgramError { diff --git a/sdk/src/system_instruction.rs b/sdk/src/system_instruction.rs index 49552209c7..5e7f56d5e3 100644 --- a/sdk/src/system_instruction.rs +++ b/sdk/src/system_instruction.rs @@ -20,7 +20,4 @@ pub enum SystemInstruction { /// * Transaction::keys[0] - source /// * Transaction::keys[1] - destination Move { tokens: u64 }, - - /// Spawn a new program from an account - Spawn, } diff --git a/sdk/src/system_transaction.rs b/sdk/src/system_transaction.rs index 4ee52a4c8d..f892eb2354 100644 --- a/sdk/src/system_transaction.rs +++ b/sdk/src/system_transaction.rs @@ -107,18 +107,6 @@ impl SystemTransaction { instructions, ) } - /// Create and sign new SystemInstruction::Spawn transaction - pub fn new_spawn(from_keypair: &Keypair, last_id: Hash, fee: u64) -> Transaction { - let spawn = SystemInstruction::Spawn; - Transaction::new( - from_keypair, - &[], - system_program::id(), - &spawn, - last_id, - fee, - ) - } } #[cfg(test)] diff --git a/wallet/src/wallet.rs b/wallet/src/wallet.rs index 410c398659..72231d0a7f 100644 --- a/wallet/src/wallet.rs +++ b/wallet/src/wallet.rs @@ -447,10 +447,6 @@ fn process_deploy( WalletError::DynamicProgramError("Program finalize transaction failed".to_string()) })?; - let mut tx = SystemTransaction::new_spawn(&program_id, last_id, 0); - send_and_confirm_tx(&rpc_client, &mut tx, &program_id) - .map_err(|_| WalletError::DynamicProgramError("Program spawn failed".to_string()))?; - Ok(json!({ "programId": format!("{}", program_id.pubkey()), })