Commit Graph

635 Commits

Author SHA1 Message Date
Sebastian Martinez 97a2f8c1df
httpd: Add issue and patch counts
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-27 12:57:20 +01:00
Fintan Halpenny 5ea8505000
radicle: custom CanonicalFormatter
The olpc-json crate's CanonicalFormatter does not escape certain
control characters, including new lines. This means that when a COB
gets serialized that includes new lines, those new lines are
serialized verbatim. Upon deserialization `serde_json` -- and any
other JSON deserializer -- will fail due to the encounter of these
control characters.

This behaviour was prevented in radicle-link with the definition of
its own CanoncialFormatter that encodes the control characters
correctly.

Inline this definition of the formatter, under MIT license, to ensure
the correct and remove oplc-cjson.

The behaviour is checked using a multiline test in the issue COB.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-24 11:59:36 +01:00
Fintan Halpenny ef0628c48e
Exchange From for TryFrom for PathBuf and Home
The `From` implementation would allow someone to create a `Home` in an
incorrect fashion, for example the path is not canonical.

Exchange `From` for a `TryFrom` implementation.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-17 10:37:39 +01:00
Sebastian Martinez b04451a1bd
Use `Did` in a bunch more places
Instead of showing just public keys we need to show the fully qualified
spec for a NID which is prefixed by `did🔑` While we want to maintain
`Author` and `ActorId` for internal use.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-16 18:01:42 +01:00
Fintan Halpenny 5477a3615f
radicle-cli: use Did across CLI
The CLI commands and output use PublicKey, ActorId, and NodeId for
peer identifiers.

Instead Did should be standardised for use in CLI arguments and
outputs.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-16 17:07:14 +01:00
Fintan Halpenny efe5ff6ddd
radicle: Did improvements
Add conversion from Did to PublicKey through a From implementation.

Add FromStr implementation.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-16 17:07:14 +01:00
Fintan Halpenny 8e26e4c046
radicle: canonicalize home path
If a path was passed to `Home` in non-canonical form it would not use
the right path for any initialisation or use.

The aim is to use the `canonicalize` function for paths. However, this
may return an error if none of the paths exist. To ensure that the
path exists the `new` constructor for `Home` creates the directory and
canonicalizes the path.

Since `new` now initialises the home directory, it would be useful if
it also initialised all the necessary subdirectories -- which removes
the need for the `init` method.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-16 16:35:59 +01:00
Alexis Sellier 950fae209d
Make `ReadStorage` more usable
Previously, we were not able to access a `ReadRepository` instance
through `ReadStorage`. With this change, we are able to.
2023-02-15 22:08:20 +01:00
Alexis Sellier 8cbc3c2403
node: Move to NoiseXK
Move from NoiseNN with a custom authentication protocol, to NoiseXK.
Uses ECDH on the ed25519 curve via the `ec25519` library.
2023-02-15 22:05:04 +01:00
Fintan Halpenny 88fc4f1782
radicle: ensure stable commits for Docs
`Doc::commit` used `git2::Signature::now` when committing the document
to the repository. This results in the commits always changing and not
allowing us to test outputs of our CLI commands that would wish to
output the SHA.

Make `Doc::commit` reproducible in debug mode using `debug_assertions`
and checking the `RAD_COMMIT_TIME` environment variable.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 18:02:20 +01:00
Fintan Halpenny 9535467ff5
radicle: identity proposal cob
In order to make identity changes where the threshold is higher than
1, it is necessary to gather signatures of delegates to surpass that
threshold.

To achieve this the Proposal cob is introduced for proposing changes
and gathering the signatures over those changes.

Once a quorum is reached the Proposal can be published, committing the
new identity document to storage.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 13:50:51 +00:00
Sebastian Martinez 881e9af219
httpd: Add `assignees` to `Issues::create`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-13 13:47:15 +01:00
Fintan Halpenny 540c56cac6
radicle: sign blob hash instead of content
The signatures for Radicle identities were using the documents
content.

It is standard to use the hash of the content instead, since signing
and verification is faster on a smaller set of data.

