Check bank capitalization (bp #11927) (#12184)

* Check bank capitalization (#11927)

* Check bank capitalization

* Simplify and unify capitalization calculation

* Improve and add tests

* Avoid overflow and inhibit automatic restart

* Fix test

* Tweak checked sum for cap. and add tests

* Fix broken build after merge conflicts..

* Rename to ClusterType

* Rename confusing method

* Clarify comment

* Verify cap. in rent and inflation tests

Co-authored-by: Stephen Akridge <sakridge@gmail.com>
(cherry picked from commit de4a613610)

# Conflicts:
#	Cargo.lock
#	accounts-bench/Cargo.toml

* Fix conflict 1/2

* Fix conflict 2/2

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
mergify[bot]
2020-09-11 18:04:10 +00:00
committed by GitHub
parent db1f57162a
commit 640bf7015f
12 changed files with 360 additions and 98 deletions

View File

@@ -202,10 +202,6 @@ impl GenesisConfig {
self.native_instruction_processors.push((name, program_id));
}
pub fn add_rewards_pool(&mut self, pubkey: Pubkey, account: Account) {
self.rewards_pools.insert(pubkey, account);
}
pub fn hashes_per_tick(&self) -> Option<u64> {
self.poh_config.hashes_per_tick
}
@@ -244,6 +240,8 @@ impl fmt::Display for GenesisConfig {
{:?}\n\
{:?}\n\
Capitalization: {} SOL in {} accounts\n\
Native instruction processors: {:#?}\n\
Rewards pool: {:#?}\n\
",
Utc.timestamp(self.creation_time, 0).to_rfc3339(),
self.cluster_type,
@@ -272,6 +270,8 @@ impl fmt::Display for GenesisConfig {
.sum::<u64>()
),
self.accounts.len(),
self.native_instruction_processors,
self.rewards_pools,
)
}
}