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 all commits
Commits
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
12 changes: 6 additions & 6 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions demo/runtime/wasm/Cargo.lock

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

Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion polkadot/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub trait PolkadotApi {
fn evaluate_block(&self, at: &Self::CheckedBlockId, block: Block) -> Result<()>;

/// Create a block builder on top of the parent block.
fn build_block(&self, parent: &Self::CheckedBlockId, timestamp: u64) -> Result<Self::BlockBuilder>;
fn build_block(&self, parent: &Self::CheckedBlockId, timestamp: Timestamp) -> Result<Self::BlockBuilder>;
}

/// A checked block ID used for the substrate-client implementation of CheckedBlockId;
Expand Down
18 changes: 13 additions & 5 deletions polkadot/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub use primitives::block::Id as BlockId;
pub use primitives::block::Log as Log;

/// An index to a block.
/// 32-bits will allow for 136 years of blocks assuming 1 block per second.
/// TODO: switch to u32
pub type BlockNumber = u64;

/// Alias to Ed25519 pubkey that identifies an account on the relay chain. This will almost
Expand All @@ -60,11 +62,11 @@ pub type AccountId = primitives::AuthorityId;
/// exactly equivalent to what the substrate calls an "authority".
pub type SessionKey = primitives::AuthorityId;

/// Indentifier for a chain.
pub type ChainId = u64;
/// Indentifier for a chain. 32-bit should be plenty.
pub type ChainId = u32;

/// Index of a transaction in the relay chain.
pub type Index = u64;
/// Index of a transaction in the relay chain. 32-bit should be plenty.
pub type Index = u32;

/// A hash of some data used by the relay chain.
pub type Hash = primitives::H256;
Expand All @@ -76,4 +78,10 @@ pub type Signature = runtime_primitives::Ed25519Signature;
pub type Timestamp = u64;

