mirror of
https://github.com/fluencelabs/trust-graph
synced 2025-07-05 09:31:38 +00:00
Compare commits
7 Commits
trust-grap
...
trust-grap
Author | SHA1 | Date | |
---|---|---|---|
864b7f5c13 | |||
da38a41ba7 | |||
7493eed216 | |||
e9399b7d0c | |||
81eb924476 | |||
fe902acc50 | |||
f5994b33d1 |
2
.github/release-please/config.json
vendored
2
.github/release-please/config.json
vendored
@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages": {
|
"packages": {
|
||||||
".": {
|
"trust-graph": {
|
||||||
"component": "trust-graph"
|
"component": "trust-graph"
|
||||||
},
|
},
|
||||||
"aqua": {
|
"aqua": {
|
||||||
|
6
.github/release-please/manifest.json
vendored
6
.github/release-please/manifest.json
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
".": "0.4.0",
|
"trust-graph": "0.4.1",
|
||||||
"aqua": "0.4.0",
|
"aqua": "0.4.1",
|
||||||
"service": "0.4.0",
|
"service": "0.4.1",
|
||||||
"keypair": "0.10.0"
|
"keypair": "0.10.0"
|
||||||
}
|
}
|
||||||
|
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -65,10 +65,8 @@ jobs:
|
|||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
|
||||||
- name: Install Marine
|
- name: Setup marine
|
||||||
uses: baptiste0928/cargo-install@v1.3.0
|
uses: fluencelabs/setup-marine@v1
|
||||||
with:
|
|
||||||
crate: marine
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@ -19,10 +19,8 @@ jobs:
|
|||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
|
||||||
- name: Install marine
|
- name: Setup marine
|
||||||
uses: baptiste0928/cargo-install@v1.3.0
|
uses: fluencelabs/setup-marine@v1
|
||||||
with:
|
|
||||||
crate: marine
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ./service
|
working-directory: ./service
|
||||||
|
1730
Cargo.lock
generated
1730
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
24
Cargo.toml
24
Cargo.toml
@ -1,28 +1,6 @@
|
|||||||
[package]
|
|
||||||
name = "trust-graph"
|
|
||||||
version = "0.4.0"
|
|
||||||
authors = ["Fluence Labs"]
|
|
||||||
edition = "2021"
|
|
||||||
description = "trust graph"
|
|
||||||
license = "Apache-2.0"
|
|
||||||
repository = "https://github.com/fluencelabs/trust-graph"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
serde = { version = "1.0.118", features = ["derive"] }
|
|
||||||
|
|
||||||
fluence-keypair = { path = "./keypair", version = "0.10.0" }
|
|
||||||
bs58 = "0.4.0"
|
|
||||||
failure = "0.1.6"
|
|
||||||
log = "0.4.11"
|
|
||||||
ref-cast = "1.0.2"
|
|
||||||
derivative = "2.1.1"
|
|
||||||
thiserror = "1.0.23"
|
|
||||||
sha2 = "0.10.6"
|
|
||||||
rand = "0.8.5"
|
|
||||||
nonempty = "0.8.1"
|
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
|
"trust-graph",
|
||||||
"keypair",
|
"keypair",
|
||||||
"service"
|
"service"
|
||||||
]
|
]
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.4.1](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.4.0...trust-graph-api-v0.4.1) (2023-04-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **deps:** update aqua to 0.10.3 ([fe902ac](https://github.com/fluencelabs/trust-graph/commit/fe902acc50a6b4c6bf97c487f3e47ae0f5ef8a95))
|
||||||
|
* **deps:** update aqua-lib to 0.7.0 ([fe902ac](https://github.com/fluencelabs/trust-graph/commit/fe902acc50a6b4c6bf97c487f3e47ae0f5ef8a95))
|
||||||
|
|
||||||
## [0.4.0](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.3.2...trust-graph-api-v0.4.0) (2023-03-15)
|
## [0.4.0](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.3.2...trust-graph-api-v0.4.0) (2023-03-15)
|
||||||
|
|
||||||
|
|
||||||
|
4744
aqua/package-lock.json
generated
4744
aqua/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@fluencelabs/trust-graph",
|
"name": "@fluencelabs/trust-graph",
|
||||||
"version": "0.4.0",
|
"version": "0.4.1",
|
||||||
"description": "Aqua Trust Graph API library",
|
"description": "Aqua Trust Graph API library",
|
||||||
"files": [
|
"files": [
|
||||||
"*.aqua"
|
"*.aqua"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
"@fluencelabs/aqua-lib": "^0.7.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"generate-aqua": "../service/build.sh",
|
"generate-aqua": "../service/build.sh",
|
||||||
@ -31,6 +31,6 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/fluencelabs/trust-graph#readme",
|
"homepage": "https://github.com/fluencelabs/trust-graph#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fluencelabs/aqua": "^0.7.4-322"
|
"@fluencelabs/aqua": "^0.10.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,6 @@ pub struct Signature(pub Vec<u8>);
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use quickcheck::*;
|
use quickcheck::*;
|
||||||
use rand::seq::SliceRandom;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
const KEY1: &'static [u8] = include_bytes!("test/rsa-2048.pk8");
|
const KEY1: &'static [u8] = include_bytes!("test/rsa-2048.pk8");
|
||||||
@ -251,8 +250,8 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Arbitrary for SomeKeypair {
|
impl Arbitrary for SomeKeypair {
|
||||||
fn arbitrary<G: Gen>(g: &mut G) -> SomeKeypair {
|
fn arbitrary(g: &mut Gen) -> SomeKeypair {
|
||||||
let mut key = [KEY1, KEY2, KEY3].choose(g).unwrap().to_vec();
|
let mut key = g.choose(&[KEY1, KEY2, KEY3]).unwrap().to_vec();
|
||||||
SomeKeypair(Keypair::from_pkcs8(&mut key).unwrap())
|
SomeKeypair(Keypair::from_pkcs8(&mut key).unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.4.1](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.4.0...trust-graph-wasm-v0.4.1) (2023-04-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **deps:** Add trust-graph to workspace and bump sqlite-wasm version ([#87](https://github.com/fluencelabs/trust-graph/issues/87)) ([da38a41](https://github.com/fluencelabs/trust-graph/commit/da38a41ba727a14774a71bba6612b1bf1f498db9))
|
||||||
|
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
* The following workspace dependencies were updated
|
||||||
|
* dependencies
|
||||||
|
* trust-graph bumped from 0.4.0 to 0.4.1
|
||||||
|
|
||||||
## [0.4.0](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.3.2...trust-graph-wasm-v0.4.0) (2023-03-15)
|
## [0.4.0](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.3.2...trust-graph-wasm-v0.4.0) (2023-03-15)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "trust-graph-wasm"
|
name = "trust-graph-wasm"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "trust graph wasm"
|
description = "trust graph wasm"
|
||||||
@ -12,7 +12,7 @@ name = "trust-graph"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
trust-graph = { version = "0.4.0", path = "../." }
|
trust-graph = { version = "0.4.1", path = "../trust-graph" }
|
||||||
fluence-keypair = { version = "0.10.0", path = "../keypair" }
|
fluence-keypair = { version = "0.10.0", path = "../keypair" }
|
||||||
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||||
marine-sqlite-connector = "0.8.0"
|
marine-sqlite-connector = "0.8.0"
|
||||||
@ -29,8 +29,8 @@ bincode = "1.3.1"
|
|||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
marine-rs-sdk-test = "0.8.1"
|
marine-rs-sdk-test = "0.9.1"
|
||||||
rusqlite = "0.28.0"
|
rusqlite = "0.28.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
marine-rs-sdk-test = "0.8.1"
|
marine-rs-sdk-test = "0.9.1"
|
||||||
|
@ -5,12 +5,10 @@ modules_dir = "artifacts/"
|
|||||||
logger_enabled = true
|
logger_enabled = true
|
||||||
|
|
||||||
[module.wasi]
|
[module.wasi]
|
||||||
preopened_files = ["/tmp"]
|
mapped_dirs = { "/tmp" = "data" }
|
||||||
mapped_dirs = { "tmp" = "/tmp" }
|
|
||||||
[[module]]
|
[[module]]
|
||||||
name = "trust-graph"
|
name = "trust-graph"
|
||||||
logger_enabled = true
|
logger_enabled = true
|
||||||
|
|
||||||
[module.wasi]
|
[module.wasi]
|
||||||
preopened_files = ["/tmp"]
|
mapped_dirs = { "/tmp" = "data" }
|
||||||
mapped_dirs = { "tmp" = "/tmp" }
|
|
||||||
|
@ -13,7 +13,7 @@ mkdir -p artifacts
|
|||||||
cp ../target/wasm32-wasi/release/trust-graph.wasm artifacts/
|
cp ../target/wasm32-wasi/release/trust-graph.wasm artifacts/
|
||||||
|
|
||||||
# download SQLite 3 to use in tests
|
# download SQLite 3 to use in tests
|
||||||
curl -sS -L https://github.com/fluencelabs/sqlite/releases/download/v0.15.0_w/sqlite3.wasm -o artifacts/sqlite3.wasm
|
curl -sS -L https://github.com/fluencelabs/sqlite/releases/download/sqlite-wasm-v0.18.1/sqlite3.wasm -o artifacts/sqlite3.wasm
|
||||||
|
|
||||||
# generate Aqua bindings
|
# generate Aqua bindings
|
||||||
marine aqua artifacts/trust-graph.wasm -s TrustGraph -i trust-graph > ../aqua/trust-graph.aqua
|
marine aqua artifacts/trust-graph.wasm -s TrustGraph -i trust-graph > ../aqua/trust-graph.aqua
|
||||||
|
@ -18,18 +18,18 @@
|
|||||||
mod service_tests {
|
mod service_tests {
|
||||||
marine_rs_sdk_test::include_test_env!("/marine_test_env.rs");
|
marine_rs_sdk_test::include_test_env!("/marine_test_env.rs");
|
||||||
use crate::error::ServiceError;
|
use crate::error::ServiceError;
|
||||||
use crate::storage_impl::DB_PATH;
|
|
||||||
use crate::TRUSTED_TIMESTAMP;
|
use crate::TRUSTED_TIMESTAMP;
|
||||||
use fluence_keypair::KeyPair;
|
use fluence_keypair::KeyPair;
|
||||||
use libp2p_identity::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use marine_rs_sdk::{CallParameters, SecurityTetraplet};
|
use marine_rs_sdk::{CallParameters, SecurityTetraplet};
|
||||||
use marine_test_env::trust_graph::{Certificate, Revocation, ServiceInterface, Trust};
|
use marine_test_env::trust_graph::{Certificate, Revocation, ServiceInterface, Trust};
|
||||||
use rusqlite::Connection;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
static HOST_ID: &str = "some_host_id";
|
static HOST_ID: &str = "some_host_id";
|
||||||
|
|
||||||
|
static TEST_DB_PATH: &str = "data/trust-graph.sqlite";
|
||||||
|
|
||||||
struct Auth {
|
struct Auth {
|
||||||
issuer: PeerId,
|
issuer: PeerId,
|
||||||
trust: Trust,
|
trust: Trust,
|
||||||
@ -55,12 +55,7 @@ mod service_tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn clear_env() {
|
fn clear_env() {
|
||||||
let connection = Connection::open(DB_PATH).unwrap();
|
std::fs::remove_file(TEST_DB_PATH).unwrap_or_default();
|
||||||
|
|
||||||
connection
|
|
||||||
.execute("DELETE FROM trust_relations", [])
|
|
||||||
.unwrap();
|
|
||||||
connection.execute("DELETE FROM roots", []).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_correct_timestamp_cp(arg_number: usize) -> CallParameters {
|
fn get_correct_timestamp_cp(arg_number: usize) -> CallParameters {
|
||||||
@ -445,32 +440,32 @@ mod service_tests {
|
|||||||
let mut trust_graph = marine_test_env::trust_graph::ServiceInterface::new();
|
let mut trust_graph = marine_test_env::trust_graph::ServiceInterface::new();
|
||||||
clear_env();
|
clear_env();
|
||||||
|
|
||||||
let peerA_kp = KeyPair::generate_ed25519();
|
let peer_a_kp = KeyPair::generate_ed25519();
|
||||||
let mut cur_time = 100u64;
|
let mut cur_time = 100u64;
|
||||||
add_root_with_trust(&mut trust_graph, &peerA_kp, cur_time, cur_time + 9999, 10);
|
add_root_with_trust(&mut trust_graph, &peer_a_kp, cur_time, cur_time + 9999, 10);
|
||||||
|
|
||||||
let peerB_kp = KeyPair::generate_ed25519();
|
let peer_b_kp = KeyPair::generate_ed25519();
|
||||||
add_trust(
|
add_trust(
|
||||||
&mut trust_graph,
|
&mut trust_graph,
|
||||||
&peerA_kp,
|
&peer_a_kp,
|
||||||
&peerB_kp.get_peer_id(),
|
&peer_b_kp.get_peer_id(),
|
||||||
cur_time,
|
cur_time,
|
||||||
cur_time + 99999,
|
cur_time + 99999,
|
||||||
);
|
);
|
||||||
|
|
||||||
let weight = get_weight(&mut trust_graph, peerB_kp.get_peer_id(), cur_time);
|
let weight = get_weight(&mut trust_graph, peer_b_kp.get_peer_id(), cur_time);
|
||||||
assert_ne!(weight, 0u32);
|
assert_ne!(weight, 0u32);
|
||||||
|
|
||||||
cur_time += 1;
|
cur_time += 1;
|
||||||
// A revokes B and cancels trust
|
// A revokes B and cancels trust
|
||||||
revoke(
|
revoke(
|
||||||
&mut trust_graph,
|
&mut trust_graph,
|
||||||
&peerA_kp,
|
&peer_a_kp,
|
||||||
&peerB_kp.get_peer_id(),
|
&peer_b_kp.get_peer_id(),
|
||||||
cur_time,
|
cur_time,
|
||||||
);
|
);
|
||||||
|
|
||||||
let weight = get_weight(&mut trust_graph, peerB_kp.get_peer_id(), cur_time);
|
let weight = get_weight(&mut trust_graph, peer_b_kp.get_peer_id(), cur_time);
|
||||||
assert_eq!(weight, 0u32);
|
assert_eq!(weight, 0u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.4.1](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.4.0...trust-graph-v0.4.1) (2023-04-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Miscellaneous Chores
|
||||||
|
|
||||||
|
* **trust-graph:** Synchronize trust-graph, wasm and api versions
|
||||||
|
|
||||||
## [0.4.0](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.3.2...trust-graph-v0.4.0) (2023-03-15)
|
## [0.4.0](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.3.2...trust-graph-v0.4.0) (2023-03-15)
|
||||||
|
|
||||||
|
|
22
trust-graph/Cargo.toml
Normal file
22
trust-graph/Cargo.toml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[package]
|
||||||
|
name = "trust-graph"
|
||||||
|
version = "0.4.1"
|
||||||
|
authors = ["Fluence Labs"]
|
||||||
|
edition = "2021"
|
||||||
|
description = "trust graph"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
repository = "https://github.com/fluencelabs/trust-graph"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde = { version = "1.0.118", features = ["derive"] }
|
||||||
|
|
||||||
|
fluence-keypair = { path = "../keypair", version = "0.10.0" }
|
||||||
|
bs58 = "0.4.0"
|
||||||
|
failure = "0.1.6"
|
||||||
|
log = "0.4.11"
|
||||||
|
ref-cast = "1.0.2"
|
||||||
|
derivative = "2.1.1"
|
||||||
|
thiserror = "1.0.23"
|
||||||
|
sha2 = "0.10.6"
|
||||||
|
rand = "0.8.5"
|
||||||
|
nonempty = "0.8.1"
|
Reference in New Issue
Block a user