From f5db3cc4f098e98071aae76f2d41418796fdc9c1 Mon Sep 17 00:00:00 2001 From: Igor Papandinas Date: Fri, 29 Mar 2024 16:47:53 +0400 Subject: [PATCH] fix: increase max_proposal_duration --- README.md | 14 +++++----- client/consensus/manual-seal/src/lib.rs | 8 +++--- .../consensus/manual-seal/src/seal_block.rs | 2 +- frame/balances/Cargo.toml | 2 +- node/src/service.rs | 2 +- runtime/src/lib.rs | 26 +++++++++---------- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 19f3da7..bba4525 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Swanky Node enables both Manual seal and Instant seal. We can tell the node to author a block by calling the `engine_createBlock` RPC. ```bash -$ curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d '{ +$ curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d '{ "jsonrpc":"2.0", "id":1, "method":"engine_createBlock", @@ -152,7 +152,7 @@ $ curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d In addition to finalizing blocks at the time of creating them, they may also be finalized later by using the RPC call `engine_finalizeBlock`. ```bash -$ curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d '{ +$ curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d '{ "jsonrpc":"2.0", "id":1, "method":"engine_finalizeBlock", @@ -176,11 +176,11 @@ Developers can forward blocks and revert blocks to requested block heights. Forwarding blocks to requested block height by calling `engine_forwardBlocksTo`. ```bash -$ curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d '{ feat/forward-revert-blocks ✭ +$ curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d '{ "jsonrpc":"2.0", "id":1, "method":"engine_forwardBlocksTo", - "params": [120, null] + "params": [120] }' ``` @@ -192,14 +192,14 @@ $ curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d Reverting blocks to requested block height by calling `engine_revertBlocksTo`. Note that reverting finalized blocks only works when node is launched with archive mode `--state-pruning archive` (or `--pruning archive`) since reverting blocks requires past blocks' states. -When blocks' states are pruned, RPC won't revert finalized blocks. +When blocks' states are pruned, **RPC won't revert finalized blocks**. ```bash -$ curl http://localhost:9933 -H "Content-Type:application/json;charset=utf-8" -d '{ feat/forward-revert-blocks ✭ +$ curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d '{ "jsonrpc":"2.0", "id":1, "method":"engine_revertBlocksTo", - "params": [50, null] + "params": [50] }' ``` diff --git a/client/consensus/manual-seal/src/lib.rs b/client/consensus/manual-seal/src/lib.rs index 61b101a..106302c 100644 --- a/client/consensus/manual-seal/src/lib.rs +++ b/client/consensus/manual-seal/src/lib.rs @@ -68,7 +68,7 @@ where /// Params required to start the instant sealing authorship task. pub struct ManualSealParams, TP, SC, CS, CIDP, P> { - /// Block import instance for well. importing blocks. + /// Block import instance. pub block_import: BI, /// The environment we are producing blocks for. @@ -120,17 +120,19 @@ pub struct InstantSealParams, TP, SC, pub create_inherent_data_providers: CIDP, } +/// Params required to start the delayed finalization task. pub struct DelayedFinalizeParams { - /// Block import instance for well. importing blocks. + /// Block import instance. pub client: Arc, + /// Handle for spawning delayed finalization tasks. pub spawn_handle: S, /// The delay in seconds before a block is finalized. pub delay_sec: u64, } -/// Creates the background authorship task for the manual seal engine. +/// Creates the background authorship task for the manually seal engine. pub async fn run_manual_seal( ManualSealParams { mut block_import, diff --git a/client/consensus/manual-seal/src/seal_block.rs b/client/consensus/manual-seal/src/seal_block.rs index 51b7ce8..390c41b 100644 --- a/client/consensus/manual-seal/src/seal_block.rs +++ b/client/consensus/manual-seal/src/seal_block.rs @@ -12,7 +12,7 @@ use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; use std::{sync::Arc, time::Duration}; /// max duration for creating a proposal in secs -pub const MAX_PROPOSAL_DURATION: u64 = 10; +pub const MAX_PROPOSAL_DURATION: u64 = 240; /// params for sealing a new block pub struct SealBlockParams<'a, B: BlockT, BI, SC, C: ProvideRuntimeApi, E, TP, CIDP, P> { diff --git a/frame/balances/Cargo.toml b/frame/balances/Cargo.toml index f122c3d..fce3a83 100644 --- a/frame/balances/Cargo.toml +++ b/frame/balances/Cargo.toml @@ -22,12 +22,12 @@ scale-info = { version = "2.5.0", default-features = false, features = ["derive" sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } serde = { version = "1.0.151", features = ["derive"] } -paste = "1.0.12" [dev-dependencies] pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false } +paste = "1.0.12" [features] default = ["std"] diff --git a/node/src/service.rs b/node/src/service.rs index 6ea8451..162df94 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -58,7 +58,7 @@ pub fn new_partial( }) .transpose()?; - let executor = sc_service::new_native_or_wasm_executor(&config); + let executor = sc_service::new_native_or_wasm_executor(config); let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 509e76c..2252179 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -270,7 +270,7 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type MaxLocks = MaxLocks; + type MaxLocks = ConstU32<50>; type MaxReserves = (); type ReserveIdentifier = [u8; 8]; /// The type for recording an account's balance. @@ -661,18 +661,18 @@ impl_runtime_apis! { } } - impl pallet_balances_rpc_runtime_api::BalancesApi for Runtime { - fn account(account_id: AccountId) -> pallet_balances::AccountData { - Balances::account(&account_id) - } - - fn get_set_free_balance_extrinsic(account_id: AccountId, free_balance: Balance) -> ::Extrinsic { - let timestamp = Timestamp::now(); - UncheckedExtrinsic::new_unsigned( - pallet_balances::Call::::set_free_balance { who: sp_runtime::MultiAddress::Id(account_id), new_free: free_balance, magic_number: timestamp.into() }.into() - ) - } - } + // impl pallet_balances_rpc_runtime_api::BalancesApi for Runtime { + // fn account(account_id: AccountId) -> pallet_balances::AccountData { + // Balances::account(&account_id) + // } + + // fn get_set_free_balance_extrinsic(account_id: AccountId, free_balance: Balance) -> ::Extrinsic { + // let timestamp = Timestamp::now(); + // UncheckedExtrinsic::new_unsigned( + // pallet_balances::Call::::set_free_balance { who: sp_runtime::MultiAddress::Id(account_id), new_free: free_balance, magic_number: timestamp.into() }.into() + // ) + // } + // } impl pallet_contracts::ContractsApi for Runtime