Commit Graph
100 Commits
Author SHA1 Message Date
cloudhead 87f6956e49 build: Fixes to release script 2024-12-16 11:08:27 +01:00
cloudhead d274b28ae0 scripts: Small fix to contributor count 2024-12-05 14:25:28 +01:00
cloudhead 7ed72ec918 cli: Fix some clippy lints 2024-12-04 12:46:47 +01:00
cloudhead 8e2fe6449e scripts: Improve changelog script
* Add number of commits and contributors
* Default to the latest version tag as the "current"
2024-12-04 12:40:10 +01:00
cloudhead 5fe3d5a7ab cli: Handle broken pipe in cob show
When piping the output in for eg. `head -n 1`, the `head` utility
might close down the pipe at some point, yielding a broken pipe error.
We catch that and simply return if that's the case.
2024-12-03 12:36:57 +01:00
cloudhead 289e59bbfa term: Bump version to 0.12.0 2024-12-02 13:03:25 +01:00
cloudhead fd892d006f Update radicle to 0.14 2024-11-29 15:25:09 +01:00
cloudhead 70f0cc354d cob: Fix serde instances for ObjectId
The type now serializes the same as `Oid`.
2024-11-28 15:19:56 +01:00
cloudhead bcba8f5a21 scripts: Add --from-version to changelog script
This allows generating changelogs from eg. version 1.1 to 1.2 combining
any pre-releases.
2024-11-27 17:25:02 +01:00
cloudhead 47b200988c cli: Fix rad cob migrate test 2024-11-27 10:19:51 +01:00
cloudhead 3ad84420bd cli: Implement rad cob migrate
Adds the new `migrate` sub-command to migrate the COB database.
Checks for version when opening the COBs database and suggests the
command on out of date version.

Also adds the 2nd migration to the COBs cache, which updates the patch
JSON schema.
2024-11-22 21:27:45 +01:00
cloudhead 2d13591ec2 radicle: Fix flaky test counts_by_repo 2024-11-21 16:05:01 +01:00
cloudhead cab56c1113 helper: Use the correct head when merging a patch
Fixes a bug where the wrong head would be used as part of the merge
action.

Use the head of the revision instead of the head of the canonical
branch.
2024-11-18 16:10:13 +01:00
cloudhead 6c8ee4330e radicle: Implement migration callback mechanism
Add the ability to have native migrations and progress callback
functions in migration code for the COB cache.
2024-11-14 17:21:33 +01:00
cloudhead f6aa46a283 cli: Try to connect to seeds specified as options
When fetching with a `--seed` specified on the CLI, try to connect to it
if not already connected.
2024-11-05 12:18:12 +01:00
cloudhead 11a6ec5dc6 cob: Add logging to COB evaluation
To use it, run for eg. the following command:

    $ RUST_LOG=debug rad patch cache
2024-11-05 12:14:26 +01:00
cloudhead 0bb0fe8f25 cob: Fix compatibility with certain old patches
We were rejecting patches that were once valid, due to a rule that was
added some time ago. Move that rule one level up, in the write path,
instead of in the read path.
2024-11-04 14:34:30 +01:00
cloudhead 6dcfbfcdee build: Separate release from upload 2024-11-01 12:28:39 +01:00
cloudhead 09f796234d radicle: Compute root OID for older remotes
For older clients, `refs/rad/root` won't be set. In that case, compute
it locally based on `refs/rad/id`.
2024-10-31 17:34:03 +01:00
cloudhead a838c3ea01 fmt: Run cargo fmt 2024-10-23 16:17:24 +02:00
cloudhead f83c116742 radicle: Fix clippy warnings around unwrap
The policy should be that we don't use unwraps outside of test code,
unless we have a good reason to.
2024-10-21 16:42:06 +02:00
cloudhead 989edacd56 Include new rad/root in signed refs
We ensure that a `rad/root` ref is included in the signed refs file
under `rad/sigrefs` for all remotes. This prevents a certain kind of
"grafting" attack where signed refs can be copied between repositories,
by having the peer sign over the identity root together with the data refs.

When verifying signed refs, we ensure that the ref is present and points
to an identity branch root that matches the repository identity containing
the signed refs.

Alternatives: lots of alternatives were considered, but this one doesn't
introduce any changes to the signing. The `rad/id/root` name was
considered but is invalid due to `rad/id`.
2024-10-21 16:32:49 +02:00
cloudhead 24066c2600 radicle: Test the signed refs grafting attack 2024-10-21 16:32:49 +02:00
cloudhead 6763bf31e1 helper: Don't require GIT_DIR for listing refs 2024-10-21 13:07:36 +02:00
cloudhead 855327d303 cob: Change APIs to take URIs for embeds
To facilitate edit actions, take URIs instead of the actual blobs. This
means API callers don't have to load all the blobs just for them to be
re-hashed when an edit action is submitted.

There are some peculiarities when dealing with the `Identity` COB since
the embed is the identity document itself. We handle that special case.
2024-10-14 12:51:36 +02:00
cloudhead 034eb41860 node: Ensure private RIDs don't leak in gossip
Though refs of private repositories are not announced publicly, they can
sometimes be relayed to nodes that are not in the allow list.

We fix this by always checking the visibility of a repository before
sending a refs announcement of it to a peer.

Discovered-by: Adrian Duke <adrian.duke@gmail.com>
2024-10-08 13:28:09 +02:00
cloudhead 3acdb17b86 cob: Fix patch review editing
Due to the way review editing was implemented, we were losing comments
on previous review edits.

Here, we add a new `review.edit` action that is specifically for
editing, and make the existing `review` action fail silently (for
backwards compatibility) in case it is used when there is already a
review.

We also simplify the review data structure by only keeping track of one
review per author per revision, instead of all edits. Later, if needed,
it will be possible to keep track of all review edits.
2024-10-04 17:44:45 +02:00
cloudhead d39ba83cfc Update Cargo.lock 2024-09-03 12:42:10 +02:00
cloudhead b77bea8e09 Update radicle-systemd Cargo.toml 2024-09-03 12:40:22 +02:00
cloudhead 1c620a2819 Update radicle-node crate to 0.10.0 2024-09-03 12:37:47 +02:00
cloudhead 57a0c8c46c Update radicle-fetch crate to 0.10.0 2024-09-03 12:36:24 +02:00
cloudhead c8b33a4fba Update radicle-remote-helper crate to 0.10.0 2024-09-03 12:34:27 +02:00
cloudhead bde68ac76c Update radicle-cli crate to 0.11.0 2024-09-03 12:33:02 +02:00
cloudhead bbc79a7e30 Update radicle-term crate to 0.11.0 2024-09-03 12:31:07 +02:00
cloudhead 73467bde83 Update radicle-signals crate to 0.10.0 2024-09-03 12:31:07 +02:00
cloudhead bc14229639 scripts: Small improvement to cache-cobs 2024-09-02 16:20:17 +02:00
cloudhead 4e112aaeaa Update radicle crate to 0.13.0 2024-08-28 13:01:35 +02:00
cloudhead 2d241e5f7d Update radicle-crypto crate to 0.11.0 2024-08-28 13:01:35 +02:00
cloudhead c112f3fbc9 Update radicle-cob crate to 0.12.0 2024-08-28 12:55:30 +02:00
cloudhead c8fbcf2a7a helper: Revert patches correctly
When pushing to the default branch and updating the canonical head,
check to see if any merged patches are reverted due to this change.

If so, make sure the COB cache reflects this.
2024-08-23 15:59:59 +02:00
cloudhead 757483f351 radicle: Fix patch COB review action
When two `review` actions were posted by the same author, for the same
revision, an error was returned, cancelling evaluation for that author.
This caused certain patches to for eg. lose their merge status.

To remedy this, we *allow* multiple `review` actions per revision, but
simply take the last one as the "current" review. Since this makes the
`review.edit` action redundant, we remove that action completely. This
is safe, as none of the tools created review edits.
2024-08-21 17:37:58 +02:00
cloudhead 8922388caa scripts: Add install command in changelog 2024-08-20 17:39:04 +02:00
cloudhead ab6ca14c88 tools: Add optional revision to rad-merge 2024-08-20 16:23:32 +02:00
cloudhead a61affa9fb node: Don't fail if we can't load a COB to cache
This change simply logs an error if there is a problem loading a COB
from storage, instead of bailing on the cache update process.

We also ensure that objects that can't be loaded from storage are
removed from the cache.
2024-08-09 11:59:53 +02:00
cloudhead 1d1b9c3d49 radicle: Don't use transactions in cache
The `transaction` method was being used for single queries. This
was unnecessary.
2024-08-09 10:54:04 +02:00
cloudhead 9db69a40a6 radicle: Remove cache entries before caching
In case of a bug or failed cache update, there may be objects in the
cache that are no longer in storage.

When doing a full re-cache, remove all existing entries from the repo
first.
2024-08-09 10:48:46 +02:00
cloudhead bfc949d094 cli: Log errors when COBs can't load 2024-08-09 10:47:54 +02:00
cloudhead 2b75045661 scripts: Add a script to create a radicle env
Creates a new profile with a repo and drops you in.
2024-08-07 10:41:28 +02:00
cloudhead 73f3c49689 cli: Don't fail on rad ls if project is invalid 2024-08-07 10:40:46 +02:00
cloudhead 16560950ec radicle: Fix log when delegate is not found 2024-08-06 16:36:27 +02:00
cloudhead a496190198 cli: Suggest the user to reset the cache
If there is an error loading a patch or issue, suggest resetting the
cache.
2024-08-06 14:43:59 +02:00
cloudhead c6a8a00055 Update rust-toolchain to 1.80
Fix new clippy warnings.
2024-08-06 14:37:21 +02:00
cloudhead 0e08452323 node: Ensure we don't prune our own routes
Filter out routing entries of our own node when prunning.
2024-08-06 14:17:12 +02:00
cloudhead 84e3ba1482 Validate project names properly in all places
We were only validating names when passed as a flag to `rad init
--name`.
2024-07-31 16:05:31 +02:00
cloudhead ee1c867800 cli: Add way to init from existing repositories
This adds an option to `rad init` to initialize a working copy with
an existing radicle repository in storage:

    rad init --existing <rid>

This sets up the remote(s) and configures the repo for you.
2024-07-29 11:49:19 +02:00
cloudhead 74336f961a cli: Write comments into draft patch review
We tidy things up with an explicit `Brain` type that stores the accepted
state of the code.

Review comments are added to the patch draft.
2024-07-24 16:46:24 +02:00
cloudhead 7cecabed42 Add id to Revision, forbid duplicate reviews
Some changes to the `Patch` state needed for code review.
2024-07-24 16:46:24 +02:00
cloudhead 123f7eb6bb Update radicle crate to 0.12.0 2024-07-18 16:22:14 +02:00
cloudhead 4a497fa66f node: Move the session lookup outside the loop
Small code change that was not possible before.
2024-07-16 19:58:47 +02:00
cloudhead 189046bb5d node: Randomize order of missing inventories 2024-07-16 19:58:47 +02:00
cloudhead aac23dde0c node: Add a max capacity to fetch queues 2024-07-16 19:58:44 +02:00
cloudhead 3c1c35f259 node: Have multiple fetch queues
In the current design it's possible for one peer to fill the fetch queue
so that fetches from other peers are delayed.

To improve fairness, we move to a queue per peer. We then try to dequeue
from all peers in a random order for good measure.
2024-07-16 17:11:46 +02:00
cloudhead 27eff8095d node: Don't depend on gix directly
This avoids pulling in the same dependency twice.
2024-07-16 15:57:27 +02:00
cloudhead 297646412a cli: Use pretty diffs for code review
We use the pretty diff renderer for code review.
2024-07-12 16:39:23 +02:00
cloudhead 823ece875e cli: Improve pretty diff printing
Refactor, cleanup, improve tests etc.
2024-07-12 16:36:04 +02:00
cloudhead a79ca5e8fc node: Constrain worker channel size
To avoid buffering large amounts of data in the process, we set the
worker channel size to `64`. Keep in mind that this is one
`ChannelEvent`, not one byte. `ChannelEvent::Data` can already contain
an arbitrary amount of data via its `Vec<u8>`, but in practice the
maximum is 8192, due to the use of `io::copy`.

We also remove an unused function, and move the flushing to the
`ChannelFlushWriter`.
2024-07-03 14:15:45 +02:00
cloudhead 38592955b2 remote-helper: Fix key-mismatch error
The error is about the remote namespace, so that's the one we should
include.
2024-06-30 10:28:23 +02:00
cloudhead 92c9e21873 Bump radicle crate to 0.11.1 2024-06-26 14:49:10 +02:00
cloudhead f7d8f1b8da radicle: Distinguish seeding policy types
We create a separate type for the default seeding policy, that
serializes differently and is only used in the node configuraiton.
2024-06-26 11:57:04 +02:00
cloudhead bbb292c8e6 node: Don't panic on connection logic error
It seems like the underlying network library has a bug, and transport
handovers don't always happen.
2024-06-26 11:31:07 +02:00
cloudhead 9edb633d98 cli: Add --from and other options to rad seed
Gives the same options to `rad seed` as `rad sync --fetch`.

Allows seeding and syncing from specific seeds in one command:

  rad seed <rid> --from <nid>

Useful for seeding private repos on public nodes.
2024-06-25 12:01:52 +02:00
cloudhead 765fc48c84 node: Fix edge case in persistent peer connections
If two peers are persistent for each other and experience
disconnections, it's possible that an outbound connection is turned into
an inbound one. But if we don't set that correctly, we'll eventually run
into a crash where an already connected peer re-connects, since the
disconnection logic checks for the link direction.
2024-06-24 14:29:00 +02:00
cloudhead c94ce020a1 cli: Small fix to ddif parsing 2024-06-24 12:09:44 +02:00
cloudhead f8c6cf8bf9 node: Fix Tor full-proxy mode support
We ensure that the global proxy is used as the connection address if
set.
2024-06-21 16:16:51 +02:00
cloudhead 6a9f11a1d9 cli: Honor --quiet flag in rad id update 2024-06-21 13:05:40 +02:00
cloudhead 42ffbf3fe6 cli: Make rad id update description optional
If a `--title` is specified, the description is optional, and will be
set to the empty string.
2024-06-20 17:33:48 +02:00
cloudhead 6f91f2fb8f clippy: Fix a few warnings 2024-06-20 15:10:39 +02:00
cloudhead 589c375624 build: Update env vars for build process
Use the standard `SOURCE_DATE_EPOCH` instead of `GIT_COMMIT_TIME`.
Set `GIT_HEAD` properly.
2024-06-20 10:47:50 +02:00
cloudhead 6598e77456 node: Log IP ban rejections 2024-06-19 20:38:23 +02:00
cloudhead 0a7a9c2945 cli: Fix disconnection timestamp
It should show since when we've been disconnected.
2024-06-19 20:37:36 +02:00
cloudhead dd7a0b3524 node: Revise fetch dequeue behavior
The fetch queue could sometimes not drain due to skipped fetches not
signaling that to the dequeue loop.

We now return a `bool` from `try_fetch` and keep trying to dequeue
fetches until one of them actually is initiated.

Additionally, we try to dequeue fetches at a regular interval
(`IDLE_INTERVAL`) to ensure that the queue is drained.
2024-06-19 15:31:00 +02:00
cloudhead 47c9f792e6 node: Handle connection state discrepancies
There are cases where the service state doesn't match the state
of the underlying wire protocol. We remedy this by transitioning peers
to a "connected" state when a message is received, if they are in a
"connecting" state.

The long term solution to this will likely be to merge the service and
protocol layer so that there are no inconsistencies.

