Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Use commit oid for COB parent
Alexis Sellier committed 3 years ago
commit 9000a626d766a845d4cd1ebef3992da731abf7c7
parent fb2c388a5de1e732d9692811e05e8a552ad4a963
7 files changed +59 -58
modified radicle-cli/examples/rad-id-rebase.md
@@ -6,7 +6,7 @@ delegates creating proposals concurrently.

```
$ rad id edit --title "Add Alice" --description "Add Alice as a delegate" --delegates did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --no-confirm
-
✓ Identity proposal '16d2b7c47bb9615da1a72e67f66f0e1d345be2e3' created 🌱
+
✓ Identity proposal '6e4dfd0edbb0974f5a4fb0990133e0911b0992c0' created 🌱
title: Add Alice
description: Add Alice as a delegate
status: ❲open❳
@@ -48,7 +48,7 @@ Quorum Reached

```
$ rad id edit --title "Add Bob" --description "Add Bob as a delegate" --delegates did:key:z6MkjchhfUsD6mmvni8mCdXHw216Xrm9bQe2mBH1P5RDjVJG --no-confirm
-
✓ Identity proposal '9615d03e4d98cf413994b6fdadf170747064c23d' created 🌱
+
✓ Identity proposal '6a687267b5063c036fdde90b75cc5eb153fa25e8' created 🌱
title: Add Bob
description: Add Bob as a delegate
status: ❲open❳
@@ -93,7 +93,7 @@ second proposal, then the identity would be out of date. So let's run
through that and see what happens.

```
-
$ rad id accept 16d2b7c47bb9615da1a72e67f66f0e1d345be2e3 --no-confirm
+
$ rad id accept 6e4dfd0edbb0974f5a4fb0990133e0911b0992c0 --no-confirm
✓ Accepted proposal ✓
title: Add Alice
description: Add Alice as a delegate
@@ -137,7 +137,7 @@ Quorum Reached
```

```
-
$ rad id commit 16d2b7c47bb9615da1a72e67f66f0e1d345be2e3 --no-confirm
+
$ rad id commit 6e4dfd0edbb0974f5a4fb0990133e0911b0992c0 --no-confirm
✓ Committed new identity '29ae4b72f5a315328f06fbd68dc1c396a2d5c45e' 🌱
title: Add Alice
description: Add Alice as a delegate
@@ -183,7 +183,7 @@ Quorum Reached
Now, when we go to accept the second proposal:

```
-
$ rad id accept 9615d03e4d98cf413994b6fdadf170747064c23d --no-confirm
+
$ rad id accept 6a687267b5063c036fdde90b75cc5eb153fa25e8 --no-confirm
! Warning: Revision is out of date
! Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f
👉 Consider using 'rad id rebase' to update the proposal to the latest identity
@@ -238,7 +238,7 @@ Note that a warning was emitted:
If we attempt to commit this revision, the command will fail:

```
-
$ rad id commit 9615d03e4d98cf413994b6fdadf170747064c23d --no-confirm
+
$ rad id commit 6a687267b5063c036fdde90b75cc5eb153fa25e8 --no-confirm
! Warning: Revision is out of date
! Warning: d96f425412c9f8ad5d9a9a05c9831d0728e2338d =/= 475cdfbc8662853dd132ec564e4f5eb0f152dd7f
👉 Consider using 'rad id rebase' to update the proposal to the latest identity
@@ -248,8 +248,8 @@ $ rad id commit 9615d03e4d98cf413994b6fdadf170747064c23d --no-confirm
So, let's fix this by running a rebase on the proposal's revision:

```
-
$ rad id rebase 9615d03e4d98cf413994b6fdadf170747064c23d --no-confirm
-
✓ Identity proposal '9615d03e4d98cf413994b6fdadf170747064c23d' rebased 🌱
+
$ rad id rebase 6a687267b5063c036fdde90b75cc5eb153fa25e8 --no-confirm
+
✓ Identity proposal '6a687267b5063c036fdde90b75cc5eb153fa25e8' rebased 🌱
✓ Revision 'aaa890c3531f880c9901b162ab38016ceb559c9f'
title: Add Bob
description: Add Bob as a delegate
@@ -293,8 +293,8 @@ Quorum Reached
We can now update the proposal to have both keys in the delegates set:

