Add storage mining pool (#4364)

* Add storage mining pool

* Set gossip port

* Add create-storage-mining-pool-account wallet command

* Add claim-storage-reward wallet command

* Create storage account upfront

* Add storage program to genesis

* Use STORAGE_ACCOUNT_SPACE

* Fix tests

* Add wallet commands to create validator/replicator storage accounts

* Add create_validator_storage_account()

* Storage stage no longer implicitly creates a storage account
This commit is contained in:
Michael Vines
2019-05-23 14:50:23 -07:00
committed by GitHub
parent 6b35e16676
commit b37d2fde3d
18 changed files with 735 additions and 177 deletions

View File

@ -27,9 +27,11 @@ solana-logger = { path = "../logger", version = "0.15.0" }
solana-metrics = { path = "../metrics", version = "0.15.0" }
solana-sdk = { path = "../sdk", version = "0.15.0" }
solana-stake-api = { path = "../programs/stake_api", version = "0.15.0" }
solana-storage-api = { path = "../programs/storage_api", version = "0.15.0" }
solana-vote-api = { path = "../programs/vote_api", version = "0.15.0" }
solana-vote-program = { path = "../programs/vote_program", version = "0.15.0" }
solana-stake-program = { path = "../programs/stake_program", version = "0.15.0" }
solana-storage-program = { path = "../programs/storage_program", version = "0.15.0" }
solana-noop-program = { path = "../programs/noop_program", version = "0.15.0" }
[lib]

View File

@ -4,6 +4,7 @@ use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_program;
use solana_stake_api::stake_state;
use solana_storage_api::storage_contract;
use solana_vote_api::vote_state;
// The default stake placed with the bootstrap leader
@ -13,6 +14,7 @@ pub struct GenesisBlockInfo {
pub genesis_block: GenesisBlock,
pub mint_keypair: Keypair,
pub voting_keypair: Keypair,
pub storage_keypair: Keypair,
}
pub fn create_genesis_block_with_leader(
@ -23,6 +25,7 @@ pub fn create_genesis_block_with_leader(
let mint_keypair = Keypair::new();
let voting_keypair = Keypair::new();
let staking_keypair = Keypair::new();
let storage_keypair = Keypair::new();
// TODO: de-duplicate the stake once passive staking
// is fully implemented
@ -41,11 +44,11 @@ pub fn create_genesis_block_with_leader(
mint_keypair.pubkey(),
Account::new(mint_lamports, 0, &system_program::id()),
),
// node needs an account to issue votes from, this will require
// node needs an account to issue votes and storage proofs from, this will require
// airdrops at some point to cover fees...
(
*bootstrap_leader_id,
Account::new(1, 0, &system_program::id()),
Account::new(42, 0, &system_program::id()),
),
// where votes go to
(voting_keypair.pubkey(), vote_account),
@ -58,13 +61,23 @@ pub fn create_genesis_block_with_leader(
bootstrap_leader_stake_lamports,
),
),
// storage account
(
storage_keypair.pubkey(),
storage_contract::create_validator_storage_account(1),
),
],
&[
solana_vote_program!(),
solana_stake_program!(),
solana_storage_program!(), // TODO: storage program is only needed by core/, move this line into core/src/genesis_utils.rs
],
&[solana_vote_program!(), solana_stake_program!()],
);
GenesisBlockInfo {
genesis_block,
mint_keypair,
voting_keypair,
storage_keypair,
}
}

View File

@ -25,5 +25,8 @@ extern crate solana_vote_program;
#[macro_use]
extern crate solana_stake_program;
#[macro_use]
extern crate solana_storage_program;
#[macro_use]
extern crate serde_derive;