mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
Integrate transaction pool to the proposal logic (#80)
* reshuffle consensus libraries * polkadot-useful type definitions for statement table * begin BftService * primary selection logic * bft service implementation without I/O * extract out `BlockImport` trait * allow bft primitives to compile on wasm * Block builder (substrate) * take polkadot-consensus down to the core. * test for preemption * fix test build * Fix wasm build * Bulid on any block * Test for block builder. * Block import tests for client. * Tidy ups * clean up block builder instantiation * justification verification logic * JustifiedHeader and import * Propert block generation for tests * network and tablerouter trait * use statement import to drive creation of further statements * Fixed rpc tests * custom error type for consensus * create proposer * asynchronous proposal evaluation * inherent transactions in polkadot runtime * fix tests to match real polkadot block constraints * implicitly generate inherent functions * add inherent transaction functionality to block body * block builder logic for polkadot * some tests for the polkadot API * avoid redundancy in native code compatibility check * helper for extracting nonce * transaction pool implementation * transaction pool * integrate transaction pool with proposer * indentation * kill storage keys module * accept new transactions to replace old
This commit is contained in:
committed by
Gav Wood
parent
1f2d01566e
commit
10546845d4
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use runtime::{system, parachains, consensus, session, timestamp};
|
||||
use runtime::{system, parachains, consensus, session};
|
||||
|
||||
impl_stubs!(
|
||||
execute_block => |block| system::internal::execute_block(block),
|
||||
@@ -24,5 +24,6 @@ impl_stubs!(
|
||||
validators => |()| session::validators(),
|
||||
authorities => |()| consensus::authorities(),
|
||||
duty_roster => |()| parachains::calculate_duty_roster(),
|
||||
get_timestamp => |()| timestamp::get()
|
||||
timestamp => |()| ::runtime::timestamp::get(),
|
||||
nonce => |account_id| system::nonce(account_id)
|
||||
);
|
||||
|
||||
@@ -31,9 +31,9 @@ extern crate polkadot_primitives;
|
||||
|
||||
#[cfg(test)] #[macro_use] extern crate hex_literal;
|
||||
|
||||
pub mod api;
|
||||
pub mod environment;
|
||||
pub mod runtime;
|
||||
pub mod api;
|
||||
|
||||
#[cfg(feature = "std")] pub mod genesismap;
|
||||
|
||||
|
||||
@@ -17,19 +17,26 @@
|
||||
//! System manager: Handles all of the top-level stuff; executing block/transaction, setting code
|
||||
//! and depositing logs.
|
||||
|
||||
use rstd::prelude::*;
|
||||
use rstd::mem;
|
||||
use runtime_io::{print, storage_root, enumerated_trie_root};
|
||||
use rstd::prelude::*;
|
||||
|
||||
use codec::{KeyedVec, Slicable};
|
||||
use runtime_support::{Hashable, storage};
|
||||
use environment::with_env;
|
||||
use polkadot_primitives::{AccountId, Hash, TxOrder, BlockNumber, Block, Header,
|
||||
UncheckedTransaction, Function, InherentFunction, Log};
|
||||
use polkadot_primitives::{
|
||||
AccountId, Hash, TxOrder, BlockNumber, Block, Header,
|
||||
UncheckedTransaction, Function, InherentFunction, Log
|
||||
};
|
||||
|
||||
use runtime_io::{print, storage_root, enumerated_trie_root};
|
||||
use runtime_support::{Hashable, storage};
|
||||
use runtime::{staking, session};
|
||||
|
||||
const NONCE_OF: &[u8] = b"sys:non:";
|
||||
const BLOCK_HASH_AT: &[u8] = b"sys:old:";
|
||||
const TEMP_TRANSACTION_NUMBER: &[u8] = b"temp:txcount:";
|
||||
/// Prefixes account ID and stores u64 nonce.
|
||||
pub const NONCE_OF: &[u8] = b"sys:non:";
|
||||
/// Prefixes block number and stores hash of that block.
|
||||
pub const BLOCK_HASH_AT: &[u8] = b"sys:old:";
|
||||
/// Stores the temporary current transaction number.
|
||||
pub const TEMP_TRANSACTION_NUMBER: &[u8] = b"temp:txcount";
|
||||
|
||||
/// The current block number being processed. Set by `execute_block`.
|
||||
pub fn block_number() -> BlockNumber {
|
||||
@@ -53,8 +60,6 @@ pub mod privileged {
|
||||
pub mod internal {
|
||||
use super::*;
|
||||
|
||||
struct CheckedTransaction(UncheckedTransaction);
|
||||
|
||||
/// Deposits a log and ensures it matches the blocks log data.
|
||||
pub fn deposit_log(log: Log) {
|
||||
with_env(|e| e.digest.logs.push(log));
|
||||
@@ -141,6 +146,12 @@ pub mod internal {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get an account's current nonce.
|
||||
pub fn nonce(account: AccountId) -> TxOrder {
|
||||
let nonce_key = account.to_keyed_vec(NONCE_OF);
|
||||
storage::get_or(&nonce_key, 0)
|
||||
}
|
||||
|
||||
/// Dispatch a function.
|
||||
fn dispatch_function(function: &Function, transactor: &AccountId) {
|
||||
match *function {
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user