Skip to content

Commit

Permalink
production eden spec (#442)
Browse files Browse the repository at this point in the history
* generalize session key injection to aura and collator

* no longer inject session keys via curl

* kill chaos config

* move dockerfile up

* minimum production chain spec

* mount chain spec in node

* fine tune chain spec

* add placeholder bootnode

* add call filter
  • Loading branch information
ETeissonniere authored Dec 8, 2021
1 parent 3070e38 commit 164a6db
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: '.maintain/docker/Dockerfile'
file: './Dockerfile'
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 0 additions & 17 deletions .maintain/chaos/docker-compose.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .maintain/docker/entrypoint.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .maintain/docker/load_keys.sh

This file was deleted.

11 changes: 4 additions & 7 deletions .maintain/docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ RUN apt-get update && \
apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y cmake pkg-config libssl-dev git clang build-essential curl
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
export PATH=$PATH:$HOME/.cargo/bin && \
scripts/init.sh && \
cargo build -p nodle-chain --$PROFILE
export PATH=$PATH:$HOME/.cargo/bin && \
scripts/init.sh && \
cargo build -p nodle-chain --$PROFILE

# ===== SECOND STAGE ======

Expand All @@ -21,9 +21,6 @@ ARG PROFILE=release

COPY --from=builder /nodle-chain/target/$PROFILE/nodle-chain /usr/local/bin

COPY ./.maintain/docker/entrypoint.sh .
COPY ./.maintain/docker/load_keys.sh .

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl netcat
Expand All @@ -41,4 +38,4 @@ USER nodle-chain
EXPOSE 30333 9933 9944
VOLUME ["/data"]

ENTRYPOINT ["./entrypoint.sh"]
ENTRYPOINT ["nodle-chain"]
115 changes: 115 additions & 0 deletions node/res/eden.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions node/src/chain_spec/cs_eden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ pub fn local_config(id: ParaId) -> ChainSpec {
)
}

// Main config, from json chainspec
pub fn main_config() -> ChainSpec {
ChainSpec::from_json_bytes(&include_bytes!("../../res/eden.json")[..]).unwrap()
}

#[cfg(test)]
pub(crate) mod tests {
use super::*;
Expand All @@ -217,4 +222,9 @@ pub(crate) mod tests {
.build_storage()
.unwrap();
}

#[test]
fn test_create_main_spec() {
main_config().build_storage().unwrap();
}
}
1 change: 1 addition & 0 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ fn load_spec(
"staking-local" => Box::new(chain_spec::cs_staking::local_staking_config()),
"eden-dev" => Box::new(chain_spec::cs_eden::development_config(para_id)),
"eden-local" => Box::new(chain_spec::cs_eden::local_config(para_id)),
"eden" => Box::new(chain_spec::cs_eden::main_config()),
"" | "main" => Box::new(chain_spec::cs_main::main_config()),
"arcadia" => Box::new(chain_spec::cs_main::arcadia_config()),
path => {
Expand Down
30 changes: 29 additions & 1 deletion runtimes/eden/src/pallets_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::{
};
use frame_support::{
parameter_types,
traits::Contains,
weights::{constants::RocksDbWeight, IdentityFee},
};
use frame_system::limits::BlockLength;
Expand All @@ -44,8 +45,35 @@ parameter_types! {
pub const SS58Prefix: u8 = 37;
}

pub struct BaseCallFilter;
impl Contains<Call> for BaseCallFilter {
fn contains(call: &Call) -> bool {
matches!(
call,
// System
Call::System(_) |
Call::Timestamp(_) |
// Governance
Call::Sudo(_) |
Call::Scheduler(_) |
// Parachain
Call::ParachainSystem(_) |
// Consensus
Call::Authorship(_) |
Call::Session(_) |
// Utility
Call::Utility(_) |
Call::Multisig(_)
)

// Call::Balances(_) |
// Call::Allocations(_) |
// Call::Vesting(_) |
}
}

impl frame_system::Config for Runtime {
type BaseCallFilter = frame_support::traits::Everything;
type BaseCallFilter = BaseCallFilter;
type BlockWeights = constants::RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength;
type DbWeight = RocksDbWeight;
Expand Down

0 comments on commit 164a6db

Please sign in to comment.