Skip to content

Commit 48403dd

Browse files
Apply pectra, weights update on testnet (#128)
* Node 161 pectra update (#126) * NODE-161, deps: update to stable2503 * NODE-161, fix: node: Replace TxPool RPC with Frontier implementation #moonbeam-foundation/moonbeam#3218 * NODE-161, fix: runtime: Fix weight limits in evm tracing runtimes (moonbeam-foundation/moonbeam#3210) * NODE-161, deps: update Cargo * NODE-161, fix: Use DecodeWithMemTracking (paritytech/polkadot-sdk#7360) * NODE-161, feat: runtime: upgrade to EIP-7702 new APIs * NODE-161, Introduce a gas-based Storage limit per tx (polkadot-evm/frontier#1142), Support external account provider (polkadot-evm/frontier#1329) * NODE-161, fix: remove sc_transaction_pool * NODE-161, fix: add missing crates * NODE-161, fix: resolve typo * NODE-161, fix: remove Paramter * NODE-161, feat: Allow whitleisting contract deployer (polkadot-evm/frontier#1629) * NODE-161, feat: Update Treasury to Support Relay Chain Block Number Provider (paritytech/polkadot-sdk#3970) * NODE-161, feat: [Identity] Decouple usernames from identities (paritytech/polkadot-sdk#5554) * NODE-161, feat: Collective: dynamic deposit based on number of proposals (paritytech/polkadot-sdk#3151) * NODE-161, fix: add missing DecodeWithMemTracking * NODE-161, feat: Moves disabling logic into pallet-session (paritytech/polkadot-sdk#7581) * NODE-161, feat: Update Scheduler to have a configurable block provider (paritytech/polkadot-sdk#7441) * NODE-161, chore: add WeightInfo to pallet_transaction_payment * NODE-161, fix: add missing authorization_list * NODE-161, fix: replace to new_bare * NODE-161, fix: add missing DecodeWithMemTracking derive * NODE-161, fix: resolve type mismatch * NODE-161, fix: use system_version (paritytech/polkadot-sdk#4257) * NODE-161, fix: use Cow (paritytech/polkadot-sdk#5693) * NODE-161, feat: Generic slashing side-effects (paritytech/polkadot-sdk#5623) * NODE-161, feat: impl create_inherent (paritytech/polkadot-sdk#3685) * NODE-161, fix: remove generic parameter from on_unbalanceds * NODE-161, fix: update storage_at runtime api * NODE-161, fix: node: Remove network starter that is no longer needed (paritytech/polkadot-sdk#6400) * NODE-161, fix: node: update FullNetworkConfiguration params * NODE-161, fix: node: update TransactionPool * NODE-161, fix: node: substrate-offchain: upgrade hyper to v1 (paritytech/polkadot-sdk#5919) * NODE-161, fix: node: update service, rpc * NODE-161, chore: remove unused imports * chore: add cargo feature "metadata-hash" * NODE-161, fix: add cumulus primitives storage proof size HostFunctions * NODE-161, chore: update dependencies branch * NODE-161, chore: update to stable2506 * NODE-161, chore: remove `RuntimeEvent` from pallet::Config * NODE-161, fix: update test code * NODE-161, fix: make node-lts compatible * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, chore: update `test_btc_registration_pool.ts` * NODE-161, fix: use node.kill() * NODE-161, fix: resolve test codes * NODE-161, fix: remove console.log * NODE-161, chore: update tools package.json * feat: init blaze * fix: remove unused crate * import precompile-blaze * NODE-161, chore: add mbm migrator into runtimes * NODE-161, chore: add pallet_session migration * NODE-161, fix: new_full_parts -> new_full_parts_record_import * fix: resolve issues * NODE-161, deps: update runtime version (489) --------- Co-authored-by: dnjscksdn98 <[email protected]> * NODE-80 branch restructure (#127) * NODE-179, feat: init pallet storages * NODE-179, feat: init pallet extrinsics * NODE-179, chore: add locktime * NODE-179, feat: finalize fee rate * NODE-179, feature: impl coin selections * NODE-179, feat: check blaze activation state * NODE-179, feature: impl `remove_outbound_messages` for legacy mode * NODE-80: implement benchmarking (#121) * NODE-80, feature: impl benchmarking.rs & mock.rs * NODE-80, fix: benchmark * NODE-80, fix: benchmark * NODE-80, chore: update weights * fix: zero out proof size in weights * chore: resolve --------- Co-authored-by: dnjscksdn98 <[email protected]> * fix: correctly use mocha with tsx (#133) --------- Co-authored-by: dnjscksdn98 <[email protected]>
1 parent 8801b8c commit 48403dd

File tree

89 files changed

+16250
-9079
lines changed

Some content is hidden

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

89 files changed

+16250
-9079
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 110 additions & 104 deletions
Large diffs are not rendered by default.

node/common/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ tokio = { workspace = true, features = ["macros", "sync"] }
1717
# substrate client dependencies
1818
sc-client-api = { workspace = true }
1919
sc-rpc = { workspace = true }
20-
sc-rpc-api = { workspace = true }
21-
sc-transaction-pool = { workspace = true }
2220
sc-chain-spec = { workspace = true }
2321
sc-consensus-grandpa = { workspace = true }
2422
sc-consensus-manual-seal = { workspace = true }
@@ -28,7 +26,7 @@ sc-service = { workspace = true }
2826
substrate-prometheus-endpoint = { workspace = true }
2927

3028
# benchmarking dependencies
31-
frame-benchmarking = { workspace = true, features = ["std"] }
29+
frame-benchmarking = { workspace = true, optional = true, features = ["std"] }
3230

3331
# substrate primitives dependencies
3432
sp-core = { workspace = true, features = ["std"] }
@@ -49,9 +47,12 @@ fc-rpc-debug = { workspace = true }
4947
fc-rpc-trace = { workspace = true }
5048
fp-ext = { workspace = true, features = ["std"] }
5149

50+
# Cumulus dependencies
51+
cumulus-primitives-proof-size-hostfunction = { workspace = true }
52+
5253
# Local Dependencies
5354
bp-core = { workspace = true }
5455

5556
[features]
5657
default = []
57-
runtime-benchmarks = []
58+
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]

node/common/src/rpc.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ use sc_consensus_manual_seal::EngineCommand;
1212
use sc_network::service::traits::NetworkService;
1313
use sc_network_sync::SyncingService;
1414
use sc_rpc::SubscriptionTaskExecutor;
15-
use sc_rpc_api::DenyUnsafe;
1615
use sc_service::TaskManager;
17-
use sc_transaction_pool::{ChainApi, Pool};
1816

1917
use bp_core::{BlockNumber, Hash, Header};
2018
use sp_core::H256;
@@ -49,7 +47,7 @@ pub struct GrandpaDeps<B> {
4947
}
5048

5149
/// Full client dependencies.
52-
pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
50+
pub struct FullDevDeps<C, P, BE, SC, CIDP> {
5351
/// Client version.
5452
pub client_version: String,
5553
/// The client instance to use.
@@ -61,9 +59,7 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
6159
/// A copy of the chain spec.
6260
pub chain_spec: Box<dyn sc_chain_spec::ChainSpec>,
6361
/// Graph pool instance.
64-
pub graph: Arc<Pool<A>>,
65-
/// Whether to deny unsafe calls
66-
pub deny_unsafe: DenyUnsafe,
62+
pub graph: Arc<P>,
6763
/// GRANDPA specific dependencies.
6864
pub grandpa: GrandpaDeps<BE>,
6965
/// The Node authority flag
@@ -101,7 +97,7 @@ pub struct FullDevDeps<C, P, BE, SC, A: ChainApi, CIDP> {
10197
}
10298

10399
/// Mainnet/Testnet client dependencies.
104-
pub struct FullDeps<C, P, BE, SC, A: ChainApi, CIDP> {
100+
pub struct FullDeps<C, P, BE, SC, CIDP> {
105101
/// Client version.
106102
pub client_version: String,
107103
/// The client instance to use.
@@ -113,9 +109,7 @@ pub struct FullDeps<C, P, BE, SC, A: ChainApi, CIDP> {
113109
/// A copy of the chain spec.
114110
pub chain_spec: Box<dyn sc_chain_spec::ChainSpec>,
115111
/// Graph pool instance.
116-
pub graph: Arc<Pool<A>>,
117-
/// Whether to deny unsafe calls
118-
pub deny_unsafe: DenyUnsafe,
112+
pub graph: Arc<P>,
119113
/// GRANDPA specific dependencies.
120114
pub grandpa: GrandpaDeps<BE>,
121115
/// The Node authority flag

node/common/src/service.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ use sp_runtime::traits::BlakeTwo256;
1717

1818
/// Only enable the benchmarking host functions when we actually want to benchmark.
1919
#[cfg(feature = "runtime-benchmarks")]
20-
pub type HostFunctions =
21-
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);
22-
/// Otherwise we use empty host functions for ext host functions.
20+
pub type HostFunctions = (
21+
sp_io::SubstrateHostFunctions,
22+
frame_benchmarking::benchmarking::HostFunctions,
23+
cumulus_primitives_proof_size_hostfunction::storage_proof_size::HostFunctions,
24+
);
25+
/// Otherwise we use storage proof size host functions for compatibility.
2326
#[cfg(not(feature = "runtime-benchmarks"))]
24-
pub type HostFunctions = (sp_io::SubstrateHostFunctions, fp_ext::bifrost_ext::HostFunctions);
27+
pub type HostFunctions = (
28+
sp_io::SubstrateHostFunctions,
29+
fp_ext::bifrost_ext::HostFunctions,
30+
cumulus_primitives_proof_size_hostfunction::storage_proof_size::HostFunctions,
31+
);
2532

2633
/// Configure frontier database.
2734
pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::PathBuf {

node/core/Cargo.toml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,17 @@ sc-service = { workspace = true }
2828
sc-consensus-grandpa = { workspace = true }
2929

3030
# benchmarking dependencies
31-
frame-benchmarking = { workspace = true, features = ["std"] }
3231
frame-benchmarking-cli = { workspace = true }
3332

3433
# Bifrost runtimes
3534
bifrost-dev-runtime = { workspace = true, features = ["std", "evm-tracing"] }
3635
bifrost-testnet-runtime = { workspace = true, features = [
37-
"std",
38-
"evm-tracing",
36+
"std",
37+
"evm-tracing",
3938
] }
4039
bifrost-mainnet-runtime = { workspace = true, features = [
41-
"std",
42-
"evm-tracing",
40+
"std",
41+
"evm-tracing",
4342
] }
4443

4544
# Bifrost node specs
@@ -53,4 +52,12 @@ substrate-build-script-utils = { workspace = true }
5352

5453
[features]
5554
default = []
56-
runtime-benchmarks = []
55+
runtime-benchmarks = [
56+
"bifrost-dev-runtime/runtime-benchmarks",
57+
"bifrost-testnet-runtime/runtime-benchmarks",
58+
"bifrost-mainnet-runtime/runtime-benchmarks",
59+
"bifrost-dev-node/runtime-benchmarks",
60+
"bifrost-testnet-node/runtime-benchmarks",
61+
"bifrost-mainnet-node/runtime-benchmarks",
62+
"sc-service/runtime-benchmarks",
63+
]

node/core/src/command.rs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use crate::cli::{Cli, Subcommand};
22

3-
use bifrost_common_node::cli_opt::{BackendType, BackendTypeConfig, RpcConfig};
3+
use bifrost_common_node::{
4+
cli_opt::{BackendType, BackendTypeConfig, RpcConfig},
5+
service::HostFunctions,
6+
};
47

58
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
69

@@ -294,9 +297,9 @@ pub fn run() -> sc_cli::Result<()> {
294297
);
295298
}
296299

297-
cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
298-
config.chain_spec,
299-
))
300+
cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, HostFunctions>(
301+
Some(config.chain_spec),
302+
)
300303
},
301304
BenchmarkCmd::Block(cmd) => {
302305
let PartialComponents { client, .. } =
@@ -310,12 +313,32 @@ pub fn run() -> sc_cli::Result<()> {
310313
),
311314
#[cfg(feature = "runtime-benchmarks")]
312315
BenchmarkCmd::Storage(cmd) => {
313-
let PartialComponents { client, backend, .. } =
314-
service::new_partial(&config)?;
315-
let db = backend.expose_db();
316-
let storage = backend.expose_storage();
316+
let chain_spec = &config.chain_spec;
317317

318-
cmd.run(config, client, db, storage)
318+
match chain_spec {
319+
_spec if chain_spec.is_dev() => {
320+
use bifrost_dev_node::service;
321+
let params = service::new_partial(&config, &rpc_config)?;
322+
let db = params.backend.expose_db();
323+
let storage = params.backend.expose_storage();
324+
cmd.run(config, params.client, db, storage)
325+
},
326+
_spec if chain_spec.is_mainnet() => {
327+
use bifrost_mainnet_node::service;
328+
let params = service::new_partial(&config, &rpc_config)?;
329+
let db = params.backend.expose_db();
330+
let storage = params.backend.expose_storage();
331+
cmd.run(config, params.client, db, storage)
332+
},
333+
_spec if chain_spec.is_testnet() => {
334+
use bifrost_testnet_node::service;
335+
let params = service::new_partial(&config, &rpc_config)?;
336+
let db = params.backend.expose_db();
337+
let storage = params.backend.expose_storage();
338+
cmd.run(config, params.client, db, storage)
339+
},
340+
_ => panic!("Invalid chain spec"),
341+
}
319342
},
320343
BenchmarkCmd::Machine(cmd) => {
321344
cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())

node/dev/Cargo.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ sc-consensus = { workspace = true }
3030
sc-network = { workspace = true }
3131
sc-network-sync = { workspace = true }
3232
sc-rpc = { workspace = true }
33-
sc-rpc-api = { workspace = true }
3433
sc-chain-spec = { workspace = true }
3534
sc-basic-authorship = { workspace = true }
3635
sc-offchain = { workspace = true }
@@ -57,22 +56,21 @@ substrate-frame-rpc-system = { workspace = true }
5756
fc-db = { workspace = true, features = ["rocksdb"] }
5857
fc-rpc-core = { workspace = true }
5958
fc-mapping-sync = { workspace = true, features = ["sql"] }
60-
fc-rpc-txpool = { workspace = true }
6159
fc-rpc-debug = { workspace = true }
6260
fc-rpc-trace = { workspace = true }
63-
fc-rpc = { workspace = true, features = ["rpc-binary-search-estimate"] }
61+
fc-rpc = { workspace = true, features = ["rpc-binary-search-estimate", "aura"] }
6462

6563
fp-evm = { workspace = true }
6664
fp-ext = { workspace = true, features = ["std"] }
6765
fp-rpc = { workspace = true, features = ["std"] }
6866
fp-rpc-txpool = { workspace = true, features = ["std"] }
6967
pallet-ethereum = { workspace = true, features = [
70-
"std",
71-
"forbid-evm-reentrancy",
68+
"std",
69+
"forbid-evm-reentrancy",
7270
] }
7371

7472
# benchmarking dependencies
75-
frame-benchmarking = { workspace = true, features = ["std"] }
73+
frame-benchmarking = { workspace = true, optional = true, features = ["std"] }
7674

7775
# Local Dependencies
7876
bp-core = { workspace = true }
@@ -82,4 +80,7 @@ bifrost-common-node = { workspace = true }
8280

8381
[features]
8482
default = []
85-
runtime-benchmarks = ["bifrost-dev-runtime/runtime-benchmarks"]
83+
runtime-benchmarks = [
84+
"bifrost-dev-runtime/runtime-benchmarks",
85+
"frame-benchmarking/runtime-benchmarks",
86+
]

node/dev/src/rpc.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,19 @@ use sp_blockchain::{
2222
use sp_consensus::SelectChain;
2323
use sp_consensus_aura::{sr25519::AuthorityId as AuraId, AuraApi};
2424
use sp_inherents::CreateInherentDataProviders;
25-
use sp_runtime::traits::BlakeTwo256;
25+
use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
2626

27-
use fc_rpc::pending::AuraConsensusDataProvider;
2827
use sc_client_api::{
2928
backend::{Backend, StateBackend, StorageProvider},
3029
UsageProvider,
3130
};
3231
pub use sc_client_api::{AuxStore, BlockOf, BlockchainEvents};
3332
use sc_consensus_manual_seal::rpc::{ManualSeal, ManualSealApiServer};
34-
pub use sc_rpc_api::DenyUnsafe;
35-
use sc_transaction_pool::ChainApi;
3633
use sc_transaction_pool_api::TransactionPool;
3734

3835
/// Instantiate all full RPC extensions.
39-
pub fn create_full<C, P, BE, SC, A, CIDP>(
40-
deps: FullDevDeps<C, P, BE, SC, A, CIDP>,
36+
pub fn create_full<C, P, BE, SC, CIDP>(
37+
deps: FullDevDeps<C, P, BE, SC, CIDP>,
4138
maybe_tracing_config: Option<TracingConfig>,
4239
pubsub_notification_sinks: Arc<
4340
fc_mapping_sync::EthereumBlockNotificationSinks<
@@ -63,18 +60,17 @@ where
6360
C::Api: fp_rpc::ConvertTransactionRuntimeApi<Block>,
6461
C::Api: fp_rpc_txpool::TxPoolRuntimeApi<Block>,
6562
C::Api: AuraApi<Block, AuraId>,
66-
P: TransactionPool<Block = Block> + 'static,
67-
A: ChainApi<Block = Block> + 'static,
63+
P: TransactionPool<Block = Block, Hash = <Block as BlockT>::Hash> + 'static,
6864
SC: SelectChain<Block> + 'static,
6965
CIDP: CreateInherentDataProviders<Block, ()> + Send + 'static,
7066
{
7167
use fc_rpc::{
72-
Eth, EthApiServer, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, Net,
73-
NetApiServer, Web3, Web3ApiServer,
68+
pending::AuraConsensusDataProvider, Eth, EthApiServer, EthFilter, EthFilterApiServer,
69+
EthPubSub, EthPubSubApiServer, Net, NetApiServer, TxPool, TxPoolApiServer, Web3,
70+
Web3ApiServer,
7471
};
7572
use fc_rpc_debug::{Debug, DebugServer};
7673
use fc_rpc_trace::{Trace, TraceServer};
77-
use fc_rpc_txpool::{TxPool, TxPoolServer};
7874
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
7975
use sc_consensus_grandpa_rpc::{Grandpa, GrandpaApiServer};
8076
use substrate_frame_rpc_system::{System, SystemApiServer};
@@ -86,7 +82,6 @@ where
8682
pool,
8783
select_chain: _,
8884
chain_spec: _,
89-
deny_unsafe,
9085
graph,
9186
network,
9287
filter_pool,
@@ -115,8 +110,7 @@ where
115110
finality_provider,
116111
} = grandpa;
117112

118-
io.merge(System::new(Arc::clone(&client), Arc::clone(&pool), deny_unsafe).into_rpc())
119-
.ok();
113+
io.merge(System::new(Arc::clone(&client), Arc::clone(&pool)).into_rpc()).ok();
120114
io.merge(TransactionPayment::new(Arc::clone(&client)).into_rpc()).ok();
121115

122116
io.merge(
@@ -191,7 +185,7 @@ where
191185
let convert_transaction: Option<Never> = None;
192186

193187
io.merge(
194-
Eth::<_, _, _, _, _, _, _, DefaultEthConfig<C, BE>>::new(
188+
Eth::<_, _, _, _, _, _, DefaultEthConfig<C, BE>>::new(
195189
Arc::clone(&client),
196190
Arc::clone(&pool),
197191
graph.clone(),
@@ -217,8 +211,13 @@ where
217211
if let Some(tracing_config) = maybe_tracing_config {
218212
if let Some(trace_filter_requester) = tracing_config.tracing_requesters.trace {
219213
io.merge(
220-
Trace::new(client, trace_filter_requester, tracing_config.trace_filter_max_count)
221-
.into_rpc(),
214+
Trace::new(
215+
client,
216+
trace_filter_requester,
217+
tracing_config.trace_filter_max_count,
218+
frontier_backend.clone(),
219+
)
220+
.into_rpc(),
222221
)
223222
.ok();
224223
}

0 commit comments

Comments
 (0)