Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NODE-65, deps: polkadot sdk migration #36

Merged
merged 53 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
98ecf69
NODE-64, deps: upgrade to bifrost-polkadot-v1.3.0
dnjscksdn98 Dec 22, 2023
e52dd03
NODE-64, chore: use
dnjscksdn98 Dec 22, 2023
f0ef82f
NODE-64, chore: remove precompile utils
dnjscksdn98 Dec 22, 2023
e9a4e5a
NODE-64, chore: replace to
dnjscksdn98 Dec 22, 2023
8dd3423
NODE-64, chore: move to
dnjscksdn98 Dec 22, 2023
479a4d9
NODE-65, chore: apply block number prelude to precompiles
dnjscksdn98 Dec 22, 2023
bc9b0b0
NODE-65, chore: add hold/freeze reasons to
dnjscksdn98 Dec 22, 2023
ff6424d
NODE-65, chore: remove hold identifier from
dnjscksdn98 Dec 22, 2023
087352e
NODE-65, chore: add to
dnjscksdn98 Dec 22, 2023
12d2de3
NODE-65, chore: add AllowMultipleBlocksPerSlot to pallet_aura
dnjscksdn98 Dec 22, 2023
3f24b2e
NODE-65, chore: add new types to pallet_treasury
dnjscksdn98 Dec 22, 2023
35349ea
NODE-65, chore: make pallet_preimage use Consideration
dnjscksdn98 Dec 22, 2023
89ce574
NODE-65, chore: add missing generic type to GenesisConfig
dnjscksdn98 Dec 22, 2023
c63180d
NODE-65, chore: update pallet_preimage
dnjscksdn98 Dec 27, 2023
10b26db
NODE-65, chore: add IdentityInformation to pallet_identity
dnjscksdn98 Dec 27, 2023
cff0013
NODE-65, chore: remove MaxPeerDataEncodingSize from pallet_im_online
dnjscksdn98 Dec 27, 2023
c8a22e4
NODE-65, chore: add SuicideQuickClearLimit to pallet_evm
dnjscksdn98 Dec 27, 2023
680d5a3
NODE-65, feat: implement GenesisBuilder runtime api
dnjscksdn98 Dec 27, 2023
ab2ef53
NODE-65, chore: rename Index to Nonce
dnjscksdn98 Dec 27, 2023
3a975b7
NODE-65, chore: specify txpool feature to fc_rpc
dnjscksdn98 Dec 27, 2023
bbfcaed
NODE-65, fix: pending runtime api for pending state
dnjscksdn98 Dec 27, 2023
e0bc423
NODE-65, chore: Removal of execution strategies
dnjscksdn98 Dec 27, 2023
f3d922b
NODE-65, chore: Set StateBackend::Transaction to PrefixedMemoryDB
dnjscksdn98 Dec 27, 2023
4da002b
NODE-65, chore: Modular block request handler
dnjscksdn98 Dec 27, 2023
0da8074
NODE-65, chore: implement eth_call state override
dnjscksdn98 Dec 27, 2023
98a8a17
NODE-65, fix: resolve service.rs compile errors
dnjscksdn98 Dec 27, 2023
fc0d609
NODE-65, fix: replace to RuntimeGenesisConfig in chain_spec
dnjscksdn98 Dec 27, 2023
5a16af4
NODE-65, chore: add missing clone()
dnjscksdn98 Dec 27, 2023
c90b0e3
NODE-65, chore: remove native runtime version api
dnjscksdn98 Dec 27, 2023
705d7ca
NODE-65, fix: replace to fp-account
dnjscksdn98 Dec 28, 2023
1d888e2
NODE-65, fix: remove RuntimeFreezeReason and sort imports
dnjscksdn98 Dec 28, 2023
68328cb
NODE-65, chore: remove unneccessary self imports
dnjscksdn98 Dec 28, 2023
cc2b2f5
NODE-65, fix: rollback cherry-picked EthereumRuntimeRPCApi changes
dnjscksdn98 Dec 28, 2023
75d3d5c
NODE-65, fix: add missing evm features
dnjscksdn98 Jan 2, 2024
2617a80
NODE-65, deps: release v1.3.0
dnjscksdn98 Jan 2, 2024
f888264
NODE-65, fix: remove unused params
dnjscksdn98 Jan 2, 2024
31a505b
NODE-65, fix: use correct crate features
dnjscksdn98 Jan 3, 2024
0f44c0e
NODE-65, fix: remove std feature on pallet GenesisConfig Default impl
dnjscksdn98 Jan 3, 2024
6c4e544
NODE-65, test: replace deprecated storage
dnjscksdn98 Jan 3, 2024
47ba133
NODE-65, test: estimated gas should be correct
dnjscksdn98 Jan 4, 2024
13798e6
NODE-65, test: split runtime tests
dnjscksdn98 Jan 4, 2024
dd89d01
NODE-65, test: check balance consistancy
dnjscksdn98 Jan 5, 2024
fa722b4
NODE-65, test: check balance consistancy (2)
dnjscksdn98 Jan 5, 2024
109355d
NODE-65, feat: Only use substrate-wasm-builder when std feature is en…
dnjscksdn98 Jan 5, 2024
b24d9a9
NODE-65, deps: update Cargo.lock
dnjscksdn98 Jan 5, 2024
d8890a6
NODE-65, fix: resolve imports
dnjscksdn98 Jan 10, 2024
901587a
NODE-65, fix: update runtime tests
dnjscksdn98 Jan 11, 2024
35cdedf
NODE-65, fix: handle runtime test failures
dnjscksdn98 Jan 11, 2024
5be907f
NODE-65, deps: update node packages
dnjscksdn98 Jan 11, 2024
8881b43
NODE-65, deps: update Cargo.lock
dnjscksdn98 Jan 12, 2024
246a981
NODE-65, fix: remove test config
dnjscksdn98 Jan 12, 2024
07b5283
NODE-84, chore: bifrost-frontier/pull/12 (#37)
alstjd0921 Jan 18, 2024
121659e
NODE-65, test: bifrost-frontier/pull/12 test code
alstjd0921 Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,443 changes: 1,480 additions & 963 deletions Cargo.lock

Large diffs are not rendered by default.

277 changes: 140 additions & 137 deletions Cargo.toml

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion node/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bifrost-common-node"
version = "1.0.0"
description = "The common code shared between node specifications for Bifrost Node"
description = "The common code shared between client implementations for Bifrost"
authors = { workspace = true }
homepage = { workspace = true }
edition = { workspace = true }
Expand All @@ -27,6 +27,9 @@ sc-network-sync = { workspace = true }
sc-service = { workspace = true }
substrate-prometheus-endpoint = { workspace = true }

# benchmarking dependencies
frame-benchmarking = { workspace = true, features = ["std"] }

# substrate primitives dependencies
sp-core = { workspace = true, features = ["std"] }
sp-runtime = { workspace = true, features = ["std"] }
Expand All @@ -36,13 +39,15 @@ sp-block-builder = { workspace = true, features = ["std"] }

# Frontier dependencies
fc-db = { workspace = true }
fc-api = { workspace = true }
fc-rpc = { workspace = true, features = ["rpc-binary-search-estimate"] }
fc-rpc-core = { workspace = true }
fp-rpc-debug = { workspace = true }
fp-storage = { workspace = true }
fp-rpc = { workspace = true }
fc-rpc-debug = { workspace = true }
fc-rpc-trace = { workspace = true }
fp-ext = { workspace = true, features = ["std"] }

# Local Dependencies
bp-core = { workspace = true }
Expand Down
39 changes: 31 additions & 8 deletions node/common/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::cli_opt::EthApi as EthApiCmd;
use bp_core::{BlockNumber, Hash, Header};

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

use fc_rpc::{
EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,
SchemaV2Override, SchemaV3Override, StorageOverride,
};
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use fp_rpc::{self, EthereumRuntimeRPCApi};
use fp_storage::EthereumStorageSchema;
use sc_client_api::{backend::Backend, StorageProvider};
use sc_consensus_grandpa::{
FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,
Expand All @@ -18,14 +18,29 @@ 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};
use std::{collections::BTreeMap, sync::Arc};

pub type Block = generic::Block<Header, UncheckedExtrinsic>;

pub struct DefaultEthConfig<C, BE>(std::marker::PhantomData<(C, BE)>);

impl<C, BE> fc_rpc::EthConfig<Block, C> for DefaultEthConfig<C, BE>
where
C: StorageProvider<Block, BE> + Sync + Send + 'static,
BE: Backend<Block> + 'static,
{
type EstimateGasAdapter = ();
type RuntimeStorageOverride =
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
Expand Down Expand Up @@ -70,7 +85,9 @@ pub struct GrandpaDeps<B> {
}

/// Full client dependencies.
pub struct FullDevDeps<C, P, BE, SC, A: ChainApi> {
pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
/// Client version.
pub client_version: String,
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
Expand All @@ -94,7 +111,7 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi> {
/// List of optional RPC extensions.
pub ethapi_cmd: Vec<EthApiCmd>,
/// Frontier backend.
pub frontier_backend: Arc<dyn fc_db::BackendReader<Block> + Send + Sync>,
pub frontier_backend: Arc<dyn fc_api::Backend<Block> + Send + Sync>,
/// Backend.
pub backend: Arc<BE>,
/// Maximum fee history cache size.
Expand All @@ -115,10 +132,14 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi> {
pub forced_parent_hashes: Option<BTreeMap<H256, H256>>,
/// Chain syncing service
pub sync_service: Arc<SyncingService<Block>>,
/// Something that can create the inherent data providers for pending state
pub pending_create_inherent_data_providers: CIDP,
}

/// Mainnet/Testnet client dependencies.
pub struct FullDeps<C, P, BE, SC, A: ChainApi> {
pub struct FullDeps<C, P, BE, SC, A: ChainApi, CIDP> {
/// Client version.
pub client_version: String,
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
Expand All @@ -142,7 +163,7 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi> {
/// List of optional RPC extensions.
pub ethapi_cmd: Vec<EthApiCmd>,
/// Frontier backend.
pub frontier_backend: Arc<dyn fc_db::BackendReader<Block> + Send + Sync>,
pub frontier_backend: Arc<dyn fc_api::Backend<Block> + Send + Sync>,
/// Backend.
pub backend: Arc<BE>,
/// Maximum fee history cache size.
Expand All @@ -161,6 +182,8 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi> {
pub forced_parent_hashes: Option<BTreeMap<H256, H256>>,
/// Chain syncing service
pub sync_service: Arc<SyncingService<Block>>,
/// Something that can create the inherent data providers for pending state
pub pending_create_inherent_data_providers: CIDP,
}

pub struct SpawnTasksParams<'a, B: BlockT, C, BE> {
Expand Down
11 changes: 8 additions & 3 deletions node/common/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
use bp_core::Block;
use crate::cli_opt::{BackendTypeConfig, RpcConfig};

use std::{path::Path, sync::Arc};

use fc_db::DatabaseSource;
use sc_client_api::{
backend::{Backend, StateBackend},
AuxStore, StorageProvider,
};
use sc_service::Configuration;

use bp_core::Block;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use sp_runtime::traits::BlakeTwo256;
use std::{path::Path, sync::Arc};

use crate::cli_opt::{BackendTypeConfig, RpcConfig};
pub type HostFunctions =
(frame_benchmarking::benchmarking::HostFunctions, fp_ext::bifrost_ext::HostFunctions);

/// Configure frontier database.
pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::PathBuf {
Expand Down
4 changes: 2 additions & 2 deletions node/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bifrost-node"
version = "1.2.5"
description = "The node specification for Bifrost Node"
version = "1.3.0"
description = "The node client implementation for Bifrost"
authors = { workspace = true }
homepage = { workspace = true }
edition = { workspace = true }
Expand Down
21 changes: 6 additions & 15 deletions node/core/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use crate::cli::{Cli, Subcommand};
use bifrost_common_node::cli_opt::{BackendType, BackendTypeConfig, RpcConfig};

use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};

use sc_cli::SubstrateCli;
use sc_service::PartialComponents;

trait IdentifyChain {
Expand Down Expand Up @@ -54,7 +55,7 @@ impl SubstrateCli for Cli {
}

fn support_url() -> String {
"support.anonymous.an".into()
env!("CARGO_PKG_HOMEPAGE").into()
}

fn copyright_start_year() -> i32 {
Expand All @@ -77,18 +78,6 @@ impl SubstrateCli for Cli {
)?),
})
}

fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
if chain_spec.is_dev() {
&bifrost_dev_runtime::VERSION
} else if chain_spec.is_testnet() {
&bifrost_testnet_runtime::VERSION
} else if chain_spec.is_mainnet() {
&bifrost_mainnet_runtime::VERSION
} else {
&bifrost_dev_runtime::VERSION
}
}
}

/// Parse and run command line arguments
Expand Down Expand Up @@ -288,6 +277,8 @@ pub fn run() -> sc_cli::Result<()> {
}
},
Some(Subcommand::Benchmark(cmd)) => {
use bifrost_common_node::rpc::Block;

let runner = cli.create_runner(cmd)?;

runner.sync_run(|config| {
Expand All @@ -303,7 +294,7 @@ pub fn run() -> sc_cli::Result<()> {
);
}

cmd.run::<bifrost_dev_runtime::Block, bifrost_dev_node::service::dev::ExecutorDispatch>(config)
cmd.run::<Block, bifrost_common_node::service::HostFunctions>(config)
},
BenchmarkCmd::Block(cmd) => {
let PartialComponents { client, .. } =
Expand Down
17 changes: 9 additions & 8 deletions node/dev/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "bifrost-dev-node"
version = "1.0.0"
description = "The node specification for Bifrost Node development"
description = "The node client implementation for Bifrost dev chain"
authors = { workspace = true }
homepage = { workspace = true}
homepage = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
Expand Down Expand Up @@ -34,6 +34,7 @@ sc-rpc = { workspace = true }
sc-rpc-api = { workspace = true }
sc-chain-spec = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-offchain = { workspace = true }

# substrate primitives dependencies
sp-core = { workspace = true, features = ["std"] }
Expand All @@ -46,6 +47,7 @@ sp-block-builder = { workspace = true, features = ["std"] }
sp-timestamp = { workspace = true, features = ["std"] }
sp-blockchain = { workspace = true }
sp-consensus = { workspace = true }
sp-inherents = { workspace = true }

# FRAME dependencies
pallet-bfc-staking = { workspace = true }
Expand All @@ -66,9 +68,10 @@ fp-storage = { workspace = true }
fp-ext = { workspace = true, features = ["std"] }
fp-rpc = { workspace = true, features = ["std"] }
fp-rpc-txpool = { workspace = true, features = ["std"] }
pallet-evm = { workspace = true, features = ["std"] }

pallet-ethereum = { workspace = true, features = ["forbid-evm-reentrancy"] }
pallet-ethereum = { workspace = true, features = [
"std",
"forbid-evm-reentrancy",
] }

# benchmarking dependencies
frame-benchmarking-cli = { workspace = true }
Expand All @@ -82,6 +85,4 @@ bifrost-common-node = { workspace = true }

[features]
default = []
runtime-benchmarks = [
"bifrost-dev-runtime/runtime-benchmarks",
]
runtime-benchmarks = ["bifrost-dev-runtime/runtime-benchmarks"]
14 changes: 4 additions & 10 deletions node/dev/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use sp_runtime::{BoundedVec, Perbill};
use hex_literal::hex;

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<devnet::GenesisConfig>;
pub type ChainSpec = sc_service::GenericChainSpec<devnet::RuntimeGenesisConfig>;

/// Generate a crypto pair from seed.
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down Expand Up @@ -132,7 +132,6 @@ pub fn development_config() -> Result<ChainSpec, String> {
AccountId::from(hex!("f4fc2d9Be3D6e19cCAfd575dE7CB290A585A1a22")),
AccountId::from(hex!("962dBf2aecF6545f552373487127976fD5B55105")),
],
true,
)
},
// Bootnodes
Expand Down Expand Up @@ -170,17 +169,12 @@ fn development_genesis(
initial_tech_committee_members: Vec<AccountId>,
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
_enable_println: bool,
) -> devnet::GenesisConfig {
// This is the simplest bytecode to revert without returning any data.
// We will pre-deploy it under all of our precompiles to ensure they can be called from
// within contracts.
// (PUSH1 0x00 PUSH1 0x00 REVERT)
let _revert_bytecode = vec![0x60, 0x00, 0x60, 0x00, 0xFD];
devnet::GenesisConfig {
) -> devnet::RuntimeGenesisConfig {
devnet::RuntimeGenesisConfig {
system: devnet::SystemConfig {
// Add Wasm runtime to storage.
code: wasm_binary.to_vec(),
..Default::default()
},
balances: devnet::BalancesConfig {
balances: endowed_accounts
Expand Down
Loading