Skip to content

Commit 4954cf7

Browse files
Release v2.0.1 (#100)
* 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 <kwonarseus@gmail.com> * 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 <kwonarseus@gmail.com> --------- Co-authored-by: Alex Won <dnjscksdn98@gmail.com> * 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 <kwonarseus@gmail.com> --------- Co-authored-by: Min-seong Kwon <kwonarseus@gmail.com> * 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 <kwonarseus@gmail.com> * 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 <dnjscksdn98@gmail.com> * NODE-127, fix: add missing psbt fee verification logic * NODE-127, chore: set default max fee rate --------- Co-authored-by: Alex Won <dnjscksdn98@gmail.com> * 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 <kwonarseus@gmail.com> * Update pallets/btc-socket-queue/src/pallet/impls.rs Co-authored-by: Min-seong Kwon <kwonarseus@gmail.com> --------- Co-authored-by: Min-seong Kwon <kwonarseus@gmail.com> * 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 <dnjscksdn98@gmail.com> * 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 <kwonarseus@gmail.com> * 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 <kwonarseus@gmail.com> * 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 <kwonarseus@gmail.com>
1 parent 08764c1 commit 4954cf7

File tree

81 files changed

+4727
-3905
lines changed

Some content is hidden

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

81 files changed

+4727
-3905
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 111 additions & 122 deletions
Large diffs are not rendered by default.

node/common/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ frame-benchmarking = { workspace = true, features = ["std"] }
3434
sp-core = { workspace = true, features = ["std"] }
3535
sp-runtime = { workspace = true, features = ["std"] }
3636
sp-api = { workspace = true, features = ["std"] }
37+
sp-io = { workspace = true, features = ["std"] }
3738
sp-blockchain = { workspace = true }
3839
sp-block-builder = { workspace = true, features = ["std"] }
3940

node/common/src/rpc.rs

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,21 @@ use crate::cli_opt::EthApi as EthApiCmd;
22

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

5-
use fc_rpc::{
6-
EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,
7-
SchemaV2Override, SchemaV3Override, StorageOverride,
8-
};
5+
use fc_rpc::{EthBlockDataCacheTask, StorageOverride};
96
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
107
use sc_client_api::{backend::Backend, StorageProvider};
118
use sc_consensus_grandpa::{
129
FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,
1310
};
1411
use sc_consensus_manual_seal::EngineCommand;
15-
use sc_network::NetworkService;
12+
use sc_network::service::traits::NetworkService;
1613
use sc_network_sync::SyncingService;
1714
use sc_rpc::SubscriptionTaskExecutor;
1815
use sc_rpc_api::DenyUnsafe;
1916
use sc_service::TaskManager;
2017
use sc_transaction_pool::{ChainApi, Pool};
2118

2219
use bp_core::{BlockNumber, Hash, Header};
23-
use fp_rpc::{self, EthereumRuntimeRPCApi};
24-
use fp_storage::EthereumStorageSchema;
25-
use sp_api::ProvideRuntimeApi;
26-
use sp_blockchain::HeaderBackend;
2720
use sp_core::H256;
2821
use sp_runtime::{generic, traits::Block as BlockT, OpaqueExtrinsic as UncheckedExtrinsic};
2922

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

44-
/// Override storage
45-
pub fn overrides_handle<B, C, BE>(client: Arc<C>) -> Arc<OverrideHandle<B>>
46-
where
47-
B: BlockT,
48-
C: ProvideRuntimeApi<B>,
49-
C::Api: EthereumRuntimeRPCApi<B>,
50-
C: HeaderBackend<B> + StorageProvider<B, BE> + 'static,
51-
BE: Backend<B> + 'static,
52-
{
53-
let mut overrides_map = BTreeMap::new();
54-
overrides_map.insert(
55-
EthereumStorageSchema::V1,
56-
Box::new(SchemaV1Override::new(client.clone())) as Box<dyn StorageOverride<_>>,
57-
);
58-
overrides_map.insert(
59-
EthereumStorageSchema::V2,
60-
Box::new(SchemaV2Override::new(client.clone())) as Box<dyn StorageOverride<_>>,
61-
);
62-
overrides_map.insert(
63-
EthereumStorageSchema::V3,
64-
Box::new(SchemaV3Override::new(client.clone())) as Box<dyn StorageOverride<_>>,
65-
);
66-
67-
Arc::new(OverrideHandle {
68-
schemas: overrides_map,
69-
fallback: Box::new(RuntimeApiStorageOverride::new(client.clone())),
70-
})
71-
}
72-
7337
/// Extra dependencies for GRANDPA
7438
pub struct GrandpaDeps<B> {
7539
/// Voting round info.
@@ -105,7 +69,7 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
10569
/// The Node authority flag
10670
pub is_authority: bool,
10771
/// Network service
108-
pub network: Arc<NetworkService<Block, Hash>>,
72+
pub network: Arc<dyn NetworkService>,
10973
/// EthFilterApi pool.
11074
pub filter_pool: FilterPool,
11175
/// List of optional RPC extensions.
@@ -119,7 +83,7 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
11983
/// Fee history cache.
12084
pub fee_history_cache: FeeHistoryCache,
12185
/// Ethereum data access overrides.
122-
pub overrides: Arc<OverrideHandle<Block>>,
86+
pub overrides: Arc<dyn StorageOverride<Block>>,
12387
/// Cache for Ethereum block data.
12488
pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,
12589
/// Manual seal command sink
@@ -157,7 +121,7 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi, CIDP> {
157121
/// The Node authority flag
158122
pub is_authority: bool,
159123
/// Network service
160-
pub network: Arc<NetworkService<Block, Hash>>,
124+
pub network: Arc<dyn NetworkService>,
161125
/// EthFilterApi pool.
162126
pub filter_pool: FilterPool,
163127
/// List of optional RPC extensions.
@@ -171,7 +135,7 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi, CIDP> {
171135
/// Fee history cache.
172136
pub fee_history_cache: FeeHistoryCache,
173137
/// Ethereum data access overrides.
174-
pub overrides: Arc<OverrideHandle<Block>>,
138+
pub overrides: Arc<dyn StorageOverride<Block>>,
175139
/// Cache for Ethereum block data.
176140
pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,
177141
/// Maximum number of logs in one query.
@@ -190,9 +154,9 @@ pub struct SpawnTasksParams<'a, B: BlockT, C, BE> {
190154
pub task_manager: &'a TaskManager,
191155
pub client: Arc<C>,
192156
pub substrate_backend: Arc<BE>,
193-
pub frontier_backend: fc_db::Backend<B>,
157+
pub frontier_backend: Arc<fc_db::Backend<B, C>>,
194158
pub filter_pool: Option<FilterPool>,
195-
pub overrides: Arc<OverrideHandle<B>>,
159+
pub overrides: Arc<dyn StorageOverride<B>>,
196160
pub fee_history_limit: u64,
197161
pub fee_history_cache: FeeHistoryCache,
198162
}

node/common/src/service.rs

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::cli_opt::{BackendTypeConfig, RpcConfig};
33
use std::{path::Path, sync::Arc};
44

55
use fc_db::DatabaseSource;
6+
use fc_rpc::StorageOverrideHandler;
67
use sc_client_api::{
78
backend::{Backend, StateBackend},
89
AuxStore, StorageProvider,
@@ -14,8 +15,13 @@ use sp_api::ProvideRuntimeApi;
1415
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
1516
use sp_runtime::traits::BlakeTwo256;
1617

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

2026
/// Configure frontier database.
2127
pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::PathBuf {
@@ -28,7 +34,7 @@ pub fn open_frontier_backend<C, BE>(
2834
client: Arc<C>,
2935
config: &Configuration,
3036
rpc_config: &RpcConfig,
31-
) -> Result<fc_db::Backend<Block>, String>
37+
) -> Result<fc_db::Backend<Block, C>, String>
3238
where
3339
C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,
3440
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,
@@ -38,32 +44,34 @@ where
3844
BE::State: StateBackend<BlakeTwo256>,
3945
{
4046
let frontier_backend = match rpc_config.frontier_backend_type {
41-
BackendTypeConfig::KeyValue => fc_db::Backend::KeyValue(fc_db::kv::Backend::<Block>::new(
42-
client,
43-
&fc_db::kv::DatabaseSettings {
44-
source: match config.database {
45-
DatabaseSource::RocksDb { .. } => DatabaseSource::RocksDb {
46-
path: frontier_database_dir(config, "db"),
47-
cache_size: 0,
48-
},
49-
DatabaseSource::ParityDb { .. } => {
50-
DatabaseSource::ParityDb { path: frontier_database_dir(config, "paritydb") }
51-
},
52-
DatabaseSource::Auto { .. } => DatabaseSource::Auto {
53-
rocksdb_path: frontier_database_dir(config, "db"),
54-
paritydb_path: frontier_database_dir(config, "paritydb"),
55-
cache_size: 0,
56-
},
57-
_ => {
58-
return Err(
59-
"Supported db sources: `rocksdb` | `paritydb` | `auto`".to_string()
60-
)
47+
BackendTypeConfig::KeyValue => {
48+
fc_db::Backend::KeyValue(Arc::new(fc_db::kv::Backend::<Block, C>::new(
49+
client,
50+
&fc_db::kv::DatabaseSettings {
51+
source: match config.database {
52+
DatabaseSource::RocksDb { .. } => DatabaseSource::RocksDb {
53+
path: frontier_database_dir(config, "db"),
54+
cache_size: 0,
55+
},
56+
DatabaseSource::ParityDb { .. } => DatabaseSource::ParityDb {
57+
path: frontier_database_dir(config, "paritydb"),
58+
},
59+
DatabaseSource::Auto { .. } => DatabaseSource::Auto {
60+
rocksdb_path: frontier_database_dir(config, "db"),
61+
paritydb_path: frontier_database_dir(config, "paritydb"),
62+
cache_size: 0,
63+
},
64+
_ => {
65+
return Err(
66+
"Supported db sources: `rocksdb` | `paritydb` | `auto`".to_string()
67+
)
68+
},
6169
},
6270
},
63-
},
64-
)?),
71+
)?))
72+
},
6573
BackendTypeConfig::Sql { pool_size, num_ops_timeout, thread_count, cache_size } => {
66-
let overrides = crate::rpc::overrides_handle(client.clone());
74+
let overrides = Arc::new(StorageOverrideHandler::<Block, _, _>::new(client.clone()));
6775
let sqlite_db_path = frontier_database_dir(config, "sql");
6876
std::fs::create_dir_all(&sqlite_db_path).expect("failed creating sql db directory");
6977
let backend = futures::executor::block_on(fc_db::sql::Backend::new(
@@ -82,7 +90,7 @@ where
8290
overrides.clone(),
8391
))
8492
.unwrap_or_else(|err| panic!("failed creating sql backend: {:?}", err));
85-
fc_db::Backend::Sql(backend)
93+
fc_db::Backend::Sql(Arc::new(backend))
8694
},
8795
};
8896

node/common/src/tracing.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ use sc_client_api::{backend::Backend, BlockOf, BlockchainEvents, StateBackend, S
1212
use substrate_prometheus_endpoint::Registry as PrometheusRegistry;
1313
use tokio::sync::Semaphore;
1414

15-
use sp_api::{BlockT, HeaderT, ProvideRuntimeApi};
15+
use sp_api::ProvideRuntimeApi;
1616
use sp_block_builder::BlockBuilder;
1717
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
1818
use sp_core::H256;
19-
use sp_runtime::traits::BlakeTwo256;
19+
use sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT};
2020

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

@@ -66,9 +66,9 @@ where
6666
let (debug_task, debug_requester) = DebugHandler::task(
6767
Arc::clone(&params.client),
6868
Arc::clone(&params.substrate_backend),
69-
match params.frontier_backend {
70-
fc_db::Backend::KeyValue(b) => Arc::new(b),
71-
fc_db::Backend::Sql(b) => Arc::new(b),
69+
match &*params.frontier_backend {
70+
fc_db::Backend::KeyValue(b) => b.clone(),
71+
fc_db::Backend::Sql(b) => b.clone(),
7272
},
7373
Arc::clone(&permit_pool),
7474
Arc::clone(&params.overrides),

node/core/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bifrost-node"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
description = "The node client implementation for Bifrost"
55
authors = { workspace = true }
66
homepage = { workspace = true }
@@ -19,6 +19,9 @@ name = "bifrost-node"
1919
# third-party dependencies
2020
clap = { workspace = true }
2121

22+
# substrate primitive dependencies
23+
sp-runtime = { workspace = true, features = ["std"] }
24+
2225
# substrate client dependencies
2326
sc-cli = { workspace = true }
2427
sc-service = { workspace = true }

node/core/src/command.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ impl SubstrateCli for Cli {
6464

6565
fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
6666
Ok(match id {
67-
"dev" => Box::new(bifrost_dev_node::chain_spec::development_config()?),
68-
"testnet-local" => Box::new(bifrost_testnet_node::chain_spec::testnet_config()?),
67+
"dev" => Box::new(bifrost_dev_node::chain_spec::development_config()),
68+
"testnet-local" => Box::new(bifrost_testnet_node::chain_spec::testnet_config()),
6969
"testnet" => Box::new(bifrost_testnet_node::chain_spec::ChainSpec::from_json_file(
7070
std::path::PathBuf::from("./specs/bifrost-testnet.json"),
7171
)?),
72-
"mainnet-local" => Box::new(bifrost_mainnet_node::chain_spec::mainnet_config()?),
72+
"mainnet-local" => Box::new(bifrost_mainnet_node::chain_spec::mainnet_config()),
7373
"mainnet" => Box::new(bifrost_mainnet_node::chain_spec::ChainSpec::from_json_file(
7474
std::path::PathBuf::from("./specs/bifrost-mainnet.json"),
7575
)?),
@@ -294,7 +294,9 @@ pub fn run() -> sc_cli::Result<()> {
294294
);
295295
}
296296

297-
cmd.run::<Block, bifrost_common_node::service::HostFunctions>(config)
297+
cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
298+
config.chain_spec,
299+
))
298300
},
299301
BenchmarkCmd::Block(cmd) => {
300302
let PartialComponents { client, .. } =

0 commit comments

Comments
 (0)