Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor]: remove signatures from blocks #4384

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions client/src/client.rs
Expand Up @@ -28,7 +28,7 @@ use crate::{
config::Config,
crypto::{HashOf, KeyPair},
data_model::{
block::SignedBlock,
block::Block,
isi::Instruction,
prelude::*,
query::{predicate::PredicateBox, Pagination, Query, Sorting},
Expand Down Expand Up @@ -950,7 +950,7 @@ impl Client {
pub fn listen_for_blocks(
&self,
height: NonZeroU64,
) -> Result<impl Iterator<Item = Result<SignedBlock>>> {
) -> Result<impl Iterator<Item = Result<Block>>> {
blocks_api::BlockIterator::new(self.blocks_handler(height)?)
}

Expand Down Expand Up @@ -1363,7 +1363,7 @@ mod blocks_api {
pub struct Events;

impl FlowEvents for Events {
type Event = crate::data_model::block::SignedBlock;
type Event = crate::data_model::block::Block;

fn message(&self, message: Vec<u8>) -> Result<Self::Event> {
Ok(BlockMessage::decode_all(&mut message.as_slice()).map(Into::into)?)
Expand Down Expand Up @@ -1444,7 +1444,7 @@ pub mod block {
}

/// Construct a query to find block header by hash
pub fn header_by_hash(hash: HashOf<SignedBlock>) -> FindBlockHeaderByHash {
pub fn header_by_hash(hash: HashOf<Block>) -> FindBlockHeaderByHash {
FindBlockHeaderByHash::new(hash)
}
}
Expand Down
12 changes: 11 additions & 1 deletion client/tests/integration/triggers/time_trigger.rs
Expand Up @@ -5,7 +5,7 @@ use iroha_client::{
client::{self, Client, QueryResult},
data_model::{prelude::*, transaction::WasmSmartContract},
};
use iroha_config::parameters::defaults::chain_wide::DEFAULT_CONSENSUS_ESTIMATION;
use iroha_config::parameters::defaults::chain_wide::{DEFAULT_BLOCK_TIME, DEFAULT_COMMIT_TIME};
use iroha_logger::info;
use test_network::*;

Expand All @@ -19,6 +19,16 @@ macro_rules! const_assert {
};
}

/// Default estimation of consensus duration.
const DEFAULT_CONSENSUS_ESTIMATION: Duration =
match DEFAULT_BLOCK_TIME.checked_add(match DEFAULT_COMMIT_TIME.checked_div(2) {
Some(x) => x,
None => unreachable!(),
}) {
Some(x) => x,
None => unreachable!(),
};

/// Time-based triggers and block commitment process depend heavily on **current time** and **CPU**,
/// so it's impossible to create fully reproducible test scenario.
///
Expand Down
10 changes: 0 additions & 10 deletions config/src/parameters/defaults.rs
Expand Up @@ -61,16 +61,6 @@ pub mod chain_wide {
// TODO: wrap into a `Bytes` newtype
pub const DEFAULT_WASM_MAX_MEMORY_BYTES: u32 = 500 * 2_u32.pow(20);

/// Default estimation of consensus duration.
pub const DEFAULT_CONSENSUS_ESTIMATION: Duration =
match DEFAULT_BLOCK_TIME.checked_add(match DEFAULT_COMMIT_TIME.checked_div(2) {
Some(x) => x,
None => unreachable!(),
}) {
Some(x) => x,
None => unreachable!(),
};

/// Default limits for metadata
pub const DEFAULT_METADATA_LIMITS: MetadataLimits =
MetadataLimits::new(2_u32.pow(20), 2_u32.pow(12));
Expand Down