-
Notifications
You must be signed in to change notification settings - Fork 276
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
[fix] #2232: Make Iroha print meaningful message when genesis has too many isi #2239
Changes from all commits
36965ee
3335aa0
a451e40
781830c
94c2de4
c206266
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,7 +195,7 @@ impl From<warp::http::Response<warp::hyper::body::Bytes>> for QueryResponseBody | |
if StatusCode::OK == src.status() { | ||
let body = VersionedQueryResult::decode_versioned(src.body()) | ||
.expect("The response body failed to be decoded to VersionedQueryResult even though the status is Ok 200"); | ||
Self::Ok(body) | ||
Self::Ok(Box::new(body)) | ||
} else { | ||
let body = query::Error::decode(&mut src.body().as_ref()) | ||
.expect("The response body failed to be decoded to query::Error even though the status is not Ok 200"); | ||
|
@@ -213,7 +213,7 @@ struct QueryResponseTest { | |
|
||
#[allow(variant_size_differences)] | ||
enum QueryResponseBody { | ||
Ok(VersionedQueryResult), | ||
Ok(Box<VersionedQueryResult>), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After rebase clippy was warning me about very different variant sizes, so I have to Box it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider removing allow. |
||
Err(query::Error), | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#![allow(clippy::restriction)] | ||
|
||
use std::{str::FromStr, thread, time::Duration}; | ||
use std::{str::FromStr, sync::Arc, thread, time::Duration}; | ||
|
||
use eyre::Result; | ||
use iroha_client::client::{self, Client}; | ||
use iroha_core::prelude::*; | ||
use iroha_core::{genesis::GenesisNetwork, prelude::*}; | ||
use iroha_data_model::prelude::*; | ||
use tempfile::TempDir; | ||
use test_network::{Peer as TestPeer, *}; | ||
|
@@ -14,7 +14,7 @@ use super::Configuration; | |
|
||
#[test] | ||
fn restarted_peer_should_have_the_same_asset_amount() -> Result<()> { | ||
let temp_dir = TempDir::new()?; | ||
let temp_dir = Arc::new(TempDir::new()?); | ||
|
||
let mut configuration = Configuration::test(); | ||
let mut peer = <TestPeer>::new()?; | ||
|
@@ -24,7 +24,13 @@ fn restarted_peer_should_have_the_same_asset_amount() -> Result<()> { | |
|
||
// Given | ||
let rt = Runtime::test(); | ||
rt.block_on(peer.start_with_config_permissions_dir(configuration.clone(), AllowAll, &temp_dir)); | ||
rt.block_on(peer.start_with_config_permissions_dir( | ||
configuration.clone(), | ||
GenesisNetwork::test(true), | ||
AllowAll, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refers to this. The permissions need to be specified inside the genesis block, not hard-coded in the init process. |
||
AllowAll, | ||
Arc::clone(&temp_dir), | ||
)); | ||
let mut iroha_client = Client::test(&peer.api_address, &peer.telemetry_address); | ||
wait_for_genesis_committed(&vec![iroha_client.clone()], 0); | ||
|
||
|
@@ -34,7 +40,7 @@ fn restarted_peer_should_have_the_same_asset_amount() -> Result<()> { | |
RegisterBox::new(AssetDefinition::quantity(asset_definition_id.clone()).build()); | ||
iroha_client.submit(create_asset)?; | ||
thread::sleep(pipeline_time * 2); | ||
//When | ||
// When | ||
let quantity: u32 = 200; | ||
let mint_asset = MintBox::new( | ||
Value::U32(quantity), | ||
|
@@ -46,7 +52,7 @@ fn restarted_peer_should_have_the_same_asset_amount() -> Result<()> { | |
iroha_client.submit(mint_asset)?; | ||
thread::sleep(pipeline_time * 2); | ||
|
||
//Then | ||
// Then | ||
let asset = iroha_client | ||
.request(client::asset::by_account_id(account_id.clone()))? | ||
.into_iter() | ||
|
@@ -60,7 +66,13 @@ fn restarted_peer_should_have_the_same_asset_amount() -> Result<()> { | |
thread::sleep(Duration::from_millis(2000)); | ||
|
||
let rt = Runtime::test(); | ||
rt.block_on(peer.start_with_config_permissions_dir(configuration, AllowAll, &temp_dir)); | ||
rt.block_on(peer.start_with_config_permissions_dir( | ||
configuration, | ||
GenesisNetwork::test(true), | ||
AllowAll, | ||
AllowAll, | ||
temp_dir, | ||
)); | ||
|
||
let account_asset = iroha_client | ||
.poll_request(client::asset::by_account_id(account_id), |assets| { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good practice.