```
-
$ rad id update 9615d03e4d98cf413994b6fdadf170747064c23d --rev aaa890c3531f880c9901b162ab38016ceb559c9f --delegates did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --no-confirm
-
✓ Identity proposal '9615d03e4d98cf413994b6fdadf170747064c23d' updated 🌱
+
$ rad id update 6a687267b5063c036fdde90b75cc5eb153fa25e8 --rev aaa890c3531f880c9901b162ab38016ceb559c9f --delegates did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --no-confirm
+
✓ Identity proposal '6a687267b5063c036fdde90b75cc5eb153fa25e8' updated 🌱
✓ Revision '24ad4a6ce84b1ce4b8cc754494c23f1079020a14'
title: Add Bob
description: Add Bob as a delegate
@@ -338,10 +338,10 @@ Quorum Reached
Finally, we can accept and commit this proposal, creating the final
state of our new Radicle identity:

-
$ rad id show 9615d03e4d98cf413994b6fdadf170747064c23d --revisions
+
$ rad id show 6a687267b5063c036fdde90b75cc5eb153fa25e8 --revisions

```
-
$ rad id accept 9615d03e4d98cf413994b6fdadf170747064c23d --rev 24ad4a6ce84b1ce4b8cc754494c23f1079020a14 --no-confirm
+
$ rad id accept 6a687267b5063c036fdde90b75cc5eb153fa25e8 --rev 24ad4a6ce84b1ce4b8cc754494c23f1079020a14 --no-confirm
✓ Accepted proposal ✓
title: Add Bob
description: Add Bob as a delegate
@@ -385,7 +385,7 @@ Quorum Reached
```

```
-
$ rad id commit 9615d03e4d98cf413994b6fdadf170747064c23d --rev 24ad4a6ce84b1ce4b8cc754494c23f1079020a14 --no-confirm
+
$ rad id commit 6a687267b5063c036fdde90b75cc5eb153fa25e8 --rev 24ad4a6ce84b1ce4b8cc754494c23f1079020a14 --no-confirm
✓ Committed new identity '60de897bc24898f6908fd1272633c0b15aa4096f' 🌱
title: Add Bob
description: Add Bob as a delegate
modified radicle-cli/examples/rad-id.md
@@ -14,7 +14,7 @@ Let's add Bob as a delegate using their DID

```
$ rad id edit --title "Add Bob" --description "Add Bob as a delegate" --delegates did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --no-confirm
-
✓ Identity proposal 'de4102c1b9b9b83683d7d9ca80c79ffebd62ac83' created 🌱
+
✓ Identity proposal 'd4ceabea6b7acc91a92c040274e4578d9158a24b' created 🌱
title: Add Bob
description: Add Bob as a delegate
status: ❲open❳
@@ -89,7 +89,7 @@ Finally, we can see whether the `Quorum` was reached:
Let's see what happens when we reject the change:

```
-
$ rad id reject de4102c1b9b9b83683d7d9ca80c79ffebd62ac83 --no-confirm
+
$ rad id reject d4ceabea6b7acc91a92c040274e4578d9158a24b --no-confirm
✓ Rejected proposal 👎
title: Add Bob
description: Add Bob as a delegate
@@ -145,7 +145,7 @@ increased to `1`.
Instead, let's accept the proposal:

```
-
$ rad id accept de4102c1b9b9b83683d7d9ca80c79ffebd62ac83 --no-confirm
+
$ rad id accept d4ceabea6b7acc91a92c040274e4578d9158a24b --no-confirm
✓ Accepted proposal ✓
title: Add Bob
description: Add Bob as a delegate
@@ -207,7 +207,7 @@ As well as that, the `Quorum` has now been reached:
At this point, we can commit the proposal and update the identity:

```
-
$ rad id commit de4102c1b9b9b83683d7d9ca80c79ffebd62ac83 --no-confirm
+
$ rad id commit d4ceabea6b7acc91a92c040274e4578d9158a24b --no-confirm
✓ Committed new identity 'c96e764965aaeff1c6ea3e5b97e2b9828773c8b0' 🌱
title: Add Bob
description: Add Bob as a delegate
@@ -255,7 +255,7 @@ the `--threshold` option:

