Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
04f2167
Start
bkchr Mar 13, 2023
08c0b32
More work!
bkchr Mar 13, 2023
d1d5d4c
Moar
bkchr Mar 14, 2023
55af869
More changes
bkchr Mar 15, 2023
4374d01
More fixes
bkchr Mar 16, 2023
cc3c030
More worrk
bkchr Mar 17, 2023
0cac727
More fixes
bkchr Mar 20, 2023
7dbaa81
More fixes to make it compile
bkchr Mar 20, 2023
5b2fc23
Adds `NoOffchainStorage`
bkchr Mar 21, 2023
9fed302
Pass the extensions
bkchr Mar 21, 2023
6730212
Small basti making small progress
bkchr Mar 22, 2023
63ada35
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Apr 4, 2023
a3ff3e3
Fix merge errors and remove `ExecutionContext`
bkchr Apr 4, 2023
afbc691
Move registration of `ReadRuntimeVersionExt` to `ExecutionExtension`
bkchr Apr 4, 2023
947b02f
Merge remote-tracking branch 'origin/bkchr-move-read-runtime-version-…
bkchr Apr 4, 2023
906fb5a
Fix compilation
bkchr Apr 5, 2023
20f3c02
Register the global extensions inside runtime api instance
bkchr Apr 10, 2023
f6928f8
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Apr 24, 2023
033a32b
Fixes
bkchr Apr 26, 2023
cb24657
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Apr 28, 2023
97befb6
Fix `generate_initial_session_keys` by passing the keystore extension
bkchr May 1, 2023
c76f8fd
Fix the grandpa tests
bkchr May 2, 2023
13347fb
Fix more tests
bkchr May 2, 2023
0bd9113
Fix more tests
bkchr May 2, 2023
d457ac9
Don't set any heap pages if there isn't an override
bkchr May 3, 2023
4e4b5e4
Fix small fallout
bkchr May 3, 2023
7d48c14
FMT
bkchr May 3, 2023
d85f8ea
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr May 5, 2023
05223f1
Fix tests
bkchr May 7, 2023
6ca6737
More tests
bkchr May 8, 2023
440d0e5
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr May 8, 2023
5942c96
Offchain worker custom extensions
bkchr May 9, 2023
5b253f8
More fixes
bkchr May 9, 2023
3b7a8b4
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr May 17, 2023
16714b6
Make offchain tx pool creation reusable
bkchr May 23, 2023
e52f63d
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr May 25, 2023
190e036
Merge remote-tracking branch 'origin/bkchr-offchain-tx-pool-factory' …
bkchr May 25, 2023
902f1a4
Fixes
bkchr May 25, 2023
671f9b9
Fixes
bkchr May 25, 2023
59a6fa0
Set offchain transaction pool in BABE before using it in the runtime
bkchr May 29, 2023
9145976
Add the `offchain_tx_pool` to Grandpa as well
bkchr May 30, 2023
c29dcb3
Fix the nodes
bkchr May 30, 2023
23578b1
Print some error when using the old warnings
bkchr Jun 2, 2023
9208bf4
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jun 2, 2023
0e0325c
Fix merge issues
bkchr Jun 2, 2023
d12e6ba
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jun 5, 2023
65248e9
Fix compilation
bkchr Jun 5, 2023
67b1730
Rename `babe_link`
bkchr Jun 5, 2023
b1bb12d
Rename to `offchain_tx_pool_factory`
bkchr Jun 5, 2023
d4de293
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jun 14, 2023
85ccb89
Cleanup
bkchr Jun 14, 2023
5042fb0
FMT
bkchr Jun 14, 2023
99a5ca8
Fix benchmark name
bkchr Jun 15, 2023
32e69a2
Fix `try-runtime`
bkchr Jun 15, 2023
38191af
Remove `--execution` CLI args
bkchr Jun 15, 2023
8960448
Make clippy happy
bkchr Jun 16, 2023
42301cd
Forward bls functions
bkchr Jun 16, 2023
296ffd5
Merge branch 'bkchr-execution-strategies-remove' of github.com:parity…
bkchr Jun 16, 2023
e4bfccc
Fix docs
bkchr Jun 16, 2023
ae756aa
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jun 20, 2023
22c5603
Update UI tests
bkchr Jun 20, 2023
74ac48e
Update client/api/src/execution_extensions.rs
bkchr Jun 24, 2023
b07fde8
Apply suggestions from code review
bkchr Jun 24, 2023
8b3f2d9
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jun 24, 2023
ec9e872
Update client/cli/src/params/import_params.rs
bkchr Jun 24, 2023
e4781c4
Update client/api/src/execution_extensions.rs
bkchr Jun 24, 2023
4115970
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jun 28, 2023
c668c7c
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jun 29, 2023
9d61976
Merge branch 'bkchr-execution-strategies-remove' of github.com:parity…
bkchr Jun 30, 2023
3c71aa1
Pass the offchain storage to the MMR RPC
bkchr Jun 30, 2023
0c5c43d
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jul 5, 2023
7079d01
Update client/api/src/execution_extensions.rs
bkchr Jul 10, 2023
ad87780
Review comments
bkchr Jul 10, 2023
dc65806
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
bkchr Jul 10, 2023
792fbcc
Fixes
bkchr Jul 10, 2023
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
Prev Previous commit
Next Next commit
Move registration of ReadRuntimeVersionExt to ExecutionExtension
Instead of registering `ReadRuntimeVersionExt` in `sp-state-machine` it is moved to
`ExecutionExtension` which provides the default extensions.
  • Loading branch information