Use the resulting Git blob's object id, i.e. `git hash-object`, as the
signing and verifying payload.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-13 13:30:44 +01:00
Alexis Sellier b461950d59
Add `ReadStorage::contains` method 2023-02-12 21:04:55 +01:00
Alexis Sellier 7087288cfb
node: Implement inventory sync command 2023-02-12 20:57:33 +01:00
xphoniex bdc0ab9881
Update `radicle-git` and `radicle-surf`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-10 22:14:50 +01:00
Sebastian Martinez a57b33c785
httpd: Add `api::test::patch` request method
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-10 12:17:03 +01:00
Slack Coder ed9900b5ac
cli: Support patch commenting
Allow commenting on a patch as well an issue.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-07 11:16:59 +01:00
Alexis Sellier c861244ab8
Fix bug with `announce-refs` result 2023-02-07 10:46:12 +01:00
Alexis Sellier 037ff39894
node: Use JSON for control commands 2023-02-07 10:46:12 +01:00
Alexis Sellier 45e31a5192
Communicate fetch results through control socket
This allows a CLI to report to the user what fetch requests were
fulfilled, and which ones failed.
2023-02-07 10:46:12 +01:00
Sebastian Martinez af3ea6a11a
httpd: Add issue endpoints
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-06 14:14:06 +01:00
Fintan Halpenny 3f48c2c516
Rust 1.67
Rust 1.67 was announced[0]. Update the necessary files for running
1.67 and fix the clippy suggestions for string interpolation.