```
$ rad id edit --title "Update threshold" --description "Update to safer threshold" --threshold 2 --no-confirm
-
✓ Identity proposal '14a980c4061f06433ace03cf6b1e5eedba4f8cfc' created 🌱
+
✓ Identity proposal 'b54d8c5fbe42236c9210f39c4051cd223a884b7c' created 🌱
title: Update threshold
description: Update to safer threshold
status: ❲open❳
@@ -298,8 +298,8 @@ Quorum Reached
But we change our minds and decide to close the proposal instead:

```
-
$ rad id close 14a980c4061f06433ace03cf6b1e5eedba4f8cfc --no-confirm
-
✓ Closed identity proposal '14a980c4061f06433ace03cf6b1e5eedba4f8cfc'
+
$ rad id close b54d8c5fbe42236c9210f39c4051cd223a884b7c --no-confirm
+
✓ Closed identity proposal 'b54d8c5fbe42236c9210f39c4051cd223a884b7c'
title: Update threshold
description: Update to safer threshold
status: ❲closed❳
@@ -348,15 +348,15 @@ Radicle identity, then we can use the list command:

```
$ rad id list
-
14a980c4061f06433ace03cf6b1e5eedba4f8cfc "Update threshold" ❲closed❳
-
de4102c1b9b9b83683d7d9ca80c79ffebd62ac83 "Add Bob"          ❲committed❳
+
b54d8c5fbe42236c9210f39c4051cd223a884b7c "Update threshold" ❲closed❳
+
d4ceabea6b7acc91a92c040274e4578d9158a24b "Add Bob"          ❲committed❳
```

And if we want to view the latest state of any proposal we can use the
show command:

```
-
$ rad id show 14a980c4061f06433ace03cf6b1e5eedba4f8cfc
+
$ rad id show b54d8c5fbe42236c9210f39c4051cd223a884b7c
title: Update threshold
description: Update to safer threshold
status: ❲closed❳
modified radicle-cli/examples/rad-issue.md
@@ -11,7 +11,7 @@ The issue is now listed under our project.

```
$ rad issue list
-
e379d630f91a6082d3c7677467eb0d4875635d74 "flux capacitor underpowered"
+
e8eb9ca4afa050499b259842ddef2d41abf0fd83 "flux capacitor underpowered"
```

Great! Now we've documented the issue for ourselves and others.
@@ -22,20 +22,20 @@ others to work on. This is to ensure work is not duplicated.
Let's assign ourselves to this one.

```
-
$ rad assign e379d630f91a6082d3c7677467eb0d4875635d74 did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+
$ rad assign e8eb9ca4afa050499b259842ddef2d41abf0fd83 did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```

It will now show in the list of issues assigned to us.

```
$ rad issue list --assigned
-
e379d630f91a6082d3c7677467eb0d4875635d74 "flux capacitor underpowered" did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+
e8eb9ca4afa050499b259842ddef2d41abf0fd83 "flux capacitor underpowered" did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```

Note: this can always be undone with the `unassign` subcommand.

```
-
$ rad unassign e379d630f91a6082d3c7677467eb0d4875635d74 did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+
$ rad unassign e8eb9ca4afa050499b259842ddef2d41abf0fd83 did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```

Great, now we have communicated to the world about our car's defect.
@@ -44,8 +44,8 @@ But wait! We've found an important detail about the car's power requirements.
It will help whoever works on a fix.

```
-
$ rad comment e379d630f91a6082d3c7677467eb0d4875635d74 --message 'The flux capacitor needs 1.21 Gigawatts'
+
$ rad comment e8eb9ca4afa050499b259842ddef2d41abf0fd83 --message 'The flux capacitor needs 1.21 Gigawatts'
f1895792f7b1b56590aa21e34454bde74d04649a
-
$ rad comment e379d630f91a6082d3c7677467eb0d4875635d74 --reply-to f1895792f7b1b56590aa21e34454bde74d04649a --message 'More power!'
+
$ rad comment e8eb9ca4afa050499b259842ddef2d41abf0fd83 --reply-to f1895792f7b1b56590aa21e34454bde74d04649a --message 'More power!'
0bf5f874c57ac0a5cc010a9895dd0fec9edc4f3d
```
modified radicle-cli/examples/rad-patch.md
@@ -45,7 +45,7 @@ No description provided.
╰───────────────────────────────────


-
✓ Patch fd1df2db86867aa859541464fa334d0b22988ea7 created 🌱
+
✓ Patch f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd created 🌱
```

It will now be listed as one of the project's open patches.
@@ -55,17 +55,17 @@ $ rad patch

