Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crystalin new genesis #237

Merged
merged 24 commits into from
Feb 12, 2021
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
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ max_line_length=100
[*.sh]
indent_style=space
indent_size=2
max_line_length=100
crystalin marked this conversation as resolved.
Show resolved Hide resolved

[*.json]
indent_style=space
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ jobs:
- name: Generate specs
run: |
chmod uog+x build/moonbeam
PARACHAIN_BINARY=build/moonbeam scripts/generate-parachain-specs.sh
MOONBEAM_BINARY=build/moonbeam scripts/generate-parachain-specs.sh
- name: Upload parachain specs
uses: actions/upload-artifact@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions docker/moonbase-parachain.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Node for Moonbase Alphanet.
# Node for Moonbase Parachains.
#
# Requires to run from repository root and to copy the binary in the build folder (part of the release workflow)

FROM phusion/baseimage:0.11
LABEL maintainer "alan@purestake.com"
LABEL description="Moonbeam network node. Supports Alphanet. Will support Moonriver and Moonbeam mainnet."
LABEL description="Moonbeam network node. Supports Alphanet/Stagenet. Will support Moonriver and Moonbeam mainnet."
ARG PROFILE=release

RUN mv /usr/share/ca* /tmp && \
Expand Down
3 changes: 3 additions & 0 deletions docker/moonbeam.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ RUN useradd -m -u 1000 -U -s /bin/sh -d /moonbeam moonbeam && \

USER moonbeam

COPY --chown=moonbeam build/moonbeam /moonbeam/moonbeam
RUN chmod uog+x /moonbeam/moonbeam

# 30333 for parachain p2p
# 30334 for relaychain p2p
# 9933 for RPC call
Expand Down
4 changes: 2 additions & 2 deletions docker/polkadot-relay.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ RUN mv /usr/share/ca* /tmp && \

USER moonbeam

