Merge pull request #2996 from input-output-hk/expose_linear_fee
expose discrimination settings in blockchain template
expose discrimination settings in blockchain template
"want",
]
[[package]]
name = "hyper-rustls"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6"
dependencies = [
"bytes 0.5.6",
"futures-util",
"hyper 0.13.10",
"log 0.4.14",
"rustls 0.18.1",
"tokio 0.2.25",
"tokio-rustls 0.14.1",
"webpki",
]
[[package]]
name = "hyper-rustls"
version = "0.22.1"
"rand 0.7.3",
"rand_chacha 0.2.2",
"rayon",
"reqwest",
"reqwest 0.11.1",
"serde",
"serde_derive",
"serde_json",
"rand 0.7.3",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"reqwest",
"reqwest 0.11.1",
"rustls 0.19.0",
"serde",
"serde_derive",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"regex",
"reqwest",
"reqwest 0.11.1",
"serde",
"serde_derive",
"serde_json",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"regex",
"reqwest",
"reqwest 0.10.10",
"serde",
"serde_derive",
"serde_json",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"regex",
"reqwest",
"reqwest 0.10.10",
"semver 0.11.0",
"serde",
"serde_derive",
"rand 0.7.3",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"reqwest",
"reqwest 0.11.1",
"semver 0.11.0",
"serde",
"serde_derive",
"winapi 0.3.9",
]
[[package]]
name = "reqwest"
version = "0.10.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c"
dependencies = [
"base64 0.13.0",
"bytes 0.5.6",
"encoding_rs",
"futures-core",
"futures-util",
"http",
"http-body 0.3.1",
"hyper 0.13.10",
"hyper-rustls 0.21.0",
"ipnet",
"js-sys",
"lazy_static",
"log 0.4.14",
"mime",
"mime_guess",
"percent-encoding 2.1.0",
"pin-project-lite 0.2.4",
"rustls 0.18.1",
"serde",
"serde_json",
"serde_urlencoded 0.7.0",
"tokio 0.2.25",
"tokio-rustls 0.14.1",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots 0.20.0",
"winreg",
]
[[package]]
name = "reqwest"
version = "0.11.1"
"http",
"http-body 0.4.0",
"hyper 0.14.4",
"hyper-rustls",
"hyper-rustls 0.22.1",
"ipnet",
"js-sys",
"lazy_static",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots",
"webpki-roots 0.21.0",
"winreg",
]
"untrusted",
]
[[package]]
name = "webpki-roots"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f"
dependencies = [
"webpki",
]
[[package]]
name = "webpki-roots"
version = "0.21.0"
use super::{Controller, ControllerError};
use chain_addr::Discrimination;
use chain_impl_mockchain::value::Value;
use chain_impl_mockchain::{chaintypes::ConsensusVersion, milli::Milli};
use jormungandr_lib::interfaces::{
value: u64,
wallet_template: Option<WalletTemplate>,
node_alias: Option<NodeAlias>,
discrimination: Discrimination,
}
impl WalletTemplateBuilder {
self
}
pub fn discrimination(&mut self, discrimination: Discrimination) -> &mut Self {
self.discrimination = discrimination;
self
}
pub fn delegated_to(&mut self, delegated_to: &str) -> &mut Self {
self.node_alias = Some(delegated_to.to_string());
self
}
pub fn build(&self) -> WalletTemplate {
let mut wallet = WalletTemplate::new_account(self.alias.clone(), Value(self.value));
let mut wallet =
WalletTemplate::new_account(self.alias.clone(), Value(self.value), self.discrimination);
*wallet.delegate_mut() = self.node_alias.clone();
wallet
}
value: 0u64,
wallet_template: None,
node_alias: None,
discrimination: Discrimination::Test,
}
}
lazy_static = "1"
[dependencies.reqwest]
version = "0.11"
version = "0.10.10"
default-features = false
features = ["blocking", "rustls-tls"]
#[allow(unused_mut)]
let mut wallet = jormungandr_testing_utils::testing::network_builder::WalletTemplate::new_account(
$initial_wallet_name.to_owned(),
chain_impl_mockchain::value::Value($initial_wallet_funds).into()
chain_impl_mockchain::value::Value($initial_wallet_funds).into(),
blockchain.discrimination()
);
$(
#[allow(unused_mut)]
let wallet = jormungandr_testing_utils::testing::network_builder::WalletTemplate::new_utxo(
$initial_wallet_name.to_owned(),
chain_impl_mockchain::value::Value($initial_wallet_funds).into()
chain_impl_mockchain::value::Value($initial_wallet_funds).into(),
blockchain.discrimination()
);
wallet
} else {
for i in 1..leader_counter {
let initial_wallet_name = wallet_name(i);
let mut wallet =
WalletTemplate::new_account(initial_wallet_name.to_owned(), Value(100_000));
let mut wallet = WalletTemplate::new_account(
initial_wallet_name.to_owned(),
Value(100_000),
blockchain.discrimination(),
);
*wallet.delegate_mut() = Some(leader_name(i).to_owned());
blockchain.add_wallet(wallet);
}
for i in 1..legacy_nodes_counter {
let initial_wallet_name = wallet_name(i);
let mut wallet =
WalletTemplate::new_account(initial_wallet_name.to_owned(), Value(100_000));
let mut wallet = WalletTemplate::new_account(
initial_wallet_name.to_owned(),
Value(100_000),
blockchain.discrimination(),
);
*wallet.delegate_mut() = Some(legacy_name(i).to_owned());
blockchain.add_wallet(wallet);
}
[dependencies]
tonic = "0.4"
prost = "0.7"
tokio = { version = "1.1", features = ["macros"] }
tokio = { version = "1.1", features = ["macros","rt","rt-multi-thread"] }
tokio-stream = "0.1"
futures = "0.3.8"
base64 = "0.13"
[dependencies.reqwest]
version = "0.11"
version = "0.10.10"
default-features = false
features = ["blocking", "json"]
features = ["blocking", "json", "rustls-tls"]
[features]
default = []
use super::{ExternalWalletTemplate, LegacyWalletTemplate, NodeAlias, WalletAlias, WalletTemplate};
use chain_addr::Discrimination;
pub use chain_impl_mockchain::chaintypes::ConsensusVersion;
use chain_impl_mockchain::{fee::LinearFee, testing::scenario::template::VotePlanDef};
use jormungandr_lib::interfaces::{
kes_update_speed: KESUpdateSpeed,
consensus_genesis_praos_active_slot_coeff: ActiveSlotCoefficient,
linear_fee: LinearFee,
discrimination: Discrimination,
}
impl Blockchain {
kes_update_speed,
consensus_genesis_praos_active_slot_coeff,
linear_fee: LinearFee::new(1, 1, 1),
discrimination: Discrimination::Test,
}
}
self.linear_fee = linear_fee;
}
pub fn discrimination(&self) -> Discrimination {
self.discrimination
}
pub fn set_discrimination(&mut self, discrimination: Discrimination) {
self.discrimination = discrimination;
}
pub fn vote_plan(&self, alias: &str) -> Option<VotePlanDef> {
self.vote_plans()
.iter()
// TODO blockchain_configuration.block0_date = ;
blockchain_configuration.linear_fees = blockchain.linear_fee();
blockchain_configuration.discrimination = chain_addr::Discrimination::Test;
blockchain_configuration.discrimination = blockchain.discrimination();
blockchain_configuration.block0_consensus = *blockchain.consensus();
blockchain_configuration.consensus_leader_ids = {
let mut leader_ids = Vec::new();
use crate::wallet::{
account::Wallet as AccountWallet, utxo::Wallet as UtxOWallet, Wallet as Inner, WalletError,
};
use chain_addr::Discrimination;
use chain_impl_mockchain::{
certificate::PoolId, fee::LinearFee, fragment::Fragment,
transaction::UnspecifiedAccountIdentifier, vote::CommitteeId,
RNG: CryptoRng + RngCore,
{
Wallet {
inner: Inner::Account(AccountWallet::generate(rng, Discrimination::Test)),
inner: Inner::Account(AccountWallet::generate(rng, template.discrimination())),
template,
}
}
RNG: CryptoRng + RngCore,
{
Wallet {
inner: Inner::UTxO(UtxOWallet::generate(rng, Discrimination::Test)),
inner: Inner::UTxO(UtxOWallet::generate(rng, template.discrimination())),
template,
}
}
use super::{WalletAlias, WalletType};
use crate::testing::network_builder::NodeAlias;
use chain_addr::Discrimination;
use chain_impl_mockchain::value::Value;
pub use external::ExternalWalletTemplate;
pub use legacy::LegacyWalletTemplate;
value: Value,
wallet_type: WalletType,
delegate: Option<NodeAlias>,
discrimination: Discrimination,
}
impl WalletTemplate {
pub fn new_account<S: Into<WalletAlias>>(alias: S, value: Value) -> Self {
Self::new(alias, value, WalletType::Account)
pub fn new_account<S: Into<WalletAlias>>(
alias: S,
value: Value,
discrimination: Discrimination,
) -> Self {
Self::new(alias, value, WalletType::Account, discrimination)
}
pub fn new_utxo<S: Into<WalletAlias>>(alias: S, value: Value) -> Self {
Self::new(alias, value, WalletType::UTxO)
pub fn new_utxo<S: Into<WalletAlias>>(
alias: S,
value: Value,
discrimination: Discrimination,
) -> Self {
Self::new(alias, value, WalletType::UTxO, discrimination)
}
#[inline]
fn new<S: Into<WalletAlias>>(alias: S, value: Value, wallet_type: WalletType) -> Self {
fn new<S: Into<WalletAlias>>(
alias: S,
value: Value,
wallet_type: WalletType,
discrimination: Discrimination,
) -> Self {
Self {
alias: alias.into(),
value,
wallet_type,
delegate: None,
discrimination,
}
}
pub fn alias(&self) -> &WalletAlias {
&self.alias
}
pub fn discrimination(&self) -> Discrimination {
self.discrimination
}
pub fn wallet_type(&self) -> &WalletType {
&self.wallet_type
}
# Conflicts: # CHANGELOG.md # package.json # source/renderer/app/components/staking/delegation-center/WalletRow.js # yarn.lock
Mutex already provides a Sync implementation for types that are Send, and those types are never taken out of the Mutex, so that bound is unnecessary.