Skip to content

Commit

Permalink
Merge Narwhal into Sui
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtian committed Sep 30, 2022
2 parents 87f3522 + 0b5d034 commit a9fa587
Show file tree
Hide file tree
Showing 506 changed files with 63,805 additions and 0 deletions.
3 changes: 3 additions & 0 deletions narwhal/.assets/diagram-primary.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions narwhal/.assets/diagram-worker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions narwhal/.assets/diagram.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2021-06-29T11:40:36.080Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36" etag="OybOxsFT5Ujje8oWMdfj" version="14.8.2" type="device" pages="2"><diagram id="04SbDpS5iBzByXe31BT4" name="worker">7V1td5s2FP41Oaf7kB7ewR+btGl3tm7Z0nXrR2Jkw4KRC3Lj7NdP4sU2kmwrCaBL4pzT2ghZxs9zr+6LLuLMvlysP+bhMv6MI5SeWUa0PrPfn1mW6VgefWEtD1WLb/tVwzxPorrTtuEm+Q/VjUbdukoiVLQ6EoxTkizbjVOcZWhKWm1hnuP7drcZTtvfugznSGi4mYap2Pp3EpG4ag1cY9v+CSXzuPlm06jPLMKmc91QxGGE73ea7A9n9mWOManeLdaXKGXgNbhUn7vac3ZzYTnKiMoH7rJ/8C/J1fxrnnz4+umPq/Off7k+Nx23GudHmK7qn1xfLnloMMjxKosQG8Y4sy/u44Sgm2U4ZWfvKeu0LSaLlB6Z9G1BcnyHLnGK8/LTtlH+0TNhmswz2paiGb3gi1mSpk23DGd0tAvxJ9W/8gfKCVrvNNU/8SPCC0TyB9qlPuvUaDfi1hzfb8mzG0biXeK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9oFKgSu5+4FrKmgDKkvNPXKFD5CAmEaGT3o2zM/LSGA3L/FGl9qFRXAMuEJx8pLeCZ+POzGA4YnibTPz64upihy6evQLMvBt5DZ/ToM71zWoEdq/BXUH5FEleiy/DFSsrwRYmuwy8et7qkLpNzWOHCkXM+xjkCFRMaFXGOQFuFpjjnTR+q96b5/EeZwqcvtzfQ+fZcSufs7rI+/QYx5obxuopUWeTe7yoKUVA5o3eZjW27S2+jwxm5S5TD7zC5O2W2xjdJ7jJvm91dcue2GDRJb2ly8/xv//376+Wg++w8310D9Z8yxnJfqrJUoz3VwqR9Ccu5L7Sn1brS4HZTJu1LhBf7Qnua72vUOfjSR6TqeunPY0pZt8iEpMf/</diagram></mxfile>
5 changes: 5 additions & 0 deletions narwhal/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# For proto file format
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 100

19 changes: 19 additions & 0 deletions narwhal/.clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# cyclomatic complexity is not always useful
cognitive-complexity-threshold = 100
# types are used for safety encoding
type-complexity-threshold = 10000
# big constructors
too-many-arguments-threshold = 15

disallowed-methods = [
{path = "anyhow", reason = "we prefer to use eyre"},
# we use tracing with the log feature instead of the log crate.
{ path = "log::info", reason = "use tracing::info instead" },
{ path = "log::debug", reason = "use tracing::debug instead" },
{ path = "log::error", reason = "use tracing::error instead" },
{ path = "log::warn", reason = "use tracing::warn instead" },
# unbounded channels are for expert use only
{ path = "tokio::sync::mpsc::unbounded_channel", reason = "use a bounded channel instead" },
{ path = "futures::channel::mpsc::unbounded", reason = "use a bounded channel instead" },
{ path = "futures_channel::mpsc::unbounded", reason = "use a bounded channel instead" },
]
7 changes: 7 additions & 0 deletions narwhal/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Exclude directories from getting copied
# to the Docker image once built.
.cargo
.github
.idea
target
benchmark
10 changes: 10 additions & 0 deletions narwhal/.github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

/crypto/ @huitseeker @kchalkias
/executor/ @asonnino @akichidis
/examples/ @arun-koshy
/network/ @bmwill
/config/tests/snapshots/ @huitseeker
/dag/ @huitseeker
/storage/ @akichidis
/primary/src/block_synchronizer/ @akichidis
/primary/src/block_waiter.rs @akichidis
13 changes: 13 additions & 0 deletions narwhal/.github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Bug
about: Create a new bug
title: '<title>'
labels: bug
assignees: ''
---

### Description
<!-- give the bug description here -->

### Steps to reproduce
<!-- provide the steps to reproduce here -->
9 changes: 9 additions & 0 deletions narwhal/.github/ISSUE_TEMPLATE/epic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Epic
about: Create a new epic
title: '<title>'
labels: epic
assignees: ''
---

### Description
14 changes: 14 additions & 0 deletions narwhal/.github/ISSUE_TEMPLATE/story.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Story
about: Create a new story
title: '<title>'
labels: story
assignees: ''
---

