Skip to content

Commit

Permalink
Beta Cleanup (#166)
Browse files Browse the repository at this point in the history
* remove/justify unwraps

* justify unwraps.

* add record and vault exists.

* update documentation for vault and store.

* update snapshot docs.

* update runtime docs.

* add docs and add .changes.

* fix(covector): JSON

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* feat(tests): add coverage

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* fix(week-of-rust): meta cleanups

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* chore(deps): bump iota-crypto

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* update cli to use generic locations.

* update example.

* fix(crypto): use working revs

see #172

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* chore(readme): update banner and testing cmd

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* chore(readme): updates

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

* chore(publish): prep

Signed-off-by: Daniel Thompson-Yvetot <denjell@mailscript.com>

Co-authored-by: Daniel Thompson-Yvetot <denjell@mailscript.com>
  • Loading branch information
tensor-programming and nothingismagick authored Mar 19, 2021
1 parent 4b522e3 commit dae0457
Show file tree
Hide file tree
Showing 42 changed files with 356 additions and 228 deletions.
9 changes: 9 additions & 0 deletions .changes/beta_cleanup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"vault": patch
"snapshot": patch
"store": patch
"runtime": patch
"iota-stronghold": patch
---

Add documentation and cleanup the code for these crates and modules in preparation for beta.
32 changes: 1 addition & 31 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- name: cargo login
run: cargo login ${{ secrets.crate_token }}
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
Expand All @@ -48,33 +48,3 @@ jobs:
labels: 'version updates'
body: ${{ steps.covector.outputs.change }}

tangle:
runs-on: ubuntu-latest
needs: version-or-publish
if: needs.version-or-publish.outputs.successfulPublish == 'true'
strategy:
fail-fast: false
matrix:
package:
- name: iota-stronghold
registryName: iota-stronghold
- name: stronghold-engine
registryName: stronghold-engine
- name: stronghold-communication
registryName: stronghold-communication

steps:
- uses: actions/checkout@v2
- run: echo "PUBLISHED=$(jq '.${{ matrix.package.name }}.command' ${{ needs.version-or-publish.outputs.change }})" >> $GITHUB_ENV
- run: echo "PACKAGE_VERSION=$(jq '.${{ matrix.package.name }}.pkg.pkgFile.version' ${{ needs.version-or-publish.outputs.change }})" >> $GITHUB_ENV
- name: Tangle Release
if: env.PUBLISHED != 'false' && startsWith(env.PUBLISHED, 'parse error') != true && startsWith(env.PACKAGE_VERSION, 'parse error') != true
id: tangle_release
uses: iotaledger/gh-tangle-release@v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IOTA_SEED: ${{ secrets.IOTA_SEED }}
IOTA_NODE: 'https://iotanode.us:14267'
with:
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
comment: 'Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }}'
38 changes: 38 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Coverage

on:
push:
branches:
- dev
- main
paths:
- '**.rs'
- '**.toml'
- '.github/workflows/coverage.yml'
- '.github/workflows/scripts/coverage.sh'

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: llvm-tools-preview
- uses: actions-rs/install@v0.1
with:
crate: cargo-binutils
version: 0.3.3
- uses: actions-rs/install@v0.1
with:
crate: rustfilt
version: 0.2.1
- name: Run test coverage
run: bash .github/workflows/scripts/coverage.sh
- uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/coverage.info
42 changes: 42 additions & 0 deletions .github/workflows/scripts/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

# Remove stale coverage report
rm -r coverage
mkdir coverage

# Run tests with profiling instrumentation
echo "Running instrumented unit tests..."
RUSTFLAGS="-Zinstrument-coverage" LLVM_PROFILE_FILE="stronghold-rs-%m.profraw" cargo +nightly test --tests --all --all-features

# Merge all .profraw files into "stronghold-rs.profdata"
echo "Merging coverage data..."
cargo +nightly profdata -- merge stronghold-rs-*.profraw -o stronghold-rs.profdata

# List the test binaries
echo "Locating test binaries..."
BINARIES=""

for file in \
$( \
RUSTFLAGS="-Zinstrument-coverage" \
cargo +nightly test --tests --all --all-features --no-run --message-format=json \
| jq -r "select(.profile.test == true) | .filenames[]" \
| grep -v dSYM - \
); \
do
echo "Found $file"
BINARIES="${BINARIES} -object $file"
done

# Generate and export the coverage report to lcov format
echo "Generating lcov file..."
cargo +nightly cov -- export ${BINARIES} \
--instr-profile=stronghold-rs.profdata \
--ignore-filename-regex="/.cargo|rustc|target|tests|/.rustup" \
--format=lcov --Xdemangler=rustfilt \
>> coverage/coverage.info

# Ensure intermediate coverage files are deleted
echo "Removing intermediate files..."
find . -name "*.profraw" -type f -delete
find . -name "*.profdata" -type f -delete
Binary file added .meta/stronghold_beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
![banner](./.meta/stronghold_alpha.png)
![banner](./.meta/stronghold_beta.png)

[![status](https://img.shields.io/badge/Status-Alpha-yellow.svg)](https://github.com/iotaledger/stronghold.rs)
[![status](https://img.shields.io/badge/Status-Beta-green.svg)](https://github.com/iotaledger/stronghold.rs)
![Audit](https://github.com/iotaledger/stronghold.rs/workflows/Audit/badge.svg?branch=dev)
![Test](https://github.com/iotaledger/stronghold.rs/workflows/Test/badge.svg)
[![docs](https://img.shields.io/badge/Docs-Official-red.svg)](https://stronghold.docs.iota.org)
[![coverage](https://coveralls.io/repos/github/iotaledger/stronghold.rs/badge.svg?branch=dev)](https://coveralls.io/github/iotaledger/stronghold.rs?branch=dev)
[![dependency status](https://deps.rs/repo/github/iotaledger/stronghold.rs/status.svg)](https://deps.rs/repo/github/iotaledger/stronghold.rs)

## Introduction
[summary]: #summary
Expand All @@ -11,16 +14,11 @@

There are four main components of Stronghold:
1. **Client**: The high-level interface to Stronghold (prefers Riker, functional integration also available)
2. **Engine**: Combines a persistence store (Snapshot) with an in-memory state interface (Vault).
3. **Runtime**: Is a process fork with limited permissions within which cryptographic operations take place
4. **Communication**: Enables Strongholds in different processes or on different devices to communicate with each other securely.

Read more about the [Alpha Release](https://blog.iota.org/stronghold-alpha-release/).
2. **Engine**: Combines a persistence store (Snapshot) with an in-memory state interface (Vault), a read/write key:value system (Store) and memory protection services (Runtime).
3. **Communication**: Enables Strongholds in different processes or on different devices to communicate with each other securely.

## WARNING
These libraries are being prepared for a number of external security audits in early 2021, so they are not yet verifiably safe. Until this warning is removed, the IOTA Foundation makes no guarantees to the fitness of these libraries for any purposes.

As such, they are to be seen as **experimental** and not ready for real-world applications.
These libraries have been reviewed internally and are being prepared for a full external security audit in mid 2021, so they are not yet verifiably safe. Until this warning is removed, the IOTA Foundation makes no guarantees to the fitness of these libraries for use by third parties.

Nevertheless, we are very interested in feedback about the design and implementation, and encourage you to reach out with any concerns or suggestions you may have.

Expand Down Expand Up @@ -62,13 +60,18 @@ Here are some of the features and tasks that we are working on.
- [ ] Move entirely to FPGA

## API Reference
### RUSTDOCS
- [client](https://stronghold.docs.iota.org/docs/iota_stronghold/index.html)
- [engine](https://stronghold.docs.iota.org/docs/stronghold_engine/index.html)
- [communication](https://stronghold.docs.iota.org/docs/stronghold_communication/index.html)

### Do it yourself
```
cargo doc --workspace --no-deps --open
```

## Running Tests
```
cargo test --all
cargo test --all --all-features
```

## Joining the discussion
Expand Down
8 changes: 2 additions & 6 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
[package]
name = "iota-stronghold"
version = "0.2.0"
authors = [
"tensorprogramming <tensordeveloper@gmail.com>",
"Daniel Thompson-Yvetot <daniel.yvetot@iota.org>"
]
authors = [ "IOTA Stiftung", "tensor-programming <tensordeveloper@gmail.com>" ]
edition = "2018"
license = "Apache-2.0"
readme = "README.md"
description = "Client interface for Stronghold"
keywords = [ "iota", "stronghold", "security" ]
categories = [ "security" ]
homepage = "https://iota.org"
homepage = "https://stronghold.docs.iota.org"
repository = "https://github.com/iotaledger/stronghold.rs"

[dependencies]
Expand All @@ -34,7 +31,6 @@ git = "https://github.com/iotaledger/crypto.rs"
rev = "b849861b86c3f7357b7477de4253b7352b363627"
features = [ "random", "ed25519", "sha", "hmac", "bip39-en", "slip10", "chacha" ]
version = "*"
# Note: We are only adding a version so that we can publish to crates.io

[dependencies.stronghold-communication]
path = "../communication"
Expand Down
Loading

0 comments on commit dae0457

Please sign in to comment.