Skip to content

Commit e5fab24

Browse files
committed
first commit
0 parents  commit e5fab24

34 files changed

+4977
-0
lines changed

.env.example

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This is only an example configuration file for this project
2+
# To set you own values, duplicate this file and rename it as ".env"
3+
# All the values will be set as environment variables and read in "src/config.rs"
4+
5+
# REST API port
6+
PORT = 8000
7+
8+
# Comma-separated list of peer addresses
9+
# PEERS = http://localhost:8001,http://localhost:8002
10+
11+
# Period of time to wait between peer block synchronization (milliseconds)
12+
PEER_SYNC_MS = 10000
13+
14+
# Upper limit of blocks to be mined (0 for unlimited)
15+
MAX_BLOCKS = 0
16+
17+
# Upper limit of tries for finding a valid block
18+
MAX_NONCE = 1000000
19+
20+
# Number of zeros needed at the start of the hash of a valid block
21+
DIFFICULTY = 10
22+
23+
# Amount of milliseconds the miner wil wait before checking new transactions
24+
TRANSACTION_WAITING_MS = 10000
25+
26+
# Recipient address of the miner, to receive block mining rewards
27+
MINER_ADDRESS = 0000000000000000000000000000000000000000000000000000000000000000

.github/workflows/build.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- '*'
6+
7+
name: build
8+
9+
jobs:
10+
check:
11+
name: Check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: stable
19+
override: true
20+
- uses: actions-rs/cargo@v1
21+
with:
22+
command: build
23+
args: --release

.github/workflows/coverage.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- '*'
6+
7+
name: coverage
8+
9+
jobs:
10+
coverage:
11+
name: Coverage
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v1
15+
16+
- uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
override: true
20+
21+
- name: Install llvm-tools-preview
22+
run: rustup component add llvm-tools-preview
23+
24+
- name: Install grcov
25+
run: cargo install grcov --locked
26+
27+
- name: Run grcov
28+
env:
29+
RUSTFLAGS: '-C instrument-coverage'
30+
LLVM_PROFILE_FILE: 'rust_blockchain-%p-%m.profraw'
31+
run: |
32+
cargo build
33+
cargo test
34+
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" --ignore "tests/*" -o lcov.info
35+
36+
- name: Push grcov results to Coveralls via GitHub Action
37+
uses: coverallsapp/github-action@master
38+
with:
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
path-to-lcov: "lcov.info"

.github/workflows/lint.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- '*'
6+
7+
name: lint
8+
9+
jobs:
10+
fmt:
11+
name: Rustfmt
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: stable
19+
override: true
20+
- run: rustup component add rustfmt
21+
- uses: actions-rs/cargo@v1
22+
with:
23+
command: fmt
24+
args: --all -- --check
25+
26+
clippy:
27+
name: Clippy
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
- uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: stable
34+
components: clippy
35+
override: true
36+
- uses: actions-rs/clippy-check@v1
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
args: --all-features
40+
name: Clippy Output

.github/workflows/test.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- '*'
6+
7+
name: test
8+
9+
jobs:
10+
check:
11+
name: Check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: stable
19+
override: true
20+
- uses: actions-rs/cargo@v1
21+
with:
22+
command: test

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
/target/
4+
5+
# These are backup files generated by rustfmt
6+
**/*.rs.bk
7+
8+
# Dotenv configuration files
9+
.env
10+
11+
# Coverage reports
12+
/coverage/
13+
**/*.profraw

0 commit comments

Comments
 (0)