Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove requirement on Hash = H256, make Proposer return StorageChanges and Proof #3860

Merged
merged 46 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
aa34fc1
Extend `Proposer` to optionally generate a proof of the proposal
bkchr Oct 19, 2019
1d7c2d4
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Oct 19, 2019
1a1c189
Something
bkchr Nov 9, 2019
e7b46bd
Refactor sr-api to not depend on client anymore
bkchr Nov 11, 2019
8aa1c6e
Fix benches
bkchr Nov 11, 2019
0a65d2b
Apply suggestions from code review
bkchr Nov 11, 2019
22534c1
Apply suggestions from code review
bkchr Nov 11, 2019
031a9e4
Merge branch 'bkchr-sr-api-refactoring' into bkchr-propose-with-proof
bkchr Nov 11, 2019
993bffb
Introduce new `into_storage_changes` function
bkchr Nov 11, 2019
3828189
Switch to runtime api for `execute_block` and don't require `H256`
bkchr Nov 14, 2019
8160ef4
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Nov 15, 2019
90626bb
Put the `StorageChanges` into the `Proposal`
bkchr Nov 15, 2019
ba39637
Move the runtime api error to its own trait
bkchr Nov 15, 2019
29c3f0c
Adds `StorageTransactionCache` to the runtime api
bkchr Nov 18, 2019
79cc228
Remove `type NodeBlock` and switch to a "better" hack
bkchr Nov 18, 2019
6eb4962
Start using the transaction cache from the runtime api
bkchr Nov 19, 2019
0e482e1
Make it compile
bkchr Nov 20, 2019
733ce46
Move `InMemory` to its own file
bkchr Nov 26, 2019
ea7d37b
Make all tests work again
bkchr Nov 27, 2019
8070db4
Return block, storage_changes and proof from Blockbuilder::bake()
bkchr Nov 28, 2019
28157d6
Make sure that we use/set `storage_changes` when possible
bkchr Dec 2, 2019
638dd3c
Add test
bkchr Dec 2, 2019
ac0f28d
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 4, 2019
12be3d4
Fix deadlock
bkchr Dec 4, 2019
e60411e
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 5, 2019
2b93d4f
Remove accidentally added folders
bkchr Dec 5, 2019
643b351
Introduce `RecordProof` as argument type to be more explicit
bkchr Dec 5, 2019
c600f16
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 5, 2019
361817b
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 10, 2019
4bb6181
Update client/src/client.rs
bkchr Dec 11, 2019
bb33e75
Update primitives/state-machine/src/ext.rs
bkchr Dec 11, 2019
ea03c84
Integrates review feedback
bkchr Dec 11, 2019
e08904f
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 11, 2019
8b46a3c
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 11, 2019
fd6a53c
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 16, 2019
09ab886
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 17, 2019
1a49df8
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 17, 2019
3e96e02
Remove `unsafe` usage
bkchr Dec 18, 2019
3a355d6
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Dec 18, 2019
a1a8c9e
Update client/block-builder/src/lib.rs
bkchr Dec 18, 2019
ec40948
Update client/src/call_executor.rs
bkchr Dec 19, 2019
0bf9348
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Jan 7, 2020
d02fb35
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Jan 7, 2020
afe8194
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Jan 8, 2020
ef74105
Merge remote-tracking branch 'origin/master' into bkchr-propose-with-…
bkchr Jan 10, 2020
c5f0e8b
Bump versions
bkchr Jan 10, 2020
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
16 changes: 15 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/node-template/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn new_full<C: Send + Default + 'static>(config: Configuration<C, GenesisCon
let can_author_with =
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());

