Skip to content

Commit

Permalink
Update mainnet spec generation
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone committed Nov 23, 2023
1 parent eec9ea0 commit 81dcbdc
Show file tree
Hide file tree
Showing 6 changed files with 39,488 additions and 49,698 deletions.
19,791 changes: 19,791 additions & 0 deletions chainspecs/mainnet/mainnet-raw.json

Large diffs are not rendered by default.

69,296 changes: 19,643 additions & 49,653 deletions chainspecs/mainnet/mainnet.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pallets/claims/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// Someone claimed some WEBBs.
/// Someone claimed some native tokens.
Claimed { who: T::AccountId, ethereum_address: EthereumAddress, amount: BalanceOf<T> },
}

Expand Down Expand Up @@ -326,7 +326,7 @@ pub mod pallet {

#[pallet::call]
impl<T: Config> Pallet<T> {
/// Make a claim to collect your WEBBs.
/// Make a claim to collect your native tokens.
///
/// The dispatch origin for this call must be _None_.
///
Expand Down Expand Up @@ -368,14 +368,14 @@ pub mod pallet {
Ok(())
}

/// Mint a new claim to collect WEBBs.
/// Mint a new claim to collect native tokens.
///
/// The dispatch origin for this call must be _Root_.
///
/// Parameters:
/// - `who`: The Ethereum address allowed to collect this claim.
/// - `value`: The number of WEBBs that will be claimed.
/// - `vesting_schedule`: An optional vesting schedule for these WEBBs.
/// - `value`: The number of native tokens that will be claimed.
/// - `vesting_schedule`: An optional vesting schedule for these native tokens.
///
/// <weight>
/// The weight of this call is invariant over the input parameters.
Expand Down Expand Up @@ -405,7 +405,7 @@ pub mod pallet {
Ok(())
}

/// Make a claim to collect your WEBBs by signing a statement.
/// Make a claim to collect your native tokens by signing a statement.
///
/// The dispatch origin for this call must be _None_.
///
Expand Down
2 changes: 1 addition & 1 deletion primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub mod currency {
pub const EXISTENTIAL_DEPOSIT: Balance = 1000;

#[cfg(not(feature = "integration-tests"))]
pub const EXISTENTIAL_DEPOSIT: Balance = 10 * CENT;
pub const EXISTENTIAL_DEPOSIT: Balance = MICROUNIT;

pub const WEI: Balance = 1;
pub const KILOWEI: Balance = 1_000;
Expand Down
73 changes: 39 additions & 34 deletions standalone/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,34 +561,37 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result<ChainSpec, String> {
"tangle-mainnet",
ChainType::Live,
move || {
testnet_genesis(
mainnet_genesis(
wasm_binary,
// Initial PoA authorities
get_standalone_initial_authorities(),
vec![
authority_keys_from_seed("Alice", "Alice//stash"),
authority_keys_from_seed("Bob", "Bob//stash"),
authority_keys_from_seed("Charlie", "Charlie//stash"),
authority_keys_from_seed("Dave", "Dave//stash"),
authority_keys_from_seed("Eve", "Eve//stash"),
],
// initial nominators
vec![],
// Sudo account
get_testnet_root_key(),
// Pre-funded accounts
vec![
get_testnet_root_key(),
hex!["4e85271af1330e5e9384bd3ac5bdc04c0f8ef5a8cc29c1a8ae483d674164745c"].into(),
hex!["804808fb75d16340dc250871138a1a6f1dfa3cab9cc1fbd6f42960f1c39a950d"].into(),
hex!["587c2ef00ec0a1b98af4c655763acd76ece690fccbb255f01663660bc274960d"].into(),
hex!["cc195602a63bbdcf2ef4773c86fdbfefe042cb9aa8e3059d02e59a062d9c3138"].into(),
hex!["a24f729f085de51eebaeaeca97d6d499761b8f6daeca9b99d754a06ef8bcec3f"].into(),
hex!["368ea402dbd9c9888ae999d6a799cf36e08673ee53c001dfb4529c149fc2c13b"].into(),
hex!["2c7f3cc085da9175414d1a9d40aa3aa161c8584a9ca62a938684dfbe90ae9d74"].into(),
hex!["0a55e5245382700f35d16a5ea6d60a56c36c435bef7204353b8c36871f347857"].into(),
hex!["e0948453e7acbc6ac937e124eb01580191e99f4262d588d4524994deb6134349"].into(),
hex!["6c73e5ee9f8614e7c9f23fd8f7257d12e061e75fcbeb3b50ed70eb87ba91f500"].into(),
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
vec![],
vec![],
get_standalone_initial_authorities().iter().map(|a| a.0.clone()).collect(),
chain_id,
DEFAULT_DKG_KEYGEN_THRESHOLD,
DEFAULT_DKG_SIGNATURE_THRESHOLD,
combine_distributions(vec![
mainnet::get_edgeware_genesis_balance_distribution(),
mainnet::get_leaderboard_balance_distribution(),
Expand Down Expand Up @@ -747,12 +750,13 @@ fn mainnet_genesis(
initial_authorities: Vec<(AccountId, AccountId, AuraId, GrandpaId, ImOnlineId, DKGId)>,
initial_nominators: Vec<AccountId>,
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
chain_id: u64,
genesis_evm_distribution: Vec<(H160, fp_evm::GenesisAccount)>,
genesis_substrate_distribution: Vec<(AccountId, Balance)>,
_enable_println: bool,
) -> RuntimeGenesisConfig {
const ENDOWMENT: Balance = 10_000_000 * UNIT;
const ENDOWMENT: Balance = 100 * UNIT;
const STASH: Balance = ENDOWMENT / 100;

// stakers: all validators and nominators.
Expand Down Expand Up @@ -781,7 +785,12 @@ fn mainnet_genesis(
},
sudo: SudoConfig { key: Some(root_key) },
balances: BalancesConfig {
balances: genesis_substrate_distribution.iter().cloned().collect(),
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, ENDOWMENT))
.chain(genesis_substrate_distribution.iter().cloned().map(|(k, v)| (k, v)))
.collect(),
},
vesting: Default::default(),
indices: Default::default(),
Expand Down Expand Up @@ -816,29 +825,25 @@ fn mainnet_genesis(
transaction_payment: Default::default(),
// EVM compatibility
evm_chain_id: EVMChainIdConfig { chain_id, ..Default::default() },
evm: EVMConfig {
accounts: {
let mut map = BTreeMap::new();
for (address, account) in genesis_evm_distribution {
map.insert(address, account);
}
map
},
..Default::default()
},
evm: Default::default(),
ethereum: Default::default(),
dynamic_fee: Default::default(),
base_fee: Default::default(),
// ETH2 light client
eth_2_client: Eth2ClientConfig {
networks: vec![
(webb_proposals::TypedChainId::Evm(1), NetworkConfig::new(&Network::Mainnet)),
(webb_proposals::TypedChainId::Evm(5), NetworkConfig::new(&Network::Goerli)),
],
networks: vec![(
webb_proposals::TypedChainId::Evm(1),
NetworkConfig::new(&Network::Mainnet),
)],
phantom: PhantomData,
},
// TODO: Remove these pallets and re-architect for mainnet
dkg: Default::default(),
dkg: DKGConfig {
authorities: initial_authorities.iter().map(|(.., x)| x.clone()).collect::<_>(),
keygen_threshold: 2,
signature_threshold: 1,
authority_ids: initial_authorities.iter().map(|(x, ..)| x.clone()).collect::<_>(),
},
dkg_proposals: Default::default(),
bridge_registry: Default::default(),
}
Expand Down
12 changes: 8 additions & 4 deletions standalone/node/src/distributions/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use serde_json::Value;
use sp_core::{crypto::Ss58Codec, H160, U256};
use sp_runtime::AccountId32;
use std::collections::BTreeMap;
use tangle_runtime::{AccountId, Balance};
use tangle_runtime::{AccountId, Balance, ExistentialDeposit};

use super::testnet::{get_git_root, read_contents, read_contents_to_evm_accounts};

Expand Down Expand Up @@ -91,12 +91,16 @@ pub fn get_leaderboard_balance_distribution() -> Vec<(H160, GenesisAccount)> {

pub fn get_substrate_balance_distribution() -> Vec<(AccountId32, Balance)> {
const ONE_TOKEN: u128 = 1_000_000_000_000_000_000;
const ENDOWMENT: u128 = 1_000_000 * ONE_TOKEN;
const ENDOWMENT: u128 = 10_000_000 * ONE_TOKEN;

let convert_to_u128 = |value: f64| -> u128 { (ENDOWMENT as f64 * value) as u128 };

get_edgeware_snapshot_list()
let balances: Vec<(AccountId32, Balance)> = get_edgeware_snapshot_list()
.into_iter()
.filter(|(_, value)| *value > 0.0)
.map(|(address, value)| (address, Balance::from(convert_to_u128(value))))
.collect()
.filter(|(_, value)| *value > ExistentialDeposit::get())
.collect();

balances
}

0 comments on commit 81dcbdc

Please sign in to comment.