Skip to content

Commit 0dfa721

Browse files
committed
feat(wip): embedded relayer
1 parent 9fba5c6 commit 0dfa721

File tree

8 files changed

+660
-34
lines changed

8 files changed

+660
-34
lines changed

Cargo.lock

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

crates/bitcoin/src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ pub(crate) mod tests {
413413

414414
#[test]
415415
fn test_parse_block_header() {
416-
let hex_header = sample_block_header();
416+
let hex_header = "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff7f2002000000";
417417
let parsed_header = BlockHeader::from_hex(&hex_header).unwrap();
418418
assert_eq!(parsed_header.version, 4);
419419
assert_eq!(parsed_header.timestamp, 1415239972);

crates/btc-relay/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ pub mod pallet {
352352

353353
/// BTC height when the relay was initialized
354354
#[pallet::storage]
355-
pub(super) type StartBlockHeight<T: Config> = StorageValue<_, u32, ValueQuery>;
355+
pub type StartBlockHeight<T: Config> = StorageValue<_, u32, ValueQuery>;
356356

357357
/// Increment-only counter used to track new BlockChain entries
358358
#[pallet::storage]

parachain/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ futures = "0.3.15"
2525
jsonrpsee = { version = "0.16.2", features = ["server", "macros"] }
2626
serde_json = "1.0.68"
2727
regex = "1.5.6"
28+
bitcoin_client = { path = "../../polkabtc-clients/bitcoin/", package = "bitcoin", features=["cli"]}
29+
hex = "0.4.2"
2830

2931
# Parachain dependencies
3032
interlay-runtime = { package = "interlay-runtime-parachain", path = "./runtime/interlay" }
3133
kintsugi-runtime = { package = "kintsugi-runtime-parachain", path = "./runtime/kintsugi" }
3234
runtime-common = { package = "runtime-common", path = "./runtime/common" }
3335
interbtc-rpc = { path = "../rpc" }
34-
bitcoin = { path = "../crates/bitcoin" }
36+
bitcoin = { path = "../crates/bitcoin", features = ["parser"] }
3537
loans = { path = "../crates/loans" }
3638
primitives = { package = "interbtc-primitives", path = "../primitives" }
3739

@@ -124,6 +126,9 @@ fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0
124126
fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" }
125127
pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.42" }
126128

129+
tokio = "1.22.0"
130+
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
131+
127132
[features]
128133
default = []
129134

parachain/runtime/kintsugi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub use sp_runtime::BuildStorage;
7575
pub use sp_runtime::{FixedU128, Perbill, Permill};
7676

7777
// interBTC exports
78-
pub use btc_relay::{bitcoin, Call as BtcRelayCall, TARGET_SPACING};
78+
pub use btc_relay::{self, bitcoin, Call as BtcRelayCall, TARGET_SPACING};
7979
pub use constants::{currency::*, time::*};
8080
pub use oracle_rpc_runtime_api::BalanceWrapper;
8181
pub use orml_asset_registry::AssetMetadata;

parachain/src/cli.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ pub struct Cli {
9090
#[clap(flatten)]
9191
pub eth: EthConfiguration,
9292

93+
/// Connection settings for Bitcoin Core for relay purposes.
94+
#[clap(flatten)]
95+
pub bitcoin: bitcoin_client::cli::BitcoinOpts,
96+
9397
/// Relaychain arguments
9498
#[clap(raw = true)]
9599
pub relaychain_args: Vec<String>,

parachain/src/command.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,10 @@ pub fn run() -> Result<()> {
470470

471471
runner
472472
.run_node_until_exit(|config| async move {
473+
log::info!("Im here");
474+
// let bitcoin_rpc = cli.bitcoin.new_client(None).await.unwrap();
475+
// plan: use pool.
476+
// bitcoin_rpc.
473477
if cli.instant_seal {
474478
start_instant(cli, config).await
475479
} else {
@@ -484,6 +488,7 @@ pub fn run() -> Result<()> {
484488
async fn start_instant(cli: Cli, config: Configuration) -> sc_service::error::Result<TaskManager> {
485489
with_runtime_or_err!(config.chain_spec, {
486490
{
491+
log::info!("starting instant..");
487492
crate::service::start_instant::<RuntimeApi, Executor, TransactionConverter>(config, cli.eth)
488493
.await
489494
.map(|r| r.0)

0 commit comments

Comments
 (0)