Skip to content

Commit d141926

Browse files
authored
Merge pull request #4 from darwinia-network/master
fetch new
2 parents 45189e5 + 4bd8b1d commit d141926

File tree

15 files changed

+647
-115
lines changed

15 files changed

+647
-115
lines changed

CONTRIBUTING.adoc

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
= Contributing
2+
3+
The `Darwinia` project is an **OPENISH Open Source Project**
4+
5+
== What?
6+
7+
Individuals making significant and valuable contributions are given commit-access to a project to contribute as they see fit. A project is more like an open wiki than a standard guarded open source project.
8+
9+
== Rules
10+
11+
There are a few basic ground-rules for contributors (including the maintainer(s) of the project):
12+
13+
. **No `--force` pushes** or modifying the master branch history in any way. If you need to rebase, ensure you do it in your own repo.
14+
. **Non-master branches**, prefixed with a short name moniker (e.g. `gav-my-feature`) must be used for ongoing work.
15+
. **All modifications** must be made in a **pull-request** to solicit feedback from other contributors.
16+
. A pull-request *must not be merged until CI* has finished successfully.
17+
. Contributors should adhere to the https://wiki.parity.io/Substrate-Style-Guide[house coding style].
18+
19+
20+
== Merge Process
21+
22+
Merging pull requests once CI is successful:
23+
24+
. A PR needs to be reviewed and approved by project maintainers unless:
25+
- it does not alter any logic (e.g. comments, dependencies, docs), then it may be tagged https://github.com/darwinia-network/darwinia/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3AA2-insubstantial[`insubstantial`] and merged by its author once CI is complete.
26+
- it is an urgent fix with no large change to logic, then it may be merged after a non-author contributor has approved the review once CI is complete.
27+
28+
. Once a PR is ready for review please add the https://github.com/darwinia-network/darwinia/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`pleasereview`] label. Generally PRs should sit with this label for 48 hours in order to garner feedback. It may be merged before if all relevant parties had a look at it.
29+
. PRs that break the external API must be tagged with https://github.com/darwinia-network/darwinia/labels/B2-breaksapi[`breaksapi`], when it changes the SRML or consensus of running system with https://github.com/darwinia-network/darwinia/labels/B3-breaksconsensus[`breaksconsensus`]
30+
. No PR should be merged until all reviews' comments are addressed.
31+
32+
*Reviewing pull requests*:
33+
34+
When reviewing a pull request, the end-goal is to suggest useful changes to the author. Reviews should finish with approval unless there are issues that would result in:
35+
36+
. Buggy behavior.
37+
. Undue maintenance burden.
38+
. Breaking with house coding style.
39+
. Pessimization (i.e. reduction of speed as measured in the projects benchmarks).
40+
. Feature reduction (i.e. it removes some aspect of functionality that a significant minority of users rely on).
41+
. Uselessness (i.e. it does not strictly add a feature or fix a known issue).
42+
43+
*Reviews may not be used as an effective veto for a PR because*:
44+
45+
. There exists a somewhat cleaner/better/faster way of accomplishing the same feature/fix.
46+
. It does not fit well with some other contributors' longer-term vision for the project.
47+
48+
== Helping out
49+
50+
We use https://github.com/darwinia-network/darwinia/labels[labels] to manage PRs and issues and communicate state of a PR. Please familiarize yourself with them. Furthermore we are organizing issues in https://github.com/darwinia-network/darwinia/milestones[milestones]. Best way to get started is to a pick a ticket from the current milestone tagged https://github.com/darwinia-network/darwinia/issues?q=is%3Aissue+is%3Aopen+label%3AQ2-easy[`easy`] or https://github.com/darwinia-network/darwinia/issues?q=is%3Aissue+is%3Aopen+label%3AQ3-medium[`medium`] and get going or https://github.com/darwinia-network/darwinia/issues?q=is%3Aissue+is%3Aopen+label%3AX1-mentor[`mentor`] and get in contact with the mentor offering their support on that larger task.
51+
52+
== Releases
53+
54+
Declaring formal releases remains the prerogative of the project maintainer(s).
55+
56+
== Changes to this arrangement
57+
58+
This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change.
59+
60+
== Heritage
61+
62+
These contributing guidelines are modified from the "OPEN Open Source Project" guidelines for the Level project: https://github.com/Level/community/blob/master/CONTRIBUTING.md

Cargo.lock

+330-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ path = 'node/src/main.rs'
5050

