Skip to content

Commit

Permalink
re-add UNIT multiplier, remove debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfra-t committed Dec 10, 2024
1 parent f02e729 commit fbad995
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 31 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 7 additions & 22 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,19 @@ pub fn pendulum_config() -> PendulumChainSpec {

for pendulum::Allocation { address, amount } in pendulum::ALLOCATIONS_10_24 {
let account_id = AccountId::from_ss58check(address).unwrap();
balances.push((account_id.clone(), amount ));
vesting_schedules.push((account_id, 0, blocks_per_year * 2, amount / 10))
balances.push((account_id.clone(), amount * UNIT));
vesting_schedules.push((account_id, 0, blocks_per_year * 2, amount * UNIT / 10))
}

for pendulum::Allocation { address, amount } in pendulum::ALLOCATIONS_12_36 {
let account_id = AccountId::from_ss58check(address).unwrap();
balances.push((account_id.clone(), amount ));
vesting_schedules.push((account_id.clone(), blocks_per_year, 1, amount * 2 / 3));
balances.push((account_id.clone(), amount * UNIT));
vesting_schedules.push((account_id.clone(), blocks_per_year, 1, amount * UNIT * 2 / 3));
vesting_schedules.push((
account_id,
blocks_per_year,
blocks_per_year * 2,
amount / 3,
amount * UNIT / 3,
));
}

Expand Down Expand Up @@ -423,6 +423,7 @@ fn amplitude_genesis(
let mut safe_balances = limit_balance_for_serialization(balances);
safe_balances.push((sudo_account.clone(), MAX_SAFE_INTEGER_JSON - 1));


let token_balances = vec![];

let stakers: Vec<_> = invulnerables
Expand Down Expand Up @@ -966,23 +967,7 @@ fn pendulum_genesis(
treasury_buyout_extension: Default::default(),
};


let value = serde_json::to_value(genesis_config).expect("Serialization of genesis config should work");

// Serialize the genesis configuration
let serialized = serde_json::to_string(&value)
.expect("Serialization of JSON value should work");

let target_position: usize = 5090;
let context_range :usize= 15;

let start: usize = target_position.saturating_sub(context_range);
let end :usize= (target_position + context_range).min(serialized.len());

let context = &serialized[start..end];
println!("Context 5090:\n{}", context);
value

serde_json::to_value(genesis_config).expect("Serialization of genesis config should work")
}

fn limit_balance_for_serialization( balances: Vec<(AccountId, Balance)> ) -> Vec<(AccountId,Balance)> {
Expand Down

0 comments on commit fbad995

Please sign in to comment.