[0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-04 19:30:29 +01:00
xphoniex 4552c1f296
httpd: Add routes for patch ops
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-04 13:22:09 +00:00
Alexis Sellier 88ffc02c5e
Use string format for `OpId` JSON 2023-02-04 12:37:58 +01:00
Slack Coder 1cb8986830
Add Op ID string formatting
To help users, create an Op ID string format of the form `<actor-id>/<lamport>`.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-02-04 12:29:50 +01:00
Alexis Sellier 98f7fe1db8
node: Rename `GIT_RESET` env var 2023-01-30 18:23:24 +01:00
Alexis Sellier 050b3acb2e
Improve storage documentation 2023-01-30 14:28:41 +01:00
Alexis Sellier 498a5c4e4a
node: Handle `fetched` differently if initiated 2023-01-30 13:22:33 +01:00
Alexis Sellier 99bd62d276
Improve error message for identity error 2023-01-30 12:38:59 +01:00
Alexis Sellier 0726c553da
node: Run git fetch without any user config 2023-01-30 12:35:08 +01:00
Alexis Sellier 258d2d35e4
Move function to trait 2023-01-30 12:27:32 +01:00
Alexis Sellier a0910f7593
Cleanup old `fetch` code
We only use the old code in the simulator now.
2023-01-30 12:26:29 +01:00
Alexis Sellier 507a41d22f
Improve `ReadRepository` trait 2023-01-30 11:45:55 +01:00
Alexis Sellier f1a6a86689
node: Check refs when getting local inventory
If we don't do this, we're going to be returning broken repos.
2023-01-30 11:38:00 +01:00
Alexis Sellier b92dc59204
node: Turn off `--atomic` when not supported 2023-01-29 18:22:41 +01:00
Alexis Sellier aac0059064
Remove redundant `commit` module
This code was replaced with an external dependency.
2023-01-29 17:50:31 +01:00
Alexis Sellier d9e1055067
Improve logging 2023-01-28 23:58:16 +01:00
Alexis Sellier 5e955d39d0
cob: Add 'description' to `Revision`
Simplifies the code a little.
2023-01-26 17:37:58 +01:00
Alexis Sellier bb3787258a
cob: Refactor `Thread` methods 2023-01-26 16:20:22 +01:00
Alexis Sellier 30e9d6103c
Cleanup `clone` code
Remove a bunch of different instances of it.
2023-01-25 17:51:49 +01:00
Alexis Sellier fdad6358fc
cli: Correctly setup remote tracking branch
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-25 17:51:49 +01:00
Alexis Sellier b1012014fe
Remove old `Profile::paths` function 2023-01-25 15:35:24 +01:00
Alexis Sellier 963ad3c3d7
Get `rad clone` working correctly 2023-01-25 11:35:20 +01:00
Alexis Sellier fea14ff7b3
Update `clone` functionality for new replication 2023-01-25 10:21:57 +01:00
Alexis Sellier ef950d515a
node: Fully integrate worker fetch into service 2023-01-25 10:21:57 +01:00
Alexis Sellier bb135b64b3
cli: Get `rad-checkout` working properly 2023-01-24 14:54:56 +01:00
Alexis Sellier 1f06f5340f
Make `Id` to string conversion more explicit
Two types of conversion: `canonical`, which is just the base58 encoding,
and `urn` which is like canonical, but includes `rad:`.
2023-01-24 13:49:03 +01:00
Alexis Sellier 3aff91f9b7
Correctly initialize home in `Profile::init` 2023-01-22 13:39:48 +01:00
Alexis Sellier 97d4729fa4
Switch to crates.io for `cyphernet` 2023-01-17 11:01:36 +01:00
Alexis Sellier be9def8b11
Rename `profile::Paths` to `profile::Home`
This makes the intent clearer.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-17 11:01:36 +01:00
Alexis Sellier d31968509d
Speed up node E2E tests
By allowing the node to run using a `MockSigner`, we speed up tests
significantly, since PBKDF2 doesn't need to run.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-17 11:01:36 +01:00
Alexis Sellier 72cb2fd713
Remove unused dependencies
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-17 11:01:36 +01:00
Alexis Sellier 63e7248847
node: Complete Noise handshake integration
Co-authored-by: Dr. Maxim Orlovsky <dr.orlovsky@gmail.com>
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-17 11:01:36 +01:00
Alexis Sellier 438ae84304
node: Implement E2E node test
There are few unrelated changes in this commit that I wasn't able to
split out, mostly due to laziness, so I'll list them here:

* The node startup logic is moved out of the main function, and into a
  dedicated functionin `client.rs`.
* There is a tentative worker implementation that is untested, and
  handles git replication both ways. It's likely lacking in various ways
  but I wanted to get it in there anyway.
* `Address` was moved from `radicle-node` to `radicle`, because it's
  needed to send `Connect` commands from the node handle.
* The `netservices` dependency was updated.
* Finally, there is a first end-to-end node test, which currently
  doesn't use NoiseXK, but uses the new reactor in `netservices`.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-12 20:34:31 +01:00
Alexis Sellier 66f0f87933
Small change to storage log output
Previously it would show eg. `RefString(...)`.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-10 21:18:47 +01:00
Slack Coder 1eb2a5ab9d
radicle: Use 'RAD_PASSPHRASE' unmodified
Keep the passphrase as is by removing 'trim_end()'.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-09 16:45:51 +01:00
Slack Coder 03bc9d84d6
rad-remote-helper: honor RAD_PASSPHRASE
Make testing more convenient by reducing rad-remote-helper's dependency
on SSH Agent.  It may be opted out of by setting the `RAD_PASSPHRASE`
environment variable.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2023-01-09 16:44:35 +01:00
Dr. Maxim Orlovsky a7b1c19746
node: Implement worker thread handover
Also implements listener behavior.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2023-01-05 15:16:38 +01:00
Alexis Sellier 67f9c3554d
cob: Start testing history permutations
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 14:26:25 +01:00
Alexis Sellier 139f095d51
cob: Consolidate `from_history` impls
By implementing `FromHistory::apply`, COBs don't need to implement
`from_history`.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 14:25:47 +01:00
Alexis Sellier 2f42bc942c
cob: Make it easy to build histories
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-03 14:23:47 +01:00
Alexis Sellier 5ee1f42b6a
cob: Have clock value for empty COB state
By using `0` as the clock value for an empty state (without operations),
we simplify transaction code. Previously, there was no clock value for
empty states, which meant that we had to sometimes use an `Option`.
2023-01-01 18:29:47 +01:00
Alexis Sellier c568feb700
cob: Merge issue tags
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-31 09:58:51 +01:00
Alexis Sellier 911c194fb3
cob: Create proper `OpId` type
To still access a comment's author, we add a new `author` field.
2022-12-31 09:58:51 +01:00
Alexis Sellier 49cd26c0b3
Tidy up COBs code a little
* Move storage impl into `storage::git::cob`
* Rename `change::Create` to `change::Template`
* Rename `change::Storage::create` to `change::Storage::store`

Some of the renames are to further distinguish COBs from Changes, and
the different types of "create" operations within cobs.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-31 09:58:45 +01:00
Alexis Sellier bf22cea014
cob: Fix typos
Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-30 12:59:11 +01:00
Alexis Sellier f193d7d6cc
Improvements to keystore
* Use the correct passphrase type everywhere
* Allow conversion of secret key
* Extract logic for storing a key in keystore

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2022-12-27 13:43:16 +01:00
Fintan Halpenny aa05f676f7
cli: add delegate cli
Adds a `rad delegate` CLI command.

The command consists of three subcommands:
* `add` -- add a new delegate to the set of delegates of a project
* `remove` -- remove an existing delegate from the set of delegates of a
  project
* `list` -- list the delegates of a project

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:25:24 +01:00
Fintan Halpenny d7170ff9e7
radicle: ensure unique signatures when parsing trailers
To ensure that signatures are unique for verifying an identity a
HashMap is used in place of a Vec of tuples.

This prevents any double counting for quorum checks.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:23:39 +01:00
Fintan Halpenny adaed6a3ac
radicle: validated construction of Project
The `validate` method of `Project` was unused, which is problematic if
the attributes are supposed to be validated based on some
constraints. The issue is that `Project` provided public construction
of its fields with enforcing validation.

This change makes `Project`'s attributes private and introduces a
smart constructor `new` which is fallible if any of the constraints
are not met. The error type was changed to be a vector of errors since
all of these errors can be collected for better error reporting.

Deserialization also provided a way of constructing a `Project`
without ensuring any of the constraints were checked. To prevent this
a hand-rolled `Deserialize` is provided that goes through
`Project::new`.

To access the fields of `Project`, accessor functions are added and
all call sites are updated to use them.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-27 12:23:39 +01:00
Slack Coder 946d6ac675
cli: assign and unassign issues
Allow assigning an issue to one or more people via a new subcommand.

    rad assign <issue> <peer>

To unassign:

    rad unassign <issue> <peer>

To support testing and documentation, create an example for maintaining
issues for a project.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-26 15:38:39 +01:00
Alexis Sellier 4307478718
Test comment editing
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-16 12:32:28 +01:00
Alexis Sellier f1217713af
Add edits to thread test generator
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-16 12:32:23 +01:00
Alexis Sellier e47d7ca2aa
cob: Implement comment edit action
This implementation intentionally preserves all edits such that
they may be displayed in an application as an edit history.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-16 12:32:20 +01:00
Alexis Sellier c68a5a8857
Move `thread` COB to test module
Threads are only intended to be used as part of other COBs.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-16 12:26:16 +01:00
Alexis Sellier f26674a5a9
Upgrade Rust to 1.66
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-15 20:55:26 +01:00
Alexis Sellier b32ae984ce
Start adding support for replies in COBs
This makes a change to comments, such that all comments require a
parent, except the "root" comment, which is created with the COB.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-15 14:43:40 +01:00
Dr Maxim Orlovsky aa02c52a2f
node: Integrate new Noise_XK transport
This is a large change that introduces transport encryption via
a Noise_XK handshake. The inner `Service` now works directly
with `NodeId` and doesn't need to interact with socket addresses.

The transport logic takes place in `wire::transport`, and the
established sessions are passed down to `Service`.

Note that the i/o implementation in the `poll-reactor` crate still
needs testing, and there is still work to be done to integrate the
Git transport as part of this architecture.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-13 14:59:06 +01:00
Alexis Sellier 909b99bb7c
Refactor using `NonEmpty::try_map`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-13 10:16:18 +01:00
Alexis Sellier f90f714fcf
Rename issue action to match patch
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-13 10:16:18 +01:00
Alexis Sellier 24f1de980e
Remove redundant `apply_one` function
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-13 10:16:18 +01:00
Alexis Sellier 0b3a32627b
Use transactions for issue COB
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-13 10:16:18 +01:00
Alexis Sellier 90f20f447a
Make `Transaction` generic, move to `store`
This allows us to use the transaction logic for any COB.
2022-12-13 10:16:18 +01:00
Alexis Sellier 036442af87
Use operation bundle for patch creation
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-13 10:16:18 +01:00
Alexis Sellier e5e1ba583f
Bundle patch CRDT operations
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-13 10:16:18 +01:00
Alexis Sellier bdbf111163
Refactor identity verification
Introduces a new `DocAt` type.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-12 15:01:47 +01:00
Alexis Sellier edafe055b4
Verify identity root commit signatures
In RIP-2, we specify that identity document root commits must include
the signature of all founding delegates.

This commit adds the required signatures during document creation
and verifies them on load.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-12 15:01:42 +01:00
Alexis Sellier c183f80a22
Cleanup some of the git error variants
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 22:06:21 +01:00
Alexis Sellier d309f593b1
Move doc initialization to storage
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 22:06:21 +01:00
Alexis Sellier b37fef9f22
Re-organize identity types and modules
The new hierarchy should be much more correct, and cleaner:

* `identity` (`Identity`)
* `identity::did` (`Did`)
* `identity::doc` (`Doc`, `Payload`)
  * `identity::doc::id` (`Id`)
* `identity::project` (`Project`)

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 22:06:20 +01:00
Alexis Sellier 8735719ecc
radicle: Remove unused error variants
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 22:05:42 +01:00
Alexis Sellier 98c1566109
Make `Doc` type payload generic 2022-12-09 22:05:38 +01:00
Slack Coder e7f2637126
node: Limit number of Refs in RefAnnouncements
Use the BoundedVec to limit the supported number of refs in
RefAnnouncement messages.  The size (235) is the maximum supported by
message wire size.

To reduce the complexity of the changes, BoundedVec is used again
instead of using a new bounded Refs or BTreeMap.  This requires
defining new Decode/Encode logic for Ref's element types, and
workarounds for arbitrary instances.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-09 21:54:10 +01:00
Alexis Sellier b7c1f091fa
Fix issue with colliding doc files
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 14:37:36 +01:00
Alexis Sellier 7b8bb08b08
Consolidate `node::Handle` traits into one
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 10:52:18 +01:00
Alexis Sellier a100f1c683
cli: Implement tracking correctly
The tracking command was tracking a project when it should
have been tracking peers.

We also add the ability to pass an alias when tracking from
the CLI.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 10:52:18 +01:00
xphoniex d4d40b1492
radicle: Remove redundant map in issue cob
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-09 10:49:28 +01:00
Alexis Sellier 5d2be57cd9
Rename patch/issue "status"
This reverts to the previous naming, since after serialization
we would otherwise end up with `{ status: { status: closed } }`.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 10:44:59 +01:00
Alexis Sellier de0e54a186
cob: Consistently name these 'ops'
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-08 16:37:44 +01:00
Alexis Sellier 56f9af650e
crdt: Remove some `Semilattice` instances
These instances were not safe to have around, as they allow
removal of items in a non-commutative way.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-08 16:37:44 +01:00
Alexis Sellier 06d658dba4
Remove `tag.rs` file that wasn't used
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-08 16:37:44 +01:00
Alexis Sellier 66d76d7ab2
radicle: Use `defaultBranch` for payload key
This was changed by mistake from the previous format used in radicle
link. We restore all keys to camel-case.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-07 18:01:47 +01:00
Fintan Halpenny 5f80ee9671
cobs: allow for batched operations
Sometimes it is more efficient to perform multiple operations at once
and store those in the collaborative object graph together.

Change the contents to be a non-empty sequence of byte sequences,
i.e. NonEmpty<Vec<u8>>. These are stored as blobs in a git tree in
order by their index in the non-empty sequence. They are, in turn,
retrieved in order of their original index.

Change the conversion of an `EntryWithClock` to return a non-empty
sequence of `Op`s, which are in turn used to apply many changes in
each `from_history` implementation.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-07 17:11:40 +01:00
Alexis Sellier 1007756238
node: Add tracking configuration store
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-07 15:41:56 +01:00
Alexis Sellier db3568db2f
Update `sqlite` dependency to 0.30.3
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-07 15:41:56 +01:00
Alexis Sellier 207d2133f9
Remove delegate names from identity doc
We are working on other mechanisms to help identify keys, and this
is just redundant.

Also update some of the CLI examples to create a canonical example
for documentation.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-07 12:16:00 +01:00
Alexis Sellier e63f334890
cli: Replace `trycmd` with our own test runner
This will allow us to run commands other than `rad`
and to have tests that switch between different users.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-06 10:01:38 +01:00
Alexis Sellier ca69fdc4fa
cob: Make json serialization consistent
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-05 18:06:45 +01:00
Alexis Sellier f9c81ab382
Replace `quickcheck` with `qcheck`
The latter is a fork of the former, which adds const generics
and a bunch of other quality of life improvements that aren't
in the original crate due to it being unmaintained.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-04 20:40:54 +01:00
Alexis Sellier cc24699232
cob: Rename `Change` to `Op`
Helps with the confusion with `radicle_cob::Change` and matches the
name for this object in common literature.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier fa3c155865
cob: Unify change decoding
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier 4e0efa4690
cob: Return error on wrong history type
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier 81a1ee5cc2
cob: Implement `Store::remove`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier 6c0c7b2969
cob: Delete redundant functions
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier e8a2432f9d
Move `Change` from `radicle-crdt` to `radicle`
Where it belongs.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier d6467fe4f1
patch: Use `GMap` to simplify code
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier eb92ac9036
patch: Fix bug where revisions can be replaced
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier ce11d69f23
cob: Move tags out of `Thread`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier 64ce15dbe2
crdt: Include timestamp in `Change`
We can then use the real change timestamp for our COBs.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:19:25 +01:00
Alexis Sellier 3a2584b544
Add `rad:` prefix to project ids
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:06:39 +01:00
Alexis Sellier 15f183ac7d
patch: Implement redacted revisions
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier b3faba715b
patch: Correctly merge review edits
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier 919e36ab1f
crdt: Rely on causal ordering of events
Since the underlying DAG guarantees causal event delivery,
we can rely on this to simplify the code.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier 3af2c53bb2
cob: Implement COB removal function
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier dd7052926a
cob: Remove `author` from `Entry`
It was no longer used.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier 5a47023ac0
cob: Change history type to a string
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier 0dc34dc15d
Implement patches with radicle CRDTs
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier b82e1864b5
cob: Update issues and threads
Updates these COBs to work with the implicit DAG clock.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier b015b29f34
cob: Add timestamp to comment state
Since the timestamp is to be retrieved from the commit,
we don't add it to the action.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier 63614e9c94
cob: Make sure we generate all thread variants
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier be789a487f
Move `hash` module to `radicle-crypto`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
Alexis Sellier 09a8b46f34
cob: Move clock out of `Issue`
The clock shouldn't be part of the issue state, but rather
the local "actor" state.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
xphoniex b4902d3408
Migrate `/projects`: `remotes`, `remote`, `blob`, `readme` handlers
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex dea7082a6f
Migrate `/projects`: `root`, `project`, `commit`, `activity` handlers
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
Alexis Sellier a79c95283b
Minor doc and instance changes
Signed-off-by: Alexis Sellier<alexis@radicle.xyz>
2022-11-26 17:51:07 +01:00
Alexis Sellier fee0296910
Rename `LClock` to `Lamport`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-26 17:48:50 +01:00
Alexis Sellier b79e2f5b56
crdt: Remove redundant `Author` type
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-26 17:44:18 +01:00
Alexis Sellier 171b5a45f7
Implement issues using radicle CRDTs
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-26 17:41:37 +01:00
Alexis Sellier cc33d04a7b
crdt: Require `LWWReg` value to be `Semilattice`
* Also derive instances of `Semilattice` for built-in types.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-26 17:13:22 +01:00
Alexis Sellier cc64c1d80b
cob: Use semilattice rules for commenting
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-26 17:13:22 +01:00
Alexis Sellier fa9a89caa3
Start integrating new CRDTs into `radicle` crate
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-26 17:13:22 +01:00
Alexis Sellier 01ad0fb31d
cob: Split generic code from automerge-specific 2022-11-26 17:13:18 +01:00
Alexis Sellier 5526eceea0
cob: Add new history type, simplify `Content`
Keep the history type in the manifest, but no need to specify it
for all individual changes.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-24 13:41:24 +01:00
Alexis Sellier 35f061746c
Add `radicle-crdt` crate
Explorations with CRDTs.
2022-11-23 19:52:18 +01:00
Alexis Sellier 308112618f
Get around circular-dependency
This was causing an issue in rust-analyzer, and probably would fail
in other ways via cargo. In any case it wasn't a good idea.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-22 13:41:32 +01:00
Alexis Sellier 093bb686a4
Fix dependency issue with "test" feature
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-22 10:44:30 +01:00
Alexis Sellier fd936becf1
Make `Profile::init` more flexible
Allow passing a custom home.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-22 10:44:30 +01:00
Dr Maxim Orlovsky 3ec460056d
Add cyphernet dependency 2022-11-22 10:34:49 +01:00
Dr Maxim Orlovsky 2a6f3c4f55
Update ed25519-compact dependency 2022-11-21 16:07:43 +01:00
Fintan Halpenny a985e067a5
Add TypeName & ObjectId parser
Added the `parse_refname` function for parsing a reference into its
`TypeName` and `ObjectId`, if possible.

This replaces the `cob_suffix` function in `radicle`.

This change also fixes the `FromStr` instance of `ObjectId` to use
`from_str` instead of `TryFrom` for bytes.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-17 17:42:21 +00:00
xphoniex 89bdf59e8e
Add `rad-issue` command
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-16 16:28:31 +01:00
Alexis Sellier 47d20003c0
Implement `rad-patch`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-16 12:07:19 +01:00
Alexis Sellier dea268c389
Implement `rad-push`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-16 11:36:23 +01:00
Alexis Sellier 12988da089
Add `Patch`, `Issue`, `Label` COBs
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-14 12:40:00 +01:00
Alexis Sellier 08811b4b87
Various fixes to COBs
* Use the existing conventions for passing a signer to functions.
* Allow replacing git refs when updating cobs.
* Fix the parsing of a cob id.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-14 12:40:00 +01:00
xphoniex 80401f89ae
Add `rad-inspect` command
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-14 12:23:24 +01:00
xphoniex 1d51afad28
Add `rad-track`, `rad-untrack` commands
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-09 15:37:37 +01:00
Alexis Sellier f05a040be6
Make `track` functions return correctly
Previously we always returned `true`. Now we return
what the node actually returns.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-09 13:29:54 +01:00
Fintan Halpenny cb2d83daae
radicle: wire up radicle-cob
To wire up radicle-cob, it is necessary to implement the traits for
the following types:
* `Repository`: `change::Storage`, `object::Storage`, and `Store`
* `project::Identity`: `identity::Identity`

For `Repository`, the `change::Storage` implementation is trivial, as
it uses the underlying `git2::Repository` implementation. Then
`object::Storage` simply defines the required references names and
does lookups or updates.

The aforementioned reference naming scheme is:

  refs/namespaces/<ns>/refs/cobs/<typename>/<object_id>

For `project::Identity`, the `identity::Identity` implementation is
straight-forward.

To finalise the work, a simplified API is exposed as `radicle::cob`
where the `create`, `update`, `get`, and `list` functions are
redefined in terms of `radicle` specific types.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-08 18:13:54 +00:00
Alexis Sellier 609d05fff2
Update `sqlite` dependency
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-08 09:39:23 +01:00
Alexis Sellier 8fe949b2a0
Implement `rad-checkout` command
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-07 22:04:47 +01:00
Alexis Sellier 32cd94dd23
Add `rad-init` command
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-07 22:01:49 +01:00
Alexis Sellier 223d36086e
Add `radicle-cli` crate's `terminal` module
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
Co-authored-by: xphoniex <dj.2dixx@gmail.com>
2022-11-07 14:48:01 +01:00
xphoniex 357fc79b41
Implement `paths` for `Profile`
Signed-off-by: xphoniex <xphoniex@users.noreply.github.com>
2022-11-06 12:42:47 +01:00
xphoniex 5847ad2ff1
Add `Clone` instance to `Profile`
Signed-off-by: xphoniex <xphoniex@users.noreply.github.com>
2022-11-06 12:42:30 +01:00
Alexis Sellier 45c7f3049b
Update to Rust 1.65
* Use new let-else syntax
* Fix new clippy lints

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-05 12:47:26 +01:00
Alexis Sellier 41f53f3fae
Small improvements to signer/agent
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-03 13:29:20 +01:00
Alexis Sellier 092ccfdcbc
Add `profile::env` module
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-03 13:06:08 +01:00
Alexis Sellier 577b632056
Use `Signer::try_sign` in interactive contexts
In interactive (user) contexts, use `try_sign` instead of `sign`.

We also revisit the `Profile` by adding a `signer` method that can
fail, eg. if we couldn't connect to ssh-agent.

Finally, we replace `UnsafeSigner` with `MemorySigner`, which makes
use of `ssh::Keystore`.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-03 13:06:00 +01:00
Alexis Sellier a79ef67b2a
Add `Signer::try_sign` method and cleanup usage
To support ssh-agent, add a signing method that can fail.
Also cleanup usage so that we always accept signer references.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-03 10:12:22 +01:00
Alexis Sellier 16b22d9178
Move `radicle/id` and `radicle/signature`
We move the identity branch out of `heads/` and to the old location:

  refs/rad/id

We move the signed refs branch to:

  refs/rad/sigrefs

Keeping both "special" branches under the same hierarchy makes things a
bit easier to work with, and tells the user that they should be updated
with special tooling.

We also revert to `rad/` because we no longer have the issue of having
`rad/rad/id` when doing a checkout of the remote branch in a working
copy.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-11-01 15:56:06 +01:00
Alexis Sellier 6f3a598cc1
Remove `git-url` dependency
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-31 18:14:54 +01:00
Slack Coder c11f5b13bf rad-auth: create profile when not found
Be careful about when to attempt creating a profile.  Errors could
trigger creating a profile even when unrelated to it not existing.

Profile::load(..) is altered to distinguish between these cases.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-10-28 09:38:12 -05:00
Fintan Halpenny c0b0d29e19
radicle-crypto: split out from radicle
The crypto types are useful to use in other components that are
separate from the radicle crate, e.g. the incoming radicle-cobs
crate.

Separate out the types into a radicle-crypto crate. This crate defines
the usual PublicKey, SecretKey, and Signature types. It also provides
the ssh functionality, under the `ssh` feature. It is also necessary
to provide the `From` impl for `Component` here, which again is
guarded by the `git-ref-format` feature.

The `Arbitrary` implementation are moved. The arbitrary decision of
redefining `ByteArray` in both radicle-crypto and radicle was made.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-10-27 20:40:39 +01:00
Alexis Sellier 2a1154ef87
Re-work git transports
The changes in this commit are all intertwined and it was hard to
split them into smaller commits:

* Use custom transports everywhere

Instead of `file://` and instead of using a child process for fetching
and pushing; we go through our custom transports, which use the `rad://`
and `heartwood://` schemes.

* Introduce a 'mock' remote transport

To test the remote transport without needing to spawn TCP streams,
we add a mock transport that works between storages on the file
system.

* Get rid of node's `git-url`

Instead of git urls, nodes simply use their node-ids to replicate.
2022-10-26 21:40:19 +02:00
Alexis Sellier 3407c6c017
Add `ToString` support for transport URLs
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-24 21:57:53 +02:00
Alexis Sellier 66493422c2
Add 'local' and 'remote' URL formats
To distinguish between working-copy-to-storage (local) and
storage-to-storage (remote) replication, we create two new
URL types: a `remote::Url` (`heartwood://`) and a `local::Url`
(`rad://`).

These schemes are to be used for the remote and local transports,
respectively.

The difference between the two schemes is that remote replication
requires a node id.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-24 20:19:45 +02:00
Slack Coder 7c65f08cd1
radicle: fix typo
Correct radicle::node::Error::Connect's string.
2022-10-21 22:13:40 +02:00
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