Skip to content

Commit f0cbc39

Browse files
committed
Initial commit
Baseline for further development
1 parent d9d468b commit f0cbc39

File tree

191 files changed

+29440
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+29440
-0
lines changed

.buildkite/hooks/post-checkout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CI_BUILD_START=$(date +%s)
2+
export CI_BUILD_START

.buildkite/hooks/post-checkout.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
post-checkout

.buildkite/hooks/post-command

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash -e
2+
3+
#
4+
# Save target/ for the next CI build on this machine
5+
#
6+
if [[ -n $CARGO_TARGET_CACHE_NAME ]]; then
7+
(
8+
d=$HOME/cargo-target-cache/"$CARGO_TARGET_CACHE_NAME"
9+
mkdir -p "$d"
10+
set -x
11+
rsync -a --delete --link-dest="$PWD" target "$d"
12+
du -hs "$d"
13+
)
14+
fi
15+
16+
#
17+
# Add job_stats data point
18+
#
19+
if [[ -z $CI_BUILD_START ]]; then
20+
echo Error: CI_BUILD_START empty
21+
else
22+
CI_BUILD_DURATION=$(( $(date +%s) - CI_BUILD_START + 1 ))
23+
24+
CI_LABEL=${BUILDKITE_LABEL:-build label missing}
25+
26+
PR=false
27+
if [[ $BUILDKITE_BRANCH =~ pull/* ]]; then
28+
PR=true
29+
fi
30+
31+
SUCCESS=true
32+
if [[ $BUILDKITE_COMMAND_EXIT_STATUS != 0 ]]; then
33+
SUCCESS=false
34+
fi
35+
36+
point_tags="pipeline=$BUILDKITE_PIPELINE_SLUG,job=$CI_LABEL,pr=$PR,success=$SUCCESS"
37+
point_tags="${point_tags// /\\ }" # Escape spaces
38+
39+
point_fields="duration=$CI_BUILD_DURATION"
40+
point_fields="${point_fields// /\\ }" # Escape spaces
41+
42+
point="job_stats,$point_tags $point_fields"
43+
44+
scripts/metrics-write-datapoint.sh "$point" || true
45+
fi

.buildkite/hooks/post-command.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
post-command

.buildkite/hooks/pre-command

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash -e
2+
3+
# Ensure the pattern "+++ ..." never occurs when |set -x| is set, as buildkite
4+
# interprets this as the start of a log group.
5+
# Ref: https://buildkite.com/docs/pipelines/managing-log-output
6+
export PS4="++"
7+
8+
#
9+
# Restore target/ from the previous CI build on this machine
10+
#
11+
[[ -n "$CARGO_TARGET_CACHE_NAME" ]] || (
12+
d=$HOME/cargo-target-cache/"$CARGO_TARGET_CACHE_NAME"
13+
14+
if [[ -d $d ]]; then
15+
du -hs "$d"
16+
read -r cacheSizeInGB _ < <(du -s --block-size=1000000000 "$d")
17+
if [[ $cacheSizeInGB -gt 5 ]]; then
18+
echo "$d has gotten too large, removing it"
19+
rm -rf "$d"
20+
fi
21+
fi
22+
23+
mkdir -p "$d"/target
24+
set -x
25+
rsync -a --delete --link-dest="$d" "$d"/target .
26+
)
27+

.buildkite/hooks/pre-command.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pre-command

.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
too-many-arguments-threshold = 9

.codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ignore:
2+
- "src/bin"
3+
coverage:
4+
status:
5+
patch: off

.github/RELEASE_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Release v0.X.Y <milestone name>
2+
3+
fun blurb about the name, what's in the release
4+
5+
## Major Features And Improvements
6+
7+
* bulleted
8+
* list of features and improvements
9+
10+
## Breaking Changes
11+
12+
* bulleted
13+
* list
14+
* of
15+
* protocol changes/breaks
16+
* API breaks
17+
* CLI changes
18+
* etc.
19+
20+
## Bug Fixes and Other Changes
21+
22+
* can be pulled from commit log, or synthesized
23+
24+
## Thanks to our Contributors
25+
26+
This release contains contributions from many people at HyperCube, as well as:
27+
28+
pull from commit log

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Cargo.lock
2+
/target/
3+
4+
**/*.rs.bk
5+
.cargo
6+
7+
# node configuration files
8+
/config/
9+
/config-private/
10+
/config-drone/
11+
/config-validator/
12+
/config-client/
13+
/multinode-demo/test/config-client/
14+
15+
# test temp files, ledgers, etc.
16+
/farf/

CONTRIBUTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
HyperCube Coding Guidelines
2+
===
3+
4+
The goal of these guidelines is to improve developer productivity by allowing developers to
5+
jump any file in the codebase and not need to adapt to inconsistencies in how the code is
6+
written. The codebase should appear as if it had been authored by a single developer. If you
7+
don't agree with a convention, submit a PR patching this document and let's discuss! Once
8+
the PR is accepted, *all* code should be updated as soon as possible to reflect the new
9+
conventions.
10+
11+
Rust coding conventions
12+
---
13+
14+
* All Rust code is formatted using the latest version of `rustfmt`. Once installed, it will be
15+
updated automatically when you update the compiler with `rustup`.
16+
17+
* All Rust code is linted with Clippy. If you'd prefer to ignore its advice, do so explicitly:
18+
19+
```rust
20+
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
21+
```
22+
23+
Note: Clippy defaults can be overridden in the top-level file `.clippy.toml`.
24+
25+
* For variable names, when in doubt, spell it out. The mapping from type names to variable names
26+
is to lowercase the type name, putting an underscore before each capital letter. Variable names
27+
should *not* be abbreviated unless being used as closure arguments and the brevity improves
28+
readability. When a function has multiple instances of the same type, qualify each with a
29+
prefix and underscore (i.e. alice_keypair) or a numeric suffix (i.e. tx0).
30+
31+
* For function and method names, use `<verb>_<subject>`. For unit tests, that verb should
32+
always be `test` and for benchmarks the verb should always be `bench`. Avoid namespacing
33+
function names with some arbitrary word. Avoid abreviating words in function names.
34+
35+
* As they say, "When in Rome, do as the Romans do." A good patch should acknowledge the coding
36+
conventions of the code that surrounds it, even in the case where that code has not yet been
37+
updated to meet the conventions described here.
38+
39+
40+
Terminology
41+
---
42+
43+
Inventing new terms is allowed, but should only be done when the term is widely used and
44+
understood. Avoid introducing new 3-letter terms, which can be confused with 3-letter acronyms.
45+
46+
Some terms we currently use regularly in the codebase:
47+
48+
* fullnode: n. A fully participating network node.
49+
* hash: n. A SHA-256 Hash.
50+
* keypair: n. A Ed25519 key-pair, containing a public and private key.
51+
* pubkey: n. The public key of a Ed25519 key-pair.
52+
* sigverify: v. To verify a Ed25519 digital signature.
53+

Cargo.toml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
[package]
2+
name = "hypercube"
3+
description = "Blockchain, Rebuilt for Scale"
4+
version = "0.9.0"
5+
documentation = "https://docs.rs/hypercube"
6+
homepage = "http://hypercube-lab.org/"
7+
readme = "README.md"
8+
repository = "https://github.com/hypercube-labs/hypercube"
9+
authors = [
10+
"John Casper<[email protected]>",
11+
"Shawn Buzzwick<[email protected]>",
12+
"Steve Anchroage<[email protected]>",
13+
"Muller Jonhyson<[email protected]>",
14+
"Robert Bossman <[email protected]>",
15+
"Pojak Longhorn <[email protected]>",
16+
"Tress Marico<[email protected]>",
17+
]
18+
license = "Apache-2.0"
19+
20+
[[bin]]
21+
name = "hypercube-upload-perf"
22+
path = "src/bin/upload-perf.rs"
23+
24+
[[bin]]
25+
name = "hypercube-bench-streamer"
26+
path = "src/bin/bench-streamer.rs"
27+
28+
[[bin]]
29+
name = "hypercube-bench-tps"
30+
path = "src/bin/bench-tps.rs"
31+
32+
[[bin]]
33+
name = "hypercube-drone"
34+
path = "src/bin/drone.rs"
35+
36+
[[bin]]
37+
name = "hypercube-replicator"
38+
path = "src/bin/replicator.rs"
39+
40+
[[bin]]
41+
name = "hypercube-fullnode"
42+
path = "src/bin/fullnode.rs"
43+
44+
[[bin]]
45+
name = "hypercube-fullnode-config"
46+
path = "src/bin/fullnode-config.rs"
47+
48+
[[bin]]
49+
name = "hypercube-genesis"
50+
path = "src/bin/genesis.rs"
51+
52+
[[bin]]
53+
name = "hypercube-ledger-tool"
54+
path = "src/bin/ledger-tool.rs"
55+
56+
[[bin]]
57+
name = "hypercube-keygen"
58+
path = "src/bin/keygen.rs"
59+
60+
[[bin]]
61+
name = "hypercube-wallet"
62+
path = "src/bin/wallet.rs"
63+
64+
[badges]
65+
codecov = { repository = "hypercube-labs/hypercube", branch = "master", service = "github" }
66+
67+
[features]
68+
unstable = []
69+
ipv6 = []
70+
cuda = []
71+
erasure = []
72+
test = []
73+
74+
[dependencies]
75+
atty = "0.2"
76+
bincode = "1.0.0"
77+
bs58 = "0.2.0"
78+
byteorder = "1.2.1"
79+
bytes = "0.4"
80+
chrono = { version = "0.4.0", features = ["serde"] }
81+
clap = "2.31"
82+
dirs = "1.0.2"
83+
env_logger = "0.5.12"
84+
generic-array = { version = "0.12.0", default-features = false, features = ["serde"] }
85+
getopts = "0.2"
86+
influx_db_client = "0.3.4"
87+
hypercube-jsonrpc-core = "0.1"
88+
hypercube-jsonrpc-http-server = "0.1"
89+
hypercube-jsonrpc-macros = "0.1"
90+
ipnetwork = "0.12.7"
91+
itertools = "0.7.8"
92+
libc = "0.2.43"
93+
libloading = "0.5.0"
94+
log = "0.4.2"
95+
matches = "0.1.6"
96+
nix = "0.11.0"
97+
pnet_datalink = "0.21.0"
98+
rand = "0.5.1"
99+
rayon = "1.0.0"
100+
reqwest = "0.9.0"
101+
ring = "0.13.2"
102+
sha2 = "0.7.0"
103+
serde = "1.0.27"
104+
serde_cbor = "0.9.0"
105+
serde_derive = "1.0.27"
106+
serde_json = "1.0.10"
107+
socket2 = "0.3.8"
108+
xpz_program_interface = { path = "common" }
109+
sys-info = "0.5.6"
110+
tokio = "0.1"
111+
tokio-codec = "0.1"
112+
untrusted = "0.6.2"
113+
114+
[dev-dependencies]
115+
noop = { path = "programs/noop" }
116+
print = { path = "programs/print" }
117+
move_funds = { path = "programs/move_funds" }
118+
119+
[[bench]]
120+
name = "bank"
121+
122+
[[bench]]
123+
name = "banking_stage"
124+
125+
[[bench]]
126+
name = "ledger"
127+
128+
[[bench]]
129+
name = "signature"
130+
131+
[[bench]]
132+
name = "sigverify"
133+
134+
[workspace]
135+
members = [
136+
".",
137+
"common",
138+
"programs/noop",
139+
"programs/print",
140+
"programs/move_funds",
141+
]
142+
default-members = [
143+
".",
144+
"common",
145+
"programs/noop",
146+
"programs/print",
147+
"programs/move_funds",
148+
]

RELEASE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# HyperCube Release process
2+
3+
## Introduction
4+
5+
HyperCube uses a channel-oriented, date-based branching process described [here](https://github.com/hypercube-labs/hypercube/blob/master/rfcs/rfc-005-branches-tags-and-channels.md).
6+
7+
## Release Steps
8+
9+
### Changing channels
10+
11+
When cutting a new channel branch these pre-steps are required:
12+
13+
1. Pick your branch point for release on master.
14+
2. Create the branch. The name should be "v" + the first 2 "version" fields from Cargo.toml. For example, a Cargo.toml with version = "0.9.0" implies the next branch name is "v0.9".
15+
3. Update Cargo.toml to the next semantic version (e.g. 0.9.0 -> 0.10.0).
16+
4. Push your new branch to hypercube.git
17+
5. Land your Carto.toml change as a master PR.
18+
19+
At this point, ci/channel-info.sh should show your freshly cut release branch as "BETA_CHANNEL" and the previous release branch as "STABLE_CHANNEL".
20+
21+
### Updating channels (i.e. "making a release")
22+
23+
We use [github's Releases UI](https://github.com/hypercube-labs/hypercube/releases) for tagging a release.
24+
25+
1. Go [there ;)](https://github.com/hypercube-labs/hypercube/releases).
26+
2. Click "Draft new release".
27+
3. If the first major release on the branch (e.g. v0.8.0), paste in [this template](https://raw.githubusercontent.com/hypercube-labs/hypercube/master/.github/RELEASE_TEMPLATE.md) and fill it in.
28+
4. Test the release by generating a tag using semver's rules. First try at a release should be <branchname>.X-rc.0.
29+
5. Verify release automation:
30+
1. [Crates.io](https://crates.io/crates/hypercube) should have an updated HyperCube version.
31+
2. ...
32+
6. After testnet deployment, verify that testnets are running correct software. http://metrics.hypercube-lab.org should show testnet running on a hash from your newly created branch.

0 commit comments

Comments
 (0)