Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
interval: monthly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
interval: monthly
- package-ecosystem: cargo
directory: /algae
schedule:
Expand All @@ -28,7 +28,3 @@ updates:
directory: /mmr
schedule:
interval: weekly
- package-ecosystem: cargo
directory: /spline
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Clippy

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

on:
pull_request:
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/crates.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Publish
name: crates-io

concurrency:
concurrency:
cancel-in-progress: true
group: ${{ github.event.repository.name }}
group: ${{ github.workflow }}-${{ github.ref }}

env:
CARGO_TERM_COLOR: always
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

on:
release:
Expand All @@ -28,23 +29,23 @@ jobs:
matrix:
feature: [ core ]
env:
PACKAGE_NAME: ${{ github.event.repository.name }}-${{ matrix.feature }}
CRATE_NAME: ${{ github.event.repository.name }}-${{ matrix.feature }}
steps:
- uses: actions/checkout@v4
- name: Publish (${{env.PACKAGE_NAME}})
run: cargo publish --all-features -v -p ${{ env.PACKAGE_NAME }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish (${{env.CRATE_NAME}})
run: cargo publish --all-features -v -p ${{ env.CRATE_NAME }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
features:
name: Publish (features)
runs-on: ubuntu-latest
strategy:
matrix:
feature: [ graph, merkle, spline ]
env:
PACKAGE_NAME: ${{ github.event.repository.name }}-${{ matrix.feature }}
CRATE_NAME: ${{ github.event.repository.name }}-${{ matrix.feature }}
steps:
- uses: actions/checkout@v4
- name: Publish (${{env.PACKAGE_NAME}})
run: cargo publish --all-features -v -p ${{ env.PACKAGE_NAME }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish (${{env.CRATE_NAME}})
run: cargo publish --all-features -v -p ${{ env.CRATE_NAME }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish:
name: Publish (sdk)
needs: features
Expand Down
50 changes: 23 additions & 27 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: Rust
name: rust

concurrency:
cancel-in-progress: false
group: ${{ github.event.repository.name }}-rust
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

env:
CARGO_TERM_COLOR: always

on:
push:
pull_request:
branches: [ main ]
tags: [ nightly*, v*.*.*]
release:
types: [ created ]
repository_dispatch:
Expand All @@ -22,39 +21,36 @@ on:
permissions: write-all

jobs:
build:
name: Build
workspace:
name: Workspace
strategy:
matrix:
platform: [ ubuntu-latest ]
target: [ wasm32-unknown-unknown, wasm32-wasi ]
toolchain: [ stable, nightly ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: setup (rustup)
run: rustup default ${{ matrix.toolchain }} && rustup update
- name: target (${{ matrix.target }})
- name: rustup
run: |
rustup default ${{ matrix.toolchain }}
rustup update
- name: build
run: cargo build --all-features -r -v --workspace
- name: test
run: cargo test --all-features -r -v --workspace
- name: benchmark
if: matrix.toolchain == 'nightly'
run: rustup target add ${{ matrix.target }}
- name: cargo (build)
run: cargo build --features full -r -v --workspace
run: cargo bench --features full -v --workspace
- name: cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/registry
~/.cargo/git
target/debug
target/release
- name: cargo (test)
run: cargo test --all-features -r -v --workspace
benchmark:
name: Bench
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup default nightly && rustup update
- name: cargo (bench)
run: cargo bench --features full -v --workspace
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.toolchain }}-
${{ runner.os }}-cargo-
${{ runner.os }}-
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ members = [
"core",
"graph",
"merkle",
"spline",
]

resolver = "2"
Expand Down
65 changes: 56 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,83 @@

[![crates.io](https://img.shields.io/crates/v/algae.svg)](https://crates.io/crates/algae)
[![docs.rs](https://docs.rs/algae/badge.svg)](https://docs.rs/algae)
[![License](https://img.shields.io/crates/l/algae.svg)](https://crates.io/crates/algae)

[![Clippy](https://github.com/FL03/algae/actions/workflows/clippy.yml/badge.svg)](https://github.com/FL03/algae/actions/workflows/clippy.yml)
[![Rust](https://github.com/FL03/algae/actions/workflows/rust.yml/badge.svg)](https://github.com/FL03/algae/actions/workflows/rust.yml)

***

_**Warning: the library is currently in development and the API is subject to heavy changes!**_

Welcome to algae, a collection of optimized data-structures and algorithms intended for use within blockchain environments.

## Features

- [ ] `graph` - a hyper-graph implementation written in pure Rust.
- [ ] `merkle` - an optimized merkle tree library
- [ ] `mmr` - a merkle mountain range implementation

## Getting Started

### Build from the source

#### _Clone the repository_
Start by cloning the repository:

```bash
git clone https://github.com/FL03/algae
git clone https://github.com/FL03/algae.git
```

#### _Build the project_
Then, build the project using cargo:

```bash
cargo build --release
cargo build --all-features --workspace
```

### Usage

Add this to your `Cargo.toml`:

```toml
[dependencies.algae]
features = []
version = "0.1"
```

### Examples

#### _HyperGraph: Basic Usage_

```rust
extern crate algae;

use algae::graph::HyperGraph;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new graph
let mut graph = HyperGraph::new();

Ok(())
}
```

#### _MerkleTree: Basic Usage_

```rust
extern crate algae;

use algae::merkle::MerkleTree;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new merkle tree
let mut merkle = MerkleTree::new();

Ok(())
}
```

## Contributors

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

- [Apache-2.0](https://choosealicense.com/licenses/apache-2.0/)
- [MIT](https://choosealicense.com/licenses/mit/)
10 changes: 0 additions & 10 deletions algae/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ merkle = [
# "dep:algae-mmr"
# ]

spline = [
"dep:algae-spline",
]

serde = [
"algae-core/serde",
"algae-graph?/serde",
Expand Down Expand Up @@ -99,12 +95,6 @@ version = "0.1.20"
# path = "../mmr"
# version = "0.1.20"

[dependencies.algae-spline]
default-features = false
optional = true
path = "../spline"
version = "0.1.20"

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
Expand Down
4 changes: 0 additions & 4 deletions algae/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ pub use algae_graph as graph;
pub use algae_merkle as merkle;
// #[cfg(feature = "mmr")]
// pub use algae_mmr as mmr;
#[cfg(feature = "spline")]
pub use algae_spline as spline;

pub mod list;

Expand All @@ -26,8 +24,6 @@ pub mod prelude {
pub use algae_merkle::prelude::*;
// #[cfg(feature = "mmr")]
// pub use algae_mmr::*;
#[cfg(feature = "spline")]
pub use algae_spline::prelude::*;

pub use crate::list::*;
}
17 changes: 14 additions & 3 deletions graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,19 @@ full = [
"serde",
]

# ********* [FF] Dependencies *********
alloc = [
"serde?/alloc",
"strum/alloc",
]

serde = [
"dep:serde",
"dep:serde_json"
]

# ********* [FF] Environments *********
std = [
"alloc",
"serde?/std",
"strum/std",
]
Expand All @@ -45,16 +52,20 @@ test = true

[dependencies]
itertools.workspace = true
serde_json = { optional = true, version = "1" }
smart-default.workspace = true
strum.workspace = true
thiserror = "1"

[dependencies.serde]
default-features = false
optional = true
features = ["derive"]
version = "1"

[dependencies.strum]
default-features = false
features = ["derive"]
version = "0.26"

[dev-dependencies]

[package.metadata.docs.rs]
Expand Down
11 changes: 0 additions & 11 deletions graph/src/algo/mod.rs

This file was deleted.

Loading