Skip to content

Commit

Permalink
fix: increase max_proposal_duration
Browse files Browse the repository at this point in the history
  • Loading branch information
ipapandinas committed Mar 29, 2024
1 parent e335087 commit f5db3cc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 26 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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]
}'
```

Expand All @@ -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]
}'
```

Expand Down
8 changes: 5 additions & 3 deletions client/consensus/manual-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ where

/// Params required to start the instant sealing authorship task.
pub struct ManualSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, 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.
Expand Down Expand Up @@ -120,17 +120,19 @@ pub struct InstantSealParams<B: BlockT, BI, E, C: ProvideRuntimeApi<B>, TP, SC,
pub create_inherent_data_providers: CIDP,
}

/// Params required to start the delayed finalization task.
pub struct DelayedFinalizeParams<C, S> {
/// Block import instance for well. importing blocks.
/// Block import instance.
pub client: Arc<C>,

/// 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<B, BI, CB, E, C, TP, SC, CS, CIDP, P>(
ManualSealParams {
mut block_import,
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/manual-seal/src/seal_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<B>, E, TP, CIDP, P> {
Expand Down
2 changes: 1 addition & 1 deletion frame/balances/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Block, RuntimeApi, _>(
Expand Down
26 changes: 13 additions & 13 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -661,18 +661,18 @@ impl_runtime_apis! {
}
}

impl pallet_balances_rpc_runtime_api::BalancesApi<Block, AccountId, Balance> for Runtime {
fn account(account_id: AccountId) -> pallet_balances::AccountData<Balance> {
Balances::account(&account_id)
}

fn get_set_free_balance_extrinsic(account_id: AccountId, free_balance: Balance) -> <Block as BlockT>::Extrinsic {
let timestamp = Timestamp::now();
UncheckedExtrinsic::new_unsigned(
pallet_balances::Call::<Runtime>::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<Block, AccountId, Balance> for Runtime {
// fn account(account_id: AccountId) -> pallet_balances::AccountData<Balance> {
// Balances::account(&account_id)
// }

// fn get_set_free_balance_extrinsic(account_id: AccountId, free_balance: Balance) -> <Block as BlockT>::Extrinsic {
// let timestamp = Timestamp::now();
// UncheckedExtrinsic::new_unsigned(
// pallet_balances::Call::<Runtime>::set_free_balance { who: sp_runtime::MultiAddress::Id(account_id), new_free: free_balance, magic_number: timestamp.into() }.into()
// )
// }
// }

impl pallet_contracts::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash, EventRecord>
for Runtime
Expand Down

0 comments on commit f5db3cc

Please sign in to comment.