bkchr committed Apr 4, 2023
commit afbc691a9049adaa083754f81e4ecdb88cbe2d0c
9 changes: 7 additions & 2 deletions bin/node/testing/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,16 @@ impl BenchDb {

let client = sc_service::new_client(
backend.clone(),
executor,
executor.clone(),
genesis_block_builder,
None,
None,
ExecutionExtensions::new(profile.into_execution_strategies(), None, None),
ExecutionExtensions::new(
profile.into_execution_strategies(),
None,
None,
Arc::new(executor),
),
Box::new(task_executor.clone()),
None,
None,
Expand Down
18 changes: 6 additions & 12 deletions client/api/src/execution_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use parking_lot::RwLock;
use sc_transaction_pool_api::OffchainSubmitTransaction;
use sp_core::{
offchain::{self, OffchainDbExt, OffchainWorkerExt, TransactionPoolExt},
traits::{ReadRuntimeVersion, ReadRuntimeVersionExt},
ExecutionContext,
};
use sp_externalities::{Extension, Extensions};
Expand Down Expand Up @@ -173,18 +174,7 @@ pub struct ExecutionExtensions<Block: BlockT> {
// during initialization.
transaction_pool: RwLock<Option<Weak<dyn OffchainSubmitTransaction<Block>>>>,
extensions_factory: RwLock<Box<dyn ExtensionsFactory<Block>>>,
}

impl<Block: BlockT> Default for ExecutionExtensions<Block> {
fn default() -> Self {
Self {
strategies: Default::default(),
keystore: None,
offchain_db: None,
transaction_pool: RwLock::new(None),
extensions_factory: RwLock::new(Box::new(())),
}
}
read_runtime_version: Arc<dyn ReadRuntimeVersion>,
}

impl<Block: BlockT> ExecutionExtensions<Block> {
Expand All @@ -193,6 +183,7 @@ impl<Block: BlockT> ExecutionExtensions<Block> {
strategies: ExecutionStrategies,
keystore: Option<KeystorePtr>,
offchain_db: Option<Box<dyn DbExternalitiesFactory>>,
read_runtime_version: Arc<dyn ReadRuntimeVersion>,
) -> Self {
let transaction_pool = RwLock::new(None);
let extensions_factory = Box::new(());
Expand All @@ -202,6 +193,7 @@ impl<Block: BlockT> ExecutionExtensions<Block> {
offchain_db,
extensions_factory: RwLock::new(extensions_factory),
transaction_pool,
read_runtime_version,
}
}

Expand Down Expand Up @@ -271,6 +263,8 @@ impl<Block: BlockT> ExecutionExtensions<Block> {
)));
}

extensions.register(ReadRuntimeVersionExt::new(self.read_runtime_version.clone()));

extensions
}

Expand Down
1 change: 1 addition & 0 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ where
config.execution_strategies.clone(),
Some(keystore_container.keystore()),
sc_offchain::OffchainDb::factory_from_backend(&*backend),
Arc::new(executor.clone()),
);

let wasm_runtime_substitutes = config
Expand Down
1 change: 1 addition & 0 deletions client/service/src/client/call_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ mod tests {
Default::default(),
None,
None,
Arc::new(executor.clone()),
)),
};

Expand Down
1 change: 1 addition & 0 deletions client/service/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ where
Default::default(),
keystore,
sc_offchain::OffchainDb::factory_from_backend(&*backend),
Arc::new(executor.clone()),
);

let call_executor =
Expand Down
10 changes: 10 additions & 0 deletions primitives/core/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ pub trait ReadRuntimeVersion: Send + Sync {
) -> Result<Vec<u8>, String>;
}

impl ReadRuntimeVersion for std::sync::Arc<dyn ReadRuntimeVersion> {
fn read_runtime_version(
&self,
wasm_code: &[u8],
ext: &mut dyn Externalities,
) -> Result<Vec<u8>, String> {
(**self).read_runtime_version(wasm_code, ext)
}
}

