Skip to content

Commit ad707a8

Browse files
Revert Bridge Relay related modules #9430
1 parent eaeb2f6 commit ad707a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+823
-770
lines changed

Cargo.lock

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

bridges/relays/client-substrate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ async-trait = { workspace = true }
1616
codec = { workspace = true, default-features = true }
1717
futures = { workspace = true }
1818
jsonrpsee = { features = ["macros", "ws-client"], workspace = true }
19+
log = { workspace = true }
1920
num-traits = { workspace = true, default-features = true }
2021
quick_cache = { workspace = true }
2122
rand = { workspace = true, default-features = true }
2223
scale-info = { features = ["derive"], workspace = true, default-features = true }
2324
serde_json = { workspace = true }
2425
thiserror = { workspace = true }
2526
tokio = { features = ["rt-multi-thread"], workspace = true, default-features = true }
26-
tracing = { workspace = true }
2727

2828
# Bridge dependencies
2929
bp-header-chain = { workspace = true, default-features = true }

bridges/relays/client-substrate/src/client/rpc.rs

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ impl<C: Chain> RpcClient<C> {
119119
loop {
120120
match Self::try_connect(params.clone()).await {
121121
Ok(client) => return client,
122-
Err(error) => tracing::error!(
122+
Err(error) => log::error!(
123123
target: "bridge",
124-
?error,
125-
"Failed to connect to {} node. Going to retry in {}s",
124+
"Failed to connect to {} node: {:?}. Going to retry in {}s",
126125
C::NAME,
126+
error,
127127
RECONNECT_DELAY.as_secs(),
128128
),
129129
}
@@ -177,7 +177,7 @@ impl<C: Chain> RpcClient<C> {
177177
Err(Error::WaitingForRuntimeUpgrade { chain: C::NAME.into(), expected, actual }),
178178
Ordering::Equal => Ok(()),
179179
Ordering::Greater => {
180-
tracing::error!(
180+
log::error!(
181181
target: "bridge",
182182
"The {} client is configured to use runtime version {expected:?} and actual \
183183
version is {actual:?}. Aborting",
@@ -195,7 +195,7 @@ impl<C: Chain> RpcClient<C> {
195195
) -> Result<(Arc<tokio::runtime::Runtime>, Arc<WsClient>)> {
196196
let tokio = tokio::runtime::Runtime::new()?;
197197
let uri = params.uri.clone();
198-
tracing::info!(target: "bridge", %uri, "Connecting to {} node", C::NAME);
198+
log::info!(target: "bridge", "Connecting to {} node at {}", C::NAME, uri);
199199

200200
let client = tokio
201201
.spawn(async move {
@@ -240,7 +240,7 @@ impl<C: Chain> RpcClient<C> {
240240
self.jsonrpsee_execute(move |client| async move {
241241
Ok(SubstrateFrameSystemClient::<C>::account_next_index(&*client, account).await?)
242242
})
243-
.await
243+
.await
244244
}
245245

246246
/// Subscribe to finality justifications.
@@ -331,40 +331,40 @@ impl<C: Chain> Client<C> for RpcClient<C> {
331331
self.jsonrpsee_execute(move |client| async move {
332332
Ok(SubstrateChainClient::<C>::block_hash(&*client, Some(number)).await?)
333333
})
334-
.await
335-
.map_err(|e| Error::failed_to_read_header_hash_by_number::<C>(number, e))
334+
.await
335+
.map_err(|e| Error::failed_to_read_header_hash_by_number::<C>(number, e))
336336
}
337337

338338
async fn header_by_hash(&self, hash: HashOf<C>) -> Result<HeaderOf<C>> {
339339
self.jsonrpsee_execute(move |client| async move {
340340
Ok(SubstrateChainClient::<C>::header(&*client, Some(hash)).await?)
341341
})
342-
.await
343-
.map_err(|e| Error::failed_to_read_header_by_hash::<C>(hash, e))
342+
.await
343+
.map_err(|e| Error::failed_to_read_header_by_hash::<C>(hash, e))
344344
}
345345

346346
async fn block_by_hash(&self, hash: HashOf<C>) -> Result<SignedBlockOf<C>> {
347347
self.jsonrpsee_execute(move |client| async move {
348348
Ok(SubstrateChainClient::<C>::block(&*client, Some(hash)).await?)
349349
})
350-
.await
351-
.map_err(|e| Error::failed_to_read_block_by_hash::<C>(hash, e))
350+
.await
351+
.map_err(|e| Error::failed_to_read_block_by_hash::<C>(hash, e))
352352
}
353353

354354
async fn best_finalized_header_hash(&self) -> Result<HashOf<C>> {
355355
self.jsonrpsee_execute(|client| async move {
356356
Ok(SubstrateChainClient::<C>::finalized_head(&*client).await?)
357357
})
358-
.await
359-
.map_err(|e| Error::failed_to_read_best_finalized_header_hash::<C>(e))
358+
.await
359+
.map_err(|e| Error::failed_to_read_best_finalized_header_hash::<C>(e))
360360
}
361361

362362
async fn best_header(&self) -> Result<HeaderOf<C>> {
363363
self.jsonrpsee_execute(|client| async move {
364364
Ok(SubstrateChainClient::<C>::header(&*client, None).await?)
365365
})
366-
.await
367-
.map_err(|e| Error::failed_to_read_best_header::<C>(e))
366+
.await
367+
.map_err(|e| Error::failed_to_read_best_header::<C>(e))
368368
}
369369

370370
async fn subscribe_best_headers(&self) -> Result<Subscription<HeaderOf<C>>> {
@@ -373,7 +373,7 @@ impl<C: Chain> Client<C> for RpcClient<C> {
373373
move |client| async move { SubstrateChainClient::<C>::subscribe_new_heads(&*client).await },
374374
|e| Error::failed_to_subscribe_best_headers::<C>(e),
375375
)
376-
.await
376+
.await
377377
}
378378

379379
async fn subscribe_finalized_headers(&self) -> Result<Subscription<HeaderOf<C>>> {
@@ -384,7 +384,7 @@ impl<C: Chain> Client<C> for RpcClient<C> {
384384
},
385385
|e| Error::failed_to_subscribe_finalized_headers::<C>(e),
386386
)
387-
.await
387+
.await
388388
}
389389

390390
async fn subscribe_grandpa_finality_justifications(&self) -> Result<Subscription<Bytes>>
@@ -394,7 +394,7 @@ impl<C: Chain> Client<C> for RpcClient<C> {
394394
self.subscribe_finality_justifications("GRANDPA", move |client| async move {
395395
SubstrateGrandpaClient::<C>::subscribe_justifications(&*client).await
396396
})
397-
.await
397+
.await
398398
}
399399

400400
async fn generate_grandpa_key_ownership_proof(
@@ -408,30 +408,30 @@ impl<C: Chain> Client<C> for RpcClient<C> {
408408
SUB_API_GRANDPA_GENERATE_KEY_OWNERSHIP_PROOF.into(),
409409
(set_id, authority_id),
410410
)
411-
.await
411+
.await
412412
}
413413

414414
async fn subscribe_beefy_finality_justifications(&self) -> Result<Subscription<Bytes>> {
415415
self.subscribe_finality_justifications("BEEFY", move |client| async move {
416416
SubstrateBeefyClient::<C>::subscribe_justifications(&*client).await
417417
})
418-
.await
418+
.await
419419
}
420420

421421
async fn token_decimals(&self) -> Result<Option<u64>> {
422422
self.jsonrpsee_execute(move |client| async move {
423423
let system_properties = SubstrateSystemClient::<C>::properties(&*client).await?;
424424
Ok(system_properties.get("tokenDecimals").and_then(|v| v.as_u64()))
425425
})
426-
.await
426+
.await
427427
}
428428

429429
async fn runtime_version(&self) -> Result<RuntimeVersion> {
430430
self.jsonrpsee_execute(move |client| async move {
431431
Ok(SubstrateStateClient::<C>::runtime_version(&*client).await?)
432432
})
433-
.await
434-
.map_err(|e| Error::failed_to_read_runtime_version::<C>(e))
433+
.await
434+
.map_err(|e| Error::failed_to_read_runtime_version::<C>(e))
435435
}
436436

437437
async fn simple_runtime_version(&self) -> Result<SimpleRuntimeVersion> {
@@ -457,16 +457,16 @@ impl<C: Chain> Client<C> for RpcClient<C> {
457457
self.jsonrpsee_execute(move |client| async move {
458458
Ok(SubstrateStateClient::<C>::storage(&*client, cloned_storage_key, Some(at)).await?)
459459
})
460-
.await
461-
.map_err(|e| Error::failed_to_read_storage_value::<C>(at, storage_key, e))
460+
.await
461+
.map_err(|e| Error::failed_to_read_storage_value::<C>(at, storage_key, e))
462462
}
463463

464464
async fn pending_extrinsics(&self) -> Result<Vec<Bytes>> {
465465
self.jsonrpsee_execute(move |client| async move {
466466
Ok(SubstrateAuthorClient::<C>::pending_extrinsics(&*client).await?)
467467
})
468-
.await
469-
.map_err(|e| Error::failed_to_get_pending_extrinsics::<C>(e))
468+
.await
469+
.map_err(|e| Error::failed_to_get_pending_extrinsics::<C>(e))
470470
}
471471

472472
async fn submit_unsigned_extrinsic(&self, transaction: Bytes) -> Result<HashOf<C>> {
@@ -482,22 +482,22 @@ impl<C: Chain> Client<C> for RpcClient<C> {
482482
let tx_hash = SubstrateAuthorClient::<C>::submit_extrinsic(&*client, transaction)
483483
.await
484484
.map_err(|e| {
485-
tracing::error!(target: "bridge", error=?e, "Failed to send transaction to {} node", C::NAME);
485+
log::error!(target: "bridge", "Failed to send transaction to {} node: {:?}", C::NAME, e);
486486
e
487487
})?;
488-
tracing::trace!(target: "bridge", ?tx_hash, "Sent transaction to {} node", C::NAME);
488+
log::trace!(target: "bridge", "Sent transaction to {} node: {:?}", C::NAME, tx_hash);
489489
Ok(tx_hash)
490490
})
491-
.await
492-
.map_err(|e| Error::failed_to_submit_transaction::<C>(e))
491+
.await
492+
.map_err(|e| Error::failed_to_submit_transaction::<C>(e))
493493
}
494494

495495
async fn submit_signed_extrinsic(
496496
&self,
497497
signer: &AccountKeyPairOf<C>,
498498
prepare_extrinsic: impl FnOnce(HeaderIdOf<C>, NonceOf<C>) -> Result<UnsignedTransaction<C>>
499-
+ Send
500-
+ 'static,
499+
+ Send
500+
+ 'static,
501501
) -> Result<HashOf<C>>
502502
where
503503
C: ChainWithTransactions,
@@ -524,8 +524,8 @@ impl<C: Chain> Client<C> for RpcClient<C> {
524524
&self,
525525
signer: &AccountKeyPairOf<C>,
526526
prepare_extrinsic: impl FnOnce(HeaderIdOf<C>, NonceOf<C>) -> Result<UnsignedTransaction<C>>
527-
+ Send
528-
+ 'static,
527+
+ Send
528+
+ 'static,
529529
) -> Result<TransactionTracker<C, Self>>
530530
where
531531
C: ChainWithTransactions,
@@ -560,12 +560,12 @@ impl<C: Chain> Client<C> for RpcClient<C> {
560560
&*client,
561561
Bytes(signed_extrinsic),
562562
)
563-
.await
564-
.map_err(|e| {
565-
tracing::error!(target: "bridge", error=?e, "Failed to send transaction to {} node", C::NAME);
566-
e
567-
})?;
568-
tracing::trace!(target: "bridge", ?tx_hash, "Sent transaction to {} node", C::NAME);
563+
.await
564+
.map_err(|e| {
565+
log::error!(target: "bridge", "Failed to send transaction to {} node: {:?}", C::NAME, e);
566+
e
567+
})?;
568+
log::trace!(target: "bridge", "Sent transaction to {} node: {:?}", C::NAME, tx_hash);
569569
Ok(TransactionTracker::new(
570570
self_clone,
571571
stall_timeout,
@@ -576,8 +576,8 @@ impl<C: Chain> Client<C> for RpcClient<C> {
576576
),
577577
))
578578
})
579-
.await
580-
.map_err(|e| Error::failed_to_submit_transaction::<C>(e))
579+
.await
580+
.map_err(|e| Error::failed_to_submit_transaction::<C>(e))
581581
}
582582

583583
async fn validate_transaction<SignedTransaction: Encode + Send + 'static>(
@@ -590,7 +590,7 @@ impl<C: Chain> Client<C> for RpcClient<C> {
590590
SUB_API_TXPOOL_VALIDATE_TRANSACTION.into(),
591591
(TransactionSource::External, transaction, at),
592592
)
593-
.await
593+
.await
594594
}
595595

596596
async fn estimate_extrinsic_weight<SignedTransaction: Encode + Send + 'static>(
@@ -620,8 +620,8 @@ impl<C: Chain> Client<C> for RpcClient<C> {
620620
.await
621621
.map_err(Into::into)
622622
})
623-
.await
624-
.map_err(|e| Error::failed_state_call::<C>(at, method_clone, arguments_clone, e))
623+
.await
624+
.map_err(|e| Error::failed_state_call::<C>(at, method_clone, arguments_clone, e))
625625
}
626626

627627
async fn prove_storage(

0 commit comments

Comments
 (0)