Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial TrustGraph integration (backend) #104

Closed
wants to merge 10 commits into from
Closed
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
17 changes: 16 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ jobs:

- name: Install nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
substituters = https://cache.nixos.org https://holochain.cachix.org https://holochain-ci.cachix.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= holochain.cachix.org-1:fWOoSTrRQ8XipZim7a8LDqFAE8aqcGnG4E7G8NAJlgY= holochain-ci.cachix.org-1:5IUSkZc0aoRS53rfkvH9Kid40NpyjwCMCzwRTXy+QN8=
nix.settings.auto-optimise-store = true;

- name: Inspect nix.conf
run: cat ~/.config/nix/nix.conf || true

- name: Set up cachix
uses: cachix/cachix-action@v12
with:
name: holochain-ci
name: holochain
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" # token exists in trustgraph org

- name: Restore cargo and build from cache
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -66,3 +75,9 @@ jobs:

- name: Check rust formatting
run: nix develop -c $SHELL -c "npm run cargo:fmt:check"

- name: Check for TypeScript errors in tests
run: nix develop -c $SHELL -c "npm run types"

- name: Build UI
run: nix develop -c $SHELL -c "cd ui && npm run build"
151 changes: 150 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ path = "dnas/mewsfeed/zomes/coordinator/agent_pins"
[workspace.dependencies.agent_pins_integrity]
path = "dnas/mewsfeed/zomes/integrity/agent_pins"

[workspace.dependencies.helpers]
path = "dnas/mewsfeed/helpers"

[workspace.dependencies.follows]
path = "dnas/mewsfeed/zomes/coordinator/follows"

Expand Down Expand Up @@ -52,3 +55,8 @@ path = "crates/hc_call_utils"

[workspace.dependencies.hc_link_pagination]
path = "crates/hc_link_pagination"
[workspace.dependencies.trust_atom]
path = "dnas/mewsfeed/zomes/coordinator/trust_atom"

[workspace.dependencies.trust_atom_integrity]
path = "dnas/mewsfeed/zomes/integrity/trust_atom"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ To test out the UI:
npm start
```

To run another agent, open another terminal, and execute again:
To run 2 agents:

```bash
npm start
npm run network 2
harlantwood marked this conversation as resolved.
Show resolved Hide resolved
```

Each new agent that you create this way will get assigned its own port and get connected to the other agents.
Expand Down
4 changes: 4 additions & 0 deletions crates/follows_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@ use hc_link_pagination::AgentPubKeyPagination;
use hdk::prelude::*;

#[derive(Serialize, Deserialize, SerializedBytes, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct AddCreatorForFollowerInput {
pub base_follower: AgentPubKey,
pub target_creator: AgentPubKey,
}

#[derive(Serialize, Deserialize, SerializedBytes, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GetCreatorsForFollowerInput {
pub follower: AgentPubKey,
pub page: Option<AgentPubKeyPagination>,
}

#[derive(Serialize, Deserialize, SerializedBytes, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GetFollowersForCreatorInput {
pub creator: AgentPubKey,
pub page: Option<AgentPubKeyPagination>,
}

#[derive(Serialize, Deserialize, SerializedBytes, Clone, Debug)]
#[serde(rename_all = "camelCase")]
pub struct RemoveCreatorForFollowerInput {
pub base_follower: AgentPubKey,
pub target_creator: AgentPubKey,
Expand Down
4 changes: 4 additions & 0 deletions crates/mews_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use hc_link_pagination::Timestamped;
use hdk::prelude::*;
use std::collections::BTreeMap;

pub const FOLLOW_TOPIC: &str = "__FOLLOW__";

#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone, PartialEq, Eq)]
pub enum LinkTarget {
Mention(AgentPubKey),
Expand Down Expand Up @@ -52,6 +54,8 @@ pub struct FeedMew {
pub author_profile: Option<Profile>,
pub is_pinned: bool,
pub original_mew: Option<EmbedMew>,
pub weight: Option<f32>, // introduced with TrustAtoms
pub topic: Option<String>, // introduced with TrustAtoms
}

#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone)]
Expand Down
8 changes: 8 additions & 0 deletions dnas/mewsfeed/workdir/dna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ integrity:
- name: agent_pins_integrity
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/agent_pins_integrity.wasm"
- name: trust_atom_integrity
bundled: ../../../target/wasm32-unknown-unknown/release/trust_atom_integrity_zome.wasm
hash: ~
dependencies: ~
coordinator:
zomes:
Expand Down Expand Up @@ -61,3 +64,8 @@ coordinator:
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/ping.wasm"
dependencies: ~
- name: trust_atom
hash: ~
bundled: ../../../target/wasm32-unknown-unknown/release/trust_atom_zome.wasm
dependencies:
- name: trust_atom_integrity
6 changes: 5 additions & 1 deletion dnas/mewsfeed/zomes/coordinator/follows/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ name = "follows"
hdk = { workspace = true }
holochain_integrity_types = { workspace = true }
serde = { workspace = true }
follows_integrity = { workspace = true }
follows_integrity = { workspace = true }
hc_link_pagination = { workspace = true }
follows_types = { workspace = true }
mews_types = { workspace = true }
hc_call_utils = { workspace = true }
trust_atom_types = {git = "https://github.com/trustgraph/trustgraph-holochain.git", package = "trust_atom_types"}
# trust_atom_types = { path= "/Users/knight/code/trustgraph/trustgraph-holochain/zomes/trust_atom_types"}
Loading
Loading