Skip to content

Commit a99f137

Browse files
committed
srml: add basic structure
1 parent 482e6cb commit a99f137

File tree

16 files changed

+1563
-2
lines changed

16 files changed

+1563
-2
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/target
2-
/Cargo.lock
1+
**/*target
32
**/*.rs.bk
3+
Cargo.lock
44
.DS_Store
55
.idea

crates/srml/Cargo.toml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
[profile.release]
2+
panic = 'unwind'
3+
4+
[package]
5+
authors = ['clearloop']
6+
build = 'build.rs'
7+
edition = '2018'
8+
name = 'lc-srml'
9+
version = '2.0.0'
10+
11+
[build-dependencies]
12+
vergen = '3.0.4'
13+
14+
[build-dependencies.build-script-utils]
15+
git = 'https://github.com/paritytech/substrate.git'
16+
package = 'substrate-build-script-utils'
17+
rev = '3e651110aa06aa835790df63410a29676243fc54'
18+
version = '2.0.0'
19+
20+
[dependencies]
21+
futures = '0.3.1'
22+
log = '0.4.8'
23+
parking_lot = '0.9.0'
24+
tokio = '0.1.22'
25+
trie-root = '0.15.2'
26+
27+
[dependencies.codec]
28+
package = 'parity-scale-codec'
29+
version = '1.0.0'
30+
31+
[dependencies.ctrlc]
32+
features = ['termination']
33+
version = '3.1.3'
34+
35+
[dependencies.futures01]
36+
package = 'futures'
37+
version = '0.1.29'
38+
39+
[dependencies.grandpa]
40+
git = 'https://github.com/paritytech/substrate.git'
41+
package = 'sc-finality-grandpa'
42+
rev = '3e651110aa06aa835790df63410a29676243fc54'
43+
version = '2.0.0'
44+
45+
[dependencies.grandpa-primitives]
46+
git = 'https://github.com/paritytech/substrate.git'
47+
package = 'sp-finality-grandpa'
48+
rev = '3e651110aa06aa835790df63410a29676243fc54'
49+
version = '2.0.0'
50+
51+
[dependencies.node-template-runtime]
52+
path = 'runtime'
53+
version = '2.0.0'
54+
55+
[dependencies.sc-basic-authority]
56+
git = 'https://github.com/paritytech/substrate.git'
57+
rev = '3e651110aa06aa835790df63410a29676243fc54'
58+
59+
[dependencies.sc-cli]
60+
git = 'https://github.com/paritytech/substrate.git'
61+
rev = '3e651110aa06aa835790df63410a29676243fc54'
62+
version = '2.0.0'
63+
64+
[dependencies.sc-client]
65+
git = 'https://github.com/paritytech/substrate.git'
66+
rev = '3e651110aa06aa835790df63410a29676243fc54'
67+
version = '2.0.0'
68+
69+
[dependencies.sc-consensus-aura]
70+
git = 'https://github.com/paritytech/substrate.git'
71+
rev = '3e651110aa06aa835790df63410a29676243fc54'
72+
version = '0.8'
73+
74+
[dependencies.sc-executor]
75+
git = 'https://github.com/paritytech/substrate.git'
76+
rev = '3e651110aa06aa835790df63410a29676243fc54'
77+
version = '2.0.0'
78+
79+
[dependencies.sc-network]
80+
git = 'https://github.com/paritytech/substrate.git'
81+
rev = '3e651110aa06aa835790df63410a29676243fc54'
82+
version = '0.8'
83+
84+
[dependencies.sc-service]
85+
git = 'https://github.com/paritytech/substrate.git'
86+
rev = '3e651110aa06aa835790df63410a29676243fc54'
87+
version = '2.0.0'
88+
89+
[dependencies.sc-transaction-pool]
90+
git = 'https://github.com/paritytech/substrate.git'
91+
rev = '3e651110aa06aa835790df63410a29676243fc54'
92+
version = '2.0.0'
93+
94+
[dependencies.sp-consensus]
95+
git = 'https://github.com/paritytech/substrate.git'
96+
rev = '3e651110aa06aa835790df63410a29676243fc54'
97+
version = '0.8'
98+
99+
[dependencies.sp-consensus-aura]
100+
git = 'https://github.com/paritytech/substrate.git'
101+
rev = '3e651110aa06aa835790df63410a29676243fc54'
102+
version = '0.8'
103+
104+
[dependencies.sp-core]
105+
git = 'https://github.com/paritytech/substrate.git'
106+
rev = '3e651110aa06aa835790df63410a29676243fc54'
107+
version = '2.0.0'
108+
109+
[dependencies.sp-inherents]
110+
git = 'https://github.com/paritytech/substrate.git'
111+
rev = '3e651110aa06aa835790df63410a29676243fc54'
112+
version = '2.0.0'
113+
114+
[dependencies.sp-io]
115+
git = 'https://github.com/paritytech/substrate.git'
116+
rev = '3e651110aa06aa835790df63410a29676243fc54'
117+
version = '2.0.0'
118+
119+
[dependencies.sp-runtime]
120+
git = 'https://github.com/paritytech/substrate.git'
121+
rev = '3e651110aa06aa835790df63410a29676243fc54'
122+
version = '2.0.0'
123+
124+
[dependencies.sp-transaction-pool]
125+
git = 'https://github.com/paritytech/substrate.git'
126+
rev = '3e651110aa06aa835790df63410a29676243fc54'
127+
version = '2.0.0'
128+
129+
[workspace]
130+
members = ['runtime']
131+
132+
[[bin]]
133+
name = 'lc-srml'
134+
path = 'src/main.rs'

