Skip to content

Commit

Permalink
rusk: Update test keys
Browse files Browse the repository at this point in the history
  • Loading branch information
moCello committed Aug 27, 2024
1 parent 0454be2 commit f0bba88
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 217 deletions.
400 changes: 200 additions & 200 deletions rusk/tests/config/bench.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rusk/tests/config/contract_deployment.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[[phoenix_balance]]
address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
seed = 57005
notes = [10_000_000_000]
4 changes: 2 additions & 2 deletions rusk/tests/config/gas-behavior.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[[phoenix_balance]]
address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
seed = 57005
notes = [10_000_000_000]

[[phoenix_balance]]
address = "3MoVQ6VfGNu8fJ5GeHPRDVUfxcsDEmGXpWhvKhXY7F2dKCp7QWRw8RqPcbuJGdRqeTtxpuiwETnGAJLnhT4Kq4e8"
address = "aTzucx7GCB74UqahpL4VKB8ZqeMwC6W9ETVx12LU4E5UKzJeg4PVwsja5STiZojy9xAZAP8XqrgwVRwc6jdQk8H"
seed = 57005
notes = [10_000_000_000]

6 changes: 3 additions & 3 deletions rusk/tests/config/multi_transfer.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[[phoenix_balance]]
address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
seed = 57005
notes = [10_000_000_000]

[[phoenix_balance]]
address = "3MoVQ6VfGNu8fJ5GeHPRDVUfxcsDEmGXpWhvKhXY7F2dKCp7QWRw8RqPcbuJGdRqeTtxpuiwETnGAJLnhT4Kq4e8"
address = "aTzucx7GCB74UqahpL4VKB8ZqeMwC6W9ETVx12LU4E5UKzJeg4PVwsja5STiZojy9xAZAP8XqrgwVRwc6jdQk8H"
seed = 57005
notes = [10_000_000_000]

