Boot SystemInstruction::Spawn
This commit is contained in:
parent
e1e84d4465
commit
4e4a1643c4
|
@ -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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -39,9 +39,6 @@ fn load_program(bank: &Bank, from: &Keypair, loader_id: Pubkey, program: Vec<u8>
|
|||
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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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()),
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue