Commit Graph

493 Commits

Author SHA1 Message Date
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 335fcbca89
cob: Return correct clock value for multi-ops
We weren't accounting for batches ops in an entry.
This change should account for it by adding N-1
to the clock value of an entry, where N is the number
of entries.

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
Slack Coder c676d8b99a node: Set test peer's time on creation
Allow setting a test peer's local time to avoid slight race conditions in
tests.  The race condition's happen because peers created within a test may
unexpectedly have slightly different local times.

To support this, a struct is used as argument to peer::config(..).  The
linter 'cargo clippy' will complain if instead of using a struct, the local
time is passed as an additional parameter in config()'s function call.

Signed-off-by: Slack Coder <slackcoder@server.ky>
2022-12-09 13:14:41 -05: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
Dr Maxim Orlovsky 3ba7a02207
Use new cyphernet ECDH-related traits 2022-12-09 13:43:08 +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 46951b1b42
httpd: Use `HashSet` instead of `BTreeSet`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-09 10:49:28 +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
xphoniex fb8020e582
httpd: Conform response from issue handlers to previous model
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-09 10:49:09 +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 96d1ce5da6
crypto: Add ECDH trait and `MemorySigner` impl
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-08 13:21:00 +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
Dr Maxim Orlovsky 7c9ee0f911
node: Remove `RefClock`
It wasn't used anymore.
2022-12-07 16:06:35 +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 c33aa87589
Move CLI command tests to integration tests
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-06 10:01:41 +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 f6e8a18b15
crdt: Remove unused `Envelope` type
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 ff79347eb0
crdt: Implement `LWWMap` in terms of `GMap`
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00
Alexis Sellier bcef784ad4
crdt: Implement Grow-only Map (`GMap`)
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-02 14:21:50 +01:00