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

Use finalized_hash instead of best_hash in pull_ledger_diff #906

Merged
merged 2 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ pub fn run_with(cli: Cli) -> Result {
&polkadot_cli,
config.tokio_handle.clone(),
)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
.map_err(|err| format!("Relay chain argument error: {err}"))?;

cmd.run(config, polkadot_config)
})
Expand Down Expand Up @@ -397,7 +397,7 @@ pub fn run_with(cli: Cli) -> Result {
.map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;
.map_err(|e| format!("Error: {e:?}"))?;

if runner.config().chain_spec.is_manta() {
runner.async_run(|config| {
Expand Down Expand Up @@ -453,13 +453,13 @@ pub fn run_with(cli: Cli) -> Result {

let block: crate::service::Block =
generate_genesis_block(&*config.chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
.map_err(|e| format!("{e:?}"))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));

let tokio_handle = config.tokio_handle.clone();
let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
.map_err(|err| format!("Relay chain argument error: {err}"))?;

info!("Parachain id: {:?}", id);
info!("Parachain Account: {}", parachain_account);
Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ pub mod pallet {
})
.unwrap_or_else(|why| {
log::warn!("Failed to remove candidate due to underperformance {:?}", why);
debug_assert!(false, "failed to remove candidate {:?}", why);
debug_assert!(false, "failed to remove candidate {why:?}");
});
}
}
Expand Down
5 changes: 2 additions & 3 deletions pallets/manta-pay/src/bin/precompute_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ fn main() -> Result<()> {
.unwrap_or(env::current_dir()?.join("precomputed_coins.rs"));
assert!(
!target_file.exists(),
"Specify a file to place the generated files: {:?}.",
target_file,
"Specify a file to place the generated files: {target_file:?}.",
);
fs::create_dir_all(
target_file
Expand All @@ -177,7 +176,7 @@ fn main() -> Result<()> {
)?;

let directory = tempfile::tempdir().expect("Unable to generate temporary test directory.");
println!("[INFO] Temporary Directory: {:?}", directory);
println!("[INFO] Temporary Directory: {directory:?}");

let mut rng = ChaCha20Rng::from_seed([0; 32]);
let (proving_context, _, parameters, utxo_accumulator_model) =
Expand Down
4 changes: 2 additions & 2 deletions pallets/manta-pay/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ where
max_senders: u64,
) -> RpcResult<PullResponse> {
let api = self.client.runtime_api();
let at = BlockId::hash(self.client.info().best_hash);
let at = BlockId::hash(self.client.info().finalized_hash);
ghzlatarev marked this conversation as resolved.
Show resolved Hide resolved
api.pull_ledger_diff(&at, checkpoint.into(), max_receivers, max_senders)
.map_err(|err| {
CallError::Custom(ErrorObject::owned(
PULL_LEDGER_DIFF_ERROR,
"Unable to compute state diff for pull",
Some(format!("{:?}", err)),
Some(format!("{err:?}")),
))
.into()
})
Expand Down
2 changes: 1 addition & 1 deletion pallets/manta-pay/src/test/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ where
let mut utxo_accumulator = UtxoAccumulator::new(UTXO_ACCUMULATOR_MODEL.clone());
let mut asset_id = 8u128;
for i in 0..total {
println!("Current: {:?}", i);
println!("Current: {i:?}");
let mint0 = PalletTransferPost::from(test::payment::to_private::prove_full(
&PROVING_CONTEXT.to_private,
&PARAMETERS,
Expand Down
2 changes: 1 addition & 1 deletion primitives/session-keys/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn unchecked_public_key<T>(seed: &str) -> PublicKey<T>
where
T: CryptoType,
{
T::Pair::from_string(&format!("//{}", seed), None)
T::Pair::from_string(&format!("//{seed}"), None)
.expect("The validity of the seed is unchecked.")
.public()
}
Expand Down
14 changes: 6 additions & 8 deletions runtime/calamari/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ mod multiplier_tests {
// Configure the target cost depending on the current state of the network.
let target_daily_congestion_cost_usd = 250000;
let kma_price = fetch_kma_price().unwrap();
println!("KMA/USD price as read from CoinGecko = {}", kma_price);
println!("KMA/USD price as read from CoinGecko = {kma_price}");
let target_daily_congestion_cost_kma =
(target_daily_congestion_cost_usd as f32 * kma_price * KMA as f32) as u128;

Expand Down Expand Up @@ -181,8 +181,8 @@ mod multiplier_tests {
let next = runtime_multiplier_update(fee_adjustment);
// if no change or less, panic. This should never happen in this case.
if fee_adjustment >= next {
println!("final fee_adjustment: {}", fee_adjustment);
println!("final next: {}", next);
println!("final fee_adjustment: {fee_adjustment}");
println!("final next: {next}");
panic!("The fee should ever increase");
}
fee_adjustment = next;
Expand Down Expand Up @@ -225,9 +225,7 @@ mod multiplier_tests {
let next = SlowAdjustingFeeUpdate::<Runtime>::convert(minimum_multiplier);
assert!(
next > minimum_multiplier,
"{:?} !>= {:?}",
next,
minimum_multiplier
"{next:?} !>= {minimum_multiplier:?}",
);
})
}
Expand All @@ -249,11 +247,11 @@ mod multiplier_tests {
run_with_system_weight(block_weight, || {
let next = SlowAdjustingFeeUpdate::<Runtime>::convert(multiplier);
// ensure that it is growing as well.
assert!(next > multiplier, "{:?} !>= {:?}", next, multiplier);
assert!(next > multiplier, "{next:?} !>= {multiplier:?}");
multiplier = next;
});
blocks += 1;
println!("block = {} multiplier {:?}", blocks, multiplier);
println!("block = {blocks} multiplier {multiplier:?}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ fn reward_fees_to_block_author_and_treasury() {
);

let author_received_reward = Balances::free_balance(alice) - INITIAL_BALANCE;
println!("The rewarded_amount is: {:?}", author_received_reward);
println!("The rewarded_amount is: {author_received_reward:?}");

// Fees split: 40% burned, 40% to treasury, 10% to author.
let author_percent = Percent::from_percent(FEES_PERCENTAGE_TO_AUTHOR);
Expand Down