Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit c1191fd

Browse files
authored
Bump Substrate (#796)
* Bump Substrate to version used by Polkadot (`5f056830`) * Use `log` crate for runtime logging See paritytech/substrate#8128 for more info. * Stop using return value from `execute_block` * Update test weight
1 parent e6328d7 commit c1191fd

20 files changed

Lines changed: 207 additions & 180 deletions

File tree

Cargo.lock

Lines changed: 116 additions & 103 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/millau/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ impl_runtime_apis! {
424424
}
425425

426426
fn execute_block(block: Block) {
427-
Executive::execute_block(block)
427+
Executive::execute_block(block);
428428
}
429429

430430
fn initialize_block(header: &<Block as BlockT>::Header) {

bin/rialto/runtime/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
1111
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
1212
hex-literal = "0.3"
1313
libsecp256k1 = { version = "0.3.4", optional = true, default-features = false, features = ["hmac"] }
14+
log = { version = "0.4.14", default-features = false }
1415
serde = { version = "1.0.124", optional = true, features = ["derive"] }
1516

1617
# Bridge dependencies
@@ -86,6 +87,7 @@ std = [
8687
"frame-support/std",
8788
"frame-system-rpc-runtime-api/std",
8889
"frame-system/std",
90+
"log/std",
8991
"pallet-aura/std",
9092
"pallet-balances/std",
9193
"pallet-bridge-eth-poa/std",

bin/rialto/runtime/src/exchange.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
8181

8282
// we only accept transactions sending funds directly to the pre-configured address
8383
if tx.unsigned.to != Some(LOCK_FUNDS_ADDRESS.into()) {
84-
frame_support::debug::trace!(
84+
log::trace!(
8585
target: "runtime",
8686
"Failed to parse fund locks transaction. Invalid peer recipient: {:?}",
8787
tx.unsigned.to,
@@ -94,7 +94,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
9494
match tx.unsigned.payload.len() {
9595
32 => recipient_raw.as_fixed_bytes_mut().copy_from_slice(&tx.unsigned.payload),
9696
len => {
97-
frame_support::debug::trace!(
97+
log::trace!(
9898
target: "runtime",
9999
"Failed to parse fund locks transaction. Invalid recipient length: {}",
100100
len,
@@ -106,7 +106,7 @@ impl MaybeLockFundsTransaction for EthTransaction {
106106
let amount = tx.unsigned.value.low_u128();
107107

108108
if tx.unsigned.value != amount.into() {
109-
frame_support::debug::trace!(
109+
log::trace!(
110110
target: "runtime",
111111
"Failed to parse fund locks transaction. Invalid amount: {}",
112112
tx.unsigned.value,

bin/rialto/runtime/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
290290
// - deposited != 0: (should never happen in practice) deposit has been partially completed
291291
match deposited_amount {
292292
_ if deposited_amount == amount => {
293-
frame_support::debug::trace!(
293+
log::trace!(
294294
target: "runtime",
295295
"Deposited {} to {:?}",
296296
amount,
@@ -300,7 +300,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
300300
Ok(())
301301
}
302302
_ if deposited_amount == 0 => {
303-
frame_support::debug::error!(
303+
log::error!(
304304
target: "runtime",
305305
"Deposit of {} to {:?} has failed",
306306
amount,
@@ -310,7 +310,7 @@ impl bp_currency_exchange::DepositInto for DepositInto {
310310
Err(bp_currency_exchange::Error::DepositFailed)
311311
}
312312
_ => {
313-
frame_support::debug::error!(
313+
log::error!(
314314
target: "runtime",
315315
"Deposit of {} to {:?} has partially competed. {} has been deposited",
316316
amount,
@@ -535,7 +535,7 @@ impl_runtime_apis! {
535535
}
536536

537537
fn execute_block(block: Block) {
538-
Executive::execute_block(block)
538+
Executive::execute_block(block);
539539
}
540540

541541
fn initialize_block(header: &<Block as BlockT>::Header) {

modules/call-dispatch/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
88

99
[dependencies]
1010
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
11+
log = { version = "0.4.14", default-features = false }
1112

1213
# Bridge dependencies
1314

@@ -33,6 +34,7 @@ std = [
3334
"bp-runtime/std",
3435
"frame-support/std",
3536
"frame-system/std",
37+
"log/std",
3638
"sp-core/std",
3739
"sp-runtime/std",
3840
"sp-std/std",

modules/call-dispatch/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
202202
let message = match message {
203203
Ok(message) => message,
204204
Err(_) => {
205-
frame_support::debug::trace!("Message {:?}/{:?}: rejected before actual dispatch", bridge, id);
205+
log::trace!("Message {:?}/{:?}: rejected before actual dispatch", bridge, id);
206206
Self::deposit_event(RawEvent::MessageRejected(bridge, id));
207207
return;
208208
}
@@ -212,7 +212,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
212212
// (we want it to be the same, because otherwise we may decode Call improperly)
213213
let expected_version = <T as frame_system::Config>::Version::get().spec_version;
214214
if message.spec_version != expected_version {
215-
frame_support::debug::trace!(
215+
log::trace!(
216216
"Message {:?}/{:?}: spec_version mismatch. Expected {:?}, got {:?}",
217217
bridge,
218218
id,
@@ -232,7 +232,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
232232
let call = match message.call.into() {
233233
Ok(call) => call,
234234
Err(_) => {
235-
frame_support::debug::trace!("Failed to decode Call from message {:?}/{:?}", bridge, id,);
235+
log::trace!("Failed to decode Call from message {:?}/{:?}", bridge, id,);
236236
Self::deposit_event(RawEvent::MessageCallDecodeFailed(bridge, id));
237237
return;
238238
}
@@ -243,15 +243,15 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
243243
CallOrigin::SourceRoot => {
244244
let hex_id = derive_account_id::<T::SourceChainAccountId>(bridge, SourceAccount::Root);
245245
let target_id = T::AccountIdConverter::convert(hex_id);
246-
frame_support::debug::trace!("Root Account: {:?}", &target_id);
246+
log::trace!("Root Account: {:?}", &target_id);
247247
target_id
248248
}
249249
CallOrigin::TargetAccount(source_account_id, target_public, target_signature) => {
250250
let digest = account_ownership_digest(&call, source_account_id, message.spec_version, bridge);
251251

252252
let target_account = target_public.into_account();
253253
if !target_signature.verify(&digest[..], &target_account) {
254-
frame_support::debug::trace!(
254+
log::trace!(
255255
"Message {:?}/{:?}: origin proof is invalid. Expected account: {:?} from signature: {:?}",
256256
bridge,
257257
id,
@@ -262,20 +262,20 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
262262
return;
263263
}
264264

265-
frame_support::debug::trace!("Target Account: {:?}", &target_account);
265+
log::trace!("Target Account: {:?}", &target_account);
266266
target_account
267267
}
268268
CallOrigin::SourceAccount(source_account_id) => {
269269
let hex_id = derive_account_id(bridge, SourceAccount::Account(source_account_id));
270270
let target_id = T::AccountIdConverter::convert(hex_id);
271-
frame_support::debug::trace!("Source Account: {:?}", &target_id);
271+
log::trace!("Source Account: {:?}", &target_id);
272272
target_id
273273
}
274274
};
275275

276276
// filter the call
277277
if !T::CallFilter::filter(&call) {
278-
frame_support::debug::trace!(
278+
log::trace!(
279279
"Message {:?}/{:?}: the call ({:?}) is rejected by filter",
280280
bridge,
281281
id,
@@ -291,7 +291,7 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
291291
let dispatch_info = call.get_dispatch_info();
292292
let expected_weight = dispatch_info.weight;
293293
if message.weight < expected_weight {
294-
frame_support::debug::trace!(
294+
log::trace!(
295295
"Message {:?}/{:?}: passed weight is too low. Expected at least {:?}, got {:?}",
296296
bridge,
297297
id,
@@ -310,11 +310,11 @@ impl<T: Config<I>, I: Instance> MessageDispatch<T::MessageId> for Module<T, I> {
310310
// finally dispatch message
311311
let origin = RawOrigin::Signed(origin_account).into();
312312

313-
frame_support::debug::trace!("Message being dispatched is: {:?}", &call);
313+
log::trace!("Message being dispatched is: {:?}", &call);
314314
let dispatch_result = call.dispatch(origin);
315315
let actual_call_weight = extract_actual_weight(&dispatch_result, &dispatch_info);
316316

317-
frame_support::debug::trace!(
317+
log::trace!(
318318
"Message {:?}/{:?} has been dispatched. Weight: {} of {}. Result: {:?}",
319319
bridge,
320320
id,
@@ -606,7 +606,7 @@ mod tests {
606606
vec![EventRecord {
607607
phase: Phase::Initialization,
608608
event: Event::call_dispatch(call_dispatch::Event::<TestRuntime>::MessageWeightMismatch(
609-
bridge, id, 1279000, 0,
609+
bridge, id, 1345000, 0,
610610
)),
611611
topics: vec![],
612612
}],

modules/currency-exchange/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
88

99
[dependencies]
1010
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
11+
log = { version = "0.4.14", default-features = false }
1112
serde = { version = "1.0", optional = true }
1213

1314
# Bridge dependencies
@@ -36,6 +37,7 @@ std = [
3637
"frame-benchmarking/std",
3738
"frame-support/std",
3839
"frame-system/std",
40+
"log/std",
3941
"serde",
4042
"sp-runtime/std",
4143
"sp-std/std",

modules/currency-exchange/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ decl_module! {
113113
// reward submitter for providing valid message
114114
T::OnTransactionSubmitted::on_valid_transaction_submitted(submitter);
115115

116-
frame_support::debug::trace!(
116+
log::trace!(
117117
target: "runtime",
118118
"Completed currency exchange: {:?}",
119119
deposit.transfer_id,
@@ -138,7 +138,7 @@ impl<T: Config<I>, I: Instance> Module<T, I> {
138138
proof: &<T::PeerBlockchain as InclusionProofVerifier>::TransactionInclusionProof,
139139
) -> bool {
140140
if let Err(err) = prepare_deposit_details::<T, I>(proof) {
141-
frame_support::debug::trace!(
141+
log::trace!(
142142
target: "runtime",
143143
"Can't accept exchange transaction: {:?}",
144144
err,

modules/ethereum/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
99
[dependencies]
1010
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
1111
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"], optional = true }
12+
log = { version = "0.4.14", default-features = false }
1213
serde = { version = "1.0", optional = true }
1314

1415
# Bridge dependencies
@@ -36,6 +37,7 @@ std = [
3637
"frame-benchmarking/std",
3738
"frame-support/std",
3839
"frame-system/std",
40+
"log/std",
3941
"serde",
4042
"sp-io/std",
4143
"sp-runtime/std",

0 commit comments

Comments
 (0)