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
Merge remote-tracking branch 'origin/master' into bkchr-execution-str…
…ategies-remove
  • Loading branch information
bkchr committed May 5, 2023
commit d85f8ea71566463b69e9a9e8ced64eaef22dbf76
1 change: 1 addition & 0 deletions bin/node-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ sc-keystore = { version = "4.0.0-dev", path = "../../../client/keystore" }
sc-transaction-pool = { version = "4.0.0-dev", path = "../../../client/transaction-pool" }
sc-transaction-pool-api = { version = "4.0.0-dev", path = "../../../client/transaction-pool/api" }
sc-offchain = { version = "4.0.0-dev", path = "../../../client/offchain" }
sc-statement-store = { version = "4.0.0-dev", path = "../../../client/statement-store" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node-template not integrate statement-store, so this seems not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find! Ty

sc-consensus-aura = { version = "0.10.0-dev", path = "../../../client/consensus/aura" }
sp-consensus-aura = { version = "0.10.0-dev", path = "../../../primitives/consensus/aura" }
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
Expand Down
1 change: 0 additions & 1 deletion client/api/src/execution_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl<Block: BlockT, Ext: Default + Extension> ExtensionsFactory<Block>
/// for each call, based on required `Capabilities`.
pub struct ExecutionExtensions<Block: BlockT> {
extensions_factory: RwLock<Box<dyn ExtensionsFactory<Block>>>,
statement_store: RwLock<Option<Weak<dyn sp_statement_store::StatementStore>>>,
read_runtime_version: Arc<dyn ReadRuntimeVersion>,
}

Expand Down
24 changes: 3 additions & 21 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,24 +279,8 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
self.import_params().map(|x| x.wasm_runtime_overrides()).unwrap_or_default()
}

/// Get the RPC HTTP address (`None` if disabled).
///
/// By default this is `None`.
fn rpc_http(&self, _default_listen_port: u16) -> Result<Option<SocketAddr>> {
Ok(None)
}

/// Get the RPC IPC path (`None` if disabled).
///
/// By default this is `None`.
fn rpc_ipc(&self) -> Result<Option<String>> {
Ok(None)
}

