Skip to content

Commit

Permalink
[refactor] hyperledger#4339: refactor iroha_crypto, update API (hyp…
Browse files Browse the repository at this point in the history
…erledger#4341)

* [refactor] hyperledger#4339: refactor `iroha_crypto`, update API

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [chore]: clean

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `from_bytes`/`to_bytes`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: use `try_from` and `into` serde container attrs

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: serialize keys' payloads in uppercase hex

There is also `iroha_swarm`, which still uses lowercase

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [fix]: also use uppercase for `Signature`'s `payload`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: stronger types in `KeyGenOption`, renames and fixes

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: revert rename

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: snip `KeyGenConfig` entirely

- Rename `KeyPair::generate` to `KeyPair::random`
- Add `KeyPair::random_with_algorithm`
- Add `KeyPair::from_seed`
- Add `impl From<PrivateKey> for KeyPair`

Also:

- Rename `KeyPair::new` to `KeyPair::from_raw_parts`
  for consistency

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

* [refactor]: restruct `KeyPair` methods

- revert `from_raw_parts` to `new`
- rename `into_raw_parts` to `into_parts`
- remove `impl From<KeyPair> to (K, K)`

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>

---------

Signed-off-by: Dmitry Balashov <43530070+0x009922@users.noreply.github.com>
  • Loading branch information
