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-35, Release bifrost-node v1.2.3 #16

Merged
merged 7 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1,739 changes: 921 additions & 818 deletions Cargo.lock

Large diffs are not rendered by default.

245 changes: 155 additions & 90 deletions Cargo.toml

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions node/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ repository = { workspace = true }

[dependencies]
# third-party dependencies
jsonrpc-core = "18.0.0"
futures = { version = "0.3" }
tokio = { version = "1.13.0", features = ["macros", "sync"] }
futures = { workspace = true }
tokio = { workspace = true, features = ["macros", "sync"] }

# substrate client dependencies
sc-client-api = { workspace = true }
Expand Down Expand Up @@ -44,7 +43,7 @@ fc-rpc-debug = { workspace = true }
fc-rpc-trace = { workspace = true }

# Local Dependencies
bp-core = { path = "../../primitives/core" }
bp-core = { workspace = true }

[features]
default = []
Expand Down
1 change: 1 addition & 0 deletions node/common/src/cli_opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ pub struct RpcConfig {
pub eth_statuses_cache: usize,
pub fee_history_limit: u64,
pub max_past_logs: u32,
pub logs_request_timeout: u64,
pub tracing_raw_max_memory_usage: usize,
}
44 changes: 17 additions & 27 deletions node/common/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ use fc_rpc::{
SchemaV2Override, SchemaV3Override, StorageOverride,
};
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use fp_rpc;
use fp_rpc::{self, EthereumRuntimeRPCApi};
use fp_storage::EthereumStorageSchema;
use sc_client_api::{
backend::{Backend, StateBackend},
AuxStore, StorageProvider,
};
use sc_client_api::{backend::Backend, StorageProvider};
use sc_consensus_manual_seal::EngineCommand;
use sc_finality_grandpa::{
FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,
Expand All @@ -21,44 +18,33 @@ use sc_rpc_api::DenyUnsafe;
use sc_service::TaskManager;
use sc_transaction_pool::{ChainApi, Pool};
use sp_api::ProvideRuntimeApi;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use sp_runtime::{
generic,
traits::{BlakeTwo256, Block as BlockT},
OpaqueExtrinsic as UncheckedExtrinsic,
};
use sp_blockchain::HeaderBackend;
use sp_runtime::{generic, traits::Block as BlockT, OpaqueExtrinsic as UncheckedExtrinsic};
use std::{collections::BTreeMap, sync::Arc};

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

/// Override storage
pub fn overrides_handle<C, BE>(client: Arc<C>) -> Arc<OverrideHandle<Block>>
pub fn overrides_handle<B, C, BE>(client: Arc<C>) -> Arc<OverrideHandle<B>>
where
C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,
C: Send + Sync + 'static,
C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,
BE: Backend<Block> + 'static,
BE::State: StateBackend<BlakeTwo256>,
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<_> + Send + Sync>,
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<_> + Send + Sync>,
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<_> + Send + Sync>,
Box::new(SchemaV3Override::new(client.clone())) as Box<dyn StorageOverride<_>>,
);