/// Get the RPC websocket address (`None` if disabled).
///
/// By default this is `None`.
fn rpc_ws(&self, _default_listen_port: u16) -> Result<Option<SocketAddr>> {
/// Get the RPC address.
fn rpc_addr(&self, _default_listen_port: u16) -> Result<Option<SocketAddr>> {
Ok(None)
}

Expand Down Expand Up @@ -497,9 +481,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
blocks_pruning: self.blocks_pruning()?,
wasm_method: self.wasm_method()?,
wasm_runtime_overrides: self.wasm_runtime_overrides(),
rpc_http: self.rpc_http(DCV::rpc_http_listen_port())?,
rpc_ws: self.rpc_ws(DCV::rpc_ws_listen_port())?,
rpc_ipc: self.rpc_ipc()?,
rpc_addr: self.rpc_addr(DCV::rpc_listen_port())?,
rpc_methods: self.rpc_methods()?,
rpc_max_connections: self.rpc_max_connections()?,
rpc_cors: self.rpc_cors(is_dev)?,
Expand Down
6 changes: 2 additions & 4 deletions client/cli/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,8 @@ mod tests {
)),
wasm_method: Default::default(),
wasm_runtime_overrides: None,
rpc_http: None,
rpc_ws: None,
rpc_ipc: None,
rpc_ws_max_connections: None,
rpc_addr: None,
rpc_max_connections: Default::default(),
rpc_cors: None,
rpc_methods: Default::default(),
rpc_max_request_size: Default::default(),
Expand Down
6 changes: 3 additions & 3 deletions client/rpc/src/dev/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ async fn block_stats_work() {
.await
.unwrap(),
Some(BlockStats {
witness_len: 612,
witness_compact_len: 516,
block_len: 99,
witness_len: expected_witness_len,
witness_compact_len: expected_witness_compact_len,
block_len: expected_block_len,
num_extrinsics: 0,
}),
);
Expand Down
12 changes: 4 additions & 8 deletions client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,10 @@ pub struct Configuration {
/// over on-chain runtimes when the spec version matches. Set to `None` to
/// disable overrides (default).
pub wasm_runtime_overrides: Option<PathBuf>,
/// RPC over HTTP binding address. `None` if disabled.
pub rpc_http: Option<SocketAddr>,
/// RPC over Websockets binding address. `None` if disabled.
pub rpc_ws: Option<SocketAddr>,
/// RPC over IPC binding path. `None` if disabled.
pub rpc_ipc: Option<String>,
/// Maximum number of connections for WebSockets RPC server. `None` if default.
pub rpc_ws_max_connections: Option<usize>,
/// JSON-RPC server binding address.
pub rpc_addr: Option<SocketAddr>,
/// Maximum number of connections for JSON-RPC server.
pub rpc_max_connections: u32,
/// CORS settings for HTTP & WS servers. `None` if all origins are allowed.
pub rpc_cors: Option<Vec<String>>,
/// RPC methods to expose (by default only a safe subset or all of them).
Expand Down
86 changes: 32 additions & 54 deletions client/service/test/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,39 +226,6 @@ fn construct_genesis_should_work_with_wasm() {
.unwrap();
}

#[test]
fn construct_genesis_with_bad_transaction_should_panic() {
let mut storage = GenesisConfig::new(
vec![Sr25519Keyring::One.public().into(), Sr25519Keyring::Two.public().into()],
vec![AccountKeyring::One.into(), AccountKeyring::Two.into()],
68,
None,
Default::default(),
)
.genesis_map();
let genesis_hash = insert_genesis_block(&mut storage);

let backend = InMemoryBackend::from((storage, StateVersion::default()));
let (b1data, _b1hash) = block1(genesis_hash, &backend);
let backend_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(&backend);
let runtime_code = backend_runtime_code.runtime_code().expect("Code is part of the backend");

let mut overlay = OverlayedChanges::default();

let r = StateMachine::new(
&backend,
&mut overlay,
&new_native_or_wasm_executor(),
"Core_execute_block",
&b1data,
&mut Default::default(),
&runtime_code,
CallContext::Onchain,
)
.execute();
assert!(r.is_err());
}

#[test]
fn client_initializes_from_genesis_ok() {
let client = substrate_test_runtime_client::new();
Expand Down Expand Up @@ -1710,7 +1677,14 @@ fn storage_keys_prefix_and_start_key_works() {
.unwrap()
.map(|x| array_bytes::bytes2hex("", &x.0))
.collect();
assert_eq!(res, [&child_root, "3a636f6465",]);
assert_eq!(
res,
[
&child_root,
"3a636f6465", //":code"
"3a65787472696e7369635f696e646578", //":extrinsic_index"
]
);

let res: Vec<_> = client
.storage_keys(
Expand All @@ -1721,7 +1695,18 @@ fn storage_keys_prefix_and_start_key_works() {
.unwrap()
.map(|x| array_bytes::bytes2hex("", &x.0))
.collect();
assert_eq!(res, Vec::<String>::new());
assert_eq!(res, ["3a65787472696e7369635f696e646578",]);

let res: Vec<_> = client
.storage_keys(
block_hash,
Some(&prefix),
Some(&StorageKey(array_bytes::hex2bytes_unchecked("3a686561707061676573"))),
)
.unwrap()
.map(|x| x.0)
.collect();
assert_eq!(res, Vec::<Vec<u8>>::new());

let res: Vec<_> = client
.child_storage_keys(block_hash, child_info.clone(), Some(&child_prefix), None)
Expand Down Expand Up @@ -1780,16 +1765,12 @@ fn storage_keys_works() {
.collect();
assert_eq!(
res,
[
"3a636f6465",
"52008686cc27f6e5ed83a216929942f8bcd32a396f09664a5698f81371934b56",
"5348d72ac6cc66e5d8cbecc27b0e0677503b845fe2382d819f83001781788fd5",
"5c2d5fda66373dabf970e4fb13d277ce91c5233473321129d32b5a8085fa8133",
"6644b9b8bc315888ac8e41a7968dc2b4141a5403c58acdf70b7e8f7e07bf5081",
"66484000ed3f75c95fc7b03f39c20ca1e1011e5999278247d3b2f5e3c3273808",
"7d5007603a7f5dd729d51d93cf695d6465789443bb967c0d1fe270e388c96eaa",
"811ecfaadcf5f2ee1d67393247e2f71a1662d433e8ce7ff89fb0d4aa9561820b",
]
expected_keys
.iter()
.filter(|&i| i > &"3a636f64".to_string())
.take(8)
.cloned()
.collect::<Vec<String>>()
);

// Starting at a complete key the first key is skipped.
Expand All @@ -1805,15 +1786,12 @@ fn storage_keys_works() {
.collect();
assert_eq!(
res,
[
"52008686cc27f6e5ed83a216929942f8bcd32a396f09664a5698f81371934b56",
"5348d72ac6cc66e5d8cbecc27b0e0677503b845fe2382d819f83001781788fd5",
"5c2d5fda66373dabf970e4fb13d277ce91c5233473321129d32b5a8085fa8133",
"6644b9b8bc315888ac8e41a7968dc2b4141a5403c58acdf70b7e8f7e07bf5081",
"66484000ed3f75c95fc7b03f39c20ca1e1011e5999278247d3b2f5e3c3273808",
"7d5007603a7f5dd729d51d93cf695d6465789443bb967c0d1fe270e388c96eaa",
"811ecfaadcf5f2ee1d67393247e2f71a1662d433e8ce7ff89fb0d4aa9561820b",
]
expected_keys
.iter()
.filter(|&i| i > &"3a636f6465".to_string())
.take(8)
.cloned()
.collect::<Vec<String>>()
);

const SOME_BALANCE_KEY : &str = "26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9e2c1dc507e2035edbbd8776c440d870460c57f0008067cc01c5ff9eb2e2f9b3a94299a915a91198bd1021a6c55596f57";
Expand Down
6 changes: 2 additions & 4 deletions client/service/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,8 @@ fn node_config<
chain_spec: Box::new((*spec).clone()),
wasm_method: Default::default(),
wasm_runtime_overrides: Default::default(),
rpc_http: None,
rpc_ipc: None,
rpc_ws: None,
rpc_ws_max_connections: None,
rpc_addr: Default::default(),
rpc_max_connections: Default::default(),
rpc_cors: None,
rpc_methods: Default::default(),
rpc_max_request_size: Default::default(),
Expand Down
3 changes: 1 addition & 2 deletions client/statement-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@ impl Store {
+ 'static,
Client::Api: ValidateStatement<Block>,
{
let store = Arc::new(Self::new(path, options, client.clone(), prometheus)?);
client.execution_extensions().register_statement_store(store.clone());
let store = Arc::new(Self::new(path, options, client, prometheus)?);

// Perform periodic statement store maintenance
let worker_store = store.clone();
Expand Down
16 changes: 12 additions & 4 deletions primitives/api/test/tests/runtime_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ fn calling_runtime_function() {
}

#[test]
fn calling_runtime_signature_changed_old_function() {
fn calling_native_runtime_function() {
calling_function_with_strat(ExecutionStrategy::NativeWhenPossible);
}

#[test]
fn calling_wasm_runtime_function() {
calling_function_with_strat(ExecutionStrategy::AlwaysWasm);
}

#[test]
fn calling_native_runtime_signature_changed_function() {
let client = TestClientBuilder::new().build();
let runtime_api = client.runtime_api();
let best_hash = client.chain_info().best_hash;

#[allow(deprecated)]
let res = runtime_api.function_signature_changed_before_version_2(best_hash).unwrap();
assert_eq!(&res, &[1, 2]);
assert_eq!(runtime_api.function_signature_changed(best_hash).unwrap(), 1);
}

#[test]
Expand Down
13 changes: 11 additions & 2 deletions primitives/keystore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,18 @@ impl<T: Keystore + ?Sized> Keystore for Arc<T> {
&self,
key_type: KeyTypeId,
public: &sr25519::Public,
transcript: &sr25519::vrf::VrfTranscript,
data: &sr25519::vrf::VrfSignData,
) -> Result<Option<sr25519::vrf::VrfSignature>, Error> {
(**self).sr25519_vrf_sign(key_type, public, transcript)
(**self).sr25519_vrf_sign(key_type, public, data)
}

fn sr25519_vrf_output(
&self,
key_type: KeyTypeId,
public: &sr25519::Public,
input: &sr25519::vrf::VrfInput,
) -> Result<Option<sr25519::vrf::VrfOutput>, Error> {
(**self).sr25519_vrf_output(key_type, public, input)
}

fn ed25519_public_keys(&self, key_type: KeyTypeId) -> Vec<ed25519::Public> {
Expand Down
35 changes: 8 additions & 27 deletions test-utils/runtime/src/genesismap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,11 @@ impl GenesisStorageBuilder {
}
}

pub fn genesis_map(&self) -> Storage {
let wasm_runtime = wasm_binary_unwrap().to_vec();
let mut map: BTreeMap<Vec<u8>, Vec<u8>> = self
.balances
.iter()
.map(|&(ref account, balance)| {
(account.to_keyed_vec(b"balance:"), vec![].and(&balance))
})
.map(|(k, v)| (blake2_256(&k[..])[..].to_vec(), v.to_vec()))
.chain(
vec![(well_known_keys::CODE.into(), wasm_runtime)]
.into_iter()
.chain(
self.heap_pages_override
.into_iter()
.map(|h| (well_known_keys::HEAP_PAGES.into(), h.encode())),
)
.into_iter(),
)
.collect();
map.insert(twox_128(&b"sys:auth"[..])[..].to_vec(), self.authorities.encode());
// Add the extra storage entries.
map.extend(self.extra_storage.top.clone().into_iter());
/// Override default wasm code to be placed into GenesisConfig.
pub fn with_wasm_code(mut self, wasm_code: &Option<Vec<u8>>) -> Self {
self.wasm_code = wasm_code.clone();
self
}

pub fn with_heap_pages(mut self, heap_pages_override: Option<u64>) -> Self {
self.heap_pages_override = heap_pages_override;
Expand Down Expand Up @@ -141,10 +123,9 @@ impl GenesisStorageBuilder {
.build_storage()
.expect("Build storage from substrate-test-runtime GenesisConfig");

storage.top.insert(
well_known_keys::HEAP_PAGES.into(),
self.heap_pages_override.unwrap_or(16_u64).encode(),
);
if let Some(heap_pages) = self.heap_pages_override {
storage.top.insert(well_known_keys::HEAP_PAGES.into(), heap_pages.encode());
}

storage.top.extend(self.extra_storage.top.clone());
storage.children_default.extend(self.extra_storage.children_default.clone());
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.