Skip to content

Commit

Permalink
Release v1.3.0 (#39)
Browse files Browse the repository at this point in the history
* NODE-79, bifrost pallets improvements (#34)

* NODE-79, feature: migrate to standard storage version for bfc-staking

* NODE-79, feature: migrate to use new standard storage version for `bfc-offences`, `bfc-utility`, `relay-manager`.

* NODE-79, refactor: replace `OrderedSet` with `BTreeMap` & `BTreeSet`

* NODE-79, refactor: calculate translate weight info

* NODE-79, refactor: Remove redundant code

* NODE-79, refactor: Remove panic point in `bfc-staking` as much as possible

* NODE-79, refactor: use btree set in `SelectedCandidates`, `SelectedFullCandidates`, `SelectedBasicCandidates`, `CachedSelectedCandidates`

* NODE-79, refactor: remove unnecessary path prefix

* NODE-79, refactor: remove unnecessary reverse

* NODE-79, refactor: migrate `CandidatePool` to use BoundedBTreeMap

* NODE-79, refactor: kill storage `MinTotalSelected`

* NODE-79, refactor: remove unnecessary path prefix

* NODE-79, fix: typo

* NODE-79, refactor: use iter_mut

* NODE-79, chore: remove deadcode

* NODE-79, refactor: use mutate

* NODE-79, refactor: clone in small range

* NODE-79, refactor: no need to be complicate

* NODE-79, refactor: use getter

* NODE-79, fix: should use take instead get

* NODE-79, refactor: remove dead code

* NODE-79, refactor: no need to be complicated

* NODE-79, refactor: use getter

* NODE-79, refactor: `relay-manager`

* NODE-79, refactor: .

* NODE-79, refactor: remove redundant

* NODE-79, fix: revert message

* NODE-79, refactor: `bfc-staking`

* NODE-79, refactor: `relay-manager`

* NODE-79, refactor: move under util methods

* NODE-79, refactor: impl From<Offence> for EvmOffence

* NODE-79, refactor: reduce getter call

* NODE-79, refactor: remove unnecessary clone

* NODE-79, refactor: `Nominator.initial_nominations` type to BTreeMap

* NODE-79, refactor: .

* NODE-79, chore: remove dead code

* NODE-79, fix:

* NODE-79, fix:

* NODE-79, test: fit into new storage format

* NODE-79, fix: modify if exists else insert

* NODE-79, refactor: remove dead code

* NODE-79, fix: condition check on OnRuntimeUpgrade

* NODE-79, chore: comment

* NODE-79, fix: remove duplicate translate in migrations

* NODE-65, deps: polkadot sdk migration (#36)

* NODE-64, deps: upgrade to bifrost-polkadot-v1.3.0

* NODE-64, chore: use

* NODE-64, chore: remove precompile utils

* NODE-64, chore: replace to

* NODE-64, chore: move  to

* NODE-65, chore: apply block number prelude to precompiles

* NODE-65, chore: add hold/freeze reasons to

* NODE-65, chore: remove hold identifier from

* NODE-65, chore: add  to

* NODE-65, chore: add AllowMultipleBlocksPerSlot to pallet_aura

* NODE-65, chore: add new types to pallet_treasury

* NODE-65, chore: make pallet_preimage use Consideration

* NODE-65, chore: add missing generic type to GenesisConfig

* NODE-65, chore: update pallet_preimage

* NODE-65, chore: add IdentityInformation to pallet_identity

* NODE-65, chore: remove MaxPeerDataEncodingSize from pallet_im_online

* NODE-65, chore: add SuicideQuickClearLimit to pallet_evm

* NODE-65, feat: implement GenesisBuilder runtime api

* NODE-65, chore: rename Index to Nonce

* NODE-65, chore: specify txpool feature to fc_rpc

* NODE-65, fix: pending runtime api for pending state

* NODE-65, chore: Removal of execution strategies

* NODE-65, chore: Set StateBackend::Transaction to PrefixedMemoryDB

* NODE-65, chore: Modular block request handler

* NODE-65, chore: implement eth_call state override

* NODE-65, fix: resolve service.rs compile errors

* NODE-65, fix: replace to RuntimeGenesisConfig in chain_spec

* NODE-65, chore: add missing clone()

* NODE-65, chore: remove native runtime version api

* NODE-65, fix: replace to fp-account

* NODE-65, fix: remove RuntimeFreezeReason and sort imports

* NODE-65, chore: remove unneccessary self imports

* NODE-65, fix: rollback cherry-picked EthereumRuntimeRPCApi changes

* NODE-65, fix: add missing evm features

* NODE-65, deps: release v1.3.0

* NODE-65, fix: remove unused params

* NODE-65, fix: use correct crate features

* NODE-65, fix: remove std feature on pallet GenesisConfig Default impl

* NODE-65, test: replace deprecated storage

* NODE-65, test: estimated gas should be correct

* NODE-65, test: split runtime tests

* NODE-65, test: check balance consistancy

* NODE-65, test: check balance consistancy (2)

* NODE-65, feat: Only use substrate-wasm-builder when std feature is enabled

* NODE-65, deps: update Cargo.lock

* NODE-65, fix: resolve imports

* NODE-65, fix: update runtime tests

* NODE-65, fix: handle runtime test failures

* NODE-65, deps: update node packages

* NODE-65, deps: update Cargo.lock

* NODE-65, fix: remove test config

* NODE-84, chore: bifrost-frontier/pull/12 (#37)

* NODE-65, test: bifrost-frontier/pull/12 test code

---------

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

* NODE-78, fix: delayed relayer address update (#38)

* NODE-64, deps: upgrade to bifrost-polkadot-v1.3.0

* NODE-65, fix: pending runtime api for pending state

* NODE-65, chore: implement eth_call state override

* NODE-65, test: split runtime tests

* NODE-65, fix: update runtime tests

* NODE-65, fix: handle runtime test failures

* NODE-65, fix: remove test config

* NODE-78, feat: use delayed relayer sets

* NODE-78, feat: handle relayer sets on round update

* NODE-78, fix: add verifications on scheduling leaves

* NODE-78, test: add basic set relayer tests

* NODE-78, test: add advanced tests

* NODE-78, feat: add constraints to set_controller

* NODE-78, feat: add constraints to set_validator_commission

* NODE-78, chore: expect replacement will always succeed

* NODE-78, chore: add missing string docs

* NODE-78, fix: round update must be priorly set

* NODE-78, chore: add missing string docs

* NODE-78, fix: remove redundant state checks

* deps: increase runtime version

* test: update live runtime tests

---------

Co-authored-by: Min-seong Kwon <[email protected]>
  • Loading branch information
dnjscksdn98 and alstjd0921 authored Feb 6, 2024
1 parent c0e82fe commit 5e6b7f7
Show file tree
Hide file tree
Showing 113 changed files with 7,048 additions and 12,042 deletions.
2,592 changes: 1,555 additions & 1,037 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

0 comments on commit 5e6b7f7

Please sign in to comment.