let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _, _>(
let aura = sc_consensus_aura::start_aura::<_, _, _, _, _, AuraPair, _, _, _>(
sc_consensus_aura::SlotDuration::get_or_compute(&*client)?,
client,
select_chain,
Expand Down
11 changes: 6 additions & 5 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use sp_runtime::traits::Block as BlockT;
use node_executor::NativeExecutor;
use sc_network::NetworkService;
use sc_offchain::OffchainWorkers;
use sp_core::Blake2Hasher;

construct_simple_protocol! {
/// Demo protocol attachment for substrate.
Expand Down Expand Up @@ -113,9 +112,7 @@ macro_rules! new_full_start {
/// concrete types instead.
macro_rules! new_full {
($config:expr, $with_startup_data: expr) => {{
use futures01::Stream;
use futures::{
compat::Stream01CompatExt,
stream::StreamExt,
future::{FutureExt, TryFutureExt},
};
Expand Down Expand Up @@ -300,7 +297,7 @@ pub fn new_full<C: Send + Default + 'static>(config: NodeConfiguration<C>)
ConcreteTransactionPool,
OffchainWorkers<
ConcreteClient,
<ConcreteBackend as sc_client_api::backend::Backend<Block, Blake2Hasher>>::OffchainStorage,
<ConcreteBackend as sc_client_api::backend::Backend<Block>>::OffchainStorage,
ConcreteBlock,
>
>,
Expand Down Expand Up @@ -387,6 +384,7 @@ mod tests {
use sc_consensus_babe::CompatibleDigestItem;
use sp_consensus::{
Environment, Proposer, BlockImportParams, BlockOrigin, ForkChoiceStrategy, BlockImport,
RecordProof,
};
use node_primitives::{Block, DigestItem, Signature};
use node_runtime::{BalancesCall, Call, UncheckedExtrinsic, Address};
Expand Down Expand Up @@ -439,6 +437,7 @@ mod tests {
internal_justification: Vec::new(),
finalized: false,
body: Some(block.extrinsics),
storage_changes: None,
header: block.header,
auxiliary: Vec::new(),
}
Expand Down Expand Up @@ -540,7 +539,8 @@ mod tests {
inherent_data,
digest,
std::time::Duration::from_secs(1),
)).expect("Error making test block");
RecordProof::Yes,
)).expect("Error making test block").block;

let (new_header, new_body) = new_block.deconstruct();
let pre_hash = new_header.hash();
Expand All @@ -559,6 +559,7 @@ mod tests {
justification: None,
post_digests: vec![item],
body: Some(new_body),
storage_changes: None,
finalized: false,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::LongestChain,
Expand Down
2 changes: 1 addition & 1 deletion bin/node/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ wabt = "0.9.2"

[features]
wasmtime = [
"sc-executor/wasmtime",
"sc-executor/wasmtime",
]
wasmi-errno = [
"sc-executor/wasmi-errno",
Expand Down
1 change: 0 additions & 1 deletion bin/node/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ native_executor_instance!(
node_runtime::api::dispatch,
node_runtime::native_version
);

6 changes: 3 additions & 3 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use node_primitives::{Balance, Hash};
use wabt;
use node_testing::keyring::*;

mod common;
pub mod common;
use self::common::{*, sign};

/// The wasm runtime binary which hasn't undergone the compacting process.
Expand Down Expand Up @@ -821,11 +821,11 @@ fn full_wasm_block_import_works_with_changes_trie() {
#[test]
fn should_import_block_with_test_client() {
use node_testing::client::{
ClientExt, TestClientBuilderExt, TestClientBuilder,
ClientBlockImportExt, TestClientBuilderExt, TestClientBuilder,
sp_consensus::BlockOrigin,
};

let client = TestClientBuilder::new().build();
let mut client = TestClientBuilder::new().build();
let block1 = changes_trie_block();
let block_data = block1.0;
let block = node_primitives::Block::decode(&mut &block_data[..]).unwrap();
Expand Down
6 changes: 2 additions & 4 deletions bin/node/executor/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use codec::{Encode, Decode};
use frame_support::{
Hashable,
};
use frame_support::Hashable;
use sp_state_machine::TestExternalities as CoreTestExternalities;
use sp_core::{
Blake2Hasher, NeverNativeValue, NativeOrEncoded,
traits::CodeExecutor,
};
use sp_runtime::traits::{Header as HeaderT};
use sp_runtime::traits::Header as HeaderT;
use sc_executor::{NativeExecutor, WasmExecutionMethod};
use sc_executor::error::Result;

Expand Down
2 changes: 1 addition & 1 deletion bin/node/executor/tests/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use node_runtime::impls::LinearWeightToFee;
use node_primitives::Balance;
use node_testing::keyring::*;

mod common;
pub mod common;
use self::common::{*, sign};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion bin/node/executor/tests/submit_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use frame_system::offchain::{SubmitSignedTransaction, SubmitUnsignedTransaction}
use pallet_im_online::sr25519::AuthorityPair as Key;
use codec::Decode;

mod common;
pub mod common;
use self::common::*;

#[test]
Expand Down
1 change: 1 addition & 0 deletions bin/node/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jsonrpc-core = "14.0.3"
node-primitives = { version = "2.0.0", path = "../primitives" }
node-runtime = { version = "2.0.0", path = "../runtime" }
sp-runtime = { version = "2.0.0", path = "../../../primitives/runtime" }
sp-api = { version = "2.0.0", path = "../../../primitives/api" }
pallet-contracts-rpc = { version = "2.0.0", path = "../../../frame/contracts/rpc/" }
pallet-transaction-payment-rpc = { version = "2.0.0", path = "../../../frame/transaction-payment/rpc/" }
substrate-frame-rpc-system = { version = "2.0.0", path = "../../../utils/frame/rpc/system" }
Expand Down
4 changes: 2 additions & 2 deletions bin/node/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use std::sync::Arc;

use node_primitives::{Block, AccountId, Index, Balance};
use node_runtime::UncheckedExtrinsic;
use sp_runtime::traits::ProvideRuntimeApi;
use sp_api::ProvideRuntimeApi;
use sp_transaction_pool::TransactionPool;

/// Light client extra dependencies.
Expand Down Expand Up @@ -62,7 +62,7 @@ pub fn create<C, P, M, F>(
pool: Arc<P>,
light_deps: Option<LightDeps<F>>,
) -> jsonrpc_core::IoHandler<M> where
C: ProvideRuntimeApi,
C: ProvideRuntimeApi<Block>,
C: sc_client::blockchain::HeaderBackend<Block>,
C: Send + Sync + 'static,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
Expand Down
4 changes: 2 additions & 2 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 200,
impl_version: 200,
spec_version: 201,
impl_version: 201,
apis: RUNTIME_API_VERSIONS,
};

Expand Down
18 changes: 9 additions & 9 deletions bin/node/transaction-factory/src/complex_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ use std::sync::Arc;
use log::info;
use sc_client::Client;
use sp_block_builder::BlockBuilder;
use sp_api::ConstructRuntimeApi;
use sp_core::{Blake2Hasher, Hasher};
use sp_api::{ConstructRuntimeApi, ProvideRuntimeApi};
use sp_runtime::generic::BlockId;
use sp_runtime::traits::{Block as BlockT, ProvideRuntimeApi, One, Zero};
use sp_runtime::traits::{Block as BlockT, One, Zero};

use crate::{RuntimeAdapter, create_block};

Expand All @@ -59,12 +58,13 @@ pub fn next<RA, Backend, Exec, Block, RtApi>(
prior_block_id: BlockId<Block>,
) -> Option<Block>
where
Block: BlockT<Hash = <Blake2Hasher as Hasher>::Out>,
Exec: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + Clone,
Backend: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send,
Client<Backend, Exec, Block, RtApi>: ProvideRuntimeApi,
<Client<Backend, Exec, Block, RtApi> as ProvideRuntimeApi>::Api:
BlockBuilder<Block, Error = sp_blockchain::Error>,
Block: BlockT,
Exec: sc_client::CallExecutor<Block, Backend = Backend> + Send + Sync + Clone,
Backend: sc_client_api::backend::Backend<Block> + Send,
Client<Backend, Exec, Block, RtApi>: ProvideRuntimeApi<Block>,
<Client<Backend, Exec, Block, RtApi> as ProvideRuntimeApi<Block>>::Api:
BlockBuilder<Block, Error = sp_blockchain::Error> +
sp_api::ApiExt<Block, StateBackend = Backend::State>,
RtApi: ConstructRuntimeApi<Block, Client<Backend, Exec, Block, RtApi>> + Send + Sync,
RA: RuntimeAdapter,
{
Expand Down
Loading