Commit Graph

556 Commits

Author SHA1 Message Date
Alexis Sellier 5f4fc8236e
A couple of docs and naming improvements
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-20 18:06:31 +02:00
Alexis Sellier 8b834a7b6e
Protect ourselves against naked refs
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-20 12:59:55 +02:00
Alexis Sellier 1906124497
Re-use `HEAD` reference if it exists
Since the `HEAD` reference is trusted (we set it locally), use that
when possible, instead of re-computing it.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-20 12:44:51 +02:00
Alexis Sellier 706fbc6550
Get the node running
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 22:39:24 +02:00
Alexis Sellier 961c18319f
Test canonical refs are set
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 15:35:35 +02:00
Alexis Sellier e6fd85f249
Implement `public_references` helper function
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 15:20:44 +02:00
Alexis Sellier 111480cd6e
Make use of `git2::Repository::refname_to_id`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 14:47:12 +02:00
Alexis Sellier 94f7675c72
Move `sign_refs` to `WriteRepository` trait
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 14:41:12 +02:00
Alexis Sellier 657a951df0
Create `url` module shared between crates
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 14:30:01 +02:00
Alexis Sellier 3bff9a9dc1
Set repository canonical refs
We set the `HEAD` and eg. `refs/heads/master` refs when updating
repositories, which allows users to easily clone with git.

For now, `HEAD` is chosen based on a unanimity quorum of delegates.
This can be made more sophisticated in the future.

We've also had to ignore some refs during verification, since these
have cropped in for eg. due to the staging copy clone and the
changes included here.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 10:27:24 +02:00
Alexis Sellier 240825387d
Implement correct `did:key` format
We weren't including the *multicodec* bytes previously.
This is now tested against some test vectors from the spec.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-17 16:37:06 +02:00
Alexis Sellier a2fc976ed6
remote-helper: Initialize
Implement a `git-remote-rad` helper for `rad://` remotes.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-17 16:23:16 +02:00
Fintan Halpenny a56d9008e6
radicle: depend on radicle-git published crates
The `git-ref-format`[0] and `radicle-git-ext`[1] crates are now
published to crates.io.

Switch the dependency to rely on them. This also required to update
the `git2` dependency to `0.15.0` as well as using the
`vendored-libgit2` feature -- avoiding the openssl dependency too.

[0]: https://crates.io/crates/git-ref-format
[1]: https://crates.io/crates/radicle-git-ext

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-10-14 13:16:11 +02:00
Alexis Sellier 07add86bb6
node: Handle node announcements
To build an address book, peers communicate via gossip, sending
`NodeAnnouncement` messages.

These need to be handled by storing the addresses in an address book
and the addresses need to be persisted to disk.

Node announcement messages should also be relayed to peers like other
gossip messages.
2022-10-14 11:58:17 +02:00
Alexis Sellier 0482f0ce04
ssh: remove unused traits, simplify code
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-13 22:33:36 +02:00
Slack Coder c294f2ab5c
ssh: support encoding/decoding armored signatures
Armored signatures are used by Git for signing commits. Support reading
writing these signatures by implementing a new trait to read and write
to the SSH formmat.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-10-13 21:15:19 +02:00
Fintan Halpenny 8d80359c38
radicle: remove verified field in Remote
The `V` parameter of `Remote` is already determined by the `refs`
field. The `verified: PhantomData<V>` field is not required.