The other case happens when a persistent peer is in "disconnected" state
and attempts an inbound connection to us.
2024-06-18 15:55:28 +02:00
cloudhead a1c9a927c2 node: Keep track of last announce separately
Fixes a bug where we try to announce the inventory over and over even
though there's nothing to announce.
2024-06-18 13:58:48 +02:00
cloudhead 484cf0220c node: Don't panic if we can't decode announcements
Bubble up the error instead.

Also, as part of the migration, delete existing announcements that won't
decode properly.
2024-06-13 21:38:30 +02:00
cloudhead 83786fbd80 node: Add a more elaborate message extension test
This required adding a type parameter to `Frame` to be able to test
different message types.
2024-06-13 11:28:09 +02:00
cloudhead 82c5884fdc radicle: Improve SQL type errors 2024-06-13 11:28:09 +02:00
cloudhead a89a300390 node: Pass Alias by reference 2024-06-13 11:28:09 +02:00
cloudhead 76edc0c523 node: Add agent and version to node announcement
1. Adds a user-agent string to the node announcement. This lets us keep
   track of what software version everyone is running. Especially useful
   to see what percentage of the network has upgraded to a new release.

  For old nodes, this defaults to the string `/radicle/`.

  The user agent format is roughly based on BIP 0014.

2. Advertize protocol version in node announcement.

  By advertizing the protocol version, nodes can decide to only connect to
  peers with a compatible version. The default and current version is `1`.

  We bundle these two changes as they both modify the node announcement
  and node database.

3. Swap the order of the fields in announcements to make the message
   extensible.
2024-06-13 11:28:09 +02:00
cloudhead 5c0d1b10e0 node: Make sure all channels we use are bounded
This prevents potential memory leaks. We also ensure that sends fail
instead of blocking, in case the channels are full.

Additionally, we add some metrics to report on channel size.
2024-06-12 19:00:23 +02:00
cloudhead 345ca92380 cli: Clarify doc test example 2024-06-12 15:36:34 +02:00
cloudhead 614f3e7b77 node: Keep private repos out of inventory
Since repos can go from public to private, make sure that we remove them
from the routing table on startup.
2024-06-12 15:36:34 +02:00
cloudhead f0e2018ac5 cli: Correctly update inventory with seed commands
Make sure our inventory is up to date with the policy changes, as well
as when publishing private repositories.
2024-06-12 15:36:34 +02:00
cloudhead fc55d67929 cli: Add rad node inventory command
Prints the local node's inventory.
2024-06-12 15:36:34 +02:00
cloudhead 50379548c2 node: Don't announce inventory redundantly
Keep track of last announcement timestamp and don't re-announce if it
matches.
2024-06-12 15:36:34 +02:00
cloudhead 81f94d0cff cli: Move common functionality out of the CLI 2024-06-12 15:36:34 +02:00
cloudhead a6b5c723c8 node: Rename certain functions for clarity 2024-06-12 15:36:34 +02:00
cloudhead b24f8a30d6 node: Update inventory when unseeding
Previously, our advertized inventory was not always correct: when we
stopped seeding a repository, it was still advertised as part of our
inventory until node restart, because the `Storage` type doesn't have
access to seeding policies.

In this change, we remove the concept of inventory from `Storage` and
make the authoritative place for it the routing table in our database.

To make this work, we have to add our node to the database on profile
creation, to not violate the foreign key constraint on the routing
table. Hence, the tests are changed to include our alias which is now
always available.
2024-06-12 15:36:34 +02:00
cloudhead d9fa83f9da term: Don't print empty tables
Before this change, the table borders would be printed, as well as the
table header if any.
2024-06-12 15:36:34 +02:00
cloudhead a6e33ec19a build: Remove rad-web from Dockerfile 2024-06-06 15:28:16 +02:00
cloudhead a4989b7ce7 Remove radicle-httpd crate
The HTTP daemon is moved to the `radicle-explorer` repository. Hence,
all traces of it are removed from this repository.
2024-06-06 11:14:00 +02:00