mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
Merge branch 'master' into gav-demo
This commit is contained in:
@@ -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