Skip to content

Commit 2e49ff4

Browse files
committed
chore: debug info
1 parent e62469d commit 2e49ff4

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

runtime/src/rpc.rs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
AccountId, AssetRegistry, CurrencyId, Error, InterBtcRuntime, InterBtcSigner, RetryPolicy, RichH256Le, SubxtError,
88
};
99
use async_trait::async_trait;
10-
use bitcoin::RawTransactionProof;
10+
use bitcoin::{FromHex, RawTransactionProof};
1111
use codec::{Decode, Encode};
1212
use futures::{future::join_all, stream::StreamExt, FutureExt, SinkExt, Stream};
1313
use module_bitcoin::{
@@ -17,6 +17,7 @@ use module_bitcoin::{
1717
};
1818
use primitives::{BalanceWrapper, UnsignedFixedPoint};
1919
use serde_json::Value;
20+
use sp_core::bytes::to_hex;
2021
use std::{convert::TryInto, future::Future, ops::Range, sync::Arc, time::Duration};
2122
use subxt::{
2223
blocks::ExtrinsicEvents,
@@ -140,6 +141,35 @@ impl InterBtcParachain {
140141
Ok(parachain_rpc)
141142
}
142143

144+
pub async fn print_debug_info(&self) {
145+
log::info!("metadata hash: {}", to_hex(&self.api.metadata().hasher().hash(), false));
146+
// log::info!(""
147+
// let batch_hash =
148+
let header = RawBlockHeader(Vec::from_hex("010000007de867cc8adc5cc8fb6b898ca4462cf9fd667d7830a275277447e60800000000338f121232e169d3100edd82004dc2a1f0e1f030c6c488fa61eafa930b0528fe021f7449ffff001d36b4af9a").unwrap());
149+
let header = parse_block_header(&header.0).unwrap();
150+
151+
let fork_bound = self.get_chain_counter().await.unwrap().saturating_add(1);
152+
153+
154+
155+
let inner_call = metadata::tx().btc_relay().store_block_header(
156+
Static(header),
157+
fork_bound,
158+
);
159+
160+
log::info!("Inner call validation: {:?}", self.api.tx().validate(&inner_call));
161+
162+
let outer_call = metadata::tx().utility().batch(vec![EncodedCall::BTCRelay(metadata::runtime_types::btc_relay::pallet::Call::store_block_header {
163+
block_header: Static(header),
164+
fork_bound,
165+
})]);
166+
log::info!("outer call validation: {:?}", self.api.tx().validate(&outer_call));
167+
168+
// let
169+
// let res = btc_parachain.store_block_headers(vec![header]).await;
170+
// tracing::info!("res: {:?}", res.map_err(|x| x.to_human()));
171+
}
172+
143173
#[cfg(feature = "testing-utils")]
144174
pub async fn manual_seal(&self) {
145175
// rather than adding a conditional dependency on substrate, just re-define the

vault/src/connection_manager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ impl<Config: Clone + Send + 'static, F: Fn()> ConnectionManager<Config, F> {
9999
)
100100
.await?;
101101

102+
btc_parachain.print_debug_info().await;
103+
102104
let config_copy = self.bitcoin_config.clone();
103105
let network_copy = bitcoin_core_master.network();
104106

0 commit comments

Comments
 (0)