crates/srml/LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org>

crates/srml/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Substrate Node Template
2+
3+
A new FRAME-based Substrate node, ready for hacking.
4+
5+
## Build
6+
7+
Install Rust:
8+
9+
```bash
10+
curl https://sh.rustup.rs -sSf | sh
11+
```
12+
13+
Initialize your Wasm Build environment:
14+
15+
```bash
16+
./scripts/init.sh
17+
```
18+
19+
Build Wasm and native code:
20+
21+
```bash
22+
cargo build --release
23+
```
24+
25+
## Run
26+
27+
### Single Node Development Chain
28+
29+
Purge any existing developer chain state:
30+
31+
```bash
32+
./target/release/node-template purge-chain --dev
33+
```
34+
35+
Start a development chain with:
36+
37+
```bash
38+
./target/release/node-template --dev
39+
```
40+
41+
Detailed logs may be shown by running the node with the following environment variables set: `RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- --dev`.
42+
43+
### Multi-Node Local Testnet
44+
45+
If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain that have been endowed with testnet units.
46+
47+
Optionally, give each node a name and expose them so they are listed on the Polkadot [telemetry site](https://telemetry.polkadot.io/#/Local%20Testnet).
48+
49+
You'll need two terminal windows open.
50+
51+
We'll start Alice's substrate node first on default TCP port 30333 with her chain database stored locally at `/tmp/alice`. The bootnode ID of her node is `QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR`, which is generated from the `--node-key` value that we specify below:
52+
53+
```bash
54+
cargo run -- \
55+
--base-path /tmp/alice \
56+
--chain=local \
57+
--alice \
58+
--node-key 0000000000000000000000000000000000000000000000000000000000000001 \
59+
--telemetry-url ws://telemetry.polkadot.io:1024 \
60+
--validator
61+
```
62+
63+
In the second terminal, we'll start Bob's substrate node on a different TCP port of 30334, and with his chain database stored locally at `/tmp/bob`. We'll specify a value for the `--bootnodes` option that will connect his node to Alice's bootnode ID on TCP port 30333:
64+
65+
```bash
66+
cargo run -- \
67+
--base-path /tmp/bob \
68+
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR \
69+
--chain=local \
70+
--bob \
71+
--port 30334 \
72+
--telemetry-url ws://telemetry.polkadot.io:1024 \
73+
--validator
74+
```
75+
76+
Additional CLI usage options are available and may be shown by running `cargo run -- --help`.
77+
78+
## Advanced: Generate Your Own Substrate Node Template
79+
80+
A substrate node template is always based on a certain version of Substrate. You can inspect it by
81+
opening [Cargo.toml](Cargo.toml) and see the template referred to a specific Substrate commit(
82+
`rev` field), branch, or version.
83+
84+
You can generate your own Substrate node-template based on a particular Substrate
85+
version/commit by running following commands:
86+
87+
```bash
88+
# git clone from the main Substrate repo
89+
git clone https://github.com/paritytech/substrate.git
90+
cd substrate
91+
92+
# Switch to a particular branch or commit of the Substrate repo your node-template based on
93+
git checkout <branch/tag/sha1>
94+
95+
# Run the helper script to generate a node template.
96+
# This script compiles Substrate and takes a while to complete. It takes a relative file path
97+
# from the current dir. to output the compressed node template.
98+
.maintain/node-template-release.sh ../node-template.tar.gz
99+
```
100+
101+
Noted though you will likely get faster and more thorough support if you stick with the releases
102+
provided in this repository.

crates/srml/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use vergen::{ConstantsFlags, generate_cargo_keys};
2+
3+
const ERROR_MSG: &str = "Failed to generate metadata files";
4+
5+
fn main() {
6+
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
7+
8+
build_script_utils::rerun_if_git_head_changed();
9+
}

0 commit comments

Comments
 (0)