[[phoenix_balance]]
address = "4RyaodGmN8MyUDmpRrtRxJJhrVW2HsY2ycRUnRUXR97JCN1GHraQT9Ygb8yYo7oKzyZg2EXXCGkHBwoeNb96BKtQ"
address = "546nHTptE8dy18tZcR6TBVXVTnRQQVJbnBMWtFm2AHzZfdQBKqEodFgTGGnvmd6ii7mpVdVkY4vDDGGCpZ5Wm3e9"
seed = 57005
notes = [10_000_000_000]
2 changes: 1 addition & 1 deletion rusk/tests/config/rusk-state.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[phoenix_balance]]
address = "29ENJqLtHJRSZdghZxiGuzQTe3F4t1bv35zM7mEMS142e5QdxkknokMALrBEFUnyav9NfeXLNvfjx4sfTtJN9WCB"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
notes = [10_000_000_000]
4 changes: 2 additions & 2 deletions rusk/tests/config/slash.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[phoenix_balance]]
address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
seed = 57005
notes = [
10_000_000_000_000,
Expand All @@ -15,6 +15,6 @@ notes = [
]

[[stake]]
address = "qe1FbZxf6YaCAeFNSvL1G82cBhG4Q4gBf4vKYo527Vws3b23jdbBuzKSFsdUHnZeBgsTnyNJLkApEpRyJw87sdzR9g9iESJrG5ZgpCs9jq88m6d4qMY5txGpaXskRQmkzE3"
address = "zryQ5mBuLvhj3bypKnykqoZH2cmoboWL36q64oCWpxzpBFygCFRqwnAiy3ajPpVCqJqY64LY1RXLUFdSk82zENHEVsHsKS2yNoDXWdCcae3r9qbTwkxxXaAi3gUZakSeqnH"
amount = 20_000_000_000
reward = 3_000_000_000
6 changes: 3 additions & 3 deletions rusk/tests/config/stake.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[phoenix_balance]]
address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
seed = 57005
notes = [
10_000_000_000_000,
Expand All @@ -15,10 +15,10 @@ notes = [
]

[[stake]]
address = "qe1FbZxf6YaCAeFNSvL1G82cBhG4Q4gBf4vKYo527Vws3b23jdbBuzKSFsdUHnZeBgsTnyNJLkApEpRyJw87sdzR9g9iESJrG5ZgpCs9jq88m6d4qMY5txGpaXskRQmkzE3"
address = "zryQ5mBuLvhj3bypKnykqoZH2cmoboWL36q64oCWpxzpBFygCFRqwnAiy3ajPpVCqJqY64LY1RXLUFdSk82zENHEVsHsKS2yNoDXWdCcae3r9qbTwkxxXaAi3gUZakSeqnH"
amount = 1_000_000_000_000

[[stake]]
address = "25omWWRyfcMjYNbQZVyc3rypYLi8UqZuthoJHqbCEriRX3z2EmnBaXWZLFL2NvzvDnkoYoHLGiSYQpmupNJj1sSdWNstqzfFEpiqvSNYw7gqvoEiU9FsEHUMG1ZyG3XgL8Rv"
address = "ugaSrdetkhaDekhvJRR8RP17FHYhEwEUq3CAx6Nem5V6ShENsHYPkLiNtdKsELr3PAZcML2ZAm5MFwxdwS7j42UwXttYhUgywN6KA4CZw9z9hi17Zx55NBf8KzPdnQaiN5g"
amount = 1_000_000_000_000
reward = 1_000_000_000_000
4 changes: 2 additions & 2 deletions rusk/tests/config/transfer.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[phoenix_balance]]
address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
seed = 57005
notes = [
10_000_000_000,
Expand All @@ -15,5 +15,5 @@ notes = [
]

[[moonlight_account]]
address = "qe1FbZxf6YaCAeFNSvL1G82cBhG4Q4gBf4vKYo527Vws3b23jdbBuzKSFsdUHnZeBgsTnyNJLkApEpRyJw87sdzR9g9iESJrG5ZgpCs9jq88m6d4qMY5txGpaXskRQmkzE3"
address = "zryQ5mBuLvhj3bypKnykqoZH2cmoboWL36q64oCWpxzpBFygCFRqwnAiy3ajPpVCqJqY64LY1RXLUFdSk82zENHEVsHsKS2yNoDXWdCcae3r9qbTwkxxXaAi3gUZakSeqnH"
balance = 10_000_000_000
6 changes: 3 additions & 3 deletions rusk/tests/config/unspendable.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[[phoenix_balance]]
address = "ivmscertKgRyX8wNMJJsQcSVEyPsfSMUQXSAgeAPQXsndqFq9Pmknzhm61QvcEEdxPaGgxDS4RHpb6KKccrnSKN"
address = "5gZ7msthCUNu2YhpQQz51Fj3L4ppYW58yG7mzZGkdzAp8iLHxkMvQAQhweJ6jhTrBZwhpTkC9ubbi135ynakNj3z"
seed = 57005
notes = [10_000_000_000]

[[phoenix_balance]]
address = "3MoVQ6VfGNu8fJ5GeHPRDVUfxcsDEmGXpWhvKhXY7F2dKCp7QWRw8RqPcbuJGdRqeTtxpuiwETnGAJLnhT4Kq4e8"
address = "aTzucx7GCB74UqahpL4VKB8ZqeMwC6W9ETVx12LU4E5UKzJeg4PVwsja5STiZojy9xAZAP8XqrgwVRwc6jdQk8H"
seed = 57005
notes = [10_000_000_000]

[[phoenix_balance]]
address = "4RyaodGmN8MyUDmpRrtRxJJhrVW2HsY2ycRUnRUXR97JCN1GHraQT9Ygb8yYo7oKzyZg2EXXCGkHBwoeNb96BKtQ"
address = "546nHTptE8dy18tZcR6TBVXVTnRQQVJbnBMWtFm2AHzZfdQBKqEodFgTGGnvmd6ii7mpVdVkY4vDDGGCpZ5Wm3e9"
seed = 57005
notes = [10_000_000_000]
75 changes: 75 additions & 0 deletions rusk/tests/rusk-state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,78 @@ async fn generate_moonlight_txs() -> Result<(), Box<dyn std::error::Error>> {

Ok(())
}

// This code is used to generate the addresses for the config-toml files.
// To generate:
// - uncomment the `#[test]' line
// - adjust the variables accordingly ("bench.toml" has each 100 phoenix and
// moonlight accounts)
// - run the test 'generate_bench_toml'
// - move the resulting "bench.toml" file under "tests/config/bench.toml"
// The first phoenix and moonlight addresses in "bench.toml" are the same
// across all the toml config files (moonlight addresses are equivalent to stake
// addresses).
#[allow(dead_code)]
// #[test]
fn generate_bench_toml() -> Result<(), Box<dyn std::error::Error>> {
use common::wallet::{TestStateClient, TestStore};
use dusk_bytes::Serializable;
use rusk_recovery_tools::state::Snapshot;
use std::io::Write;

const MAX_INDEX: u8 = 100;
const PHOENIX: bool = true;
const MOONLIGHT: bool = true;
let file_name = "bench.toml";

// create a dummy wallet for keys generation
let tmp = tempdir()?;
let rusk = new_state(&tmp, &Snapshot::default(), 0)?;
let cache =
Arc::new(std::sync::RwLock::new(std::collections::HashMap::new()));
let wallet =
test_wallet::Wallet::new(TestStore, TestStateClient { rusk, cache });

// write the toml file
let mut toml_file = std::fs::File::create(file_name)?;
toml_file.write(b"[acl.stake]\nowners = []\nallowlist = []\n\n")?;

if PHOENIX {
for index in 0..MAX_INDEX {
let phoenix_pk = wallet
.phoenix_public_key(index)
.expect("key-generation should work");
toml_file.write(b"[[phoenix_balance]]\n")?;
toml_file.write(b"address = \"")?;
toml_file.write(
bs58::encode(phoenix_pk.to_bytes()).into_string().as_bytes(),
)?;
toml_file.write(b"\"\n")?;
toml_file.write(b"seed = 57005\n")?;
toml_file.write(b"notes = [10_000_000_000]\n")?;
if index < MAX_INDEX - 1 || MOONLIGHT {
toml_file.write(b"\n")?;
}
}
}

if MOONLIGHT {
for index in 0..MAX_INDEX {
let account_pk = wallet
.account_public_key(index)
.expect("key-generation should work");
toml_file.write(b"[[moonlight_account]]\n")?;
toml_file.write(b"address = \"")?;
toml_file.write(
bs58::encode(account_pk.to_bytes()).into_string().as_bytes(),
)?;
toml_file.write(b"\"\n")?;
toml_file.write(b"balance = 10_000_000_000\n")?;
if index < MAX_INDEX - 1 {
toml_file.write(b"\n")?;
}
}
}

Ok(())
}

0 comments on commit f0bba88

Please sign in to comment.