/// The balance of an account.
pub type Balance = u64;
/// 128-bits (or 38 significant decimal figures) will allow for 10m currency (10^7) at a resolution
/// to all for one second's worth of an annualised 50% reward be paid to a unit holder (10^11 unit
/// denomination), or 10^18 total atomic units, to grow at 50%/year for 51 years (10^9 multiplier)
/// for an eventual total of 10^27 units (27 significant decimal figures).
/// We round denomination to 10^12 (12 sdf), and leave the other redundancy at the upper end so
/// that 32 bits may be multiplied with a balance in 128 bits without worrying about overflow.
pub type Balance = runtime_primitives::U128;
6 changes: 3 additions & 3 deletions polkadot/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ mod tests {
let tx = UncheckedExtrinsic {
extrinsic: Extrinsic {
signed: [1; 32],
index: 999u64,
index: 999,
function: Call::Timestamp(TimestampCall::set(135135)),
},
signature: primitives::hash::H512([0; 64]).into(),
Expand All @@ -307,7 +307,7 @@ mod tests {
fn serialize_checked() {
let xt = Extrinsic {
signed: hex!["0d71d1a9cad6f2ab773435a7dec1bac019994d05d1dd5eb3108211dcf25c9d1e"],
index: 0u64,
index: 0,
function: Call::CouncilVoting(council::voting::Call::propose(Box::new(
PrivCall::Consensus(consensus::PrivCall::set_code(
vec![]
Expand All @@ -316,7 +316,7 @@ mod tests {
};
let v = Slicable::encode(&xt);

let data = hex!["e00000000d71d1a9cad6f2ab773435a7dec1bac019994d05d1dd5eb3108211dcf25c9d1e000000000000000007000000000000006369D39D892B7B87A6769F90E14C618C2B84EBB293E2CC46640136E112C078C75619AC2E0815F2511568736623C055156C8FC427CE2AEE4AE2838F86EFE80208"];
let data = hex!["e00000000d71d1a9cad6f2ab773435a7dec1bac019994d05d1dd5eb3108211dcf25c9d1e0000000007000000000000006369D39D892B7B87A6769F90E14C618C2B84EBB293E2CC46640136E112C078C75619AC2E0815F2511568736623C055156C8FC427CE2AEE4AE2838F86EFE80208"];
let uxt: UncheckedExtrinsic = Slicable::decode(&mut &data[..]).unwrap();
assert_eq!(uxt.extrinsic, xt);

Expand Down
8 changes: 4 additions & 4 deletions polkadot/runtime/wasm/Cargo.lock

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

Binary file not shown.
Binary file not shown.
24 changes: 12 additions & 12 deletions polkadot/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,22 @@ fn poc_1_testnet_config() -> ChainConfig {
staking: Some(StakingConfig {
current_era: 0,
intentions: initial_authorities.clone(),
transaction_fee: 100,
balances: endowed_accounts.iter().map(|&k|(k, 1u64 << 60)).collect(),
transaction_fee: 100.into(),
balances: endowed_accounts.iter().map(|&k|(k, (1u128 << 60).into())).collect(),
validator_count: 12,
sessions_per_era: 24, // 24 hours per era.
bonding_duration: 90, // 90 days per bond.
}),
democracy: Some(DemocracyConfig {
launch_period: 120 * 24 * 14, // 2 weeks per public referendum
voting_period: 120 * 24 * 28, // 4 weeks to discuss & vote on an active referendum
minimum_deposit: 1000, // 1000 as the minimum deposit for a referendum
minimum_deposit: 1000.into(), // 1000 as the minimum deposit for a referendum
}),
council: Some(CouncilConfig {
active_council: vec![],
candidacy_bond: 1000, // 1000 to become a council candidate
voter_bond: 100, // 100 down to vote for a candidate
present_slash_per_voter: 1, // slash by 1 per voter for an invalid presentation.
candidacy_bond: 1000.into(), // 1000 to become a council candidate
voter_bond: 100.into(), // 100 down to vote for a candidate
present_slash_per_voter: 1.into(), // slash by 1 per voter for an invalid presentation.
carry_count: 24, // carry over the 24 runners-up to the next council election
presentation_duration: 120 * 24, // one day for presenting winners.
approval_voting_period: 7 * 120 * 24, // one week period between possible council elections.
Expand Down Expand Up @@ -212,22 +212,22 @@ fn testnet_config(initial_authorities: Vec<AuthorityId>) -> ChainConfig {
staking: Some(StakingConfig {
current_era: 0,
intentions: initial_authorities.clone(),
transaction_fee: 1,
balances: endowed_accounts.iter().map(|&k|(k, 1u64 << 60)).collect(),
transaction_fee: 1.into(),
balances: endowed_accounts.iter().map(|&k|(k, (1u128 << 60).into())).collect(),
validator_count: 2,
sessions_per_era: 5,
bonding_duration: 2,
}),
democracy: Some(DemocracyConfig {
launch_period: 9,
voting_period: 18,
minimum_deposit: 10,
minimum_deposit: 10.into(),
}),
council: Some(CouncilConfig {
active_council: endowed_accounts.iter().filter(|a| initial_authorities.iter().find(|b| a == b).is_none()).map(|a| (a.clone(), 1000000)).collect(),
candidacy_bond: 10,
voter_bond: 2,
present_slash_per_voter: 1,
candidacy_bond: 10.into(),
voter_bond: 2.into(),
present_slash_per_voter: 1.into(),
carry_count: 4,
presentation_duration: 10,
approval_voting_period: 20,
Expand Down
4 changes: 2 additions & 2 deletions polkadot/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use std::sync::Arc;
use polkadot_api::PolkadotApi;
use primitives::{AccountId, Timestamp};
use runtime::{Block, UncheckedExtrinsic, TimestampCall, Call};
use substrate_runtime_primitives::traits::Checkable;
use substrate_runtime_primitives::traits::{Bounded, Checkable};
use transaction_pool::{Pool, Readiness};
use transaction_pool::scoring::{Change, Choice};

Expand Down Expand Up @@ -295,7 +295,7 @@ impl<'a, T: 'a + PolkadotApi> transaction_pool::Ready<VerifiedTransaction> for R
// transaction-pool trait.
let (api_handle, at_block) = (&self.api_handle, &self.at_block);
let next_index = self.known_indices.entry(sender)
.or_insert_with(|| api_handle.index(at_block, sender).ok().unwrap_or_else(u64::max_value));
.or_insert_with(|| api_handle.index(at_block, sender).ok().unwrap_or_else(Bounded::max_value));

trace!(target: "transaction-pool", "Next index for sender is {}; xt index is {}", next_index, xt.inner.index);

Expand Down
2 changes: 1 addition & 1 deletion substrate/codec/src/slicable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ macro_rules! impl_non_endians {
)* }
}

impl_endians!(u16, u32, u64, usize, i16, i32, i64, isize);
impl_endians!(u16, u32, u64, u128, usize, i16, i32, i64, i128, isize);
impl_non_endians!(i8, [u8; 1], [u8; 2], [u8; 3], [u8; 4], [u8; 5], [u8; 6], [u8; 7], [u8; 8],
[u8; 10], [u8; 12], [u8; 14], [u8; 16], [u8; 20], [u8; 24], [u8; 28], [u8; 32], [u8; 40],
[u8; 48], [u8; 56], [u8; 64], [u8; 80], [u8; 96], [u8; 112], [u8; 128], bool);
Expand Down
Binary file not shown.
Binary file not shown.
Loading