COPY --chown=moonbeam specs/MoonbaseStageV5-Relay.json /moonbase-alphanet/stagenet-relay-raw-specs.json
COPY --chown=moonbeam specs/MoonbaseAlphaV5-Relay.json /moonbase-alphanet/alphanet-relay-raw-specs.json
COPY --chown=moonbeam specs/stagenet/rococo-embedded-specs-v6.json /moonbase-alphanet/stagenet-relay-raw-specs.json
COPY --chown=moonbeam specs/alphanet/rococo-embedded-specs-v6.json /moonbase-alphanet/alphanet-relay-raw-specs.json
RUN grep -v '/p2p/' /moonbase-alphanet/stagenet-relay-raw-specs.json > \
/moonbase-alphanet/stagenet-relay-raw-specs-no-bootnodes.json && \
grep -v '/p2p/' /moonbase-alphanet/alphanet-relay-raw-specs.json > \
Expand Down
4 changes: 2 additions & 2 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn development_chain_spec() -> ChainSpec {
vec![(
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
None,
100_000 * GLMR,
1_000 * GLMR,
)],
moonbeam_inflation_config(),
vec![AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap()],
Expand Down Expand Up @@ -93,7 +93,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
vec![(
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
None,
100_000 * GLMR,
1_000 * GLMR,
)],
moonbeam_inflation_config(),
vec![AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap()],
Expand Down
8 changes: 4 additions & 4 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ fn load_spec(
) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
match id {
"alphanet" => Ok(Box::new(chain_spec::ChainSpec::from_json_bytes(
&include_bytes!("../../specs/MoonbaseAlphaV5.json")[..],
&include_bytes!("../../specs/alphanet/parachain-embedded-specs-v6.json")[..],
)?)),
"stagenet" => Ok(Box::new(chain_spec::ChainSpec::from_json_bytes(
&include_bytes!("../../specs/MoonbaseStageV5.json")[..],
&include_bytes!("../../specs/stagenet/parachain-embedded-specs-v6.json")[..],
)?)),
"dev" | "development" => Ok(Box::new(chain_spec::development_chain_spec())),
"local" => Ok(Box::new(chain_spec::get_chain_spec(para_id))),
Expand Down Expand Up @@ -133,10 +133,10 @@ impl SubstrateCli for RelayChainCli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
match id {
"moonbase_alpha_relay" => Ok(Box::new(RococoChainSpec::from_json_bytes(
&include_bytes!("../../specs/MoonbaseAlphaV5-Relay.json")[..],
&include_bytes!("../../specs/alphanet/rococo-embedded-specs-v6.json")[..],
)?)),
"moonbase_stage_relay" => Ok(Box::new(RococoChainSpec::from_json_bytes(
&include_bytes!("../../specs/MoonbaseStageV5-Relay.json")[..],
&include_bytes!("../../specs/stagenet/rococo-embedded-specs-v6.json")[..],
)?)),
// If we are not using a moonbeam-centric pre-baked relay spec, then fall back to the
// Polkadot service to interpret the id.
Expand Down
12 changes: 6 additions & 6 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub type DigestItem = generic::DigestItem<Hash>;
pub const MINIMUM_PERIOD: u64 = 3000;

/// Maximum weight per block
pub const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;

/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
Expand Down Expand Up @@ -130,7 +130,7 @@ pub fn native_version() -> NativeVersion {
}
}

const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(65);
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);

parameter_types! {
pub const BlockHashCount: BlockNumber = 250;
Expand Down Expand Up @@ -234,8 +234,8 @@ impl pallet_ethereum_chain_id::Config for Runtime {}

/// Current approximation of the gas/s consumption considering
/// EVM execution over compiled WASM (on 4.4Ghz CPU).
/// Given the 500ms Weight, from which 65% only are used for transactions,
/// the total EVM execution gas limit is: GAS_PER_SECOND * 0.500 * 0.65 ~= 12_500_000.
/// Given the 500ms Weight, from which 75% only are used for transactions,
/// the total EVM execution gas limit is: GAS_PER_SECOND * 0.500 * 0.75 ~= 15_000_000.
pub const GAS_PER_SECOND: u64 = 40_000_000;

/// Approximate ratio of the amount of Weight per Gas.
Expand Down Expand Up @@ -390,8 +390,8 @@ parameter_types! {
pub const MaxValidatorsPerNominator: u32 = 8;
/// The maximum percent a validator can take off the top of its rewards is 50%
pub const MaxFee: Perbill = Perbill::from_percent(50);
/// Minimum stake required to be reserved to be a validator is 5
pub const MinValidatorStk: u128 = 100_000 * GLMR;
/// Minimum stake required to be reserved to be a validator is 1_000
pub const MinValidatorStk: u128 = 1_000 * GLMR;
/// Minimum stake required to be reserved to be a nominator is 5
pub const MinNominatorStk: u128 = 5 * GLMR;
}
Expand Down
27 changes: 9 additions & 18 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ The standalone nodes are made to be executed without explicitly supplied specs.
They also don't require any runtime wasm file or genesis state.

```bash
scripts/run-moonbase-standalone.sh
scripts/run-moonbase-dev.sh
```

# Alphanet nodes
# Alphanet local nodes

The alphanet nodes require having relay nodes (at least 2) and parachain nodes (at least 1).
The alphanet nodes will run on a rococo-local relay, preventing them from connecting to the real alphanet.
It requires having relay nodes (at least 2) and parachain nodes (at least 1).
Those require sharing many files (specs, runtime wasm, genesis state).

The following steps will guide you through the generation of those files.
Expand All @@ -81,29 +82,19 @@ scripts/generate-relay-specs.sh
```

The script downloads `purestake/moonbase-relay-testnet:$POLKADOT_VERSION` docker image and execute the build-spec.
It also relies on the `/specs/rococo-alphanet-specs-template.json` for the specs template.
The files generated are (by default) stored in `build/rococo-alphanet-specs-[plain,raw].json`
It also relies on the `rococo-local` for the specs.

## Generating the parachain specs

```bash
scripts/generate-parachain-specs.sh
```

The script executes (by default) `target/release/moonbase-alphanet` `build-spec`
It also relies on the `/specs/moonbase-alphanet-specs-template.json` for the specs template.
The files generated are (by default) stored in `build/moonbase-alphanet-specs-[plain,raw].json`
The script executes (by default) `target/release/moonbeam` `build-spec`
It also relies on the [../specs/alphanet/parachain-specs-template.json] for the specs template.
The files generated are (by default) stored in `build/alphanet/parachain-specs-[plain,raw].json`

It also generates the `build/parachain.wasm` and `build/parachain.genesis`

### Alternate parachain specs

If you want to use an alternative spec template (like [../moonbase-alphanet-dev-specs-template.json](moonbase-alphanet-dev-specs-template.json which contains gerald funds)),
you can provide the template like this:

```bash
ALPHANET_SPEC_TEMPLATE=specs/moonbase-alphanet-dev-specs-template.json scripts/generate-parachain-specs.sh
```
It also generates the `build/alphanet/runtime.wasm` and `build/alphanet/genesis.txt`

## Running Relay nodes

Expand Down
Loading