mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 23:21: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) {
|
fn execute_block(block: Block) {
|
||||||
Executive::execute_block(block)
|
Executive::execute_block(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
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"] }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
|
||||||
hex-literal = "0.3"
|
hex-literal = "0.3"
|
||||||
libsecp256k1 = { version = "0.3.4", optional = true, default-features = false, features = ["hmac"] }
|
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"] }
|
serde = { version = "1.0.124", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
@@ -86,6 +87,7 @@ std = [
|
|||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system-rpc-runtime-api/std",
|
"frame-system-rpc-runtime-api/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
|
"log/std",
|
||||||
"pallet-aura/std",
|
"pallet-aura/std",
|
||||||
"pallet-balances/std",
|
"pallet-balances/std",
|
||||||
"pallet-bridge-eth-poa/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
|
// we only accept transactions sending funds directly to the pre-configured address
|
||||||
if tx.unsigned.to != Some(LOCK_FUNDS_ADDRESS.into()) {
|
if tx.unsigned.to != Some(LOCK_FUNDS_ADDRESS.into()) {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Failed to parse fund locks transaction. Invalid peer recipient: {:?}",
|
"Failed to parse fund locks transaction. Invalid peer recipient: {:?}",
|
||||||
tx.unsigned.to,
|
tx.unsigned.to,
|
||||||
@@ -94,7 +94,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
|
|||||||
match tx.unsigned.payload.len() {
|
match tx.unsigned.payload.len() {
|
||||||
32 => recipient_raw.as_fixed_bytes_mut().copy_from_slice(&tx.unsigned.payload),
|
32 => recipient_raw.as_fixed_bytes_mut().copy_from_slice(&tx.unsigned.payload),
|
||||||
len => {
|
len => {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Failed to parse fund locks transaction. Invalid recipient length: {}",
|
"Failed to parse fund locks transaction. Invalid recipient length: {}",
|
||||||
len,
|
len,
|
||||||
@@ -106,7 +106,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
|
|||||||
let amount = tx.unsigned.value.low_u128();
|
let amount = tx.unsigned.value.low_u128();
|
||||||
|
|
||||||
if tx.unsigned.value != amount.into() {
|
if tx.unsigned.value != amount.into() {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Failed to parse fund locks transaction. Invalid amount: {}",
|
"Failed to parse fund locks transaction. Invalid amount: {}",
|
||||||
tx.unsigned.value,
|
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
|
// - deposited != 0: (should never happen in practice) deposit has been partially completed
|
||||||
match deposited_amount {
|
match deposited_amount {
|
||||||
_ if deposited_amount == amount => {
|
_ if deposited_amount == amount => {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Deposited {} to {:?}",
|
"Deposited {} to {:?}",
|
||||||
amount,
|
amount,
|
||||||
@@ -300,7 +300,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
_ if deposited_amount == 0 => {
|
_ if deposited_amount == 0 => {
|
||||||
frame_support::debug::error!(
|
log::error!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Deposit of {} to {:?} has failed",
|
"Deposit of {} to {:?} has failed",
|
||||||
amount,
|
amount,
|
||||||
@@ -310,7 +310,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
|
|||||||
Err(bp_currency_exchange::Error::DepositFailed)
|
Err(bp_currency_exchange::Error::DepositFailed)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
frame_support::debug::error!(
|
log::error!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Deposit of {} to {:?} has partially competed. {} has been deposited",
|
"Deposit of {} to {:?} has partially competed. {} has been deposited",
|
||||||
amount,
|
amount,
|
||||||
@@ -535,7 +535,7 @@ impl_runtime_apis! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn execute_block(block: Block) {
|
fn execute_block(block: Block) {
|
||||||
Executive::execute_block(block)
|
Executive::execute_block(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
fn initialize_block(header: &<Block as BlockT>::Header) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||||
|
log = { version = "0.4.14", default-features = false }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ std = [
|
|||||||
"bp-runtime/std",
|
"bp-runtime/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
|
"log/std",
|
||||||
"sp-core/std",
|
"sp-core/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
"sp-std/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 {
|
let message = match message {
|
||||||
Ok(message) => message,
|
Ok(message) => message,
|
||||||
Err(_) => {
|
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));
|
Self::deposit_event(RawEvent::MessageRejected(bridge, id));
|
||||||
return;
|
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)
|
// (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;
|
let expected_version = <T as frame_system::Config>::Version::get().spec_version;
|
||||||
if message.spec_version != expected_version {
|
if message.spec_version != expected_version {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message {:?}/{:?}: spec_version mismatch. Expected {:?}, got {:?}",
|
"Message {:?}/{:?}: spec_version mismatch. Expected {:?}, got {:?}",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -232,7 +232,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
let call = match message.call.into() {
|
let call = match message.call.into() {
|
||||||
Ok(call) => call,
|
Ok(call) => call,
|
||||||
Err(_) => {
|
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));
|
Self::deposit_event(RawEvent::MessageCallDecodeFailed(bridge, id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
CallOrigin::SourceRoot => {
|
CallOrigin::SourceRoot => {
|
||||||
let hex_id = derive_account_id::<T::SourceChainAccountId>(bridge, SourceAccount::Root);
|
let hex_id = derive_account_id::<T::SourceChainAccountId>(bridge, SourceAccount::Root);
|
||||||
let target_id = T::AccountIdConverter::convert(hex_id);
|
let target_id = T::AccountIdConverter::convert(hex_id);
|
||||||
frame_support::debug::trace!("Root Account: {:?}", &target_id);
|
log::trace!("Root Account: {:?}", &target_id);
|
||||||
target_id
|
target_id
|
||||||
}
|
}
|
||||||
CallOrigin::TargetAccount(source_account_id, target_public, target_signature) => {
|
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();
|
let target_account = target_public.into_account();
|
||||||
if !target_signature.verify(&digest[..], &target_account) {
|
if !target_signature.verify(&digest[..], &target_account) {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message {:?}/{:?}: origin proof is invalid. Expected account: {:?} from signature: {:?}",
|
"Message {:?}/{:?}: origin proof is invalid. Expected account: {:?} from signature: {:?}",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -262,20 +262,20 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_support::debug::trace!("Target Account: {:?}", &target_account);
|
log::trace!("Target Account: {:?}", &target_account);
|
||||||
target_account
|
target_account
|
||||||
}
|
}
|
||||||
CallOrigin::SourceAccount(source_account_id) => {
|
CallOrigin::SourceAccount(source_account_id) => {
|
||||||
let hex_id = derive_account_id(bridge, SourceAccount::Account(source_account_id));
|
let hex_id = derive_account_id(bridge, SourceAccount::Account(source_account_id));
|
||||||
let target_id = T::AccountIdConverter::convert(hex_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
|
target_id
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// filter the call
|
// filter the call
|
||||||
if !T::CallFilter::filter(&call) {
|
if !T::CallFilter::filter(&call) {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
|
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
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 dispatch_info = call.get_dispatch_info();
|
||||||
let expected_weight = dispatch_info.weight;
|
let expected_weight = dispatch_info.weight;
|
||||||
if message.weight < expected_weight {
|
if message.weight < expected_weight {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message {:?}/{:?}: passed weight is too low. Expected at least {:?}, got {:?}",
|
"Message {:?}/{:?}: passed weight is too low. Expected at least {:?}, got {:?}",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -310,11 +310,11 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
|
|||||||
// finally dispatch message
|
// finally dispatch message
|
||||||
let origin = RawOrigin::Signed(origin_account).into();
|
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 dispatch_result = call.dispatch(origin);
|
||||||
let actual_call_weight = extract_actual_weight(&dispatch_result, &dispatch_info);
|
let actual_call_weight = extract_actual_weight(&dispatch_result, &dispatch_info);
|
||||||
|
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message {:?}/{:?} has been dispatched. Weight: {} of {}. Result: {:?}",
|
"Message {:?}/{:?} has been dispatched. Weight: {} of {}. Result: {:?}",
|
||||||
bridge,
|
bridge,
|
||||||
id,
|
id,
|
||||||
@@ -606,7 +606,7 @@ mod tests {
|
|||||||
vec![EventRecord {
|
vec![EventRecord {
|
||||||
phase: Phase::Initialization,
|
phase: Phase::Initialization,
|
||||||
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
|
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
|
||||||
bridge, id, 1279000, 0,
|
bridge, id, 1345000, 0,
|
||||||
)),
|
)),
|
||||||
topics: vec![],
|
topics: vec![],
|
||||||
}],
|
}],
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
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 }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
@@ -36,6 +37,7 @@ std = [
|
|||||||
"frame-benchmarking/std",
|
"frame-benchmarking/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
|
"log/std",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
"sp-std/std",
|
"sp-std/std",
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ decl_module! {
|
|||||||
// reward submitter for providing valid message
|
// reward submitter for providing valid message
|
||||||
T::OnTransactionSubmitted::on_valid_transaction_submitted(submitter);
|
T::OnTransactionSubmitted::on_valid_transaction_submitted(submitter);
|
||||||
|
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Completed currency exchange: {:?}",
|
"Completed currency exchange: {:?}",
|
||||||
deposit.transfer_id,
|
deposit.transfer_id,
|
||||||
@@ -138,7 +138,7 @@ impl<T: Config<I>, I: Instance> Module<T, I> {
|
|||||||
proof: &<T::PeerBlockchain as InclusionProofVerifier>::TransactionInclusionProof,
|
proof: &<T::PeerBlockchain as InclusionProofVerifier>::TransactionInclusionProof,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if let Err(err) = prepare_deposit_details::<T, I>(proof) {
|
if let Err(err) = prepare_deposit_details::<T, I>(proof) {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Can't accept exchange transaction: {:?}",
|
"Can't accept exchange transaction: {:?}",
|
||||||
err,
|
err,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||||
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"], optional = true }
|
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 }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# Bridge dependencies
|
# Bridge dependencies
|
||||||
@@ -36,6 +37,7 @@ std = [
|
|||||||
"frame-benchmarking/std",
|
"frame-benchmarking/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
|
"log/std",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-io/std",
|
"sp-io/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ impl<T: Config<I>, I: Instance> BridgeStorage<T, I> {
|
|||||||
// start pruning blocks
|
// start pruning blocks
|
||||||
let begin = new_pruning_range.oldest_unpruned_block;
|
let begin = new_pruning_range.oldest_unpruned_block;
|
||||||
let end = new_pruning_range.oldest_block_to_keep;
|
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 {
|
for number in begin..end {
|
||||||
// if we can't prune anything => break
|
// if we can't prune anything => break
|
||||||
if max_blocks_to_prune == 0 {
|
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
|
// we have pruned all headers at number
|
||||||
new_pruning_range.oldest_unpruned_block = number + 1;
|
new_pruning_range.oldest_unpruned_block = number + 1;
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Oldest unpruned PoA header is now: {}",
|
"Oldest unpruned PoA header is now: {}",
|
||||||
new_pruning_range.oldest_unpruned_block,
|
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
|
// physically remove headers and (probably) obsolete validators sets
|
||||||
while let Some(hash) = blocks_at_number.pop() {
|
while let Some(hash) = blocks_at_number.pop() {
|
||||||
let header = Headers::<T, I>::take(&hash);
|
let header = Headers::<T, I>::take(&hash);
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Pruning PoA header: ({}, {})",
|
"Pruning PoA header: ({}, {})",
|
||||||
number,
|
number,
|
||||||
@@ -818,7 +818,7 @@ impl<T: Config<I>, I: Instance> Storage for BridgeStorage<T, I> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Inserting PoA header: ({}, {})",
|
"Inserting PoA header: ({}, {})",
|
||||||
header.header.number,
|
header.header.number,
|
||||||
@@ -846,7 +846,7 @@ impl<T: Config<I>, I: Instance> Storage for BridgeStorage<T, I> {
|
|||||||
.map(|f| f.number)
|
.map(|f| f.number)
|
||||||
.unwrap_or_else(|| FinalizedBlock::<I>::get().number);
|
.unwrap_or_else(|| FinalizedBlock::<I>::get().number);
|
||||||
if let Some(finalized) = finalized {
|
if let Some(finalized) = finalized {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Finalizing PoA header: ({}, {})",
|
"Finalizing PoA header: ({}, {})",
|
||||||
finalized.number,
|
finalized.number,
|
||||||
@@ -869,7 +869,7 @@ pub(crate) fn initialize_storage<T: Config<I>, I: Instance>(
|
|||||||
initial_validators: &[Address],
|
initial_validators: &[Address],
|
||||||
) {
|
) {
|
||||||
let initial_hash = initial_header.compute_hash();
|
let initial_hash = initial_header.compute_hash();
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Initializing bridge with PoA header: ({}, {})",
|
"Initializing bridge with PoA header: ({}, {})",
|
||||||
initial_header.number,
|
initial_header.number,
|
||||||
@@ -917,7 +917,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
proof: &[(RawTransaction, RawTransactionReceipt)],
|
proof: &[(RawTransaction, RawTransactionReceipt)],
|
||||||
) -> bool {
|
) -> bool {
|
||||||
if tx_index >= proof.len() as _ {
|
if tx_index >= proof.len() as _ {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: transaction index ({}) is larger than number of transactions ({})",
|
"Tx finality check failed: transaction index ({}) is larger than number of transactions ({})",
|
||||||
tx_index,
|
tx_index,
|
||||||
@@ -930,7 +930,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
let header = match storage.header(&block) {
|
let header = match storage.header(&block) {
|
||||||
Some((header, _)) => header,
|
Some((header, _)) => header,
|
||||||
None => {
|
None => {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: can't find header in the storage: {}",
|
"Tx finality check failed: can't find header in the storage: {}",
|
||||||
block,
|
block,
|
||||||
@@ -943,7 +943,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
|
|
||||||
// if header is not yet finalized => return
|
// if header is not yet finalized => return
|
||||||
if header.number > finalized.number {
|
if header.number > finalized.number {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: header {}/{} is not finalized. Best finalized: {}",
|
"Tx finality check failed: header {}/{} is not finalized. Best finalized: {}",
|
||||||
header.number,
|
header.number,
|
||||||
@@ -962,7 +962,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
false => block == finalized.hash,
|
false => block == finalized.hash,
|
||||||
};
|
};
|
||||||
if !is_finalized {
|
if !is_finalized {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: header {} is not finalized: no canonical path to best finalized block {}",
|
"Tx finality check failed: header {} is not finalized: no canonical path to best finalized block {}",
|
||||||
block,
|
block,
|
||||||
@@ -974,7 +974,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
|
|
||||||
// verify that transaction is included in the block
|
// verify that transaction is included in the block
|
||||||
if let Err(computed_root) = header.check_transactions_root(proof.iter().map(|(tx, _)| tx)) {
|
if let Err(computed_root) = header.check_transactions_root(proof.iter().map(|(tx, _)| tx)) {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: transactions root mismatch. Expected: {}, computed: {}",
|
"Tx finality check failed: transactions root mismatch. Expected: {}, computed: {}",
|
||||||
header.transactions_root,
|
header.transactions_root,
|
||||||
@@ -986,7 +986,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
|
|
||||||
// verify that transaction receipt is included in the block
|
// verify that transaction receipt is included in the block
|
||||||
if let Err(computed_root) = header.check_raw_receipts_root(proof.iter().map(|(_, r)| r)) {
|
if let Err(computed_root) = header.check_raw_receipts_root(proof.iter().map(|(_, r)| r)) {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: receipts root mismatch. Expected: {}, computed: {}",
|
"Tx finality check failed: receipts root mismatch. Expected: {}, computed: {}",
|
||||||
header.receipts_root,
|
header.receipts_root,
|
||||||
@@ -1001,7 +1001,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
match is_successful_raw_receipt {
|
match is_successful_raw_receipt {
|
||||||
Ok(true) => true,
|
Ok(true) => true,
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: receipt shows that transaction has failed",
|
"Tx finality check failed: receipt shows that transaction has failed",
|
||||||
);
|
);
|
||||||
@@ -1009,7 +1009,7 @@ pub fn verify_transaction_finalized<S: Storage>(
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Tx finality check failed: receipt check has failed: {}",
|
"Tx finality check failed: receipt check has failed: {}",
|
||||||
err,
|
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
|
// the heaviest, but rare operation - we do not want invalid receipts in the pool
|
||||||
if let Some(receipts) = receipts {
|
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() {
|
if header.check_receipts_root(receipts).is_err() {
|
||||||
return Err(Error::TransactionsReceiptsMismatch);
|
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
|
// the rest of checks requires access to the parent header
|
||||||
let context = storage.import_context(submitter, &header.parent_hash).ok_or_else(|| {
|
let context = storage.import_context(submitter, &header.parent_hash).ok_or_else(|| {
|
||||||
frame_support::debug::warn!(
|
log::warn!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Missing parent PoA block: ({:?}, {})",
|
"Missing parent PoA block: ({:?}, {})",
|
||||||
header.number.checked_sub(1),
|
header.number.checked_sub(1),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||||
finality-grandpa = { version = "0.14.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 }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
@@ -40,6 +41,7 @@ std = [
|
|||||||
"finality-grandpa/std",
|
"finality-grandpa/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
|
"log/std",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-finality-grandpa/std",
|
"sp-finality-grandpa/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ pub mod pallet {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let (hash, number) = (finality_target.hash(), finality_target.number());
|
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(
|
let best_finalized = <ImportedHeaders<T>>::get(<BestFinalized<T>>::get()).expect(
|
||||||
"In order to reach this point the bridge must have been initialized. Afterwards,
|
"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(
|
verify_justification::<BridgedHeader<T>>((hash, *number), set_id, voter_set, &justification).map_err(
|
||||||
|e| {
|
|e| {
|
||||||
frame_support::debug::error!("Received invalid justification for {:?}: {:?}", finality_target, e);
|
log::error!("Received invalid justification for {:?}: {:?}", finality_target, e);
|
||||||
<Error<T>>::InvalidJustification
|
<Error<T>>::InvalidJustification
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let best_finalized = T::HeaderChain::best_finalized();
|
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!(
|
ensure!(
|
||||||
T::AncestryChecker::are_ancestors(&best_finalized, &finality_target, &ancestry_proof),
|
T::AncestryChecker::are_ancestors(&best_finalized, &finality_target, &ancestry_proof),
|
||||||
@@ -169,7 +169,7 @@ pub mod pallet {
|
|||||||
import_header::<T>(hash, finality_target)?;
|
import_header::<T>(hash, finality_target)?;
|
||||||
<RequestCount<T>>::mutate(|count| *count += 1);
|
<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())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ pub mod pallet {
|
|||||||
ensure!(init_allowed, <Error<T>>::AlreadyInitialized);
|
ensure!(init_allowed, <Error<T>>::AlreadyInitialized);
|
||||||
initialize_bridge::<T>(init_data.clone());
|
initialize_bridge::<T>(init_data.clone());
|
||||||
|
|
||||||
frame_support::debug::info!(
|
log::info!(
|
||||||
"Pallet has been initialized with the following parameters: {:?}",
|
"Pallet has been initialized with the following parameters: {:?}",
|
||||||
init_data
|
init_data
|
||||||
);
|
);
|
||||||
@@ -211,11 +211,11 @@ pub mod pallet {
|
|||||||
match new_owner {
|
match new_owner {
|
||||||
Some(new_owner) => {
|
Some(new_owner) => {
|
||||||
ModuleOwner::<T>::put(&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 => {
|
None => {
|
||||||
ModuleOwner::<T>::kill();
|
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 {
|
pub fn halt_operations(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
||||||
ensure_owner_or_root::<T>(origin)?;
|
ensure_owner_or_root::<T>(origin)?;
|
||||||
<IsHalted<T>>::put(true);
|
<IsHalted<T>>::put(true);
|
||||||
frame_support::debug::warn!("Stopping pallet operations.");
|
log::warn!("Stopping pallet operations.");
|
||||||
|
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ pub mod pallet {
|
|||||||
pub fn resume_operations(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
pub fn resume_operations(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
||||||
ensure_owner_or_root::<T>(origin)?;
|
ensure_owner_or_root::<T>(origin)?;
|
||||||
<IsHalted<T>>::put(false);
|
<IsHalted<T>>::put(false);
|
||||||
frame_support::debug::info!("Resuming pallet operations.");
|
log::info!("Resuming pallet operations.");
|
||||||
|
|
||||||
Ok(().into())
|
Ok(().into())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
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 }
|
num-traits = { version = "0.2", default-features = false }
|
||||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ std = [
|
|||||||
"codec/std",
|
"codec/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
|
"log/std",
|
||||||
"num-traits/std",
|
"num-traits/std",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-core/std",
|
"sp-core/std",
|
||||||
|
|||||||
@@ -167,13 +167,13 @@ fn pay_relayer_reward<Currency, AccountId>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
match pay_result {
|
match pay_result {
|
||||||
Ok(_) => frame_support::debug::trace!(
|
Ok(_) => log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Rewarded relayer {:?} with {:?}",
|
"Rewarded relayer {:?} with {:?}",
|
||||||
relayer_account,
|
relayer_account,
|
||||||
reward,
|
reward,
|
||||||
),
|
),
|
||||||
Err(error) => frame_support::debug::trace!(
|
Err(error) => log::trace!(
|
||||||
target: "runtime",
|
target: "runtime",
|
||||||
"Failed to pay relayer {:?} reward {:?}: {:?}",
|
"Failed to pay relayer {:?} reward {:?}: {:?}",
|
||||||
relayer_account,
|
relayer_account,
|
||||||
|
|||||||
@@ -255,11 +255,11 @@ decl_module! {
|
|||||||
match new_owner {
|
match new_owner {
|
||||||
Some(new_owner) => {
|
Some(new_owner) => {
|
||||||
ModuleOwner::<T, I>::put(&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 => {
|
None => {
|
||||||
ModuleOwner::<T, I>::kill();
|
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) {
|
pub fn halt_operations(origin) {
|
||||||
ensure_owner_or_root::<T, I>(origin)?;
|
ensure_owner_or_root::<T, I>(origin)?;
|
||||||
IsHalted::<I>::put(true);
|
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.
|
/// Resume all pallet operations. May be called even if pallet is halted.
|
||||||
@@ -281,7 +281,7 @@ decl_module! {
|
|||||||
pub fn resume_operations(origin) {
|
pub fn resume_operations(origin) {
|
||||||
ensure_owner_or_root::<T, I>(origin)?;
|
ensure_owner_or_root::<T, I>(origin)?;
|
||||||
IsHalted::<I>::put(false);
|
IsHalted::<I>::put(false);
|
||||||
frame_support::debug::info!("Resuming pallet operations.");
|
log::info!("Resuming pallet operations.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update pallet parameter.
|
/// Update pallet parameter.
|
||||||
@@ -310,7 +310,7 @@ decl_module! {
|
|||||||
// let's first check if message can be delivered to target chain
|
// let's first check if message can be delivered to target chain
|
||||||
T::TargetHeaderChain::verify_message(&payload)
|
T::TargetHeaderChain::verify_message(&payload)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message to lane {:?} is rejected by target chain: {:?}",
|
"Message to lane {:?} is rejected by target chain: {:?}",
|
||||||
lane_id,
|
lane_id,
|
||||||
err,
|
err,
|
||||||
@@ -328,7 +328,7 @@ decl_module! {
|
|||||||
&lane.data(),
|
&lane.data(),
|
||||||
&payload,
|
&payload,
|
||||||
).map_err(|err| {
|
).map_err(|err| {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message to lane {:?} is rejected by lane verifier: {:?}",
|
"Message to lane {:?} is rejected by lane verifier: {:?}",
|
||||||
lane_id,
|
lane_id,
|
||||||
err,
|
err,
|
||||||
@@ -343,7 +343,7 @@ decl_module! {
|
|||||||
&delivery_and_dispatch_fee,
|
&delivery_and_dispatch_fee,
|
||||||
&Self::relayer_fund_account_id(),
|
&Self::relayer_fund_account_id(),
|
||||||
).map_err(|err| {
|
).map_err(|err| {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Message to lane {:?} is rejected because submitter {:?} is unable to pay fee {:?}: {:?}",
|
"Message to lane {:?} is rejected because submitter {:?} is unable to pay fee {:?}: {:?}",
|
||||||
lane_id,
|
lane_id,
|
||||||
submitter,
|
submitter,
|
||||||
@@ -363,7 +363,7 @@ decl_module! {
|
|||||||
});
|
});
|
||||||
lane.prune_messages(T::MaxMessagesToPruneAtOnce::get());
|
lane.prune_messages(T::MaxMessagesToPruneAtOnce::get());
|
||||||
|
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Accepted message {} to lane {:?}. Message size: {:?}",
|
"Accepted message {} to lane {:?}. Message size: {:?}",
|
||||||
nonce,
|
nonce,
|
||||||
lane_id,
|
lane_id,
|
||||||
@@ -399,7 +399,7 @@ decl_module! {
|
|||||||
&additional_fee,
|
&additional_fee,
|
||||||
&Self::relayer_fund_account_id(),
|
&Self::relayer_fund_account_id(),
|
||||||
).map_err(|err| {
|
).map_err(|err| {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Submitter {:?} can't pay additional fee {:?} for the message {:?}/{:?}: {:?}",
|
"Submitter {:?} can't pay additional fee {:?} for the message {:?}/{:?}: {:?}",
|
||||||
submitter,
|
submitter,
|
||||||
additional_fee,
|
additional_fee,
|
||||||
@@ -455,7 +455,7 @@ decl_module! {
|
|||||||
T::InboundPayload,
|
T::InboundPayload,
|
||||||
>(proof, messages_count)
|
>(proof, messages_count)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Rejecting invalid messages proof: {:?}",
|
"Rejecting invalid messages proof: {:?}",
|
||||||
err,
|
err,
|
||||||
);
|
);
|
||||||
@@ -474,7 +474,7 @@ decl_module! {
|
|||||||
)
|
)
|
||||||
.fold(0, |sum, weight| sum.saturating_add(weight));
|
.fold(0, |sum, weight| sum.saturating_add(weight));
|
||||||
if dispatch_weight < actual_dispatch_weight {
|
if dispatch_weight < actual_dispatch_weight {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Rejecting messages proof because of dispatch weight mismatch: declared={}, expected={}",
|
"Rejecting messages proof because of dispatch weight mismatch: declared={}, expected={}",
|
||||||
dispatch_weight,
|
dispatch_weight,
|
||||||
actual_dispatch_weight,
|
actual_dispatch_weight,
|
||||||
@@ -492,7 +492,7 @@ decl_module! {
|
|||||||
if let Some(lane_state) = lane_data.lane_state {
|
if let Some(lane_state) = lane_data.lane_state {
|
||||||
let updated_latest_confirmed_nonce = lane.receive_state_update(lane_state);
|
let updated_latest_confirmed_nonce = lane.receive_state_update(lane_state);
|
||||||
if let Some(updated_latest_confirmed_nonce) = updated_latest_confirmed_nonce {
|
if let Some(updated_latest_confirmed_nonce) = updated_latest_confirmed_nonce {
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Received lane {:?} state update: latest_confirmed_nonce={}",
|
"Received lane {:?} state update: latest_confirmed_nonce={}",
|
||||||
lane_id,
|
lane_id,
|
||||||
updated_latest_confirmed_nonce,
|
updated_latest_confirmed_nonce,
|
||||||
@@ -510,7 +510,7 @@ decl_module! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Received messages: total={}, valid={}",
|
"Received messages: total={}, valid={}",
|
||||||
total_messages,
|
total_messages,
|
||||||
valid_messages,
|
valid_messages,
|
||||||
@@ -530,7 +530,7 @@ decl_module! {
|
|||||||
|
|
||||||
let confirmation_relayer = ensure_signed(origin)?;
|
let confirmation_relayer = ensure_signed(origin)?;
|
||||||
let (lane_id, lane_data) = T::TargetHeaderChain::verify_messages_delivery_proof(proof).map_err(|err| {
|
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: {:?}",
|
"Rejecting invalid messages delivery proof: {:?}",
|
||||||
err,
|
err,
|
||||||
);
|
);
|
||||||
@@ -585,7 +585,7 @@ decl_module! {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_support::debug::trace!(
|
log::trace!(
|
||||||
"Received messages delivery proof up to (and including) {} at lane {:?}",
|
"Received messages delivery proof up to (and including) {} at lane {:?}",
|
||||||
last_delivered_nonce,
|
last_delivered_nonce,
|
||||||
lane_id,
|
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 }
|
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
|
||||||
finality-grandpa = { version = "0.14.0", default-features = false }
|
finality-grandpa = { version = "0.14.0", default-features = false }
|
||||||
hash-db = { version = "0.15.2", 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 }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# Bridge Dependencies
|
# Bridge Dependencies
|
||||||
@@ -44,6 +45,7 @@ std = [
|
|||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
"hash-db/std",
|
"hash-db/std",
|
||||||
|
"log/std",
|
||||||
"serde",
|
"serde",
|
||||||
"sp-finality-grandpa/std",
|
"sp-finality-grandpa/std",
|
||||||
"sp-runtime/std",
|
"sp-runtime/std",
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ decl_module! {
|
|||||||
ensure_operational::<T>()?;
|
ensure_operational::<T>()?;
|
||||||
let _ = ensure_signed(origin)?;
|
let _ = ensure_signed(origin)?;
|
||||||
let hash = header.hash();
|
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 {
|
let mut verifier = verifier::Verifier {
|
||||||
storage: PalletStorage::<T>::new(),
|
storage: PalletStorage::<T>::new(),
|
||||||
@@ -190,11 +190,11 @@ decl_module! {
|
|||||||
let _ = verifier
|
let _ = verifier
|
||||||
.import_header(hash, header)
|
.import_header(hash, header)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
frame_support::debug::error!("Failed to import header {:?}: {:?}", hash, e);
|
log::error!("Failed to import header {:?}: {:?}", hash, e);
|
||||||
<Error<T>>::InvalidHeader
|
<Error<T>>::InvalidHeader
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
frame_support::debug::trace!("Successfully imported header: {:?}", hash);
|
log::trace!("Successfully imported header: {:?}", hash);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ decl_module! {
|
|||||||
) -> DispatchResult {
|
) -> DispatchResult {
|
||||||
ensure_operational::<T>()?;
|
ensure_operational::<T>()?;
|
||||||
let _ = ensure_signed(origin)?;
|
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 {
|
let mut verifier = verifier::Verifier {
|
||||||
storage: PalletStorage::<T>::new(),
|
storage: PalletStorage::<T>::new(),
|
||||||
@@ -222,11 +222,11 @@ decl_module! {
|
|||||||
let _ = verifier
|
let _ = verifier
|
||||||
.import_finality_proof(hash, finality_proof.into())
|
.import_finality_proof(hash, finality_proof.into())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
frame_support::debug::error!("Failed to finalize header {:?}: {:?}", hash, e);
|
log::error!("Failed to finalize header {:?}: {:?}", hash, e);
|
||||||
<Error<T>>::UnfinalizedHeader
|
<Error<T>>::UnfinalizedHeader
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
frame_support::debug::trace!("Successfully finalized header: {:?}", hash);
|
log::trace!("Successfully finalized header: {:?}", hash);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ decl_module! {
|
|||||||
ensure!(init_allowed, <Error<T>>::AlreadyInitialized);
|
ensure!(init_allowed, <Error<T>>::AlreadyInitialized);
|
||||||
initialize_bridge::<T>(init_data.clone());
|
initialize_bridge::<T>(init_data.clone());
|
||||||
|
|
||||||
frame_support::debug::info!(
|
log::info!(
|
||||||
"Pallet has been initialized with the following parameters: {:?}", init_data
|
"Pallet has been initialized with the following parameters: {:?}", init_data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -265,11 +265,11 @@ decl_module! {
|
|||||||
match new_owner {
|
match new_owner {
|
||||||
Some(new_owner) => {
|
Some(new_owner) => {
|
||||||
ModuleOwner::<T>::put(&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 => {
|
None => {
|
||||||
ModuleOwner::<T>::kill();
|
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) {
|
pub fn halt_operations(origin) {
|
||||||
ensure_owner_or_root::<T>(origin)?;
|
ensure_owner_or_root::<T>(origin)?;
|
||||||
IsHalted::put(true);
|
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.
|
/// Resume all pallet operations. May be called even if pallet is halted.
|
||||||
@@ -291,7 +291,7 @@ decl_module! {
|
|||||||
pub fn resume_operations(origin) {
|
pub fn resume_operations(origin) {
|
||||||
ensure_owner_or_root::<T>(origin)?;
|
ensure_owner_or_root::<T>(origin)?;
|
||||||
IsHalted::put(false);
|
IsHalted::put(false);
|
||||||
frame_support::debug::info!("Resuming pallet operations.");
|
log::info!("Resuming pallet operations.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,9 +240,9 @@ where
|
|||||||
&proof.0,
|
&proof.0,
|
||||||
)
|
)
|
||||||
.map_err(|_| FinalizationError::InvalidJustification)?;
|
.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 {:?}",
|
"Checking ancestry for headers between {:?} and {:?}",
|
||||||
last_finalized,
|
last_finalized,
|
||||||
header
|
header
|
||||||
|
|||||||
Reference in New Issue
Block a user