❲YOU PROPOSED❳

-
define power requirements fd1df2db868 R0 3e674d1 (flux-capacitor-power) ahead 1, behind 0
+
define power requirements f504e78d71e R0 3e674d1 (flux-capacitor-power) ahead 1, behind 0
└─ * opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [..]
-
└─ * patch id fd1df2db86867aa859541464fa334d0b22988ea7
+
└─ * patch id f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd

❲OTHERS PROPOSED❳

Nothing to show.

-
$ rad patch show fd1df2db86867aa859541464fa334d0b22988ea7
+
$ rad patch show f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd

-
patch fd1df2db86867aa859541464fa334d0b22988ea7
+
patch f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd

╭─ define power requirements ───────

@@ -94,34 +94,34 @@ $ git commit --message "Add README, just for the fun"
[flux-capacitor-power 27857ec] Add README, just for the fun
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README.md
-
$ rad patch update --message "Add README, just for the fun" --no-confirm fd1df2db86867aa859541464fa334d0b22988ea7
+
$ rad patch update --message "Add README, just for the fun" --no-confirm f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd

🌱 Updating patch for heartwood

✓ Pushing HEAD to storage...
✓ Analyzing remotes...

-
fd1df2db868 R0 (3e674d1) -> R1 (27857ec)
+
f504e78d71e R0 (3e674d1) -> R1 (27857ec)
1 commit(s) ahead, 0 commit(s) behind


-
✓ Patch fd1df2db86867aa859541464fa334d0b22988ea7 updated 🌱
+
✓ Patch f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd updated 🌱