0x009922 committed Mar 13, 2024
1 parent 702df2d commit 7014f53
Show file tree
Hide file tree
Showing 53 changed files with 409 additions and 414 deletions.
2 changes: 1 addition & 1 deletion cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ mod tests {
use super::*;

fn config_factory() -> PartialUserConfig {
let (pubkey, privkey) = KeyPair::generate().into();
let (pubkey, privkey) = KeyPair::random().into_parts();

let mut base = PartialUserConfig::default();

Expand Down
2 changes: 1 addition & 1 deletion cli/src/samples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn get_user_config(
) -> UserConfig {
let chain_id = chain_id.unwrap_or_else(|| ChainId::from("0"));

let (public_key, private_key) = key_pair.unwrap_or_else(KeyPair::generate).into();
let (public_key, private_key) = key_pair.unwrap_or_else(KeyPair::random).into_parts();
iroha_logger::info!(%public_key);

let mut config = UserConfig::new();
Expand Down
4 changes: 2 additions & 2 deletions client/benches/torii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn query_requests(criterion: &mut Criterion) {
let domain_id: DomainId = "domain".parse().expect("Valid");
let create_domain = Register::domain(Domain::new(domain_id.clone()));
let account_id = AccountId::new(domain_id.clone(), "account".parse().expect("Valid"));
let (public_key, _) = KeyPair::generate().into();
let (public_key, _) = KeyPair::random().into_parts();
let create_account = Register::account(Account::new(account_id.clone(), public_key));
let asset_definition_id = AssetDefinitionId::new(domain_id, "xor".parse().expect("Valid"));
let create_asset =
Expand Down Expand Up @@ -162,7 +162,7 @@ fn instruction_submits(criterion: &mut Criterion) {
let domain_id: DomainId = "domain".parse().expect("Valid");
let create_domain: InstructionBox = Register::domain(Domain::new(domain_id.clone())).into();
let account_id = AccountId::new(domain_id.clone(), "account".parse().expect("Valid"));
let (public_key, _) = KeyPair::generate().into();
let (public_key, _) = KeyPair::random().into_parts();
let create_account = Register::account(Account::new(account_id.clone(), public_key)).into();
let asset_definition_id = AssetDefinitionId::new(domain_id, "xor".parse().expect("Valid"));
let client_config = iroha_client::samples::get_client_config(
Expand Down
2 changes: 1 addition & 1 deletion client/benches/tps/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl MeasurerUnit {

/// Submit initial transactions for measurement
fn ready(self) -> Result<Self> {
let keypair = iroha_client::crypto::KeyPair::generate();
let keypair = iroha_client::crypto::KeyPair::random();

let account_id = account_id(self.name);
let asset_id = asset_id(self.name);
Expand Down
2 changes: 1 addition & 1 deletion client/examples/million_accounts_genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn create_million_accounts_directly() {
let create_domain: InstructionBox = Register::domain(Domain::new(domain_id)).into();
let create_account = Register::account(Account::new(
normal_account_id.clone(),
KeyPair::generate().into_raw_parts().0,
KeyPair::random().into_parts().0,
))
.into();
if test_client
Expand Down
2 changes: 1 addition & 1 deletion client/examples/tutorial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn account_registration_test(config: Config) -> Result<(), Error> {

// TODO: consider getting a key from white_rabbit
// Generate a new public key for a new account
let (public_key, _) = KeyPair::generate().into();
let (public_key, _) = KeyPair::random().into_parts();

// #region register_account_generate
// Generate a new account
Expand Down
2 changes: 1 addition & 1 deletion client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ mod tests {
fn config_factory() -> Config {
Config {
chain_id: ChainId::from("0"),
key_pair: KeyPair::generate(),
key_pair: KeyPair::random(),
account_id: "alice@wonderland"
.parse()
.expect("This account ID should be valid"),
Expand Down
4 changes: 2 additions & 2 deletions client/tests/integration/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ fn find_rate_and_make_exchange_isi_should_succeed() {
let seller_btc: AssetId = "btc#crypto#seller@company".parse().expect("Valid.");
let buyer_eth: AssetId = "eth#crypto#buyer@company".parse().expect("Valid.");

let seller_keypair = KeyPair::generate();
let buyer_keypair = KeyPair::generate();
let seller_keypair = KeyPair::random();
let buyer_keypair = KeyPair::random();

let register_account = |account_id: AccountId, signature: PublicKey| {
Register::account(Account::new(account_id, signature))
Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/asset_propagation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn client_add_asset_quantity_to_existing_asset_should_increase_asset_amount_on_a
let create_domain: InstructionBox =
Register::domain(Domain::new(DomainId::from_str("domain")?)).into();
let account_id = AccountId::from_str("account@domain")?;
let (public_key, _) = KeyPair::generate().into();
let (public_key, _) = KeyPair::random().into_parts();
let create_account = Register::account(Account::new(account_id.clone(), public_key)).into();
let asset_definition_id = AssetDefinitionId::from_str("xor#domain")?;
let create_asset =
Expand Down
4 changes: 2 additions & 2 deletions client/tests/integration/burn_public_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn public_keys_cannot_be_burned_to_nothing() {
let (_rt, _peer, client) = <PeerBuilder>::new().with_port(10_045).start_with_runtime();
wait_for_genesis_committed(&vec![client.clone()], 0);

let charlie_initial_keypair = KeyPair::generate();
let charlie_initial_keypair = KeyPair::random();
let register_charlie = Register::account(Account::new(
charlie_id.clone(),
charlie_initial_keypair.public_key().clone(),
Expand All @@ -60,7 +60,7 @@ fn public_keys_cannot_be_burned_to_nothing() {
assert_eq!(keys_count, 1);

let mint_keys = (0..KEYS_COUNT - 1).map(|_| {
let (public_key, _) = KeyPair::generate().into();
let (public_key, _) = KeyPair::random().into_parts();
Mint::account_public_key(public_key, charlie_id.clone())
});

Expand Down
14 changes: 7 additions & 7 deletions client/tests/integration/domain_owner_permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn domain_owner_domain_permissions() -> Result<()> {
let kingdom = Domain::new(kingdom_id.clone());
test_client.submit_blocking(Register::domain(kingdom))?;

let bob_keypair = KeyPair::generate();
let bob_keypair = KeyPair::random();
let bob = Account::new(bob_id.clone(), bob_keypair.public_key().clone());
test_client.submit_blocking(Register::account(bob))?;

Expand Down Expand Up @@ -95,15 +95,15 @@ fn domain_owner_account_permissions() -> Result<()> {
let kingdom = Domain::new(kingdom_id);
test_client.submit_blocking(Register::domain(kingdom))?;

let mad_hatter_keypair = KeyPair::generate();
let mad_hatter_keypair = KeyPair::random();
let mad_hatter = Account::new(
mad_hatter_id.clone(),
mad_hatter_keypair.public_key().clone(),
);
test_client.submit_blocking(Register::account(mad_hatter))?;

// check that "alice@wonderland" as owner of domain can burn and mint public keys for accounts in her domain
let mad_hatter_new_keypair = KeyPair::generate();
let mad_hatter_new_keypair = KeyPair::random();
test_client.submit_blocking(Mint::account_public_key(
mad_hatter_new_keypair.public_key().clone(),
mad_hatter_id.clone(),
Expand Down Expand Up @@ -159,7 +159,7 @@ fn domain_owner_asset_definition_permissions() -> Result<()> {
let kingdom = Domain::new(kingdom_id.clone());
test_client.submit_blocking(Register::domain(kingdom))?;

let bob_keypair = KeyPair::generate();
let bob_keypair = KeyPair::random();
let bob = Account::new(bob_id.clone(), bob_keypair.public_key().clone());
test_client.submit_blocking(Register::account(bob))?;

Expand Down Expand Up @@ -229,7 +229,7 @@ fn domain_owner_asset_permissions() -> Result<()> {
let kingdom = Domain::new(kingdom_id.clone());
test_client.submit_blocking(Register::domain(kingdom))?;

let bob_keypair = KeyPair::generate();
let bob_keypair = KeyPair::random();
let bob = Account::new(bob_id.clone(), bob_keypair.public_key().clone());
test_client.submit_blocking(Register::account(bob))?;

Expand Down Expand Up @@ -294,7 +294,7 @@ fn domain_owner_trigger_permissions() -> Result<()> {
let kingdom = Domain::new(kingdom_id);
test_client.submit_blocking(Register::domain(kingdom))?;

let bob_keypair = KeyPair::generate();
let bob_keypair = KeyPair::random();
let bob = Account::new(bob_id.clone(), bob_keypair.public_key().clone());
test_client.submit_blocking(Register::account(bob))?;

Expand Down Expand Up @@ -355,7 +355,7 @@ fn domain_owner_transfer() -> Result<()> {
let kingdom = Domain::new(kingdom_id.clone());
test_client.submit_blocking(Register::domain(kingdom))?;

let bob_keypair = KeyPair::generate();
let bob_keypair = KeyPair::random();
let bob = Account::new(bob_id.clone(), bob_keypair.public_key().clone());
test_client.submit_blocking(Register::account(bob))?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn long_multiple_blocks_created() -> Result<()> {

let create_domain: InstructionBox = Register::domain(Domain::new("domain".parse()?)).into();
let account_id: AccountId = "account@domain".parse()?;
let (public_key, _) = KeyPair::generate().into();
let (public_key, _) = KeyPair::random().into_parts();
let create_account = Register::account(Account::new(account_id.clone(), public_key)).into();
let asset_definition_id: AssetDefinitionId = "xor#domain".parse()?;
let create_asset =
Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/extra_functional/offline_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn register_offline_peer() -> Result<()> {
check_status(&peer_clients, 1);

let address = socket_addr!(128.0.0.2:8085);
let key_pair = KeyPair::generate();
let key_pair = KeyPair::random();
let public_key = key_pair.public_key().clone();
let peer_id = PeerId::new(address, public_key);
let register_peer = Register::peer(DataModelPeer::new(peer_id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fn init() -> Result<(
.into_set_parameters();
let create_domain = Register::domain(Domain::new("domain".parse()?));
let account_id: AccountId = "account@domain".parse()?;
let (public_key, _) = KeyPair::generate().into();
let (public_key, _) = KeyPair::random().into_parts();
let create_account = Register::account(Account::new(account_id.clone(), public_key));
let asset_definition_id: AssetDefinitionId = "xor#domain".parse()?;
let create_asset =
Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ mod tx_rollback;
mod upgrade;

fn new_account_with_random_public_key(account_id: AccountId) -> NewAccount {
Account::new(account_id, KeyPair::generate().into_raw_parts().0)
Account::new(account_id, KeyPair::random().into_parts().0)
}
2 changes: 1 addition & 1 deletion client/tests/integration/multisignature_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn transaction_signed_by_new_signatory_of_account_should_pass() -> Result<()> {
let asset_definition_id: AssetDefinitionId = "xor#wonderland".parse().expect("Valid");
let create_asset =
Register::asset_definition(AssetDefinition::numeric(asset_definition_id.clone()));
let key_pair = KeyPair::generate();
let key_pair = KeyPair::random();
let add_signatory = Mint::account_public_key(key_pair.public_key().clone(), account_id.clone());

let instructions: [InstructionBox; 2] = [create_asset.into(), add_signatory.into()];
Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/multisignature_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn multisignature_transactions_should_be_accepted_after_fully_signed() -> Result

let alice_id = AccountId::from_str("alice@wonderland")?;
let alice_key_pair = get_key_pair();
let key_pair_2 = KeyPair::generate();
let key_pair_2 = KeyPair::random();
let asset_definition_id = AssetDefinitionId::from_str("camomile#wonderland")?;
let create_asset =
Register::asset_definition(AssetDefinition::numeric(asset_definition_id.clone()));
Expand Down
8 changes: 4 additions & 4 deletions client/tests/integration/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn permissions_disallow_asset_transfer() {
let asset_definition_id: AssetDefinitionId = "xor#wonderland".parse().expect("Valid");
let create_asset =
Register::asset_definition(AssetDefinition::numeric(asset_definition_id.clone()));
let mouse_keypair = KeyPair::generate();
let mouse_keypair = KeyPair::random();

let alice_start_assets = get_assets(&iroha_client, &alice_id);
iroha_client
Expand Down Expand Up @@ -130,7 +130,7 @@ fn permissions_disallow_asset_burn() {
let asset_definition_id = AssetDefinitionId::from_str("xor#wonderland").expect("Valid");
let create_asset =
Register::asset_definition(AssetDefinition::numeric(asset_definition_id.clone()));
let mouse_keypair = KeyPair::generate();
let mouse_keypair = KeyPair::random();

let alice_start_assets = get_assets(&iroha_client, &alice_id);

Expand Down Expand Up @@ -201,7 +201,7 @@ fn permissions_differ_not_only_by_names() {

let alice_id: AccountId = "alice@wonderland".parse().expect("Valid");
let mouse_id: AccountId = "mouse@outfit".parse().expect("Valid");
let mouse_keypair = KeyPair::generate();
let mouse_keypair = KeyPair::random();

// Registering mouse
let outfit_domain: DomainId = "outfit".parse().unwrap();
Expand Down Expand Up @@ -305,7 +305,7 @@ fn stored_vs_granted_token_payload() -> Result<()> {
let create_asset =
Register::asset_definition(AssetDefinition::store(asset_definition_id.clone()));
let mouse_id: AccountId = "mouse@wonderland".parse().expect("Valid");
let mouse_keypair = KeyPair::generate();
let mouse_keypair = KeyPair::random();
let new_mouse_account = Account::new(mouse_id.clone(), mouse_keypair.public_key().clone());
let instructions: [InstructionBox; 2] = [
Register::account(new_mouse_account).into(),
Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/queries/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn find_asset_total_quantity() -> Result<()> {
"white_rabbit@looking_glass".parse()?,
];

let keys = core::iter::repeat_with(KeyPair::generate)
let keys = core::iter::repeat_with(KeyPair::random)
.take(accounts.len() - 1)
.collect::<Vec<_>>();

Expand Down
4 changes: 2 additions & 2 deletions client/tests/integration/roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn register_and_grant_role_for_metadata_access() -> Result<()> {
let mouse_id = AccountId::from_str("mouse@wonderland")?;

// Registering Mouse
let mouse_key_pair = KeyPair::generate();
let mouse_key_pair = KeyPair::random();
let register_mouse = Register::account(Account::new(
mouse_id.clone(),
mouse_key_pair.public_key().clone(),
Expand Down Expand Up @@ -227,7 +227,7 @@ fn grant_revoke_role_permissions() -> Result<()> {
let mouse_id = AccountId::from_str("mouse@wonderland")?;

// Registering Mouse
let mouse_key_pair = KeyPair::generate();
let mouse_key_pair = KeyPair::random();
let register_mouse = Register::account(Account::new(
mouse_id.clone(),
mouse_key_pair.public_key().clone(),
Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/transfer_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,6 @@ fn generate_two_ids() -> (AccountId, AccountId) {
}

fn create_mouse(mouse_id: AccountId) -> Register<Account> {
let (mouse_public_key, _) = KeyPair::generate().into();
let (mouse_public_key, _) = KeyPair::random().into_parts();
Register::account(Account::new(mouse_id, mouse_public_key))
}
4 changes: 2 additions & 2 deletions client/tests/integration/tx_chain_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fn send_tx_with_different_chain_id() {
wait_for_genesis_committed(&[test_client.clone()], 0);
// Given
let sender_account_id = AccountId::from_str("sender@wonderland").unwrap();
let sender_keypair = KeyPair::generate();
let sender_keypair = KeyPair::random();
let receiver_account_id = AccountId::from_str("receiver@wonderland").unwrap();
let receiver_keypair = KeyPair::generate();
let receiver_keypair = KeyPair::random();
let asset_definition_id = AssetDefinitionId::from_str("test_asset#wonderland").unwrap();
let to_transfer = numeric!(1);

Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn executor_upgrade_should_work() -> Result<()> {
client.submit_blocking(register_admin_domain)?;

let admin_id: AccountId = "admin@admin".parse()?;
let admin_keypair = KeyPair::generate();
let admin_keypair = KeyPair::random();
let admin_account = Account::new(admin_id.clone(), admin_keypair.public_key().clone());
let register_admin_account = Register::account(admin_account);
client.submit_blocking(register_admin_account)?;
Expand Down
4 changes: 2 additions & 2 deletions config/src/parameters/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ pub(crate) fn private_key_from_env<E: Error>(

match (algorithm, payload) {
(ParseEnvResult::Value(algorithm), ParseEnvResult::Value(payload)) => {
match PrivateKey::from_hex(algorithm, &payload).wrap_err_with(|| {
match PrivateKey::from_hex(algorithm, payload).wrap_err_with(|| {
eyre!(
"failed to construct `{}` from `{}` and `{}` environment variables",
name_base.as_ref(),
Expand Down Expand Up @@ -643,7 +643,7 @@ mod tests {
.get()
.expect("private key is provided, should not fail");

let (algorithm, payload) = private_key.to_raw();
let (algorithm, payload) = private_key.to_bytes();
assert_eq!(algorithm, "ed25519".parse().unwrap());
assert_eq!(hex::encode(payload), "8f4c15e5d664da3f13778801d23d4e89b76e94c1b94b389544168b6cb894f84f8ba62848cf767d72e7f7f4b9d2d7ba07fee33760f79abe5597a51520e292a0cb");
}
Expand Down
2 changes: 1 addition & 1 deletion core/benches/blocks/apply_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl WsvApplyBlocks {
let accounts_per_domain = 1000;
let assets_per_domain = 1000;
let account_id: AccountId = "alice@wonderland".parse()?;
let key_pair = KeyPair::generate();
let key_pair = KeyPair::random();
let wsv = build_wsv(rt, &account_id, &key_pair);

let nth = 100;
Expand Down
5 changes: 2 additions & 3 deletions core/benches/blocks/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn populate_wsv(
instructions.push(can_unregister_domain.into());
for j in 0..accounts_per_domain {
let account_id = construct_account_id(j, domain_id.clone());
let account = Account::new(account_id.clone(), KeyPair::generate().into_raw_parts().0);
let account = Account::new(account_id.clone(), KeyPair::random().into_parts().0);
instructions.push(Register::account(account).into());
let can_unregister_account = Grant::permission(
PermissionToken::new(
Expand Down Expand Up @@ -147,8 +147,7 @@ pub fn restore_every_nth(
for j in 0..accounts_per_domain {
if j % nth == 0 || i % nth == 0 {
let account_id = construct_account_id(j, domain_id.clone());
let account =
Account::new(account_id.clone(), KeyPair::generate().into_raw_parts().0);
let account = Account::new(account_id.clone(), KeyPair::random().into_parts().0);
instructions.push(Register::account(account).into());
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/benches/blocks/validate_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl WsvValidateBlocks {
let accounts_per_domain = 1000;
let assets_per_domain = 1000;
let account_id: AccountId = "alice@wonderland".parse()?;
let key_pair = KeyPair::generate();
let key_pair = KeyPair::random();
let wsv = build_wsv(rt, &account_id, &key_pair);

let nth = 100;
Expand Down
6 changes: 3 additions & 3 deletions core/benches/kura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async fn measure_block_size_for_n_executors(n_executors: u32) {
let xor_id = AssetDefinitionId::from_str("xor#test").expect("tested");
let alice_xor_id = AssetId::new(xor_id, alice_id);
let transfer = Transfer::asset_numeric(alice_xor_id, 10u32, bob_id);
let keypair = KeyPair::generate();
let keypair = KeyPair::random();
let tx = TransactionBuilder::new(
chain_id.clone(),
AccountId::from_str("alice@wonderland").expect("checked"),
Expand All @@ -53,10 +53,10 @@ async fn measure_block_size_for_n_executors(n_executors: u32) {
let topology = Topology::new(UniqueVec::new());
let mut block = BlockBuilder::new(vec![tx], topology, Vec::new())
.chain(0, &mut wsv)
.sign(&KeyPair::generate());
.sign(&KeyPair::random());

for _ in 1..n_executors {
block = block.sign(&KeyPair::generate());
block = block.sign(&KeyPair::random());
}
let mut block_store = BlockStore::new(dir.path(), LockStatus::Unlocked);
block_store.create_files_if_they_do_not_exist().unwrap();
Expand Down
Loading

0 comments on commit 7014f53

Please sign in to comment.