Remove the `verified` field to simplify the `Remote` struct.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-10-12 13:29:15 +02:00
Fintan Halpenny df15b497ab
radicle: namespace peers
The previous iteration of the storage layout for projects organised
peer's subtrees by the `refs/remotes` category. This layout leads to
problems when linking a working copy to the storage project. The fetch
refspec would look something like:

  fetch = +refs/remotes/abc/heads/*:refs/remotes/rad/*

This works perfectly fine when running:

  git fetch rad

but will fail when one tries to specify:

  git fetch rad main

Instead, the command would need to be:

  git fetch remotes/abc/heads/main

This patch proposes to move the use of `refs/namespaces` for each
peer. The layout looks similar in that each peer has a subtree, but
instead it is under `refs/namespaces/<peer>/refs/...`.

The previous refspec would look more familiar in its new form:

  fetch = +refs/heads/*:refs/remotes/rad/*

With this in place running:

  git --namespace=abc rad main

Will work as expected and place the reference under
`refs/remotes/rad/main`. Similary, `git --namespace=abc push` will
work as expected.

Another benefit of this approach is that the use of namespacing means
that a tag is pushed it will be placed under the respective namespace
rather than in the global `refs/tags` category.

The actual implementation needed to work around the fact that
`git2`/`libgit2` does not have any options for fetching or pushing
using namespaces. The working copy code uses processes to shell out to
`git` for namespacing needs.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-10-12 12:30:05 +02:00
Alexis Sellier a104f9681c
Warn on `unwrap`, remove last remaining instances
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-11 09:31:54 +02:00
Alexis Sellier 5ccf9a388a
Handle errors in `rad::remote` properly
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-11 09:31:53 +02:00
Alexis Sellier 6ef74c6674
Don't nest options inside results
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-11 09:31:52 +02:00
Alexis Sellier fde0af09f7
Handle errors correctly in storage
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-11 09:31:48 +02:00
Alexis Sellier 832c6ad53f
Improve error handling in a few places
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-10 11:29:22 +02:00
Alexis Sellier b8c2ab5316
Switch to a lighter sqlite dependency
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-08 12:13:59 +02:00
Alexis Sellier e909e04c6c
Implement proper `node::Features` type
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-07 22:49:58 +02:00
Alexis Sellier 77ee404e83
Fix issue with dev mode on `radicle` crate
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-06 18:39:32 +02:00
Alexis Sellier 2d52a53ce5
Add variable bloom filter sizes
This should help small nodes waste less bandwidth, while standardizing
on set sizes.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-05 15:58:34 +02:00
Alexis Sellier 85ac8a1d4d
Implement routing table persistence
Uses SQLite for persistence.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-05 12:13:12 +02:00
Alexis Sellier efdc8c52c7
Add a `CommitObject::TryFrom<git2::Buf>` instance
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-03 21:33:04 +02:00
Alexis Sellier fece740fcb
Implement commit parsing/formatting
To be able to support git commits with multiple signature
headers, we have to implement our own parsing and formatting.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-03 21:17:52 +02:00
Alexis Sellier 5b673c7440
Add `rad-clone` initial sketch
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-03 11:50:43 +02:00
Alexis Sellier c8bff35229
Improve ssh crate API
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-03 11:13:53 +02:00
Alexis Sellier 79c1372d33
Simplify ssh formatting code
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-03 10:48:22 +02:00
Alexis Sellier 2acd999c16
Add SSH functionality with new `radicle-ssh`
We borrow code from `thrussh`, refactored to be runtime-less.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-03 10:34:59 +02:00
Slack Coder f9ad3ac155 git: Use RefString types for git::refs
Lean on rust's type system to improve safety.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-09-28 16:11:03 -05:00
Alexis Sellier 48a5c75ae3
Revise git transport to use I/O more directly
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-28 15:41:11 +02:00
Alexis Sellier f85a0426d7
Only support `rad://` in the custom proto
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-28 13:45:03 +02:00
Alexis Sellier 1da38708fc
Flesh out custom git transport
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-28 13:36:57 +02:00
Alexis Sellier b4dcc00fe3
Custom git protocol sketch
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-27 18:14:57 +02:00
Alexis Sellier 85f9a1afc2
Fully verify fetches
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-27 14:30:03 +02:00
Alexis Sellier 27e39c0df5
Make `Id` a `Copy` 2022-09-27 14:13:20 +02:00
Alexis Sellier a20d16fc31
tools: Announce refs on push
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-26 16:16:32 +02:00
Alexis Sellier c991c0eea0
Improve some project path code 2022-09-26 15:34:03 +02:00
Alexis Sellier ca2f766d19
Add `Profile::connect`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-26 14:27:56 +02:00
Alexis Sellier 116eaa79e6
Use `Profile` in client
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-23 20:21:21 +02:00
Alexis Sellier 51e18c27fc
Add `rad-push`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-23 20:10:52 +02:00
Alexis Sellier a3bf5ab7c3
Initialize `radicle-tools` crate
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-23 17:33:31 +02:00
Alexis Sellier fcb1007f9d
Refactor service
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-23 15:43:55 +02:00
Alexis Sellier 7169881849
Remove peer timestamp
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-22 18:17:51 +02:00
Alexis Sellier 51f2d4e3fc
Move identity types to project
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-22 16:31:58 +02:00
Alexis Sellier 00ed8793af
Rename a few more things for clarity
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-22 16:15:59 +02:00
Alexis Sellier 62408234cf
Rename `doc` module to `project`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-22 16:02:42 +02:00
Alexis Sellier e382bc4eb9
Remove `Project` type
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-22 15:59:20 +02:00
Alexis Sellier c2b599f068
Implement node handle to control node
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-22 12:36:12 +02:00
Alexis Sellier f5bfb8d90a
radicle: Implement canonical fork
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-21 16:08:04 +02:00
Alexis Sellier 46501507be
Split repository into two creates
* `radicle`: core library
* `radicle-node`: node

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-09-21 15:11:17 +02:00