Bump Substrate (#796)

* Bump Substrate to version used by Polkadot (`5f056830`)

* Use `log` crate for runtime logging

See https://github.com/paritytech/substrate/pull/8128/ for more info.

* Stop using return value from `execute_block`

* Update test weight
This commit is contained in:
Hernando Castano
2021-03-08 11:55:51 -05:00
committed by Bastian Köcher
parent afb48a547e
commit f7c3bd4e08
19 changed files with 91 additions and 77 deletions
+14 -14
View File
@@ -603,7 +603,7 @@ impl<T: Config<I>, I: Instance> BridgeStorage<T, I> {
// start pruning blocks
let begin = new_pruning_range.oldest_unpruned_block;
let end = new_pruning_range.oldest_block_to_keep;
frame_support::debug::trace!(target: "runtime", "Pruning blocks in range [{}..{})", begin, end);
log::trace!(target: "runtime", "Pruning blocks in range [{}..{})", begin, end);
for number in begin..end {
// if we can't prune anything => break
if max_blocks_to_prune == 0 {
@@ -629,7 +629,7 @@ impl<T: Config<I>, I: Instance> BridgeStorage<T, I> {
// we have pruned all headers at number
new_pruning_range.oldest_unpruned_block = number + 1;
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Oldest unpruned PoA header is now: {}",
new_pruning_range.oldest_unpruned_block,
@@ -658,7 +658,7 @@ impl<T: Config<I>, I: Instance> BridgeStorage<T, I> {
// physically remove headers and (probably) obsolete validators sets
while let Some(hash) = blocks_at_number.pop() {
let header = Headers::<T, I>::take(&hash);
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Pruning PoA header: ({}, {})",
number,
@@ -818,7 +818,7 @@ impl<T: Config<I>, I: Instance> Storage for BridgeStorage<T, I> {
}
}
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Inserting PoA header: ({}, {})",
header.header.number,
@@ -846,7 +846,7 @@ impl<T: Config<I>, I: Instance> Storage for BridgeStorage<T, I> {
.map(|f| f.number)
.unwrap_or_else(|| FinalizedBlock::<I>::get().number);
if let Some(finalized) = finalized {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Finalizing PoA header: ({}, {})",
finalized.number,
@@ -869,7 +869,7 @@ pub(crate) fn initialize_storage<T: Config<I>, I: Instance>(
initial_validators: &[Address],
) {
let initial_hash = initial_header.compute_hash();
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Initializing bridge with PoA header: ({}, {})",
initial_header.number,
@@ -917,7 +917,7 @@ pub fn verify_transaction_finalized<S: Storage>(
proof: &[(RawTransaction, RawTransactionReceipt)],
) -> bool {
if tx_index >= proof.len() as _ {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: transaction index ({}) is larger than number of transactions ({})",
tx_index,
@@ -930,7 +930,7 @@ pub fn verify_transaction_finalized<S: Storage>(
let header = match storage.header(&block) {
Some((header, _)) => header,
None => {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: can't find header in the storage: {}",
block,
@@ -943,7 +943,7 @@ pub fn verify_transaction_finalized<S: Storage>(
// if header is not yet finalized => return
if header.number > finalized.number {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: header {}/{} is not finalized. Best finalized: {}",
header.number,
@@ -962,7 +962,7 @@ pub fn verify_transaction_finalized<S: Storage>(
false => block == finalized.hash,
};
if !is_finalized {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: header {} is not finalized: no canonical path to best finalized block {}",
block,
@@ -974,7 +974,7 @@ pub fn verify_transaction_finalized<S: Storage>(
// verify that transaction is included in the block
if let Err(computed_root) = header.check_transactions_root(proof.iter().map(|(tx, _)| tx)) {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: transactions root mismatch. Expected: {}, computed: {}",
header.transactions_root,
@@ -986,7 +986,7 @@ pub fn verify_transaction_finalized<S: Storage>(
// verify that transaction receipt is included in the block
if let Err(computed_root) = header.check_raw_receipts_root(proof.iter().map(|(_, r)| r)) {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: receipts root mismatch. Expected: {}, computed: {}",
header.receipts_root,
@@ -1001,7 +1001,7 @@ pub fn verify_transaction_finalized<S: Storage>(
match is_successful_raw_receipt {
Ok(true) => true,
Ok(false) => {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: receipt shows that transaction has failed",
);
@@ -1009,7 +1009,7 @@ pub fn verify_transaction_finalized<S: Storage>(
false
}
Err(err) => {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: receipt check has failed: {}",
err,
+2 -2
View File
@@ -144,7 +144,7 @@ pub fn accept_aura_header_into_pool<S: Storage, CT: ChainTime>(
// the heaviest, but rare operation - we do not want invalid receipts in the pool
if let Some(receipts) = receipts {
frame_support::debug::trace!(target: "runtime", "Got receipts! {:?}", receipts);
log::trace!(target: "runtime", "Got receipts! {:?}", receipts);
if header.check_receipts_root(receipts).is_err() {
return Err(Error::TransactionsReceiptsMismatch);
}
@@ -166,7 +166,7 @@ pub fn verify_aura_header<S: Storage, CT: ChainTime>(
// the rest of checks requires access to the parent header
let context = storage.import_context(submitter, &header.parent_hash).ok_or_else(|| {
frame_support::debug::warn!(
log::warn!(
target: "runtime",
"Missing parent PoA block: ({:?}, {})",
header.number.checked_sub(1),