```

And lets leave a quick comment for our team:

```
-
$ rad comment fd1df2db86867aa859541464fa334d0b22988ea7 --message 'I cannot wait to get back to the 90s!'
+
$ rad comment f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd --message 'I cannot wait to get back to the 90s!'
84ef44764de73695cf30e6b284585d2c50d6d0e5
-
$ rad comment fd1df2db86867aa859541464fa334d0b22988ea7 --message 'I cannot wait to get back to the 90s!' --reply-to 84ef44764de73695cf30e6b284585d2c50d6d0e5
+
$ rad comment f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd --message 'I cannot wait to get back to the 90s!' --reply-to 84ef44764de73695cf30e6b284585d2c50d6d0e5
2fa3ac18d82ebdafe73484a15fa9823355c4664b
```

Now, let's checkout the patch that we just created:

```
-
$ rad patch checkout fd1df2db86867aa859541464fa334d0b22988ea7
+
$ rad patch checkout f504e78d71e7c2d70569976ef9f6b37b6a3d0bfd
✓ Performing patch checkout...
-
✓ Switched to branch patch/fd1df2db868
+
✓ Switched to branch patch/f504e78d71e
```
modified radicle-httpd/src/api/v1/projects.rs
@@ -617,9 +617,11 @@ mod routes {
    use pretty_assertions::assert_eq;
    use serde_json::json;

-
    use crate::test::{self, get, patch, post, HEAD, HEAD_1, ISSUE_ID, PATCH_ID, SESSION_ID};
+
    use crate::test::{
+
        self, get, patch, post, HEAD, HEAD_1, ISSUE_ID, PATCH_ID, SESSION_ID, TIMESTAMP,
+
    };

-
    const CREATED_ISSUE_ID: &str = "745052a1603000b9566445753d7e2fee1ff5041f";
+
    const CREATED_ISSUE_ID: &str = "7596e4b788c37d633a8bd665e4d3a5a632c90eab";

    #[tokio::test]
    async fn test_projects_root() {
@@ -1105,7 +1107,7 @@ mod routes {
                    },
                    "body": "Change 'hello world' to 'hello everyone'",
                    "reactions": [],
-
                    "timestamp": 1673001014,
+
                    "timestamp": TIMESTAMP,
                    "replyTo": null
                  }
                ],
@@ -1167,7 +1169,7 @@ mod routes {
                  },
                  "body": "Change 'hello world' to 'hello everyone'",
                  "reactions": [],
-
                  "timestamp": 1673001014,
+
                  "timestamp": TIMESTAMP,
                  "replyTo": null,
              }],
              "tags": [
@@ -1228,7 +1230,7 @@ mod routes {
                  },
                  "body": "Change 'hello world' to 'hello everyone'",
                  "reactions": [],
-
                  "timestamp": 1673001014,
+
                  "timestamp": TIMESTAMP,
                  "replyTo": null,
                },
                {
@@ -1238,7 +1240,7 @@ mod routes {
                  },
                  "body": "This is first-level comment",
                  "reactions": [],
-
                  "timestamp": 1673001014,
+
                  "timestamp": TIMESTAMP,
                  "replyTo": null,
                },
              ],
@@ -1298,7 +1300,7 @@ mod routes {
                  },
                  "body": "Change 'hello world' to 'hello everyone'",
                  "reactions": [],
-
                  "timestamp": 1673001014,
+
                  "timestamp": TIMESTAMP,
                  "replyTo": null,
                },
                {
@@ -1308,7 +1310,7 @@ mod routes {
                  },
                  "body": "This is a reply to the first comment",
                  "reactions": [],
-
                  "timestamp": 1673001014,
+
                  "timestamp": TIMESTAMP,
                  "replyTo": "f0afe34f5bf4248df432f6b6a8818bcae360bbc2",
                },
              ],
@@ -1408,14 +1410,14 @@ mod routes {
            json!(
              {
                "success": true,
-
                "id": "cd370c8a263e8b0c9836d6a5dd3bf7a633d69acf",
+
                "id": "48d6d96e1f80b3ccd5bd9675d407e09e7bbaa7ab",
              }
            )
        );

        let response = get(
            &app,
-
            "/projects/rad:z4FucBZHZMCsxTyQE1dfE2YR59Qbp/patches/cd370c8a263e8b0c9836d6a5dd3bf7a633d69acf",
+
            "/projects/rad:z4FucBZHZMCsxTyQE1dfE2YR59Qbp/patches/48d6d96e1f80b3ccd5bd9675d407e09e7bbaa7ab",
        )
        .await;

@@ -1424,7 +1426,7 @@ mod routes {
            response.json().await,
            json!(
              {
-
                "id": "cd370c8a263e8b0c9836d6a5dd3bf7a633d69acf",
+
                "id": "48d6d96e1f80b3ccd5bd9675d407e09e7bbaa7ab",
                "author": {
                    "id": "did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"
                },
modified radicle-httpd/src/test.rs
@@ -22,9 +22,10 @@ use crate::api::{auth, Context};

pub const HEAD: &str = "1e978d19f251cd9821d9d9a76d1bd436bf0690d5";
pub const HEAD_1: &str = "f604ce9fd5b7cc77b7609beda45ea8760bee78f7";
-
pub const PATCH_ID: &str = "afb3063f8f0343fa31d2a0d55bac2a6f4a77125e";
-
pub const ISSUE_ID: &str = "331569cd5e4dcc55104363ebce92c78b0e5d67d4";
+
pub const PATCH_ID: &str = "3cccb7ac7325215731c62c9c5aef2ec51ba91317";
+
pub const ISSUE_ID: &str = "dc368184c379a7802c78b729ed631d2712ce22ab";
pub const SESSION_ID: &str = "u9MGAkkfkMOv0uDDB2WeUHBT7HbsO2Dy";
+
pub const TIMESTAMP: u64 = 1671125284;

const PASSWORD: &str = "radicle";

@@ -32,6 +33,7 @@ pub fn seed(dir: &Path) -> Context {
    let workdir = dir.join("hello-world");
    let rad_home = dir.join("radicle");

+
    env::set_var("RAD_COMMIT_TIME", TIMESTAMP.to_string());
    env::set_var("RAD_PASSPHRASE", PASSWORD);
    env::set_var(
        "RAD_SEED",
@@ -103,9 +105,6 @@ pub fn seed(dir: &Path) -> Context {
    )
    .unwrap();

-
    // eq. rad issue new
-
    env::set_var("RAD_COMMIT_TIME", "1673001014");
-

    let signer = MemorySigner::load(&profile.keystore, PASSWORD.to_owned().into()).unwrap();
    let storage = &profile.storage;
    let (_, id) = radicle::rad::repo(&workdir).unwrap();
modified radicle/src/cob/store.rs
@@ -107,8 +107,8 @@ impl<'a, T> Store<'a, T> {
        let identity = repo.identity()?;

        Ok(Self {
-
            parent: identity.current,
            repo,
+
            parent: identity.head,
            witness: PhantomData,
            rng,
        })