Skip to content

Commit

Permalink
refactor!: don't send public key with signature
Browse files Browse the repository at this point in the history
Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
  • Loading branch information
mversic committed May 8, 2024
1 parent 85cfd97 commit fb852e9
Show file tree
Hide file tree
Showing 50 changed files with 1,274 additions and 1,629 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl Iroha {
&config.block_sync,
sumeragi.clone(),
Arc::clone(&kura),
config.common.peer_id(),
config.common.peer_id.clone(),
network.clone(),
Arc::clone(&state),
)
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 @@ -4,11 +4,11 @@ use eyre::{Result, WrapErr};
use iroha_client::{
client::Client,
data_model::{
events::pipeline::{BlockEventFilter, BlockStatus},
parameter::{default::MAX_TRANSACTIONS_IN_BLOCK, ParametersBuilder},
prelude::*,
},
};
use iroha_data_model::events::pipeline::{BlockEventFilter, BlockStatus};
use nonzero_ext::nonzero;
use serde::Deserialize;
use test_network::*;
Expand Down
7 changes: 4 additions & 3 deletions client/examples/million_accounts_genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
use std::{thread, time::Duration};

use iroha::samples::{construct_executor, get_config};
use iroha_client::data_model::prelude::*;
use iroha_crypto::KeyPair;
use iroha_data_model::isi::InstructionBox;
use iroha_client::{
crypto::KeyPair,
data_model::{isi::InstructionBox, prelude::*},
};
use iroha_genesis::{GenesisNetwork, RawGenesisBlock, RawGenesisBlockBuilder};
use iroha_primitives::unique_vec;
use test_network::{
Expand Down
6 changes: 4 additions & 2 deletions client/examples/register_1000_triggers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
use std::str::FromStr;

use iroha::samples::{construct_executor, get_config};
use iroha_client::{client::Client, data_model::prelude::*};
use iroha_data_model::trigger::TriggerId;
use iroha_client::{
client::Client,
data_model::{prelude::*, trigger::TriggerId},
};
use iroha_genesis::{GenesisNetwork, RawGenesisBlock, RawGenesisBlockBuilder};
use iroha_primitives::unique_vec;
use test_network::{
Expand Down
19 changes: 8 additions & 11 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ use eyre::{eyre, Result, WrapErr};
use futures_util::StreamExt;
use http_default::{AsyncWebSocketStream, WebSocketStream};
pub use iroha_config::client_api::ConfigDTO;
use iroha_data_model::{
events::pipeline::{
BlockEventFilter, BlockStatus, PipelineEventBox, PipelineEventFilterBox,
TransactionEventFilter, TransactionStatus,
},
query::QueryOutputBox,
};
use iroha_logger::prelude::*;
use iroha_telemetry::metrics::Status;
use iroha_torii_const::uri as torii_uri;
Expand All @@ -35,9 +28,13 @@ use crate::{
crypto::{HashOf, KeyPair},
data_model::{
block::SignedBlock,
events::pipeline::{
BlockEventFilter, BlockStatus, PipelineEventBox, PipelineEventFilterBox,
TransactionEventFilter, TransactionStatus,
},
isi::Instruction,
prelude::*,
query::{predicate::PredicateBox, Pagination, Query, Sorting},
query::{predicate::PredicateBox, Pagination, Query, QueryOutputBox, Sorting},
BatchedResponse, ChainId, ValidationFail,
},
http::{Method as HttpMethod, RequestBuilder, Response, StatusCode},
Expand Down Expand Up @@ -70,17 +67,17 @@ pub type QueryResult<T> = core::result::Result<T, ClientQueryError>;
/// Trait for signing transactions
pub trait Sign {
/// Sign transaction with provided key pair.
fn sign(self, key_pair: &crate::crypto::KeyPair) -> SignedTransaction;
fn sign(self, key_pair: &KeyPair) -> SignedTransaction;
}

impl Sign for TransactionBuilder {
fn sign(self, key_pair: &crate::crypto::KeyPair) -> SignedTransaction {
fn sign(self, key_pair: &KeyPair) -> SignedTransaction {
self.sign(key_pair)
}
}

impl Sign for SignedTransaction {
fn sign(self, key_pair: &crate::crypto::KeyPair) -> SignedTransaction {
fn sign(self, key_pair: &KeyPair) -> SignedTransaction {
self.sign(key_pair)
}
}
Expand Down
8 changes: 5 additions & 3 deletions client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ use iroha_config::{
base,
base::{FromEnv, StdEnv, UnwrapPartial},
};
use iroha_crypto::KeyPair;
use iroha_data_model::{prelude::*, ChainId};
use iroha_primitives::small::SmallStr;
use serde::{Deserialize, Serialize};
use serde_with::{DeserializeFromStr, SerializeDisplay};
use url::Url;

use crate::config::user::RootPartial;
use crate::{
config::user::RootPartial,
crypto::KeyPair,
data_model::{prelude::*, ChainId},
};

mod user;

Expand Down
8 changes: 5 additions & 3 deletions client/src/config/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ use std::{fs::File, io::Read, path::Path, str::FromStr, time::Duration};
pub use boilerplate::*;
use eyre::{eyre, Context, Report};
use iroha_config::base::{Emitter, ErrorsCollection};
use iroha_crypto::{KeyPair, PrivateKey, PublicKey};
use iroha_data_model::{account::AccountId, ChainId};
use merge::Merge;
use serde_with::DeserializeFromStr;
use url::Url;

use crate::config::BasicAuth;
use crate::{
config::BasicAuth,
crypto::{KeyPair, PrivateKey, PublicKey},
data_model::{account::AccountId, ChainId},
};

impl RootPartial {
/// Reads the partial layer from TOML
Expand Down
16 changes: 9 additions & 7 deletions client/src/config/user/boilerplate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ use iroha_config::base::{
Emitter, FromEnv, HumanDuration, Merge, ParseEnvResult, UnwrapPartial, UnwrapPartialResult,
UserField,
};
use iroha_crypto::{PrivateKey, PublicKey};
use iroha_data_model::{account::AccountId, ChainId};
use serde::Deserialize;

use crate::config::{
base::{FromEnvResult, ReadEnv},
user::{Account, OnlyHttpUrl, Root, Transaction},
BasicAuth, DEFAULT_TRANSACTION_NONCE, DEFAULT_TRANSACTION_STATUS_TIMEOUT,
DEFAULT_TRANSACTION_TIME_TO_LIVE,
use crate::{
config::{
base::{FromEnvResult, ReadEnv},
user::{Account, OnlyHttpUrl, Root, Transaction},
BasicAuth, DEFAULT_TRANSACTION_NONCE, DEFAULT_TRANSACTION_STATUS_TIMEOUT,
DEFAULT_TRANSACTION_TIME_TO_LIVE,
},
crypto::{PrivateKey, PublicKey},
data_model::{account::AccountId, ChainId},
};

#[derive(Debug, Clone, Deserialize, Eq, PartialEq, Default, Merge)]
Expand Down
6 changes: 3 additions & 3 deletions client/src/query_builder.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::fmt::Debug;

use iroha_data_model::query::QueryOutputBox;

use crate::{
client::{Client, QueryOutput, QueryResult},
data_model::query::{predicate::PredicateBox, sorting::Sorting, FetchSize, Pagination, Query},
data_model::query::{
predicate::PredicateBox, sorting::Sorting, FetchSize, Pagination, Query, QueryOutputBox,
},
};

pub struct QueryRequestBuilder<'a, R> {
Expand Down
12 changes: 6 additions & 6 deletions client/tests/integration/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use eyre::Result;
use iroha_client::{
client::{self, QueryResult},
crypto::{KeyPair, PublicKey},
data_model::prelude::*,
data_model::{
asset::{AssetId, AssetValue, AssetValueType},
isi::error::{InstructionEvaluationError, InstructionExecutionError, Mismatch, TypeError},
prelude::*,
transaction::error::TransactionRejectionReason,
},
};
use iroha_config::parameters::actual::Root as Config;
use iroha_data_model::{
asset::{AssetId, AssetValue, AssetValueType},
isi::error::{InstructionEvaluationError, InstructionExecutionError, Mismatch, TypeError},
transaction::error::TransactionRejectionReason,
};
use serde_json::json;
use test_network::*;

Expand Down
3 changes: 1 addition & 2 deletions client/tests/integration/burn_public_keys.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use iroha_client::{
client::{account, transaction, Client},
crypto::{HashOf, KeyPair, PublicKey},
data_model::{isi::Instruction, prelude::*},
data_model::{isi::Instruction, prelude::*, query::TransactionQueryOutput},
};
use iroha_data_model::query::TransactionQueryOutput;
use test_network::*;

fn submit(
Expand Down
6 changes: 4 additions & 2 deletions client/tests/integration/domain_owner_permissions.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use eyre::Result;
use iroha_client::{
crypto::KeyPair,
data_model::{account::SignatureCheckCondition, prelude::*},
data_model::{
account::SignatureCheckCondition, prelude::*,
transaction::error::TransactionRejectionReason,
},
};
use iroha_data_model::transaction::error::TransactionRejectionReason;
use serde_json::json;
use test_network::*;

Expand Down
14 changes: 6 additions & 8 deletions client/tests/integration/events/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ use eyre::Result;
use iroha_client::{
crypto::HashOf,
data_model::{
events::pipeline::{
BlockEvent, BlockEventFilter, BlockStatus, TransactionEventFilter, TransactionStatus,
},
isi::error::InstructionExecutionError,
parameter::{default::MAX_TRANSACTIONS_IN_BLOCK, ParametersBuilder},
prelude::*,
transaction::error::TransactionRejectionReason,
ValidationFail,
},
};
use iroha_config::parameters::actual::Root as Config;
use iroha_data_model::{
events::pipeline::{
BlockEvent, BlockEventFilter, BlockStatus, TransactionEventFilter, TransactionStatus,
},
isi::error::InstructionExecutionError,
transaction::error::TransactionRejectionReason,
ValidationFail,
};
use test_network::*;

// Needed to re-enable ignored tests.
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
@@ -1,13 +1,13 @@
use eyre::Result;
use iroha_client::{
client::{self, Client, QueryResult},
crypto::KeyPair,
data_model::{
peer::{Peer as DataModelPeer, PeerId},
prelude::*,
},
};
use iroha_config::parameters::actual::Root as Config;
use iroha_crypto::KeyPair;
use iroha_primitives::addr::socket_addr;
use test_network::*;
use tokio::runtime::Runtime;
Expand Down
6 changes: 4 additions & 2 deletions client/tests/integration/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use iroha_crypto::KeyPair;
use iroha_data_model::account::{Account, AccountId, NewAccount};
use iroha_client::{
crypto::KeyPair,
data_model::account::{Account, AccountId, NewAccount},
};

mod add_account;
mod add_domain;
Expand Down
3 changes: 1 addition & 2 deletions client/tests/integration/non_mintable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use std::str::FromStr as _;
use eyre::Result;
use iroha_client::{
client::{self, QueryResult},
data_model::{metadata::UnlimitedMetadata, prelude::*},
data_model::{isi::InstructionBox, metadata::UnlimitedMetadata, prelude::*},
};
use iroha_data_model::isi::InstructionBox;
use test_network::*;

#[test]
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 @@ -4,10 +4,10 @@ use eyre::Result;
use iroha_client::{
client::{self, Client, QueryResult},
crypto::KeyPair,
data_model::prelude::*,
};
use iroha_data_model::{
permission::PermissionToken, role::RoleId, transaction::error::TransactionRejectionReason,
data_model::{
permission::PermissionToken, prelude::*, role::RoleId,
transaction::error::TransactionRejectionReason,
},
};
use iroha_genesis::GenesisNetwork;
use serde_json::json;
Expand Down
3 changes: 1 addition & 2 deletions client/tests/integration/roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use eyre::Result;
use iroha_client::{
client::{self, QueryResult},
crypto::KeyPair,
data_model::prelude::*,
data_model::{prelude::*, transaction::error::TransactionRejectionReason},
};
use iroha_data_model::transaction::error::TransactionRejectionReason;
use serde_json::json;
use test_network::*;

Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration/sorting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use iroha_client::{
client::{self, QueryResult},
data_model::{
account::Account,
isi::InstructionBox,
prelude::*,
query::{
predicate::{string, value, PredicateBox},
Pagination, Sorting,
},
},
};
use iroha_data_model::isi::InstructionBox;
use nonzero_ext::nonzero;
use test_network::*;

Expand Down
15 changes: 8 additions & 7 deletions client/tests/integration/transfer_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ use std::str::FromStr;
use iroha_client::{
client::{self, QueryResult},
crypto::KeyPair,
data_model::{isi::Instruction, prelude::*, Registered},
};
use iroha_data_model::{
account::{Account, AccountId},
asset::{Asset, AssetDefinition},
isi::InstructionBox,
name::Name,
data_model::{
account::{Account, AccountId},
asset::{Asset, AssetDefinition},
isi::{Instruction, InstructionBox},
name::Name,
prelude::*,
Registered,
},
};
use test_network::*;

Expand Down
6 changes: 4 additions & 2 deletions client/tests/integration/triggers/data_trigger.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use eyre::Result;
use iroha_client::{client, data_model::prelude::*};
use iroha_data_model::asset::AssetValue;
use iroha_client::{
client,
data_model::{asset::AssetValue, prelude::*},
};
use test_network::*;

use crate::integration::new_account_with_random_public_key;
Expand Down
7 changes: 5 additions & 2 deletions client/tests/integration/triggers/time_trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ use std::{str::FromStr as _, time::Duration};
use eyre::Result;
use iroha_client::{
client::{self, Client, QueryResult},
data_model::{prelude::*, transaction::WasmSmartContract},
data_model::{
events::pipeline::{BlockEventFilter, BlockStatus},
prelude::*,
transaction::WasmSmartContract,
},
};
use iroha_config::parameters::defaults::chain_wide::DEFAULT_CONSENSUS_ESTIMATION;
use iroha_data_model::events::pipeline::{BlockEventFilter, BlockStatus};
use iroha_logger::info;
use test_network::*;

Expand Down
3 changes: 1 addition & 2 deletions client/tests/integration/tx_chain_id.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::str::FromStr;

use iroha_crypto::KeyPair;
use iroha_data_model::prelude::*;
use iroha_client::{crypto::KeyPair, data_model::prelude::*};
use iroha_primitives::numeric::numeric;
use test_network::*;

Expand Down
Loading

0 comments on commit fb852e9

Please sign in to comment.