mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Convert all UK spelling to US (#2138)
* all the ise * forgot a misspelling * a few more replacements * bump impl * rollback and fixes * bump impl again * Add aliases for RPC * Update on_demand.rs
This commit is contained in:
@@ -28,7 +28,7 @@ decl_runtime_apis! {
|
||||
/// Apply the given extrinsics.
|
||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult;
|
||||
/// Finish the current block.
|
||||
fn finalise_block() -> <Block as BlockT>::Header;
|
||||
fn finalize_block() -> <Block as BlockT>::Header;
|
||||
/// Generate inherent extrinsics. The inherent data will vary from chain to chain.
|
||||
fn inherent_extrinsics(inherent: InherentData) -> Vec<<Block as BlockT>::Extrinsic>;
|
||||
/// Check that the inherents are valid. The inherent data will vary from chain to chain.
|
||||
|
||||
@@ -64,7 +64,7 @@ where
|
||||
Default::default()
|
||||
);
|
||||
let api = api.runtime_api();
|
||||
api.initialise_block_with_context(block_id, ExecutionContext::BlockConstruction, &header)?;
|
||||
api.initialize_block_with_context(block_id, ExecutionContext::BlockConstruction, &header)?;
|
||||
Ok(BlockBuilder {
|
||||
header,
|
||||
extrinsics: Vec::new(),
|
||||
@@ -97,7 +97,7 @@ where
|
||||
|
||||
/// Consume the builder to return a valid `Block` containing all pushed extrinsics.
|
||||
pub fn bake(mut self) -> error::Result<Block> {
|
||||
self.header = self.api.finalise_block_with_context(&self.block_id, ExecutionContext::BlockConstruction)?;
|
||||
self.header = self.api.finalize_block_with_context(&self.block_id, ExecutionContext::BlockConstruction)?;
|
||||
|
||||
debug_assert_eq!(
|
||||
self.header.extrinsics_root().clone(),
|
||||
|
||||
@@ -73,7 +73,7 @@ where
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
changes: &mut OverlayedChanges,
|
||||
initialised_block: &mut Option<BlockId<B>>,
|
||||
initialized_block: &mut Option<BlockId<B>>,
|
||||
prepare_environment_block: PB,
|
||||
execution_manager: ExecutionManager<EM>,
|
||||
native_call: Option<NC>,
|
||||
@@ -213,14 +213,14 @@ where
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
changes: &mut OverlayedChanges,
|
||||
initialised_block: &mut Option<BlockId<Block>>,
|
||||
initialized_block: &mut Option<BlockId<Block>>,
|
||||
prepare_environment_block: PB,
|
||||
execution_manager: ExecutionManager<EM>,
|
||||
native_call: Option<NC>,
|
||||
mut side_effects_handler: Option<&mut O>,
|
||||
) -> Result<NativeOrEncoded<R>, error::Error> where ExecutionManager<EM>: Clone {
|
||||
let state = self.backend.state_at(*at)?;
|
||||
if method != "Core_initialise_block" && initialised_block.map(|id| id != *at).unwrap_or(true) {
|
||||
if method != "Core_initialize_block" && initialized_block.map(|id| id != *at).unwrap_or(true) {
|
||||
let header = prepare_environment_block()?;
|
||||
state_machine::new(
|
||||
&state,
|
||||
@@ -228,14 +228,14 @@ where
|
||||
side_effects_handler.as_mut().map(|x| &mut **x),
|
||||
changes,
|
||||
&self.executor,
|
||||
"Core_initialise_block",
|
||||
"Core_initialize_block",
|
||||
&header.encode(),
|
||||
).execute_using_consensus_failure_handler::<_, R, fn() -> _>(
|
||||
execution_manager.clone(),
|
||||
false,
|
||||
None,
|
||||
)?;
|
||||
*initialised_block = Some(*at);
|
||||
*initialized_block = Some(*at);
|
||||
}
|
||||
|
||||
let result = state_machine::new(
|
||||
@@ -252,9 +252,9 @@ where
|
||||
native_call,
|
||||
).map(|(result, _, _)| result)?;
|
||||
|
||||
// If the method is `initialise_block` we need to set the `initialised_block`
|
||||
if method == "Core_initialise_block" {
|
||||
*initialised_block = Some(*at);
|
||||
// If the method is `initialize_block` we need to set the `initialized_block`
|
||||
if method == "Core_initialize_block" {
|
||||
*initialized_block = Some(*at);
|
||||
}
|
||||
|
||||
self.backend.destroy_state(state)?;
|
||||
|
||||
@@ -285,7 +285,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
|
||||
backend.begin_state_operation(&mut op, BlockId::Hash(Default::default()))?;
|
||||
let state_root = op.reset_storage(genesis_storage, children_genesis_storage)?;
|
||||
let genesis_block = genesis::construct_genesis_block::<Block>(state_root.into());
|
||||
info!("Initialising Genesis block/state (state: {}, header-hash: {})", genesis_block.header().state_root(), genesis_block.header().hash());
|
||||
info!("Initializing Genesis block/state (state: {}, header-hash: {})", genesis_block.header().state_root(), genesis_block.header().hash());
|
||||
op.set_block_data(
|
||||
genesis_block.deconstruct().0,
|
||||
Some(vec![]),
|
||||
@@ -1351,7 +1351,7 @@ impl<B, E, Block, RA> CallRuntimeAt<Block> for Client<B, E, Block, RA> where
|
||||
function: &'static str,
|
||||
args: Vec<u8>,
|
||||
changes: &mut OverlayedChanges,
|
||||
initialised_block: &mut Option<BlockId<Block>>,
|
||||
initialized_block: &mut Option<BlockId<Block>>,
|
||||
native_call: Option<NC>,
|
||||
context: ExecutionContext,
|
||||
) -> error::Result<NativeOrEncoded<R>> {
|
||||
@@ -1373,7 +1373,7 @@ impl<B, E, Block, RA> CallRuntimeAt<Block> for Client<B, E, Block, RA> where
|
||||
function,
|
||||
&args,
|
||||
changes,
|
||||
initialised_block,
|
||||
initialized_block,
|
||||
|| self.prepare_environment_block(at),
|
||||
manager,
|
||||
native_call,
|
||||
@@ -1630,7 +1630,7 @@ pub(crate) mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn client_initialises_from_genesis_ok() {
|
||||
fn client_initializes_from_genesis_ok() {
|
||||
let client = test_client::new();
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -93,7 +93,7 @@ mod tests {
|
||||
state_machine::NeverOffchainExt::new(),
|
||||
&mut overlay,
|
||||
&executor(),
|
||||
"Core_initialise_block",
|
||||
"Core_initialize_block",
|
||||
&header.encode(),
|
||||
).execute(
|
||||
ExecutionStrategy::NativeElseWasm,
|
||||
@@ -119,7 +119,7 @@ mod tests {
|
||||
state_machine::NeverOffchainExt::new(),
|
||||
&mut overlay,
|
||||
&executor(),
|
||||
"BlockBuilder_finalise_block",
|
||||
"BlockBuilder_finalize_block",
|
||||
&[],
|
||||
).execute(
|
||||
ExecutionStrategy::NativeElseWasm,
|
||||
|
||||
@@ -118,14 +118,14 @@ where
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
changes: &mut OverlayedChanges,
|
||||
initialised_block: &mut Option<BlockId<Block>>,
|
||||
initialized_block: &mut Option<BlockId<Block>>,
|
||||
_prepare_environment_block: PB,
|
||||
execution_manager: ExecutionManager<EM>,
|
||||
_native_call: Option<NC>,
|
||||
side_effects_handler: Option<&mut O>,
|
||||
) -> ClientResult<NativeOrEncoded<R>> where ExecutionManager<EM>: Clone {
|
||||
// it is only possible to execute contextual call if changes are empty
|
||||
if !changes.is_empty() || initialised_block.is_some() {
|
||||
if !changes.is_empty() || initialized_block.is_some() {
|
||||
return Err(ClientErrorKind::NotAvailableOnLightClient.into());
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ impl<Block, B, Remote, Local> CallExecutor<Block, Blake2Hasher> for
|
||||
method: &str,
|
||||
call_data: &[u8],
|
||||
changes: &mut OverlayedChanges,
|
||||
initialised_block: &mut Option<BlockId<Block>>,
|
||||
initialized_block: &mut Option<BlockId<Block>>,
|
||||
prepare_environment_block: PB,
|
||||
_manager: ExecutionManager<EM>,
|
||||
native_call: Option<NC>,
|
||||
@@ -270,7 +270,7 @@ impl<Block, B, Remote, Local> CallExecutor<Block, Blake2Hasher> for
|
||||
method,
|
||||
call_data,
|
||||
changes,
|
||||
initialised_block,
|
||||
initialized_block,
|
||||
prepare_environment_block,
|
||||
ExecutionManager::NativeWhenPossible,
|
||||
native_call,
|
||||
@@ -291,7 +291,7 @@ impl<Block, B, Remote, Local> CallExecutor<Block, Blake2Hasher> for
|
||||
method,
|
||||
call_data,
|
||||
changes,
|
||||
initialised_block,
|
||||
initialized_block,
|
||||
prepare_environment_block,
|
||||
ExecutionManager::NativeWhenPossible,
|
||||
native_call,
|
||||
@@ -388,7 +388,7 @@ pub fn prove_execution<Block, S, E>(
|
||||
let (_, init_proof) = executor.prove_at_trie_state(
|
||||
&trie_state,
|
||||
&mut changes,
|
||||
"Core_initialise_block",
|
||||
"Core_initialize_block",
|
||||
&header.encode(),
|
||||
)?;
|
||||
|
||||
@@ -435,7 +435,7 @@ pub fn check_execution_proof<Header, E, H>(
|
||||
&trie_backend,
|
||||
&mut changes,
|
||||
executor,
|
||||
"Core_initialise_block",
|
||||
"Core_initialize_block",
|
||||
&next_block.encode(),
|
||||
)?;
|
||||
|
||||
@@ -516,12 +516,12 @@ mod tests {
|
||||
assert_eq!(remote, local);
|
||||
|
||||
// check method that requires environment
|
||||
let (_, block) = execute(&remote_client, 0, "BlockBuilder_finalise_block");
|
||||
let (_, block) = execute(&remote_client, 0, "BlockBuilder_finalize_block");
|
||||
let local_block: Header = Decode::decode(&mut &block[..]).unwrap();
|
||||
assert_eq!(local_block.number, 1);
|
||||
|
||||
// check method that requires environment
|
||||
let (_, block) = execute(&remote_client, 2, "BlockBuilder_finalise_block");
|
||||
let (_, block) = execute(&remote_client, 2, "BlockBuilder_finalize_block");
|
||||
let local_block: Header = Decode::decode(&mut &block[..]).unwrap();
|
||||
assert_eq!(local_block.number, 3);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ pub trait CallRuntimeAt<Block: BlockT> {
|
||||
function: &'static str,
|
||||
args: Vec<u8>,
|
||||
changes: &mut OverlayedChanges,
|
||||
initialised_block: &mut Option<BlockId<Block>>,
|
||||
initialized_block: &mut Option<BlockId<Block>>,
|
||||
native_call: Option<NC>,
|
||||
context: ExecutionContext,
|
||||
) -> error::Result<NativeOrEncoded<R>>;
|
||||
@@ -121,8 +121,8 @@ decl_runtime_apis! {
|
||||
fn authorities() -> Vec<AuthorityIdFor<Block>>;
|
||||
/// Execute the given block.
|
||||
fn execute_block(block: Block);
|
||||
/// Initialise a block with the given header.
|
||||
fn initialise_block(header: &<Block as BlockT>::Header);
|
||||
/// Initialize a block with the given header.
|
||||
fn initialize_block(header: &<Block as BlockT>::Header);
|
||||
}
|
||||
|
||||
/// The `Metadata` api trait that returns metadata for the runtime.
|
||||
|
||||
Reference in New Issue
Block a user