Skip to content

Commit

Permalink
Added glossary entries.
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr <a-p-petrosyan@yandex.ru>
  • Loading branch information
appetrosyan committed Nov 24, 2021
1 parent 579db85 commit 52a74a0
Show file tree
Hide file tree
Showing 22 changed files with 347 additions and 436 deletions.
27 changes: 4 additions & 23 deletions Cargo.lock

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

30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ cd target/debug
./iroha_client_cli --help
```

More details about Iroha Client CLI can be found [here](https://github.com/hyperledger/iroha/blob/iroha2-dev/client_cli/README.md).
More details about Iroha Client CLI can be found [here](./client_cli/README.md).

# Integration
## Overall structure
Expand Down Expand Up @@ -120,26 +120,28 @@ Iroha project mainly consists of the following crates:
# Maintenance
## Configuration

A detailed breakdown of all available configuration parameters is available [here](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/config.md). All configuration parameters can be either provided as a `config.json` or using environment variables.
A detailed breakdown of all available configuration parameters is available [here](./docs/source/references/config.md). All configuration parameters can be either provided as a `config.json` or using environment variables.

The tests in the repository verify that the `trusted_peers.json` is compatible with the provided `config.json`, and that the `client/config.json` can be used to operate on the provided `genesis.json` block. It may be useful to generate the configurations by looking at [`core/src/samples.rs`](./core/src/samples.rs) and [`client/src/samples.rs`](./core/src/samples.rs) to see examples that can be serialised into `json` and used for your needs.

## Endpoints

A detailed list of all available endpoints is available [here](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/api_spec.md#endpoints).
A detailed list of all available endpoints is available [here](./docs/source/references/api_spec.md#endpoints).

## Logging

By default Iroha logs in a human readable format to `stdout`. The logging level is set as described [here](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/config.md#loggermax_log_level), and it can be changed at run-time using the `configuration` endpoint.
By default Iroha logs in a human readable format to `stdout`. The logging level is set as described [here](./docs/source/references/config.md#loggermax_log_level), and it can be changed at run-time using the `configuration` endpoint.

For example if your iroha instance is running at `127.0.0.1:8080` to change the log level to `DEBUG` using `curl` one can
```bash
curl -X POST -H 'content-type: application/json' http://127.0.0.1:8080/configuration -d '{"ChangeLogLevel": "DEBUG"}' -i
```

Optional JSON formatted logging can be saved to the [logging file](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/config.md#loggerlog_file_path). [Log rotation](https://www.commandlinux.com/man-page/man5/logrotate.conf.5.html) is the peer administrator's responsibility.
Optional JSON formatted logging can be saved to the [logging file](./docs/source/references/config.md#loggerlog_file_path). [Log rotation](https://www.commandlinux.com/man-page/man5/logrotate.conf.5.html) is the peer administrator's responsibility.

## Monitoring

The details of the `Health` endpoint can be found [here](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/api_spec.md#health).
The details of the `Health` endpoint can be found [here](./docs/source/references/api_spec.md#health).

## Storage

Expand All @@ -155,22 +157,22 @@ The provided `docker-compose` file showcases a minimum viable network and the ge

# Further reading

* [Iroha 2 Whitepaper](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/iroha_2_whitepaper.md)
* [Minting your first asset (tutorial)](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/tutorials/mint-your-first-asset.md)
* [Glossary](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/glossary.md)
* [Configuration](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/config.md)
* [Iroha Special Instructions](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/isi.md)
* [API specification](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/api_spec.md)
* [Iroha 2 Whitepaper](./docs/source/iroha_2_whitepaper.md)
* [Minting your first asset (tutorial)](./docs/source/tutorials/mint-your-first-asset.md)
* [Glossary](./docs/source/references/glossary.md)
* [Configuration](./docs/source/references/config.md)
* [Iroha Special Instructions](./docs/source/references/isi.md)
* [API specification](./docs/source/references/api_spec.md)
* [Iroha Python](https://github.com/hyperledger/iroha-python)

# Contributing

That's great!
Check out [`Contributing guide`](https://github.com/hyperledger/iroha/blob/iroha2-dev/CONTRIBUTING.md)
Check out our [contributing guide](./CONTRIBUTING.md)

# Help

* Join [Telegram chat](https://t.me/hyperledgeriroha) or [Hyperledger RocketChat](https://chat.hyperledger.org/channel/iroha) where the maintainers, contributors and fellow users are ready to help you.
* Join our [Telegram chat](https://t.me/hyperledgeriroha) or [Hyperledger RocketChat](https://chat.hyperledger.org/channel/iroha) where the maintainers, contributors and fellow users are ready to help you.
You can also discuss your concerns and proposals and simply chat about Iroha there or in Gitter [![Join the chat at https://gitter.im/hyperledger-iroha/Lobby](https://badges.gitter.im/hyperledger-iroha/Lobby.svg)](https://gitter.im/hyperledger-iroha/Lobby)
* Submit issues and improvement suggestions via [Hyperledger Jira](https://jira.hyperledger.org/secure/CreateIssue!default.jspa)
* Subscribe to our [mailing list](https://lists.hyperledger.org/g/iroha) to receive the latest and most important news and spread your word within Iroha community
Expand Down
39 changes: 16 additions & 23 deletions client/benches/torii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,28 @@
use std::thread;

use criterion::{criterion_group, criterion_main, Criterion, Throughput};
use iroha_client::{
client::{asset, Client},
config::Configuration as ClientConfiguration,
};
use iroha_client::client::{asset, Client};
use iroha_core::{
config::Configuration,
genesis::{GenesisNetwork, GenesisNetworkTrait},
genesis::{GenesisNetwork, GenesisNetworkTrait, RawGenesisBlock},
prelude::*,
samples::get_config,
};
use iroha_data_model::prelude::*;
use test_network::{Peer as TestPeer, TestRuntime};
use test_network::{get_key_pair, Peer as TestPeer, TestRuntime};
use tokio::runtime::Runtime;

const CONFIGURATION_PATH: &str = "../configs/test_config.json";
const CLIENT_CONFIGURATION_PATH: &str = "../configs/test_client_config.json";
const GENESIS_PATH: &str = "../configs/genesis.json";
const MINIMUM_SUCCESS_REQUEST_RATIO: f32 = 0.9;

fn query_requests(criterion: &mut Criterion) {
let mut configuration =
Configuration::from_path(CONFIGURATION_PATH).expect("Failed to load configuration.");
let mut peer = <TestPeer>::new().expect("Failed to create peer");
let configuration = get_config(
std::iter::once(peer.id.clone()).collect(),
Some(get_key_pair()),
);
let rt = Runtime::test();
configuration.sumeragi.trusted_peers.peers = std::iter::once(peer.id.clone()).collect();
let genesis = GenesisNetwork::from_configuration(
true,
GENESIS_PATH,
RawGenesisBlock::new("alice", "wonderland", &get_key_pair().public_key),
&configuration.genesis,
configuration.sumeragi.max_instruction_number,
)
Expand Down Expand Up @@ -61,8 +56,7 @@ fn query_requests(criterion: &mut Criterion) {
Value::U32(quantity),
IdBox::AssetId(AssetId::new(asset_definition_id, account_id.clone())),
);
let mut client_config = ClientConfiguration::from_path(CLIENT_CONFIGURATION_PATH)
.expect("Failed to load configuration.");
let mut client_config = iroha_client::samples::get_client_config(&get_key_pair());
client_config.torii_api_url = peer.api_address.clone();
let mut iroha_client = Client::new(&client_config);
let _ = iroha_client
Expand Down Expand Up @@ -104,15 +98,15 @@ fn query_requests(criterion: &mut Criterion) {
}

fn instruction_submits(criterion: &mut Criterion) {
let mut configuration =
Configuration::from_path(CONFIGURATION_PATH).expect("Failed to load configuration.");
let rt = Runtime::test();
let mut peer = <TestPeer>::new().expect("Failed to create peer");
configuration.sumeragi.trusted_peers.peers = std::iter::once(peer.id.clone()).collect();

let configuration = get_config(
std::iter::once(peer.id.clone()).collect(),
Some(get_key_pair()),
);
let genesis = GenesisNetwork::from_configuration(
true,
GENESIS_PATH,
RawGenesisBlock::new("alice", "wonderland", &configuration.public_key),
&configuration.genesis,
configuration.sumeragi.max_instruction_number,
)
Expand All @@ -135,8 +129,7 @@ fn instruction_submits(criterion: &mut Criterion) {
.into(),
));
let asset_definition_id = AssetDefinitionId::new("xor", domain_name);
let mut client_config = ClientConfiguration::from_path(CLIENT_CONFIGURATION_PATH)
.expect("Failed to load configuration.");
let mut client_config = iroha_client::samples::get_client_config(&get_key_pair());
client_config.torii_api_url = peer.api_address.clone();
let mut iroha_client = Client::new(&client_config);
let _ = iroha_client
Expand Down
35 changes: 19 additions & 16 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ pub mod client;
pub mod config;
pub use config::Configuration;
mod http_client;

/// Module containing sample configurations for tests and benchmarks.
pub mod samples {
use super::Configuration;
use iroha_core::prelude::KeyPair;
/// Get sample client configuration.
pub fn get_client_config(key_pair: &KeyPair) -> Configuration {
let (public_key, private_key) = key_pair.clone().into();
Configuration {
public_key,
private_key,
account_id: iroha_data_model::prelude::AccountId{
name: "alice".to_string(),
domain_name: "wonderland".to_string(),
},
torii_api_url: iroha_core::torii::config::DEFAULT_TORII_API_URL.to_string(),
..Configuration::default()
}
}
use iroha_core::prelude::KeyPair;

use super::Configuration;
/// Get sample client configuration.
pub fn get_client_config(key_pair: &KeyPair) -> Configuration {
let (public_key, private_key) = key_pair.clone().into();
Configuration {
public_key,
private_key,
account_id: iroha_data_model::prelude::AccountId {
name: "alice".to_owned(),
domain_name: "wonderland".to_owned(),
},
torii_api_url: iroha_core::torii::config::DEFAULT_TORII_API_URL.to_owned(),
..Configuration::default()
}
}
}
14 changes: 0 additions & 14 deletions client/src/samples.rs

This file was deleted.

2 changes: 1 addition & 1 deletion configs/peer/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
"payload": "9ac47abf59b356e0bd7dcbbbb4dec080e302156a48ca907e47cb6aea1d32719e7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
}
}
}
}
2 changes: 1 addition & 1 deletion configs/peer/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion configs/peer/trusted_peers.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"address": "127.0.0.1:1340",
"public_key": "ed01208e351a70b6a603ed285d666b8d689b680865913ba03ce29fb7d13a166c4e7f1f"
}
]
]
5 changes: 3 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ pin-project = "1"


[dev-dependencies]
hex-literal = "0.2.1"
test_network = { version = "=0.1.0", path = "./test_network" }

hex-literal = "0.3.4"
tempfile = "3"
criterion = "0.3"
hex = "0.4.0"
unique_port = "0.1.0"
byte-unit = "4.0.12"
once_cell = "1"
test_network = { version = "=0.1.0", path = "./test_network" }

[[bench]]
name = "sumeragi"
Expand Down
20 changes: 10 additions & 10 deletions core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
block_sync::config::BlockSyncConfiguration,
genesis::config::GenesisConfiguration,
kura::config::KuraConfiguration,
queue::config::QueueConfiguration,
queue::Configuration as QueueConfiguration,
sumeragi::config::{SumeragiConfiguration, TrustedPeers},
torii::config::ToriiConfiguration,
wsv::config::Configuration as WorldStateViewConfiguration,
Expand Down Expand Up @@ -139,8 +139,8 @@ mod tests {

use super::*;

const CONFIGURATION_PATH: &str = "../configs/test_config.json";
const TRUSTED_PEERS_PATH: &str = "../configs/test_trusted_peers.json";
const CONFIGURATION_PATH: &str = "../configs/peer/config.json";
const TRUSTED_PEERS_PATH: &str = "../configs/peer/trusted_peers.json";

#[test]
fn parse_example_json() -> Result<()> {
Expand Down Expand Up @@ -173,39 +173,39 @@ mod tests {
let public_key2 = PublicKey {
digest_function: iroha_crypto::ED_25519.to_string(),
payload: hex::decode(
"7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c1",
"CC25624D62896D3A0BFD8940F928DC2ABF27CC57CEFEB442AA96D9081AAE58A1",
)
.expect("Failed to decode"),
};
let public_key3 = PublicKey {
digest_function: iroha_crypto::ED_25519.to_string(),
payload: hex::decode(
"7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c2",
"FACA9E8AA83225CB4D16D67F27DD4F93FC30FFA11ADC1F5C88FD5495ECC91020",
)
.expect("Failed to decode"),
};
let public_key4 = PublicKey {
digest_function: iroha_crypto::ED_25519.to_string(),
payload: hex::decode(
"7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c3",
"8E351A70B6A603ED285D666B8D689B680865913BA03CE29FB7D13A166C4E7F1F",
)
.expect("Failed to decode"),
};
let expected_trusted_peers = vec![
PeerId {
address: "127.0.0.1:1337".to_string(),
address: "127.0.0.1:1337".to_owned(),
public_key: public_key1,
},
PeerId {
address: "localhost:1338".to_string(),
address: "127.0.0.1:1338".to_owned(),
public_key: public_key2,
},
PeerId {
address: "195.162.0.1:23".to_string(),
address: "127.0.0.1:1339".to_owned(),
public_key: public_key3,
},
PeerId {
address: "195.162.0.1:24".to_string(),
address: "127.0.0.1:1340".to_owned(),
public_key: public_key4,
},
]
Expand Down
Loading

0 comments on commit 52a74a0

Please sign in to comment.