Add account owner to Storage Accounts (#4537)

* Add account owner to Storage Accounts

* Fix tests
This commit is contained in:
Sagar Dhawan
2019-06-04 14:52:52 -07:00
committed by GitHub
parent e3365529de
commit de5cad9211
9 changed files with 161 additions and 29 deletions

View File

@ -131,7 +131,7 @@ impl LocalCluster {
config.node_stakes[0],
);
let storage_keypair = Keypair::new();
genesis_block.add_storage_program(&storage_keypair.pubkey());
genesis_block.add_storage_program(&leader_pubkey, &storage_keypair.pubkey());
genesis_block.ticks_per_slot = config.ticks_per_slot;
genesis_block.slots_per_epoch = config.slots_per_epoch;
genesis_block.stakers_slot_offset = config.stakers_slot_offset;
@ -479,6 +479,7 @@ impl LocalCluster {
))
}
/// Sets up the storage account for validators/replicators and assumes the funder is the owner
fn setup_storage_account(
client: &ThinClient,
storage_keypair: &Keypair,
@ -488,12 +489,14 @@ impl LocalCluster {
let message = Message::new_with_payer(
if replicator {
storage_instruction::create_replicator_storage_account(
&from_keypair.pubkey(),
&from_keypair.pubkey(),
&storage_keypair.pubkey(),
1,
)
} else {
storage_instruction::create_validator_storage_account(
&from_keypair.pubkey(),
&from_keypair.pubkey(),
&storage_keypair.pubkey(),
1,

View File

@ -444,6 +444,7 @@ impl Replicator {
let (blockhash, _fee_calculator) = client.get_recent_blockhash().expect("blockhash");
let ix = storage_instruction::create_replicator_storage_account(
&keypair.pubkey(),
&keypair.pubkey(),
&storage_keypair.pubkey(),
1,