Skip to content

Commit

Permalink
Merge pull request #48 from input-output-hk/external_initials
Browse files Browse the repository at this point in the history
add possibility to define static addresses in block0
  • Loading branch information
dkijania committed Feb 23, 2021
2 parents e1f7f30 + c1c7701 commit 1bd158d
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ commands:
command: |
git clone https://github.com/input-output-hk/jormungandr.git
cd jormungandr
git checkout master
git checkout 7a201c6694118561f08e9140b9899888e6c6d993
- run:
name: install jormungandr
command: |
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions iapyx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ rand = "0.7"
rand_core = "0.5"
cryptoxide = "0.2.0"
ed25519-bip32 = "^0.3.1"
jormungandr-testing-utils ={ git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jormungandr-lib = { git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jortestkit = { git = "https://github.com/input-output-hk/jortestkit.git", branch = "master" }
jormungandr-testing-utils ={ git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
jormungandr-lib = { git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
jortestkit = { git = "https://github.com/input-output-hk/jortestkit.git" }
hyper = "0.13.6"
thiserror = "1.0"
serde_json = "1.0.53"
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
jormungandr-scenario-tests = { git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jormungandr-testing-utils = { git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jormungandr-lib = { git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jormungandr-scenario-tests = { git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
jormungandr-testing-utils = { git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
jormungandr-lib = { git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
vit-servicing-station-tests = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
vit-servicing-station-lib = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
jortestkit = { git = "https://github.com/input-output-hk/jortestkit.git", branch = "master" }
Expand Down
5 changes: 3 additions & 2 deletions vitup/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vit_backend/
/data/
/vit_backend/**
/data/**
/snapshot/
6 changes: 3 additions & 3 deletions vitup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ chain-addr = { git = "https://github.com/input-output-hk/chain-libs.gi
chain-impl-mockchain = { git = "https://github.com/input-output-hk/chain-libs.git", branch = "master", features = [ "property-test-api" ] }
chain-time = { git = "https://github.com/input-output-hk/chain-libs.git", branch = "master" }
chain-vote = { git = "https://github.com/input-output-hk/chain-libs.git", branch = "master" }
jormungandr-testing-utils = { git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jormungandr-lib = { git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jormungandr-scenario-tests = { git = "https://github.com/input-output-hk/jormungandr.git", branch = "master" }
jormungandr-testing-utils = { git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
jormungandr-lib = { git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
jormungandr-scenario-tests = { git = "https://github.com/input-output-hk/jormungandr.git", rev = "7a201c6694118561f08e9140b9899888e6c6d993" }
jortestkit = { git = "https://github.com/input-output-hk/jortestkit.git", branch = "master" }
vit-servicing-station-tests = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
vit-servicing-station-lib = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
Expand Down
26 changes: 22 additions & 4 deletions vitup/src/config/initials.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use chain_addr::Discrimination;
use chain_impl_mockchain::value::Value;
use jormungandr_testing_utils::testing::network_builder::WalletTemplate;
use jormungandr_testing_utils::testing::network_builder::{ExternalWalletTemplate, WalletTemplate};
use rand::Rng;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
Expand All @@ -27,6 +27,10 @@ pub enum Initial {
funds: usize,
pin: String,
},
External {
address: String,
funds: usize,
},
}

pub const GRACE_VALUE: u64 = 1;
Expand Down Expand Up @@ -71,6 +75,20 @@ impl Initials {
}])
}

pub fn external_templates(&self) -> Vec<ExternalWalletTemplate> {
let mut templates = Vec::new();
for (index, initial) in self.0.iter().enumerate() {
if let Initial::External { address, funds } = initial {
templates.push(ExternalWalletTemplate::new(
format!("wallet_{}", index + 1),
Value(*funds as u64),
address.to_string(),
));
}
}
templates
}

pub fn templates(
&self,
threshold: u64,
Expand Down Expand Up @@ -122,9 +140,6 @@ impl Initials {
);
}
}
Initial::ZeroFunds { .. } => {
//skip
}
Initial::Wallet { name, funds, pin } => {
let wallet_alias = format!("wallet_{}", name);
templates.insert(
Expand All @@ -136,6 +151,9 @@ impl Initials {
pin.to_string(),
);
}
_ => {
//skip
}
}
}
templates
Expand Down
2 changes: 2 additions & 0 deletions vitup/src/setup/start/quick/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ impl QuickVitBackendSettingsBuilder {

let mut templates = HashMap::new();
if let Some(initials) = &self.parameters.initials {
blockchain.set_external_wallets(initials.external_templates());

templates =
initials.templates(self.parameters.voting_power, blockchain.discrimination());
for (wallet, _) in templates.iter().filter(|(x, _)| *x.value() > Value::zero()) {
Expand Down

0 comments on commit 1bd158d

Please sign in to comment.