Skip to content
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
219 changes: 116 additions & 103 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions bin/rialto/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions bin/rialto/runtime/src/exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions modules/call-dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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",
Expand Down
24 changes: 12 additions & 12 deletions modules/call-dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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,
Expand All @@ -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;
}
Expand All @@ -243,15 +243,15 @@ 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) => {
let digest = account_ownership_digest(&call, source_account_id, message.spec_version, bridge);

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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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![],
}],
Expand Down
2 changes: 2 additions & 0 deletions modules/currency-exchange/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -36,6 +37,7 @@ std = [
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"log/std",
"serde",
"sp-runtime/std",
"sp-std/std",
Expand Down
4 changes: 2 additions & 2 deletions modules/currency-exchange/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions modules/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -36,6 +37,7 @@ std = [
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"log/std",
"serde",
"sp-io/std",
"sp-runtime/std",
Expand Down
28 changes: 14 additions & 14 deletions modules/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -1001,15 +1001,15 @@ 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",
);

false
}
Err(err) => {
frame_support::debug::trace!(
log::trace!(
target: "runtime",
"Tx finality check failed: receipt check has failed: {}",
err,
Expand Down
4 changes: 2 additions & 2 deletions modules/ethereum/src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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),
Expand Down
Loading