sp_externalities::decl_extension! {
/// An extension that provides functionality to read version information from a given wasm blob.
pub struct ReadRuntimeVersionExt(Box<dyn ReadRuntimeVersion>);
Expand Down
6 changes: 2 additions & 4 deletions primitives/state-machine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ mod execution {
use sp_core::{
hexdisplay::HexDisplay,
storage::{ChildInfo, ChildType, PrefixedStorageKey},
traits::{CallContext, CodeExecutor, ReadRuntimeVersionExt, RuntimeCode},
traits::{CallContext, CodeExecutor, RuntimeCode},
};
use sp_externalities::Extensions;
use std::{
Expand Down Expand Up @@ -322,12 +322,10 @@ mod execution {
exec: &'a Exec,
method: &'a str,
call_data: &'a [u8],
mut extensions: Extensions,
extensions: Extensions,
runtime_code: &'a RuntimeCode,
context: CallContext,
) -> Self {
extensions.register(ReadRuntimeVersionExt::new(exec.clone()));

Self {
backend,
exec,
Expand Down
3 changes: 2 additions & 1 deletion test-utils/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,13 @@ impl<Block: BlockT, D, Backend, G: GenesisInit>
});
let executor = LocalCallExecutor::new(
self.backend.clone(),
executor,
executor.clone(),
Default::default(),
ExecutionExtensions::new(
self.execution_strategies.clone(),
self.keystore.clone(),
sc_offchain::OffchainDb::factory_from_backend(&*self.backend),
Arc::new(executor),
),
)
.expect("Creates LocalCallExecutor");
Expand Down
3 changes: 2 additions & 1 deletion utils/frame/benchmarking-cli/src/pallet/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use sp_core::{
testing::{TestOffchainExt, TestTransactionPoolExt},
OffchainDbExt, OffchainWorkerExt, TransactionPoolExt,
},
traits::CallContext,
traits::{CallContext, ReadRuntimeVersionExt},
};
use sp_externalities::Extensions;
use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
Expand Down Expand Up @@ -225,6 +225,7 @@ impl PalletCmd {
extensions.register(OffchainWorkerExt::new(offchain.clone()));
extensions.register(OffchainDbExt::new(offchain));
extensions.register(TransactionPoolExt::new(pool));
extensions.register(ReadRuntimeVersionExt::new(executor.clone()));
extensions
};

Expand Down
2 changes: 1 addition & 1 deletion utils/frame/try-runtime/cli/src/commands/execute_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ where
&executor,
"TryRuntime_execute_block",
&payload,
full_extensions(),
full_extensions(executor.clone()),
shared.export_proof,
)?;

Expand Down
4 changes: 2 additions & 2 deletions utils/frame/try-runtime/cli/src/commands/fast_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async fn dry_run<T: Decode, Block: BlockT, HostFns: HostFunctions>(
executor,
method,
data,
full_extensions(),
full_extensions(executor.clone()),
)?;

Ok(<T>::decode(&mut &*result)?)
Expand All @@ -121,7 +121,7 @@ async fn run<Block: BlockT, HostFns: HostFunctions>(
executor,
method,
data,
full_extensions(),
full_extensions(executor.clone()),
)?;

let storage_changes = changes.drain_storage_changes(
Expand Down
2 changes: 1 addition & 1 deletion utils/frame/try-runtime/cli/src/commands/follow_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where
&executor,
"TryRuntime_execute_block",
(block, command.state_root_check, command.try_state.clone()).encode().as_ref(),
full_extensions(),
full_extensions(executor.clone()),
shared
.export_proof
.as_ref()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ where
&executor,
"OffchainWorkerApi_offchain_worker",
&payload,
full_extensions(),
full_extensions(executor.clone()),
)?;

Ok(())
Expand Down
5 changes: 3 additions & 2 deletions utils/frame/try-runtime/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ use sp_core::{
OffchainDbExt, OffchainWorkerExt, TransactionPoolExt,
},
storage::well_known_keys,
traits::{CallContext, ReadRuntimeVersion},
traits::{CallContext, ReadRuntimeVersion, ReadRuntimeVersionExt},
twox_128, H256,
};
use sp_externalities::Extensions;
Expand Down Expand Up @@ -810,7 +810,7 @@ where
}

/// Build all extensions that we typically use.
pub(crate) fn full_extensions() -> Extensions {
pub(crate) fn full_extensions<H: HostFunctions>(wasm_executor: WasmExecutor<H>) -> Extensions {
let mut extensions = Extensions::default();
let (offchain, _offchain_state) = TestOffchainExt::new();
let (pool, _pool_state) = TestTransactionPoolExt::new();
Expand All @@ -819,6 +819,7 @@ pub(crate) fn full_extensions() -> Extensions {
extensions.register(OffchainWorkerExt::new(offchain));
extensions.register(KeystoreExt::new(keystore));
extensions.register(TransactionPoolExt::new(pool));
extensions.register(ReadRuntimeVersionExt::new(wasm_executor));

extensions
}
Expand Down