Skip to content

Commit

Permalink
Release v2.0.1 (#100)
Browse files Browse the repository at this point in the history
* NODE-106, deps: `polkadot-sdk@stable2407` migration (#67)

* [Testnet] Apply Bitcoin Relay Protocol (BRP) (#53)

* NODE-98, feat: bitcoin registration pool (#41)

* NODE-96, feature: initialize pallet

* NODE-96, feature: init storage

* NODE-96, feature: init extrinsics

* NODE-96, feature: impl signature verification

* NODE-96, docs: add missing doc-strings

* NODE-96, feature: attach precompile

* NODE-96, fix: resolve precompile interface

* NODE-96, fix: use correct string bound

* NODE-96, fix: use vector

* NODE-96, test: add tests

* NODE-96, chore: simple fix

* NODE-98, feat: add relay executives

* NODE-98, feat: finalize pallet

* NODE-98, feat: update precompile

* NODE-98, feat: add config set extrinsics

* NODE-98, fix: resolve imports

* NODE-98, fix: update types

* NODE-98, fix: n check

* NODE-98, test: add test

* NODE-98, chore: apply feedback

* NODE-98, refactor: use better structure

* NODE-98, refactor: use better structure (2)

* NODE-98, feat: add system vault

* NODE-98, test: fix test code

* NODE-98, chore: simplify message

* NODE-98, chore: remove unused import

* NODE-99, feature: btc socket queue (#42)

* NODE-99, chore: init pallet

* NODE-99, feat: init pallet

* NODE-99, refactor: use multi-sig primitive

* NODE-99, chore: temp

* NODE-99, feat: impl extrinsics

* NODE-99, feat: add pallet

* NODE-99, fix: support no-std

* NODE-99, fix: resolve wasm build

* NODE-99, fix: comment out build

* NODE-99, feat: set submitter

* NODE-99, fix: use correct psbt hash

* NODE-99, test: add tests

* NODE-99, feat: verify duplicate signed psbt

* NODE-99, feat: verify socket message

* NODE-99, feat: verify psbt outputs

* NODE-99, fix: signed psbt

* NODE-99, refactor: update

* NODE-99, chore: set genesis config

* NODE-99, feat: add precompile

* NODE-99, feat: add relay exec precompile

* NODE-99, refactor: use unbounded bytes

* NODE-99, refactor: move miniscript to primitive only

* NODE-99, chore: check token len

* NODE-99, chore: use amount unit as sat

* NODE-99, chore: remove impl code

* NODE-99, chore: simplify code with closure

* NODE-99, chore: impl TryFrom

* NODE-99, chore: add missing docstrings

* NODE-99, fix: replace T::Signer to T::AccountId

* NODE-99, feat: store socket messages to check duplications

* NODE-99, feat: check duplicate socket message submission

* NODE-99, test: test unsigned psbt submission

* NODE-99, test: test signed psbt submission

* NODE-99, test: test finalize request

* NODE-99, fix: resolve registration pool test errors

* NODE-99, fix: check bonded pubKeys

* NODE-99, test: system vault test

* NODE-99, feat: add set_refund

* NODE-99, chore: apply cargo-clippy

* NODE-99, feat: add pending registrations

* NODE-99, fix: rename function

* NODE-99, feat: add role checker

* NODE-99, fix: apply change suggestions

* NODE-99, feat: add BondedOutboundTx

* NODE-99, feat: add precompile function

* NODE-99, fix: allow every bitcoin network type

* NODE-99, feat: add registration_info()

* NODE-102, feature: socket queue update (#43)

* NODE-102, feat: add system vout

* NODE-102, feat: try psbt finalization

* NODE-102, feat: check if message is outbound

* NODE-102, fix: update system vault interface

* NODE-102, fix: remove system vault from function

* NODE-102, fix: use correct uint type

* NODE-102, feat: allow multiple signed psbt submissions

* NODE-102, test: fix tests

* NODE-98, feat: build address script from descriptor

* NODE-98, chore: `[u8; 33]` can convert into `PublicKeyBytes`

* NODE-98, chore: not max length. should be length

* NODE-98, fix: multisig `m` could be 20 & bech32 max length is 90

* NODE-98, refactor:

* NODE-98, chore: remove unused import

* NODE-98, fix: typo

* NODE-98, refactor: remove redundant

* NODE-98, chore: unnecessary path prefix

* Update precompiles/btc-socket-queue/src/lib.rs

* NODE-98, chore: resolve comment

* NODE-98, fix: swap txid endian format

* NODE-98, test: update test code

* NODE-98, chore: update npm packages

* NODE-98, test: use correct socket message

* NODE-98, feat: store descriptor

* NODE-98, test: check descriptor existance

* NODE-98, feat: viewable descriptor

* NODE-98, refactor: use same struct

---------

Co-authored-by: alstjd0921 <[email protected]>

* deploy: init testbed config

* deps: update dev chain spec

* fix: use correct context and update precompile

* fix: use single event

* test: update test

* feat: update precompile

* deps: increase runtime version

* fix: rename extrinsic

* deps: increase runtime version

* NODE-108, feat: socket queue update(2) (#48)

* NODE-108, fix: use txid as storage key

* NODE-108, feat: update precompile

* NODE-108, test: update test code

* NODE-109, feat: registration pool update (#49)

* NODE-109, feat: add clear_vault()

* NODE-109, fix: remove duplicate genesis config

* NODE-109, test: update test

* NODE-109, fix: consider system vault clear

* NODE-109, test: update test

* deps: increase runtime version

* NODE-110, fix: use desc address (#50)

* deps: increase runtime version (335)

* fix: resolve pallet issue

* NODE-114, fix: use dynamic multiSig fields & allow duplicate refund addresses (#51)

* NODE-114, fix: use dynamic n and ratio

* NODE-114, test: update tests

* NODE-114, chore: add migration

* NODE-114, fix: allow duplicate refund addresses

* NODE-114, test: update tests

* NODE-114, fix: remove unused weights

* fix: resolve import error

* deps: reset testbed

* fix: (review) move event recording

* [CCCP-385] registration-pool migration process (#55)

* CCCP-385, feature: registration pool roundup process

* CCCP-385, chore: move migration sequence enum to primitives

* CCCP-385, feature: add pool_round argument for registration pool's evm interface

* CCCP-385, chore: add default state

* CCCP-385, chore: remove `DefaultPoolRound`

* CCCP-385, fix: use correct access control

* CCCP-385, chore: set storageVersion to 1, remove migrations.rs

* NODE-117, feat: rollback protocol (#54)

* NODE-117, feat: impl rollback request submission

* NODE-117, feat: impl rollback poll submission

* NODE-117, fix: insert BondedOutboundTx only for non-rollback requests

* NODE-117, chore: cleanup palet

* NODE-117, feat: update precompile

* NODE-117, chore: update doc-string

* NODE-117, test: resolve test failures

* NODE-117, fix: use correct origin

* NODE-117, test: add rollback tests

* NODE-117, fix: resolve encode errors

* NODE-117, chore: add missing docstrings

* NODE-117, fix: prevent same side voting

* NODE-117, feat: update precompile

* NODE-117, feat: bond rollback output

* NODE-117, test: update ttest

* NODE-117, fix: use correct key prefix

* chore: remove redundant

* chore: remove unused import

* fix: typo

---------

Co-authored-by: alstjd0921 <[email protected]>

---------

Co-authored-by: Alex Won <[email protected]>

* fix: add missing imports

* fix: double check storage existence

* NODE-119, unsigned psbt message update (#56)

* NODE-119, fix: update psbt output verification

* NODE-119, fix: check psbt output amount only for refunds

* NODE-119, fix: resolve wrong state check

* NODE-119, fix: check migration sequence

* NODE-119, feat: add migration request submission

* NODE-119, fix: set correct runtime error

* fix: set default code for precompiles

* deps: update dev chain spec

* fix: use vec instead of map

* fix: check system vault

* feat: add precompile function

* chore: add missing event

* fix: add function inputs

* minor fixes (#57)

* feat: add multisig ration set extrinsic

* fix: use correct duplication check

* deps: update rust docker version

* fix: change output can not always exist

* deps: use latest rust image

* [CCCP-403] Implement `vault_key_presubmission` (#58)

* CCCP-403, feature: storage `PresubmittedPubKeys`

* CCCP-403, feature: implement vault key pre-submission

* CCCP-403, feature: Immediately generate vault address when all executives pre-submitted keys

* CCCP-403, fix: resolve comments

* chore: update ensure (#59)

* chore: update ensure

* chore: update comment

Co-authored-by: Min-seong Kwon <[email protected]>

---------

Co-authored-by: Min-seong Kwon <[email protected]>

* fix: socket queue minor update (#60)

* fix: use psbt txid

* fix: remove useless state checks

* deps: increase runtime version (349)

* fix: use correct output len check & add output to check

* fix: use ensure_root (#61)

* fix: simply use txid instead of psbt bytes (#62)

* chore: add missing pool events (#63)

* NODE-120, test code update (#64)

* NODE-120, fix: update ethers

* NODE-120, fix: update ethers (2)

* NODE-120, fix: registration pool tests

* NODE-120, fix: socket queue tests

* NODE-120, chore: rollback to dev runtime

* NODE-120, chore: update npm package

* fix: simplify context

* deps: release pre-v2.0.0

* NODE-122, feature: apply brp to testnet (#65)

* NODE-122, feature: apply brp to testnet

* NODE-122, chore: init pallet storage v1

---------

Co-authored-by: alstjd0921 <[email protected]>

* chore: remove passed storage migration

* NODE-127, fix: add psbt fee verification logic (#69)

* NODE-127, fix: filter meaningless psbt

* NODE-127, chore: resolve `unexpected cfg condition value`

* NODE-127, fix: add psbt fee verification logic

* Update pallets/btc-socket-queue/src/pallet/mod.rs

Co-authored-by: Alex Won <[email protected]>

* NODE-127, fix: add missing psbt fee verification logic

* NODE-127, chore: set default max fee rate

---------

Co-authored-by: Alex Won <[email protected]>

* NODE-128, fix: add `SetExecutiveMembers` to `MigrationSequence` (#70)

* NODE-128, fix: add SetExecutiveMembers to MigrationSequence

* NODE-128, chore: add doc-strings

* NODE-130, fix: Update to unpayable extrinsics (#72)

* NODE-130, fix: replace unsigned transactions to unpayable extrinsics - registration pool

* NODE-130, fix: replace unsigned transactions to unpayable extrinsics - socket queue

* NODE-130, fix: remove unused Config type

* NODE-130, chore: add AuthorityDNE error

* NODE-126, fix: consider address check after vault generation (#68)

* NODE-126, fix: consider address check after vault generation

* NODE-126, fix: remove pubkey clear logic

* NODE-126, fix: insert default on failure

* fix: replace to `ensure_signed` (#73)

* fix: replace to ensure_signed

* test: replace test to signed tx

* Revert "fix: replace to `ensure_signed` (#73)" (#74)

This reverts commit b64dc4b.

* Revert "NODE-130, fix: Update to unpayable extrinsics (#72)" (#75)

This reverts commit 883262e.

* NODE-131, fix: add verifiers to signature (#76)

* NODE-131, fix: add pool_round to signature

* NODE-131, fix: add SigDomain

* NODE-131, fix: use concatenated bytes

* NODE-131, fix: use remove :?

* NODE-134, feat: add `submit_bump_fee_request()` (#78)

* NODE-134, feat: add submit_bump_fee_request

* NODE-134, feat: insert new SocketMessages

* NODE-134, fix: improve verification

* Update pallets/btc-socket-queue/src/pallet/impls.rs

Co-authored-by: Min-seong Kwon <[email protected]>

* Update pallets/btc-socket-queue/src/pallet/impls.rs

Co-authored-by: Min-seong Kwon <[email protected]>

---------

Co-authored-by: Min-seong Kwon <[email protected]>

* NODE-139, fix: only permit when the migration tx broadcast (#84)

* NODE-139, fix: only permit when the migration tx broadcast

* NODE-139, fix: consider multiple migration transactions

* NODE-141, fix: include field `is_approved` into signature message (#86)

* NODE-140, fix: `btc-socket-queue` should be empty before pool migration (#85)

Co-authored-by: Alex Won <[email protected]>

* NODE-142, refactor: apply pending and approval process when setting refunds (#87)

* NODE-142, refactor: apply pending and approval process when setting refunds

* chore: remove unnecessary `return`

* NODE-142, chore: store current and present addresses both

---------

Co-authored-by: alstjd0921 <[email protected]>

* NODE-144, feat: update `submit_bump_fee_request()` (#89)

* NODE-144, feat: make it compatible with rollbacks/migrations

* NODE-144, fix: use correct output check

* NODE-144, fix: use correct storage key

* NODE-144, fix: use mutate

* NODE-106, deps: update to bifrost-polkadot-v1.12.0

* NODE-106, fix: use in_code_storage_version()

* NODE-106, fix: resolve collective precompile compile error

* NODE-106, fix: resolve UnboundedBytes comparison

* NODE-106, fix: remove unused param

* NODE-106, fix: use legacy

* NODE-106, feat: update pallet_balances config

* NODE-106, feat: update pallet_identity config

* NODE-106, feat: add RuntimeTask type

* NODE-106, feat: add migrations and system callbacks

* NODE-106, feat: expose SlotDuration

* NODE-106, feat: add runtime apis

* NODE-106, fix: resolve Aura storage access

* NODE-106, feat: migrate to fungible

* NODE-106, deps: std and serde setup

* NODE-106, fix: rollback GasWeightMapping import

* NODE-106, feat: update client side

* NODE-106, fix: rollback CurrencyAdaptor

* NODE-106, deps: add Migrations

* NODE-106, feat: impl safe-mode and tx-pause

* NODE-106, feat: replace to derive_impl and v2 runtime construction

* NODE-106, chore: set CFLAGS mcpu=mvp on aarch64 arch

* NODE-106, deps: replace substrate-fixed to concrete version

* NODE-106, refactor: remove pallet::getter from custom pallets

* NODE-106, chore: possibly overflow

* NODE-106, deps: remove unused dependencies

* NODE-106, fix: remove deprecated getter

* NODE-106, deps: bump to stable2407

* NODE-106, chore: replace deprecated getters

* NODE-106, chore: Add RPC api pending_initialize_block

* NODE-106, chore: update pallet_treasury config

* NODE-106, chore: remove generic

* NODE-106, fix: remove deprecated getter

* NODE-106, fix: resolve merge conflicts

* NODE-106, deps: release v2.0.1

* NODE-106, fix: use correct balance

* NODE-106, fix: remove duplicate test code

* NODE-106, fix: remove deposit amount

* NODE-106, chore: update SafeModeWhitelistedCalls

* NODE-106, fix: remove experimental features

---------

Co-authored-by: alstjd0921 <[email protected]>

* fix: replace deprecated function

* fix: resolve old syntax

* feat: include system vault address

* deps: update cargo

* chore: update package.json

* chore: remove passed storage migrations

* deps: update cargo

* feat: update cargo - Cancun support

* deps: update cargo (bifrost-frontier)

* (rollback): include system vault address

---------

Co-authored-by: alstjd0921 <[email protected]>
  • Loading branch information
dnjscksdn98 and alstjd0921 authored Dec 10, 2024
1 parent 08764c1 commit 4954cf7
Show file tree
Hide file tree
Showing 81 changed files with 4,727 additions and 3,905 deletions.
5,090 changes: 2,866 additions & 2,224 deletions Cargo.lock

Large diffs are not rendered by default.

233 changes: 111 additions & 122 deletions Cargo.toml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions node/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ frame-benchmarking = { workspace = true, features = ["std"] }
sp-core = { workspace = true, features = ["std"] }
sp-runtime = { workspace = true, features = ["std"] }
sp-api = { workspace = true, features = ["std"] }
sp-io = { workspace = true, features = ["std"] }
sp-blockchain = { workspace = true }
sp-block-builder = { workspace = true, features = ["std"] }

Expand Down
52 changes: 8 additions & 44 deletions node/common/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@ use crate::cli_opt::EthApi as EthApiCmd;

use std::{collections::BTreeMap, sync::Arc};

use fc_rpc::{
EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,
SchemaV2Override, SchemaV3Override, StorageOverride,
};
use fc_rpc::{EthBlockDataCacheTask, StorageOverride};
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use sc_client_api::{backend::Backend, StorageProvider};
use sc_consensus_grandpa::{
FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,
};
use sc_consensus_manual_seal::EngineCommand;
use sc_network::NetworkService;
use sc_network::service::traits::NetworkService;
use sc_network_sync::SyncingService;
use sc_rpc::SubscriptionTaskExecutor;
use sc_rpc_api::DenyUnsafe;
use sc_service::TaskManager;
use sc_transaction_pool::{ChainApi, Pool};

use bp_core::{BlockNumber, Hash, Header};
use fp_rpc::{self, EthereumRuntimeRPCApi};
use fp_storage::EthereumStorageSchema;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_core::H256;
use sp_runtime::{generic, traits::Block as BlockT, OpaqueExtrinsic as UncheckedExtrinsic};

Expand All @@ -41,35 +34,6 @@ where
fc_rpc::frontier_backend_client::SystemAccountId20StorageOverride<Block, C, BE>;
}

/// Override storage
pub fn overrides_handle<B, C, BE>(client: Arc<C>) -> Arc<OverrideHandle<B>>
where
B: BlockT,
C: ProvideRuntimeApi<B>,
C::Api: EthereumRuntimeRPCApi<B>,
C: HeaderBackend<B> + StorageProvider<B, BE> + 'static,
BE: Backend<B> + 'static,
{
let mut overrides_map = BTreeMap::new();
overrides_map.insert(
EthereumStorageSchema::V1,
Box::new(SchemaV1Override::new(client.clone())) as Box<dyn StorageOverride<_>>,
);
overrides_map.insert(
EthereumStorageSchema::V2,
Box::new(SchemaV2Override::new(client.clone())) as Box<dyn StorageOverride<_>>,
);
overrides_map.insert(
EthereumStorageSchema::V3,
Box::new(SchemaV3Override::new(client.clone())) as Box<dyn StorageOverride<_>>,
);

Arc::new(OverrideHandle {
schemas: overrides_map,
fallback: Box::new(RuntimeApiStorageOverride::new(client.clone())),
})
}

/// Extra dependencies for GRANDPA
pub struct GrandpaDeps<B> {
/// Voting round info.
Expand Down Expand Up @@ -105,7 +69,7 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
/// The Node authority flag
pub is_authority: bool,
/// Network service
pub network: Arc<NetworkService<Block, Hash>>,
pub network: Arc<dyn NetworkService>,
/// EthFilterApi pool.
pub filter_pool: FilterPool,
/// List of optional RPC extensions.
Expand All @@ -119,7 +83,7 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
/// Fee history cache.
pub fee_history_cache: FeeHistoryCache,
/// Ethereum data access overrides.
pub overrides: Arc<OverrideHandle<Block>>,
pub overrides: Arc<dyn StorageOverride<Block>>,
/// Cache for Ethereum block data.
pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,
/// Manual seal command sink
Expand Down Expand Up @@ -157,7 +121,7 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi, CIDP> {
/// The Node authority flag
pub is_authority: bool,
/// Network service
pub network: Arc<NetworkService<Block, Hash>>,
pub network: Arc<dyn NetworkService>,
/// EthFilterApi pool.
pub filter_pool: FilterPool,
/// List of optional RPC extensions.
Expand All @@ -171,7 +135,7 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi, CIDP> {
/// Fee history cache.
pub fee_history_cache: FeeHistoryCache,
/// Ethereum data access overrides.
pub overrides: Arc<OverrideHandle<Block>>,
pub overrides: Arc<dyn StorageOverride<Block>>,
/// Cache for Ethereum block data.
pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,
/// Maximum number of logs in one query.
Expand All @@ -190,9 +154,9 @@ pub struct SpawnTasksParams<'a, B: BlockT, C, BE> {
pub task_manager: &'a TaskManager,
pub client: Arc<C>,
pub substrate_backend: Arc<BE>,
pub frontier_backend: fc_db::Backend<B>,
pub frontier_backend: Arc<fc_db::Backend<B, C>>,
pub filter_pool: Option<FilterPool>,
pub overrides: Arc<OverrideHandle<B>>,
pub overrides: Arc<dyn StorageOverride<B>>,
pub fee_history_limit: u64,
pub fee_history_cache: FeeHistoryCache,
}
Expand Down
60 changes: 34 additions & 26 deletions node/common/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::cli_opt::{BackendTypeConfig, RpcConfig};
use std::{path::Path, sync::Arc};

use fc_db::DatabaseSource;
use fc_rpc::StorageOverrideHandler;
use sc_client_api::{
backend::{Backend, StateBackend},
AuxStore, StorageProvider,
Expand All @@ -14,8 +15,13 @@ use sp_api::ProvideRuntimeApi;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use sp_runtime::traits::BlakeTwo256;

/// Only enable the benchmarking host functions when we actually want to benchmark.
#[cfg(feature = "runtime-benchmarks")]
pub type HostFunctions =
(frame_benchmarking::benchmarking::HostFunctions, fp_ext::bifrost_ext::HostFunctions);
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);
/// Otherwise we use empty host functions for ext host functions.
#[cfg(not(feature = "runtime-benchmarks"))]
pub type HostFunctions = (sp_io::SubstrateHostFunctions, fp_ext::bifrost_ext::HostFunctions);

/// Configure frontier database.
pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::PathBuf {
Expand All @@ -28,7 +34,7 @@ pub fn open_frontier_backend<C, BE>(
client: Arc<C>,
config: &Configuration,
rpc_config: &RpcConfig,
) -> Result<fc_db::Backend<Block>, String>
) -> Result<fc_db::Backend<Block, C>, String>
where
C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,
Expand All @@ -38,32 +44,34 @@ where
BE::State: StateBackend<BlakeTwo256>,
{
let frontier_backend = match rpc_config.frontier_backend_type {
BackendTypeConfig::KeyValue => fc_db::Backend::KeyValue(fc_db::kv::Backend::<Block>::new(
client,
&fc_db::kv::DatabaseSettings {
source: match config.database {
DatabaseSource::RocksDb { .. } => DatabaseSource::RocksDb {
path: frontier_database_dir(config, "db"),
cache_size: 0,
},
DatabaseSource::ParityDb { .. } => {
DatabaseSource::ParityDb { path: frontier_database_dir(config, "paritydb") }
},
DatabaseSource::Auto { .. } => DatabaseSource::Auto {
rocksdb_path: frontier_database_dir(config, "db"),
paritydb_path: frontier_database_dir(config, "paritydb"),
cache_size: 0,
},
_ => {
return Err(
"Supported db sources: `rocksdb` | `paritydb` | `auto`".to_string()
)
BackendTypeConfig::KeyValue => {
fc_db::Backend::KeyValue(Arc::new(fc_db::kv::Backend::<Block, C>::new(
client,
&fc_db::kv::DatabaseSettings {
source: match config.database {
DatabaseSource::RocksDb { .. } => DatabaseSource::RocksDb {
path: frontier_database_dir(config, "db"),
cache_size: 0,
},
DatabaseSource::ParityDb { .. } => DatabaseSource::ParityDb {
path: frontier_database_dir(config, "paritydb"),
},
DatabaseSource::Auto { .. } => DatabaseSource::Auto {
rocksdb_path: frontier_database_dir(config, "db"),
paritydb_path: frontier_database_dir(config, "paritydb"),
cache_size: 0,
},
_ => {
return Err(
"Supported db sources: `rocksdb` | `paritydb` | `auto`".to_string()
)
},
},
},
},
)?),
)?))
},
BackendTypeConfig::Sql { pool_size, num_ops_timeout, thread_count, cache_size } => {
let overrides = crate::rpc::overrides_handle(client.clone());
let overrides = Arc::new(StorageOverrideHandler::<Block, _, _>::new(client.clone()));
let sqlite_db_path = frontier_database_dir(config, "sql");
std::fs::create_dir_all(&sqlite_db_path).expect("failed creating sql db directory");
let backend = futures::executor::block_on(fc_db::sql::Backend::new(
Expand All @@ -82,7 +90,7 @@ where
overrides.clone(),
))
.unwrap_or_else(|err| panic!("failed creating sql backend: {:?}", err));
fc_db::Backend::Sql(backend)
fc_db::Backend::Sql(Arc::new(backend))
},
};

Expand Down
10 changes: 5 additions & 5 deletions node/common/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ use sc_client_api::{backend::Backend, BlockOf, BlockchainEvents, StateBackend, S
use substrate_prometheus_endpoint::Registry as PrometheusRegistry;
use tokio::sync::Semaphore;

use sp_api::{BlockT, HeaderT, ProvideRuntimeApi};
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use sp_core::H256;
use sp_runtime::traits::BlakeTwo256;
use sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT};

use std::{sync::Arc, time::Duration};

Expand Down Expand Up @@ -66,9 +66,9 @@ where
let (debug_task, debug_requester) = DebugHandler::task(
Arc::clone(&params.client),
Arc::clone(&params.substrate_backend),
match params.frontier_backend {
fc_db::Backend::KeyValue(b) => Arc::new(b),
fc_db::Backend::Sql(b) => Arc::new(b),
match &*params.frontier_backend {
fc_db::Backend::KeyValue(b) => b.clone(),
fc_db::Backend::Sql(b) => b.clone(),
},
Arc::clone(&permit_pool),
Arc::clone(&params.overrides),
Expand Down
5 changes: 4 additions & 1 deletion node/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bifrost-node"
version = "2.0.0"
version = "2.0.1"
description = "The node client implementation for Bifrost"
authors = { workspace = true }
homepage = { workspace = true }
Expand All @@ -19,6 +19,9 @@ name = "bifrost-node"
# third-party dependencies
clap = { workspace = true }

# substrate primitive dependencies
sp-runtime = { workspace = true, features = ["std"] }

# substrate client dependencies
sc-cli = { workspace = true }
sc-service = { workspace = true }
Expand Down
10 changes: 6 additions & 4 deletions node/core/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ impl SubstrateCli for Cli {

fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(bifrost_dev_node::chain_spec::development_config()?),
"testnet-local" => Box::new(bifrost_testnet_node::chain_spec::testnet_config()?),
"dev" => Box::new(bifrost_dev_node::chain_spec::development_config()),
"testnet-local" => Box::new(bifrost_testnet_node::chain_spec::testnet_config()),
"testnet" => Box::new(bifrost_testnet_node::chain_spec::ChainSpec::from_json_file(
std::path::PathBuf::from("./specs/bifrost-testnet.json"),
)?),
"mainnet-local" => Box::new(bifrost_mainnet_node::chain_spec::mainnet_config()?),
"mainnet-local" => Box::new(bifrost_mainnet_node::chain_spec::mainnet_config()),
"mainnet" => Box::new(bifrost_mainnet_node::chain_spec::ChainSpec::from_json_file(
std::path::PathBuf::from("./specs/bifrost-mainnet.json"),
)?),
Expand Down Expand Up @@ -294,7 +294,9 @@ pub fn run() -> sc_cli::Result<()> {
);
}

cmd.run::<Block, bifrost_common_node::service::HostFunctions>(config)
cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
config.chain_spec,
))
},
BenchmarkCmd::Block(cmd) => {
let PartialComponents { client, .. } =
Expand Down
Loading

0 comments on commit 4954cf7

Please sign in to comment.