5151
[workspace]
5252
members = [
53-
# "test-client",
53+
# "darwinia-client",
5454
"node/cli",
5555
"node/executor",
5656
"node/primitives",
@@ -69,6 +69,6 @@ exclude = ["node/runtime/wasm"]
6969
authors = ['Darwinia Network <hello@darwinia.network>']
7070
build = 'build.rs'
7171
edition = '2018'
72-
name = 'darwinia-crayfish'
73-
version = '0.3.0'
72+
name = 'darwinia'
73+
version = '0.3.1'
7474

node/cli/res/crayfish-fir.json

+87
Large diffs are not rendered by default.

node/cli/src/chain_spec.rs

+17-9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ pub fn flaming_fir_config() -> Result<ChainSpec, String> {
4444
ChainSpec::from_embedded(include_bytes!("../res/flaming-fir.json"))
4545
}
4646

47+
pub fn crayfish_fir_config() -> Result<ChainSpec, String> {
48+
ChainSpec::from_embedded(include_bytes!("../res/crayfish-fir.json"))
49+
}
50+
4751
fn staging_testnet_config_genesis() -> GenesisConfig {
4852
// stash, controller, session-key
4953
// generated with secret:
@@ -306,10 +310,7 @@ fn crayfish_config_genesis() -> GenesisConfig {
306310
get_authority_keys_from_seed("Bob"),
307311
],
308312
hex!["5225c14bd888f6f623d4c6fb283b3b6bbb76560151f6dbf3476dc2b60c24c476"].unchecked_into(),
309-
Some(vec![
310-
// tony
311-
hex!["12d5e8af67fc5c08ed231619d9210ecad2c665ff5d72e5948e56e82a0553f86b"].unchecked_into()
312-
]),
313+
None,
313314
false,
314315
)
315316
}
@@ -352,8 +353,8 @@ pub fn crayfish_testnet_genesis(
352353
}),
353354
balances: Some(BalancesConfig {
354355
balances: endowed_accounts.iter().cloned()
355-
.map(|k| (k, 18 * ENDOWMENT))
356-
.chain(initial_authorities.iter().map(|x| (x.0.clone(), ENDOWMENT)))
356+
.map(|k| (k, 1 * ENDOWMENT))
357+
.chain(initial_authorities.iter().map(|x| (x.0.clone(), 4 * ENDOWMENT)))
357358
.collect(),
358359
vesting: vec![],
359360
}),
@@ -367,8 +368,7 @@ pub fn crayfish_testnet_genesis(
367368
}),
368369
staking: Some(StakingConfig {
369370
current_era: 0,
370-
// TODO: ready for hacking
371-
current_era_total_reward: 80_000_000 * COIN / 63720,
371+
current_era_total_reward: 80_000_000 * COIN / 105120,
372372
minimum_validator_count: 1,
373373
validator_count: 30,
374374
offline_slash: Perbill::from_parts(1_000_000),
@@ -431,7 +431,15 @@ pub fn local_testnet_config() -> ChainSpec {
431431

432432
/// c￿rayfish testnet config (multivalidator Alice + Bob)
433433
pub fn crayfish_testnet_config() -> ChainSpec {
434-
ChainSpec::from_genesis("Crayfish Testnet", "crayfish_testnet", crayfish_config_genesis, vec![], None, Some("DAR"), None, token_properties())
434+
ChainSpec::from_genesis(
435+
"Darwinia Crayfish Testnet",
436+
"crayfish_testnet",
437+
crayfish_config_genesis,
438+
vec![],
439+
Some(TelemetryEndpoints::new(vec![(STAGING_TELEMETRY_URL.to_string(), 0)])),
440+
Some("DAR"),
441+
None,
442+
token_properties())
435443
}
436444

437445
#[cfg(test)]

node/cli/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub enum ChainSpec {
5252
StagingTestnet,
5353
/// Crayfish, darwinia network poc-2
5454
CrayfishTestnet,
55+
CrayfishTestnetFir,
5556
}
5657

5758
/// Custom subcommands.
@@ -125,14 +126,16 @@ impl ChainSpec {
125126
ChainSpec::LocalTestnet => chain_spec::local_testnet_config(),
126127
ChainSpec::StagingTestnet => chain_spec::staging_testnet_config(),
127128
ChainSpec::CrayfishTestnet => chain_spec::crayfish_testnet_config(),
129+
ChainSpec::CrayfishTestnetFir => chain_spec::crayfish_fir_config()?,
128130
})
129131
}
130132

131133
pub(crate) fn from(s: &str) -> Option<Self> {
132134
match s {
133135
"dev" => Some(ChainSpec::Development),
136+
"" => Some(ChainSpec::CrayfishTestnetFir),
134137
"local" => Some(ChainSpec::LocalTestnet),
135-
"" | "crayfish" => Some(ChainSpec::CrayfishTestnet),
138+
"crayfish" => Some(ChainSpec::CrayfishTestnet),
136139
"flaming-fir" => Some(ChainSpec::FlamingFir),
137140
"staging" => Some(ChainSpec::StagingTestnet),
138141
_ => None,

node/cli/src/panic_handle.rs

+1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ mod tests {
164164
use super::*;
165165

166166
#[test]
167+
#[ignore]
167168
fn does_not_abort() {
168169
set("test");
169170
let _guard = AbortGuard::force_unwind();

node/executor/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ node-primitives = { path = "../primitives" }
1717
node-runtime = { path = "../runtime" }
1818

1919
[dev-dependencies]
20-
#test-client = { package = "substrate-test-client", git = 'https://github.com/paritytech/substrate.git' }
20+
test-client = { package = "substrate-test-client", git = 'https://github.com/paritytech/substrate.git', rev = "5bf5e8f5" }
2121
keyring = { package = "substrate-keyring", git = 'https://github.com/paritytech/substrate.git' }
2222
runtime_primitives = { package = "sr-primitives", git = 'https://github.com/paritytech/substrate.git' }
2323
runtime_support = { package = "srml-support", git = 'https://github.com/paritytech/substrate.git' }

node/executor/src/lib.rs

+14-48
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ mod tests {
132132
fn xt() -> UncheckedExtrinsic {
133133
sign(CheckedExtrinsic {
134134
signed: Some((alice(), 0)),
135-
function: Call::Balances(balances::Call::transfer::<Runtime>(bob().into(), 69)),
135+
function: Call::Balances(balances::Call::transfer::<Runtime>(bob().into(), 69 * COIN)),
136136
})
137137
}
138138

@@ -247,8 +247,8 @@ mod tests {
247247
assert!(r.is_ok());
248248

249249
runtime_io::with_externalities(&mut t, || {
250-
assert_eq!(Balances::total_balance(&alice()), 110999999789);
251-
assert_eq!(Balances::total_balance(&bob()), 69);
250+
assert_eq!(Balances::total_balance(&alice()), 41997856000);
251+
assert_eq!(Balances::total_balance(&bob()), 69 * COIN);
252252
});
253253
}
254254

@@ -283,8 +283,8 @@ mod tests {
283283
assert!(r.is_ok());
284284

285285
runtime_io::with_externalities(&mut t, || {
286-
assert_eq!(Balances::total_balance(&alice()), 110999999789);
287-
assert_eq!(Balances::total_balance(&bob()), 69);
286+
assert_eq!(Balances::total_balance(&alice()), 41997856000);
287+
assert_eq!(Balances::total_balance(&bob()), 69 * COIN);
288288
});
289289
}
290290

@@ -327,7 +327,6 @@ mod tests {
327327
(ferdie(), 100),
328328
],
329329
vesting: vec![],
330-
sys_acc: ferdie(),
331330
}),
332331
session: Some(SessionConfig {
333332
validators: vec![AccountKeyring::One.into(), AccountKeyring::Two.into(), three],
@@ -349,7 +348,6 @@ mod tests {
349348
minimum_validator_count: 0,
350349
offline_slash: Perbill::zero(),
351350
session_reward: Perbill::zero(),
352-
current_session_reward: 0,
353351
offline_slash_grace: 0,
354352
invulnerables: vec![alice(), bob(), charlie()],
355353
}),
@@ -435,7 +433,7 @@ mod tests {
435433
},
436434
CheckedExtrinsic {
437435
signed: Some((alice(), 0)),
438-
function: Call::Balances(balances::Call::transfer(bob().into(), 69)),
436+
function: Call::Balances(balances::Call::transfer(bob().into(), 69 * COIN)),
439437
},
440438
]
441439
)
@@ -524,7 +522,7 @@ mod tests {
524522
runtime_io::with_externalities(&mut t, || {
525523
// block1 transfers from alice 69 to bob.
526524
// -1 is the default fee
527-
assert_eq!(Balances::total_balance(&alice()), 110999999789);
525+
assert_eq!(Balances::total_balance(&alice()), 110997859931);
528526
assert_eq!(Balances::total_balance(&bob()), 100000000069);
529527
// assert_eq!(System::events(), vec![
530528
// EventRecord {
@@ -577,9 +575,9 @@ mod tests {
577575
runtime_io::with_externalities(&mut t, || {
578576
// bob sends 5, alice sends 15 | bob += 10, alice -= 10
579577
// 111 - 69 - 1 - 10 - 1 = 30
580-
assert_eq!(Balances::total_balance(&alice()), 110999999638);
578+
assert_eq!(Balances::total_balance(&alice()), 110995720921);
581579
// 100 + 69 + 10 - 1 = 178
582-
assert_eq!(Balances::total_balance(&bob()), 99999999938);
580+
assert_eq!(Balances::total_balance(&bob()), 99997861079);
583581
// assert_eq!(System::events(), vec![
584582
// EventRecord {
585583
// phase: Phase::ApplyExtrinsic(0),
@@ -635,7 +633,7 @@ mod tests {
635633
runtime_io::with_externalities(&mut t, || {
636634
// block1 transfers from alice 69 to bob.
637635
// -1 is the default fee
638-
assert_eq!(Balances::total_balance(&alice()), 110999999789);
636+
assert_eq!(Balances::total_balance(&alice()), 110997859931);
639637
assert_eq!(Balances::total_balance(&bob()), 100000000069);
640638
});
641639

@@ -644,9 +642,9 @@ mod tests {
644642
runtime_io::with_externalities(&mut t, || {
645643
// bob sends 5, alice sends 15 | bob += 10, alice -= 10
646644
// 111 - 69 - 1 - 10 - 1 = 30
647-
assert_eq!(Balances::total_balance(&alice()), 110999999638);
645+
assert_eq!(Balances::total_balance(&alice()), 110995720921);
648646
// 100 + 69 + 10 - 1 = 178
649-
assert_eq!(Balances::total_balance(&bob()), 99999999938);
647+
assert_eq!(Balances::total_balance(&bob()), 99997861079);
650648
});
651649
}
652650

@@ -933,8 +931,8 @@ mod tests {
933931
assert_eq!(r, Ok(ApplyOutcome::Success));
934932

935933
runtime_io::with_externalities(&mut t, || {
936-
assert_eq!(Balances::total_balance(&alice()), 110999999789);
937-
assert_eq!(Balances::total_balance(&bob()), 69);
934+
assert_eq!(Balances::total_balance(&alice()), 41997856000);
935+
assert_eq!(Balances::total_balance(&bob()), 69 * COIN);
938936
});
939937
}
940938

@@ -966,36 +964,4 @@ mod tests {
966964

967965
assert!(t.storage_changes_root(GENESIS_HASH.into()).unwrap().is_some());
968966
}
969-
970-
#[test]
971-
fn should_import_block_with_test_client() {
972-
use test_client::{ClientExt, TestClientBuilder, consensus::BlockOrigin};
973-
974-
let client = TestClientBuilder::default()
975-
.build_with_native_executor::<Block, node_runtime::RuntimeApi, _>(executor())
976-
.0;
977-
978-
let block1 = changes_trie_block();
979-
let block_data = block1.0;
980-
let block = Block::decode(&mut &block_data[..]).unwrap();
981-
982-
client.import(BlockOrigin::Own, block).unwrap();
983-
}
984-
985-
#[cfg(feature = "benchmarks")]
986-
mod benches {
987-
use super::*;
988-
use test::Bencher;
989-
990-
#[bench]
991-
fn wasm_execute_block(b: &mut Bencher) {
992-
let (block1, block2) = blocks();
993-
994-
b.iter(|| {
995-
let mut t = new_test_ext(COMPACT_CODE, false);
996-
WasmExecutor::new().call(&mut t, "Core_execute_block", &block1.0).unwrap();
997-
WasmExecutor::new().call(&mut t, "Core_execute_block", &block2.0).unwrap();
998-
});
999-
}
1000-
}
1001967
}

node/runtime/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub use contracts::Gas;
5555
pub use runtime_primitives::{Permill, Perbill, impl_opaque_keys};
5656
pub use support::StorageValue;
5757
pub use staking::StakerStatus;
58-
pub use staking::ErasNums;
58+
pub use staking::EraIndex;
5959

6060

6161
/// Runtime version.
@@ -230,8 +230,8 @@ parameter_types! {
230230
pub const SessionsPerEra: session::SessionIndex = 5;
231231
// about 14 days
232232
pub const BondingDuration: staking::EraIndex = 4032;
233-
// 365 days * 24 hours * 60 miutes / 5 minutes
234-
pub const ErasPerEpoch: staking::ErasNums = 63720;
233+
// 365 days * 24 hours * 60 minutes / 5 minutes
234+
pub const ErasPerEpoch: EraIndex = 105120;
235235
}
236236

237237
// customed

node/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl cli::IntoExit for Exit {
4545

4646
fn main() {
4747
let version = VersionInfo {
48-
name: "Darwinia POC-1 Node",
48+
name: "Darwinia Crayfish Node",
4949
commit: env!("VERGEN_SHA_SHORT"),
5050
version: env!("CARGO_PKG_VERSION"),
5151
executable_name: "darwinia",

0 commit comments

Comments
 (0)