Arc::new(OverrideHandle {
Expand Down Expand Up @@ -121,6 +107,8 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi> {
pub command_sink: Option<futures::channel::mpsc::Sender<EngineCommand<Hash>>>,
/// Maximum number of logs in one query.
pub max_past_logs: u32,
/// Timeout for eth logs query in seconds. (default 10)
pub logs_request_timeout: u64,
}

/// Mainnet/Testnet client dependencies.
Expand Down Expand Up @@ -161,6 +149,8 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi> {
pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,
/// Maximum number of logs in one query.
pub max_past_logs: u32,
/// Timeout for eth logs query in seconds. (default 10)
pub logs_request_timeout: u64,
}

pub struct SpawnTasksParams<'a, B: BlockT, C, BE> {
Expand Down
18 changes: 9 additions & 9 deletions node/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bifrost-node"
version = "1.2.2"
version = "1.2.3"
description = "The node specification for BIFROST Node"
authors = { workspace = true }
homepage = { workspace = true}
Expand All @@ -17,7 +17,7 @@ name = "bifrost-node"

[dependencies]
# third-party dependencies
clap = { version = "4.0.9", features = ["derive"] }
clap = { workspace = true }

# substrate client dependencies
sc-cli = { workspace = true }
Expand All @@ -29,15 +29,15 @@ frame-benchmarking = { workspace = true, features = ["std"] }
frame-benchmarking-cli = { workspace = true}

# BIFROST runtimes
bifrost-dev-runtime = { path = "../../runtime/dev", features = ["std", "evm-tracing"] }
bifrost-testnet-runtime = { path = "../../runtime/testnet", features = ["std", "evm-tracing"] }
bifrost-mainnet-runtime = { path = "../../runtime/mainnet", features = ["std", "evm-tracing"] }
bifrost-dev-runtime = { workspace = true, features = ["std", "evm-tracing"] }
bifrost-testnet-runtime = { workspace = true, features = ["std", "evm-tracing"] }
bifrost-mainnet-runtime = { workspace = true, features = ["std", "evm-tracing"] }

# BIFROST node specs
bifrost-common-node = { path = "../common" }
bifrost-dev-node = { path = "../dev" }
bifrost-testnet-node = { path = "../testnet" }
bifrost-mainnet-node = { path = "../mainnet" }
bifrost-common-node = { workspace = true }
bifrost-dev-node = { workspace = true }
bifrost-testnet-node = { workspace = true }
bifrost-mainnet-node = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions node/core/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ pub struct Cli {
#[clap(long, default_value = "10000")]
pub max_past_logs: u32,

/// Timeout for eth logs query RPCs in seconds. (default 10)
#[clap(long, default_value = "10")]
pub logs_request_timeout: u64,

/// Maximum fee history cache size.
#[clap(long, default_value = "2048")]
pub fee_history_limit: u64,
Expand Down
13 changes: 8 additions & 5 deletions node/core/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ pub fn run() -> sc_cli::Result<()> {
"Runtime benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
.into(),
)
);
}

cmd.run::<bifrost_dev_runtime::Block, bifrost_dev_node::service::dev::ExecutorDispatch>(config)
Expand All @@ -302,12 +302,14 @@ pub fn run() -> sc_cli::Result<()> {

cmd.run(config, client, db, storage)
},
BenchmarkCmd::Machine(cmd) =>
cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()),
_ =>
BenchmarkCmd::Machine(cmd) => {
cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())
},
_ => {
return Err("Runtime benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
.into()),
.into())
},
}
})
},
Expand All @@ -321,6 +323,7 @@ pub fn run() -> sc_cli::Result<()> {
eth_statuses_cache: cli.eth_statuses_cache,
fee_history_limit: cli.fee_history_limit,
max_past_logs: cli.max_past_logs,
logs_request_timeout: cli.logs_request_timeout,
tracing_raw_max_memory_usage: cli.tracing_raw_max_memory_usage,
};

Expand Down
21 changes: 10 additions & 11 deletions node/dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ repository = { workspace = true }

[dependencies]
# third-party dependencies
serde_json = "1.0"
jsonrpc-core = "18.0.0"
jsonrpsee = { version = "0.16.2", features = ["server"] }
futures = { version = "0.3" }
hex-literal = { version = "0.3.1" }
tokio = { version = "1.13.0", features = ["macros", "sync"] }
serde_json = { workspace = true }
jsonrpsee = { workspace = true, features = ["server"] }
futures = { workspace = true }
hex-literal = { workspace = true }
tokio = { workspace = true, features = ["macros", "sync"] }

# substrate client dependencies
sc-client-api = { workspace = true }
Expand Down Expand Up @@ -48,7 +47,7 @@ sp-blockchain = { workspace = true }
sp-consensus = { workspace = true }

# FRAME dependencies
pallet-bfc-staking = { path = "../../pallets/bfc-staking" }
pallet-bfc-staking = { workspace = true }
pallet-im-online = { workspace = true, features = ["std"] }
pallet-transaction-payment-rpc = { workspace = true }
substrate-frame-rpc-system = { workspace = true }
Expand All @@ -75,10 +74,10 @@ frame-benchmarking-cli = { workspace = true }
frame-benchmarking = { workspace = true, features = ["std"] }

