mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
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:
committed by
Bastian Köcher
parent
afb48a547e
commit
f7c3bd4e08
@@ -424,7 +424,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn execute_block(block: Block) {
|
||||
Executive::execute_block(block)
|
||||
Executive::execute_block(block);
|
||||
}
|
||||
|
||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
||||
|
||||
@@ -11,6 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
hex-literal = "0.3"
|
||||
libsecp256k1 = { version = "0.3.4", optional = true, default-features = false, features = ["hmac"] }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
serde = { version = "1.0.124", optional = true, features = ["derive"] }
|
||||
|
||||
# Bridge dependencies
|
||||
@@ -86,6 +87,7 @@ std = [
|
||||
"frame-support/std",
|
||||
"frame-system-rpc-runtime-api/std",
|
||||
"frame-system/std",
|
||||
"log/std",
|
||||
"pallet-aura/std",
|
||||
"pallet-balances/std",
|
||||
"pallet-bridge-eth-poa/std",
|
||||
|
||||
@@ -81,7 +81,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
|
||||
|
||||
// we only accept transactions sending funds directly to the pre-configured address
|
||||
if tx.unsigned.to != Some(LOCK_FUNDS_ADDRESS.into()) {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
target: "runtime",
|
||||
"Failed to parse fund locks transaction. Invalid peer recipient: {:?}",
|
||||
tx.unsigned.to,
|
||||
@@ -94,7 +94,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
|
||||
match tx.unsigned.payload.len() {
|
||||
32 => recipient_raw.as_fixed_bytes_mut().copy_from_slice(&tx.unsigned.payload),
|
||||
len => {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
target: "runtime",
|
||||
"Failed to parse fund locks transaction. Invalid recipient length: {}",
|
||||
len,
|
||||
@@ -106,7 +106,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
|
||||
let amount = tx.unsigned.value.low_u128();
|
||||
|
||||
if tx.unsigned.value != amount.into() {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
target: "runtime",
|
||||
"Failed to parse fund locks transaction. Invalid amount: {}",
|
||||
tx.unsigned.value,
|
||||
|
||||
@@ -290,7 +290,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
|
||||
// - deposited != 0: (should never happen in practice) deposit has been partially completed
|
||||
match deposited_amount {
|
||||
_ if deposited_amount == amount => {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
target: "runtime",
|
||||
"Deposited {} to {:?}",
|
||||
amount,
|
||||
@@ -300,7 +300,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
|
||||
Ok(())
|
||||
}
|
||||
_ if deposited_amount == 0 => {
|
||||
frame_support::debug::error!(
|
||||
log::error!(
|
||||
target: "runtime",
|
||||
"Deposit of {} to {:?} has failed",
|
||||
amount,
|
||||
@@ -310,7 +310,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
|
||||
Err(bp_currency_exchange::Error::DepositFailed)
|
||||
}
|
||||
_ => {
|
||||
frame_support::debug::error!(
|
||||
log::error!(
|
||||
target: "runtime",
|
||||
"Deposit of {} to {:?} has partially competed. {} has been deposited",
|
||||
amount,
|
||||
@@ -535,7 +535,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
|
||||
fn execute_block(block: Block) {
|
||||
Executive::execute_block(block)
|
||||
Executive::execute_block(block);
|
||||
}
|
||||
|
||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
||||
|
||||
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
|
||||
# Bridge dependencies
|
||||
|
||||
@@ -33,6 +34,7 @@ std = [
|
||||
"bp-runtime/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"log/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
|
||||
@@ -202,7 +202,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
let message = match message {
|
||||
Ok(message) => message,
|
||||
Err(_) => {
|
||||
frame_support::debug::trace!("Message {:?}/{:?}: rejected before actual dispatch", bridge, id);
|
||||
log::trace!("Message {:?}/{:?}: rejected before actual dispatch", bridge, id);
|
||||
Self::deposit_event(RawEvent::MessageRejected(bridge, id));
|
||||
return;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
// (we want it to be the same, because otherwise we may decode Call improperly)
|
||||
let expected_version = <T as frame_system::Config>::Version::get().spec_version;
|
||||
if message.spec_version != expected_version {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message {:?}/{:?}: spec_version mismatch. Expected {:?}, got {:?}",
|
||||
bridge,
|
||||
id,
|
||||
@@ -232,7 +232,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
let call = match message.call.into() {
|
||||
Ok(call) => call,
|
||||
Err(_) => {
|
||||
frame_support::debug::trace!("Failed to decode Call from message {:?}/{:?}", bridge, id,);
|
||||
log::trace!("Failed to decode Call from message {:?}/{:?}", bridge, id,);
|
||||
Self::deposit_event(RawEvent::MessageCallDecodeFailed(bridge, id));
|
||||
return;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
CallOrigin::SourceRoot => {
|
||||
let hex_id = derive_account_id::<T::SourceChainAccountId>(bridge, SourceAccount::Root);
|
||||
let target_id = T::AccountIdConverter::convert(hex_id);
|
||||
frame_support::debug::trace!("Root Account: {:?}", &target_id);
|
||||
log::trace!("Root Account: {:?}", &target_id);
|
||||
target_id
|
||||
}
|
||||
CallOrigin::TargetAccount(source_account_id, target_public, target_signature) => {
|
||||
@@ -251,7 +251,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
|
||||
let target_account = target_public.into_account();
|
||||
if !target_signature.verify(&digest[..], &target_account) {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message {:?}/{:?}: origin proof is invalid. Expected account: {:?} from signature: {:?}",
|
||||
bridge,
|
||||
id,
|
||||
@@ -262,20 +262,20 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
return;
|
||||
}
|
||||
|
||||
frame_support::debug::trace!("Target Account: {:?}", &target_account);
|
||||
log::trace!("Target Account: {:?}", &target_account);
|
||||
target_account
|
||||
}
|
||||
CallOrigin::SourceAccount(source_account_id) => {
|
||||
let hex_id = derive_account_id(bridge, SourceAccount::Account(source_account_id));
|
||||
let target_id = T::AccountIdConverter::convert(hex_id);
|
||||
frame_support::debug::trace!("Source Account: {:?}", &target_id);
|
||||
log::trace!("Source Account: {:?}", &target_id);
|
||||
target_id
|
||||
}
|
||||
};
|
||||
|
||||
// filter the call
|
||||
if !T::CallFilter::filter(&call) {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
|
||||
bridge,
|
||||
id,
|
||||
@@ -291,7 +291,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
let dispatch_info = call.get_dispatch_info();
|
||||
let expected_weight = dispatch_info.weight;
|
||||
if message.weight < expected_weight {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message {:?}/{:?}: passed weight is too low. Expected at least {:?}, got {:?}",
|
||||
bridge,
|
||||
id,
|
||||
@@ -310,11 +310,11 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
||||
// finally dispatch message
|
||||
let origin = RawOrigin::Signed(origin_account).into();
|
||||
|
||||
frame_support::debug::trace!("Message being dispatched is: {:?}", &call);
|
||||
log::trace!("Message being dispatched is: {:?}", &call);
|
||||
let dispatch_result = call.dispatch(origin);
|
||||
let actual_call_weight = extract_actual_weight(&dispatch_result, &dispatch_info);
|
||||
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message {:?}/{:?} has been dispatched. Weight: {} of {}. Result: {:?}",
|
||||
bridge,
|
||||
id,
|
||||
@@ -606,7 +606,7 @@ mod tests {
|
||||
vec![EventRecord {
|
||||
phase: Phase::Initialization,
|
||||
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
|
||||
bridge, id, 1279000, 0,
|
||||
bridge, id, 1345000, 0,
|
||||
)),
|
||||
topics: vec![],
|
||||
}],
|
||||
|
||||
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
serde = { version = "1.0", optional = true }
|
||||
|
||||
# Bridge dependencies
|
||||
@@ -36,6 +37,7 @@ std = [
|
||||
"frame-benchmarking/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"log/std",
|
||||
"serde",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
|
||||
@@ -113,7 +113,7 @@ decl_module! {
|
||||
// reward submitter for providing valid message
|
||||
T::OnTransactionSubmitted::on_valid_transaction_submitted(submitter);
|
||||
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
target: "runtime",
|
||||
"Completed currency exchange: {:?}",
|
||||
deposit.transfer_id,
|
||||
@@ -138,7 +138,7 @@ impl<T: Config<I>, I: Instance> Module<T, I> {
|
||||
proof: &<T::PeerBlockchain as InclusionProofVerifier>::TransactionInclusionProof,
|
||||
) -> bool {
|
||||
if let Err(err) = prepare_deposit_details::<T, I>(proof) {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
target: "runtime",
|
||||
"Can't accept exchange transaction: {:?}",
|
||||
err,
|
||||
|
||||
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"], optional = true }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
serde = { version = "1.0", optional = true }
|
||||
|
||||
# Bridge dependencies
|
||||
@@ -36,6 +37,7 @@ std = [
|
||||
"frame-benchmarking/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"log/std",
|
||||
"serde",
|
||||
"sp-io/std",
|
||||
"sp-runtime/std",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -10,6 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||
finality-grandpa = { version = "0.14.0", default-features = false }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
serde = { version = "1.0", optional = true }
|
||||
|
||||
# Bridge Dependencies
|
||||
@@ -40,6 +41,7 @@ std = [
|
||||
"finality-grandpa/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"log/std",
|
||||
"serde",
|
||||
"sp-finality-grandpa/std",
|
||||
"sp-runtime/std",
|
||||
|
||||
@@ -133,7 +133,7 @@ pub mod pallet {
|
||||
);
|
||||
|
||||
let (hash, number) = (finality_target.hash(), finality_target.number());
|
||||
frame_support::debug::trace!("Going to try and finalize header {:?}", finality_target);
|
||||
log::trace!("Going to try and finalize header {:?}", finality_target);
|
||||
|
||||
let best_finalized = <ImportedHeaders<T>>::get(<BestFinalized<T>>::get()).expect(
|
||||
"In order to reach this point the bridge must have been initialized. Afterwards,
|
||||
@@ -151,13 +151,13 @@ pub mod pallet {
|
||||
|
||||
verify_justification::<BridgedHeader<T>>((hash, *number), set_id, voter_set, &justification).map_err(
|
||||
|e| {
|
||||
frame_support::debug::error!("Received invalid justification for {:?}: {:?}", finality_target, e);
|
||||
log::error!("Received invalid justification for {:?}: {:?}", finality_target, e);
|
||||
<Error<T>>::InvalidJustification
|
||||
},
|
||||
)?;
|
||||
|
||||
let best_finalized = T::HeaderChain::best_finalized();
|
||||
frame_support::debug::trace!("Checking ancestry against best finalized header: {:?}", &best_finalized);
|
||||
log::trace!("Checking ancestry against best finalized header: {:?}", &best_finalized);
|
||||
|
||||
ensure!(
|
||||
T::AncestryChecker::are_ancestors(&best_finalized, &finality_target, &ancestry_proof),
|
||||
@@ -169,7 +169,7 @@ pub mod pallet {
|
||||
import_header::<T>(hash, finality_target)?;
|
||||
<RequestCount<T>>::mutate(|count| *count += 1);
|
||||
|
||||
frame_support::debug::info!("Succesfully imported finalized header with hash {:?}!", hash);
|
||||
log::info!("Succesfully imported finalized header with hash {:?}!", hash);
|
||||
|
||||
Ok(().into())
|
||||
}
|
||||
@@ -194,7 +194,7 @@ pub mod pallet {
|
||||
ensure!(init_allowed, <Error<T>>::AlreadyInitialized);
|
||||
initialize_bridge::<T>(init_data.clone());
|
||||
|
||||
frame_support::debug::info!(
|
||||
log::info!(
|
||||
"Pallet has been initialized with the following parameters: {:?}",
|
||||
init_data
|
||||
);
|
||||
@@ -211,11 +211,11 @@ pub mod pallet {
|
||||
match new_owner {
|
||||
Some(new_owner) => {
|
||||
ModuleOwner::<T>::put(&new_owner);
|
||||
frame_support::debug::info!("Setting pallet Owner to: {:?}", new_owner);
|
||||
log::info!("Setting pallet Owner to: {:?}", new_owner);
|
||||
}
|
||||
None => {
|
||||
ModuleOwner::<T>::kill();
|
||||
frame_support::debug::info!("Removed Owner of pallet.");
|
||||
log::info!("Removed Owner of pallet.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ pub mod pallet {
|
||||
pub fn halt_operations(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
||||
ensure_owner_or_root::<T>(origin)?;
|
||||
<IsHalted<T>>::put(true);
|
||||
frame_support::debug::warn!("Stopping pallet operations.");
|
||||
log::warn!("Stopping pallet operations.");
|
||||
|
||||
Ok(().into())
|
||||
}
|
||||
@@ -241,7 +241,7 @@ pub mod pallet {
|
||||
pub fn resume_operations(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
||||
ensure_owner_or_root::<T>(origin)?;
|
||||
<IsHalted<T>>::put(false);
|
||||
frame_support::debug::info!("Resuming pallet operations.");
|
||||
log::info!("Resuming pallet operations.");
|
||||
|
||||
Ok(().into())
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
num-traits = { version = "0.2", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
|
||||
@@ -40,6 +41,7 @@ std = [
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"log/std",
|
||||
"num-traits/std",
|
||||
"serde",
|
||||
"sp-core/std",
|
||||
|
||||
@@ -167,13 +167,13 @@ fn pay_relayer_reward<Currency, AccountId>(
|
||||
);
|
||||
|
||||
match pay_result {
|
||||
Ok(_) => frame_support::debug::trace!(
|
||||
Ok(_) => log::trace!(
|
||||
target: "runtime",
|
||||
"Rewarded relayer {:?} with {:?}",
|
||||
relayer_account,
|
||||
reward,
|
||||
),
|
||||
Err(error) => frame_support::debug::trace!(
|
||||
Err(error) => log::trace!(
|
||||
target: "runtime",
|
||||
"Failed to pay relayer {:?} reward {:?}: {:?}",
|
||||
relayer_account,
|
||||
|
||||
@@ -255,11 +255,11 @@ decl_module! {
|
||||
match new_owner {
|
||||
Some(new_owner) => {
|
||||
ModuleOwner::<T, I>::put(&new_owner);
|
||||
frame_support::debug::info!("Setting pallet Owner to: {:?}", new_owner);
|
||||
log::info!("Setting pallet Owner to: {:?}", new_owner);
|
||||
},
|
||||
None => {
|
||||
ModuleOwner::<T, I>::kill();
|
||||
frame_support::debug::info!("Removed Owner of pallet.");
|
||||
log::info!("Removed Owner of pallet.");
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,7 @@ decl_module! {
|
||||
pub fn halt_operations(origin) {
|
||||
ensure_owner_or_root::<T, I>(origin)?;
|
||||
IsHalted::<I>::put(true);
|
||||
frame_support::debug::warn!("Stopping pallet operations.");
|
||||
log::warn!("Stopping pallet operations.");
|
||||
}
|
||||
|
||||
/// Resume all pallet operations. May be called even if pallet is halted.
|
||||
@@ -281,7 +281,7 @@ decl_module! {
|
||||
pub fn resume_operations(origin) {
|
||||
ensure_owner_or_root::<T, I>(origin)?;
|
||||
IsHalted::<I>::put(false);
|
||||
frame_support::debug::info!("Resuming pallet operations.");
|
||||
log::info!("Resuming pallet operations.");
|
||||
}
|
||||
|
||||
/// Update pallet parameter.
|
||||
@@ -310,7 +310,7 @@ decl_module! {
|
||||
// let's first check if message can be delivered to target chain
|
||||
T::TargetHeaderChain::verify_message(&payload)
|
||||
.map_err(|err| {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message to lane {:?} is rejected by target chain: {:?}",
|
||||
lane_id,
|
||||
err,
|
||||
@@ -328,7 +328,7 @@ decl_module! {
|
||||
&lane.data(),
|
||||
&payload,
|
||||
).map_err(|err| {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message to lane {:?} is rejected by lane verifier: {:?}",
|
||||
lane_id,
|
||||
err,
|
||||
@@ -343,7 +343,7 @@ decl_module! {
|
||||
&delivery_and_dispatch_fee,
|
||||
&Self::relayer_fund_account_id(),
|
||||
).map_err(|err| {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Message to lane {:?} is rejected because submitter {:?} is unable to pay fee {:?}: {:?}",
|
||||
lane_id,
|
||||
submitter,
|
||||
@@ -363,7 +363,7 @@ decl_module! {
|
||||
});
|
||||
lane.prune_messages(T::MaxMessagesToPruneAtOnce::get());
|
||||
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Accepted message {} to lane {:?}. Message size: {:?}",
|
||||
nonce,
|
||||
lane_id,
|
||||
@@ -399,7 +399,7 @@ decl_module! {
|
||||
&additional_fee,
|
||||
&Self::relayer_fund_account_id(),
|
||||
).map_err(|err| {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Submitter {:?} can't pay additional fee {:?} for the message {:?}/{:?}: {:?}",
|
||||
submitter,
|
||||
additional_fee,
|
||||
@@ -455,7 +455,7 @@ decl_module! {
|
||||
T::InboundPayload,
|
||||
>(proof, messages_count)
|
||||
.map_err(|err| {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Rejecting invalid messages proof: {:?}",
|
||||
err,
|
||||
);
|
||||
@@ -474,7 +474,7 @@ decl_module! {
|
||||
)
|
||||
.fold(0, |sum, weight| sum.saturating_add(weight));
|
||||
if dispatch_weight < actual_dispatch_weight {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Rejecting messages proof because of dispatch weight mismatch: declared={}, expected={}",
|
||||
dispatch_weight,
|
||||
actual_dispatch_weight,
|
||||
@@ -492,7 +492,7 @@ decl_module! {
|
||||
if let Some(lane_state) = lane_data.lane_state {
|
||||
let updated_latest_confirmed_nonce = lane.receive_state_update(lane_state);
|
||||
if let Some(updated_latest_confirmed_nonce) = updated_latest_confirmed_nonce {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Received lane {:?} state update: latest_confirmed_nonce={}",
|
||||
lane_id,
|
||||
updated_latest_confirmed_nonce,
|
||||
@@ -510,7 +510,7 @@ decl_module! {
|
||||
}
|
||||
}
|
||||
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Received messages: total={}, valid={}",
|
||||
total_messages,
|
||||
valid_messages,
|
||||
@@ -530,7 +530,7 @@ decl_module! {
|
||||
|
||||
let confirmation_relayer = ensure_signed(origin)?;
|
||||
let (lane_id, lane_data) = T::TargetHeaderChain::verify_messages_delivery_proof(proof).map_err(|err| {
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Rejecting invalid messages delivery proof: {:?}",
|
||||
err,
|
||||
);
|
||||
@@ -585,7 +585,7 @@ decl_module! {
|
||||
);
|
||||
}
|
||||
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Received messages delivery proof up to (and including) {} at lane {:?}",
|
||||
last_delivered_nonce,
|
||||
lane_id,
|
||||
|
||||
@@ -11,6 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||
finality-grandpa = { version = "0.14.0", default-features = false }
|
||||
hash-db = { version = "0.15.2", default-features = false }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
serde = { version = "1.0", optional = true }
|
||||
|
||||
# Bridge Dependencies
|
||||
@@ -44,6 +45,7 @@ std = [
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"hash-db/std",
|
||||
"log/std",
|
||||
"serde",
|
||||
"sp-finality-grandpa/std",
|
||||
"sp-runtime/std",
|
||||
|
||||
@@ -181,7 +181,7 @@ decl_module! {
|
||||
ensure_operational::<T>()?;
|
||||
let _ = ensure_signed(origin)?;
|
||||
let hash = header.hash();
|
||||
frame_support::debug::trace!("Going to import header {:?}: {:?}", hash, header);
|
||||
log::trace!("Going to import header {:?}: {:?}", hash, header);
|
||||
|
||||
let mut verifier = verifier::Verifier {
|
||||
storage: PalletStorage::<T>::new(),
|
||||
@@ -190,11 +190,11 @@ decl_module! {
|
||||
let _ = verifier
|
||||
.import_header(hash, header)
|
||||
.map_err(|e| {
|
||||
frame_support::debug::error!("Failed to import header {:?}: {:?}", hash, e);
|
||||
log::error!("Failed to import header {:?}: {:?}", hash, e);
|
||||
<Error<T>>::InvalidHeader
|
||||
})?;
|
||||
|
||||
frame_support::debug::trace!("Successfully imported header: {:?}", hash);
|
||||
log::trace!("Successfully imported header: {:?}", hash);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -213,7 +213,7 @@ decl_module! {
|
||||
) -> DispatchResult {
|
||||
ensure_operational::<T>()?;
|
||||
let _ = ensure_signed(origin)?;
|
||||
frame_support::debug::trace!("Going to finalize header: {:?}", hash);
|
||||
log::trace!("Going to finalize header: {:?}", hash);
|
||||
|
||||
let mut verifier = verifier::Verifier {
|
||||
storage: PalletStorage::<T>::new(),
|
||||
@@ -222,11 +222,11 @@ decl_module! {
|
||||
let _ = verifier
|
||||
.import_finality_proof(hash, finality_proof.into())
|
||||
.map_err(|e| {
|
||||
frame_support::debug::error!("Failed to finalize header {:?}: {:?}", hash, e);
|
||||
log::error!("Failed to finalize header {:?}: {:?}", hash, e);
|
||||
<Error<T>>::UnfinalizedHeader
|
||||
})?;
|
||||
|
||||
frame_support::debug::trace!("Successfully finalized header: {:?}", hash);
|
||||
log::trace!("Successfully finalized header: {:?}", hash);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -251,7 +251,7 @@ decl_module! {
|
||||
ensure!(init_allowed, <Error<T>>::AlreadyInitialized);
|
||||
initialize_bridge::<T>(init_data.clone());
|
||||
|
||||
frame_support::debug::info!(
|
||||
log::info!(
|
||||
"Pallet has been initialized with the following parameters: {:?}", init_data
|
||||
);
|
||||
}
|
||||
@@ -265,11 +265,11 @@ decl_module! {
|
||||
match new_owner {
|
||||
Some(new_owner) => {
|
||||
ModuleOwner::<T>::put(&new_owner);
|
||||
frame_support::debug::info!("Setting pallet Owner to: {:?}", new_owner);
|
||||
log::info!("Setting pallet Owner to: {:?}", new_owner);
|
||||
},
|
||||
None => {
|
||||
ModuleOwner::<T>::kill();
|
||||
frame_support::debug::info!("Removed Owner of pallet.");
|
||||
log::info!("Removed Owner of pallet.");
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ decl_module! {
|
||||
pub fn halt_operations(origin) {
|
||||
ensure_owner_or_root::<T>(origin)?;
|
||||
IsHalted::put(true);
|
||||
frame_support::debug::warn!("Stopping pallet operations.");
|
||||
log::warn!("Stopping pallet operations.");
|
||||
}
|
||||
|
||||
/// Resume all pallet operations. May be called even if pallet is halted.
|
||||
@@ -291,7 +291,7 @@ decl_module! {
|
||||
pub fn resume_operations(origin) {
|
||||
ensure_owner_or_root::<T>(origin)?;
|
||||
IsHalted::put(false);
|
||||
frame_support::debug::info!("Resuming pallet operations.");
|
||||
log::info!("Resuming pallet operations.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,9 +240,9 @@ where
|
||||
&proof.0,
|
||||
)
|
||||
.map_err(|_| FinalizationError::InvalidJustification)?;
|
||||
frame_support::debug::trace!("Received valid justification for {:?}", header);
|
||||
log::trace!("Received valid justification for {:?}", header);
|
||||
|
||||
frame_support::debug::trace!(
|
||||
log::trace!(
|
||||
"Checking ancestry for headers between {:?} and {:?}",
|
||||
last_finalized,
|
||||
header
|
||||
|
||||
Reference in New Issue
Block a user