Skip to content

Commit

Permalink
test: initial state with extra pairs of accounts and assets
Browse files Browse the repository at this point in the history
Signed-off-by: Shunkichi Sato <[email protected]>
  • Loading branch information
s8sato committed Jan 8, 2025
1 parent 27d9f85 commit 17bfacd
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/irohad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ iroha_crypto = { workspace = true }
iroha_torii = { workspace = true }
iroha_genesis = { workspace = true }
iroha_version = { workspace = true }
iroha_test_samples = { workspace = true }

clap = { workspace = true, features = ["derive", "env", "string"] }
eyre = { workspace = true }
Expand Down
17 changes: 13 additions & 4 deletions crates/irohad/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,19 @@ impl Iroha {
None
}
}.unwrap_or_else(|| {
let world = World::with(
[genesis_domain(config.genesis.public_key.clone())],
[genesis_account(config.genesis.public_key.clone())],
[],
let genesis_domain = genesis_domain(config.genesis.public_key.clone());
let genesis_domain_id = genesis_domain.id().clone();
let genesis_account = genesis_account(config.genesis.public_key.clone());
let genesis_account_id = genesis_account.id().clone();
let mandatory_asset: AssetDefinitionId = format!("mandatory#{genesis_domain}").parse().unwrap();
let iter = (0..1 << 20).map(|_| {
iroha_test_samples::gen_account_in(&genesis_domain_id).0
});
let world = World::with_assets(
[genesis_domain],
std::iter::once(genesis_account).chain(iter.clone().map(|id| Account::new(id).build(&genesis_account_id))),
[AssetDefinition::numeric(mandatory_asset.clone()).build(&genesis_account_id)],
std::iter::once(genesis_account_id.clone()).chain(iter).map(|account_id| Asset::new(AssetId::new(mandatory_asset.clone(), account_id), AssetValue::Numeric(Numeric::ONE))),
);

State::new(
Expand Down
67 changes: 67 additions & 0 deletions peer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

## For the full reference, go to (TODO put link)

## You can use another TOML file to extend from.
## For a single file extension:

# extends = "./base.toml"

## Or, for a chain of extensions:

# extends = ["base-1.toml", "base-2.toml"]

chain = "00000000-0000-0000-0000-000000000000"
public_key = "ed0120A98BAFB0663CE08D75EBD506FEC38A84E576A7C9B0897693ED4B04FD9EF2D18D"
private_key = "802620A4DFC16789FBF9A588525E4AC7F791AC51B12AEE8919EACC03EB2FC31D32C692"

trusted_peers = ["ed0120A98BAFB0663CE08D75EBD506FEC38A84E576A7C9B0897693ED4B04FD9EF2D18D@localhost:1337"]

[genesis]
public_key = "ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4"
# file =

[network]
address = "0.0.0.0:1337"
public_address = "localhost:1337"
# block_gossip_period_ms = 10_000
# block_gossip_size = 4
# transaction_gossip_period_ms = 1_000
# transaction_gossip_size = 500
# idle_timeout_ms = 60_000

[torii]
address = "0.0.0.0:8080"
# max_content_len = 16_000_000
# query_idle_time_ms = 30_000
# query_store_capacity = 128
# query_store_capacity_per_user = 128

[kura]
# init_mode = "strict"
# store_dir = "./storage"
# blocks_in_memory = 128

[logger]
# level = "INFO"
# format = "full"

## Transactions Queue
[queue]
# capacity = 65536
# capacity_per_user = 65536
# transaction_time_to_live_ms = 86_400_000 # 1 day

[snapshot]
# mode = "read_write"
# create_every_ms = 60_000
# store_dir = "./storage/snapshot"

# [telemetry]
# name =
# url =
# min_retry_period_ms = 1_000
# max_retry_delay_exponent = 4

[dev_telemetry]
## A path to a file with JSON logs
# out_file = "./dev_telemetry.json"

0 comments on commit 17bfacd

Please sign in to comment.