# Local Dependencies
bp-core = { path = "../../primitives/core" }
bifrost-dev-runtime = { path = "../../runtime/dev", features = ["std", "evm-tracing"] }
bifrost-dev-constants = { path = "../../runtime/dev/constants" }
bifrost-common-node = { path = "../common" }
bp-core = { workspace = true }
bifrost-dev-runtime = { workspace = true, features = ["std", "evm-tracing"] }
bifrost-dev-constants = { workspace = true }
bifrost-common-node = { workspace = true }

[features]
default = []
Expand Down
4 changes: 2 additions & 2 deletions node/dev/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ fn development_genesis(
evm: Default::default(),
ethereum: Default::default(),
base_fee: devnet::BaseFeeConfig::new(
sp_core::U256::from(100 * GWEI * SUPPLY_FACTOR),
sp_runtime::Permill::from_parts(125_000),
sp_core::U256::from(1_000 * GWEI * SUPPLY_FACTOR),
sp_runtime::Permill::zero(),
),
relay_manager: Default::default(),
bfc_staking: devnet::BfcStakingConfig {
Expand Down
2 changes: 2 additions & 0 deletions node/dev/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ where
grandpa,
command_sink,
max_past_logs,
logs_request_timeout,
} = deps;

let GrandpaDeps {
Expand Down Expand Up @@ -118,6 +119,7 @@ where
filter_pool,
500_usize, // max stored filters
max_past_logs,
logs_request_timeout,
block_data_cache.clone(),
)
.into_rpc(),
Expand Down
59 changes: 23 additions & 36 deletions node/dev/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use sc_network::NetworkService;
use sc_rpc_api::DenyUnsafe;
use sc_service::{
error::Error as ServiceError, Configuration, RpcHandlers, SpawnTaskHandle, TaskManager,
WarpSyncParams,
};
use sc_telemetry::{Telemetry, TelemetryWorker};

Expand Down Expand Up @@ -267,7 +268,7 @@ pub fn new_full_base(
spawn_handle: task_manager.spawn_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
})?;

if config.offchain_worker.enabled {
Expand Down Expand Up @@ -400,24 +401,6 @@ pub fn new_full_base(
);
}

// Frontier offchain DB task. Essential.
// Maps emulated ethereum data to substrate native data.
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
backend.clone(),
frontier_backend.clone(),
3,
0,
SyncStrategy::Normal,
)
.for_each(|()| futures::future::ready(())),
);

network_starter.start_network();
Ok(NewFullBase { task_manager, client, network, transaction_pool, rpc_handlers })
}
Expand Down Expand Up @@ -467,7 +450,7 @@ pub fn new_manual_base(
spawn_handle: task_manager.spawn_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
})?;

if config.offchain_worker.enabled {
Expand Down Expand Up @@ -593,22 +576,6 @@ pub fn new_manual_base(
);
}

task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
backend.clone(),
frontier_backend.clone(),
3,
0,
SyncStrategy::Normal,
)
.for_each(|()| futures::future::ready(())),
);

network_starter.start_network();
Ok(NewFullBase { task_manager, client, network, transaction_pool, rpc_handlers })
}
Expand Down Expand Up @@ -677,6 +644,25 @@ pub fn build_rpc_extensions_builder(
),
);

// Frontier offchain DB task. Essential.
// Maps emulated ethereum data to substrate native data.
builder.task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
backend.clone(),
overrides.clone(),
frontier_backend.clone(),
3,
0,
SyncStrategy::Normal,
)
.for_each(|()| futures::future::ready(())),
);

let tracing_requesters: RpcRequesters = {
if ethapi_cmd.contains(&EthApiCmd::Debug) || ethapi_cmd.contains(&EthApiCmd::Trace) {
spawn_tracing_tasks(
Expand Down Expand Up @@ -724,6 +710,7 @@ pub fn build_rpc_extensions_builder(
},
command_sink: command_sink.clone(),
max_past_logs: rpc_config.max_past_logs,
logs_request_timeout: rpc_config.logs_request_timeout,
};

if ethapi_cmd.contains(&EthApiCmd::Debug) || ethapi_cmd.contains(&EthApiCmd::Trace) {
Expand Down
Loading