### Epic
<!-- here you can reference they parent Epic, given that this exists. Just insert the number of issue (e.x #34).
If no Epic exists, ignore and feel free to delete the "Epic" section. -->
Parent epic: #

### Description
14 changes: 14 additions & 0 deletions narwhal/.github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Task
about: Create a new task
title: '<title>'
labels: task
assignees: ''
---

### Story
<!-- here you can reference they parent Story, given that this exists. Just insert the number of issue (e.x #34).
If no Story exists, ignore and feel free to delete the "Story" section. -->
Parent story: #

### Description
2 changes: 2 additions & 0 deletions narwhal/.github/config/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
failure-threshold: error
14 changes: 14 additions & 0 deletions narwhal/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Dependabot configuration file
#

version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
86 changes: 86 additions & 0 deletions narwhal/.github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Benchmark

on:
## Allow triggering this workflow manually via GitHub CLI/web
workflow_dispatch:

push:
branches:
- main
- devnet

env:
CARGO_TERM_COLOR: always
# Disable incremental compilation.
#
# Incremental compilation is useful as part of an edit-build-test-edit cycle,
# as it lets the compiler avoid recompiling code that hasn't changed. However,
# on CI, we're not making small edits; we're almost always building the entire
# project from scratch. Thus, incremental compilation on CI actually
# introduces *additional* overhead to support making future builds
# faster...but no future builds will ever occur in any given CI environment.
#
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
# for details.
CARGO_INCREMENTAL: 0
# Allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). This should help to reduce flaky CI failures
# from transient network timeouts or other issues.
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
# Don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short

jobs:
bench:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache-id
with:
path: ${{ runner.temp }}/benchmark-cache-directory
key: ${{ runner.os }}-benchmark-cache-v1.0
- uses: airvzxf/[email protected]
with:
script: 'install.sh'
is_cached: ${{ steps.cache-id.outputs.cache-hit }}
cache: ${{ runner.temp }}/benchmark-cache-directory
snapshot: '/'
exclude: '/boot /data /dev /mnt /proc /run /sys'
- name: Install python dependencies
run: |
if [ -f benchmark/requirements.txt ]; then pip install -r benchmark/requirements.txt; fi
- uses: actions-rs/toolchain@v1
# Enable caching of the 'librocksdb-sys' crate by additionally caching the
# 'librocksdb-sys' src directory which is managed by cargo
- uses: bmwill/rust-cache@v1 # Fork of 'Swatinem/rust-cache' which allows caching additional paths
with:
path: ~/.cargo/registry/src/**/librocksdb-sys-*
- name: prepare artifact directory
run: |
mkdir -p artifacts
echo '# Bench results' > artifacts/bench_results.md
- name: build benchmarks
run: cd benchmark && fab local | tail -n 31 | tee -a ../artifacts/bench_results.md
- name: finish the benchmark results
run: |
cat >> artifacts/bench_results.md <<EOF
<details>
<summary>PR to merge $GITHUB_HEAD_REF $GITHUB_SHA -> $GITHUB_BASE_REF</summary>
</details>
EOF
- name: escape benchmark results
id: get-comment-body
run: |
body=$(cat artifacts/bench_results.md)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Create commit comment
uses: peter-evans/commit-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ steps.get-comment-body.outputs.body }}
48 changes: 48 additions & 0 deletions narwhal/.github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Codecov
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, reopened, synchronize]

jobs:
codecov-grcov:
name: Generate code coverage
runs-on: ubuntu-ghcloud
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
components: llvm-tools-preview
# Enable caching of the 'librocksdb-sys' crate by additionally caching the
# 'librocksdb-sys' src directory which is managed by cargo
- uses: bmwill/rust-cache@v1 # Fork of 'Swatinem/rust-cache' which allows caching additional paths
with:
path: ~/.cargo/registry/src/**/librocksdb-sys-*
- name: Install grcov, and cache the binary
uses: baptiste0928/cargo-install@v1
with:
crate: grcov
locked: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
env:
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
- name: Run tests
env:
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'codecov-instrumentation-%p-%m.profraw'
run: cargo test --tests
- name: Run grcov
run: grcov . --binary-path target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
58 changes: 58 additions & 0 deletions narwhal/.github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: auto-merge & finishing steps for dependabot

on:
pull_request_target:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.AUTOMERGE_TOKEN }}
- uses: actions-rs/toolchain@v1
- name: Install cargo-hakari, and cache the binary
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-hakari
locked: true
- name: run cargo-hakari
run: |
cargo hakari generate
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Push changes
if: steps.git-check.outputs.modified == 'true'
# using secrets.AUTOMERGE_TOKEN in the below is key to re-trigger CI
run: |
git config --global user.name 'Francois Garillot'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.AUTOMERGE_TOKEN }}@github.com/${{ github.repository }}
git commit -am "chore(deps): cargo hakari"
git push
- uses: ahmadnassri/[email protected]
with:
github-token: ${{ secrets.AUTOMERGE_TOKEN }}
command: 'squash and merge'
target: minor
- name: Enable auto-merge for Dependabot PRs on patch versions
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

41 changes: 41 additions & 0 deletions narwhal/.github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docs

on:
push:
branches:
- main
- devnet
paths:
- "**.rs"
- "Cargo.toml"
- "Cargo.lock"
workflow_dispatch:

jobs:
docs:
name: Generate crate documentation
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- name: Generate documentation
uses: actions-rs/cargo@v1
env:
RUSTDOCFLAGS: "--enable-index-page -Zunstable-options"
with:
command: doc
args: --workspace --no-deps

- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
12 changes: 12 additions & 0 deletions narwhal/.github/workflows/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Copyright (c) 2022, Mysten Labs, Inc.
# SPDX-License-Identifier: Apache-2.0

# Add clang & others
sudo apt-get update

sudo apt-get install -y --no-install-recommends python3-numpy libatlas-base-dev clang-11

# Make python3 default
sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3 40
sudo pip3 --no-cache-dir install --upgrade pip
Loading

0 comments on commit a9fa587

Please sign in to comment.