Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion pkgs/id/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions pkgs/id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ default-members = [".", "crates/id-core", "crates/id-caps", "crates/id-store", "

[features]
default = ["sandbox", "world"]
sandbox = ["dep:wasmtime", "world", "id-core/sandbox", "id-caps/sandbox"]
sandbox = ["world", "id-core/sandbox", "id-caps/sandbox", "id-worlds/sandbox"]
world = [
"dep:subtle",
"dep:hmac",
Expand Down Expand Up @@ -179,11 +179,8 @@ hmac = { version = "0.13", optional = true }
# scrypt for the Seitan V2 stretch (P6.1). Already in the lock as a transitive dependency.
scrypt = { version = "0.12", optional = true }
subtle = { version = "2", optional = true }
wasmtime = { version = "=48.0.7", default-features = false, features = [
"cranelift",
"runtime",
"std",
], optional = true }
# wasmtime moved to id-worlds in step 5b of the crate split (#4408):
# the `sandbox` feature above forwards to `id-worlds/sandbox`.
russh = { version = "=0.65.0", optional = true }

[dev-dependencies]
Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/crates/id-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ vt100 = "=0.16.2"
iroh = { version = "1", features = ["test-utils"] }
# Narrowing-only property test for boundary composition (boundary.rs, #7782).
proptest = "1.12"
# The test_forgeries fixtures' own tests sign and verify (test_forgeries.rs,
# moved here in step 5 of the crate split, #4408). Dev only.
ed25519-dalek = { version = "3", features = ["rand_core"] }

[lints.rust]
# Rust compiler lints
Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/crates/id-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ mod unicode;
pub use unicode::is_format_char;
pub mod waiting;

#[cfg(any(test, feature = "test-utils"))]
pub mod test_forgeries;

#[cfg(feature = "world")]
pub mod petname;
#[cfg(feature = "world")]
Expand Down
72 changes: 62 additions & 10 deletions pkgs/id/crates/id-worlds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,85 @@ license = "MIT OR Apache-2.0"

# Step 5 of the pkgs/id crate split (#3447 umbrella, #4408): the world
# family lives here. Dependencies per the design map: id-core, id-caps,
# id-store, id-events, id-groups, id-sync. This first step-5 PR brings
# the leaves that name nothing above them (the compiled-world cache,
# the line/terminal helpers), seam 6's cross-world bridge
# (`groups::worlds` — the consumer side of the groups/worlds
# relationship, per the design), and the blob gate's `FoldedWorlds`
# adapter over that bridge (parked in the facade by step 4 to move
# together with the bridge). The world core, sessions and the rest of
# the family follow in later step-5 PRs.
# id-store, id-events, id-groups, id-sync.
#
# Step 5a brought the leaves, seam 6's cross-world bridge
# (`groups::worlds`) and the blob gate's `FoldedWorlds` adapter.
# Step 5b brings the runtime core: `world`, `world_session`, the
# sandbox and its compile/fixture/native paths, the hub, net and
# store, `world_records` and `shell_contract` — and, with them, the
# directory cluster (`directory`, `directory_auth`, `directory_view`,
# `directory_mail`). The directory is the world runtime's own state:
# `WorldCore` holds it, the world actor executes directory actions
# against it, and `world_store` persists it beside the journal, so
# the cluster moves as the consumer side of the relationship (the
# seam-6 pattern). Seam 10's remaining half is unchanged by this:
# step 6's `id-directory` extraction must still invert or re-home
# `WorldCore`'s hold on the directory, exactly as it would have had
# to from the facade. The facade re-exports the directory modules at
# their historical `id::` paths until then.
#
# `session_host` also lands here: it implements `id_sync::host::
# SessionHost` for the hub and `id_sync::artifact::ArtifactSink` for
# the directory, and the orphan rule puts those impls in the crate
# that owns the types (they sat in the facade only while the hub and
# directory did).

[features]
default = []
# The wasmtime dependency lives inside id-worlds (design feature
# mapping); the facade's `sandbox` feature forwards here.
sandbox = ["dep:wasmtime", "id-caps/sandbox", "id-core/sandbox"]

[dependencies]
anyhow = "1"
blake3 = "1"
ed25519-dalek = { version = "3", features = ["rand_core"] }
futures-lite = "2"
id-caps = { path = "../id-caps", default-features = false }
id-core = { path = "../id-core", default-features = false, features = [
"world",
] }
id-events = { path = "../id-events", default-features = false }
id-groups = { path = "../id-groups", default-features = false }
id-store = { path = "../id-store", default-features = false }
id-sync = { path = "../id-sync", default-features = false }
iroh = "1"
iroh-base = "1"
iroh-blobs = "0.103"
iroh-docs = "0.101"
iroh-gossip = { version = "0.101", features = ["net"] }
libc = "0.2"
p2panda-core = { git = "https://github.com/p2panda/p2panda", rev = "da80c05b95269926bf58121cf6a2d3dd5ca41dfc" }
postcard = { version = "1", features = ["alloc"] }
rand = "0.10"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.11"
subtle = "2"
tempfile = "3"
thiserror = "2"
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
wasmtime = { version = "=48.0.7", default-features = false, features = [
"cranelift",
"runtime",
"std",
], optional = true }

[dev-dependencies]
p2panda-core = { git = "https://github.com/p2panda/p2panda", rev = "da80c05b95269926bf58121cf6a2d3dd5ca41dfc" }
id-core = { path = "../id-core", default-features = false, features = [
"test-utils",
] }
# The directory tests sign artifacts through the id-sync test seam
# (SignedArtifact::sign_unchecked), as the facade dev build did.
id-sync = { path = "../id-sync", default-features = false, features = [
"test-utils",
] }
proptest = "1.12"
tempfile = "3"
tokio = { version = "1", features = ["test-util"] }
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
wat = "=1.261.0"

[lints.rust]
unsafe_code = "warn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ impl Directory {
}
}

pub(crate) fn apply(&mut self, entry: &DirectoryEntry) -> Result<()> {
pub fn apply(&mut self, entry: &DirectoryEntry) -> Result<()> {
self.apply_mode(entry, true)
}

Expand Down Expand Up @@ -2494,7 +2494,7 @@ fn clean_description_mode(description: &str, refuse_format: bool) -> Result<Stri
Ok(description.to_owned())
}

pub(crate) fn hex_to_array<const N: usize>(text: &str) -> Option<[u8; N]> {
pub fn hex_to_array<const N: usize>(text: &str) -> Option<[u8; N]> {
// Every byte must be an ASCII hex digit (#2517): u8::from_str_radix
// also accepts a leading '+', so without this gate a byte 0x00-0x0f
// has two accepted spellings ('0x' and '+x') and key strings stop
Expand Down
75 changes: 65 additions & 10 deletions pkgs/id/crates/id-worlds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,79 @@
//! world family lives here, over `id-core`, `id-caps`, `id-store`,
//! `id-events`, `id-groups` and `id-sync`.
//!
//! This first step-5 PR brings:
//! Contents:
//!
//! - [`blob_gate`]: the blob gate's folded-worlds adapter
//! ([`blob_gate::FoldedWorlds`]), parked in the facade by step 4 so
//! it could move together with the cross-world bridge it folds.
//! - The runtime: [`world`] (core, actor, replica, replication,
//! handle), [`world_session`], [`world_hub`], [`world_net`],
//! [`world_store`], [`world_records`], [`world_compile`],
//! [`world_native`], [`world_fixture`], [`world_cache`] and, under
//! the `sandbox` feature, [`sandbox`] — the wasmtime guest runner
//! whose fuel budgets are the split's determinism canary.
//! - [`shell_contract`]: the F13.1 shell contract the native shell
//! speaks.
//! - [`groups::worlds`]: seam 6 of the design — the groups→worlds
//! bridge is the consumer side of the relationship, so it lives in
//! the worlds crate, over the group model in `id-events`.
//! - [`world_cache`], [`world_line`], [`world_terminal`]: the family
//! leaves that name nothing above them.
//! - [`blob_gate`]: the blob gate's folded-worlds adapter, which
//! folds through the bridge above (step 4 parked it in the facade
//! to move together with the bridge; it cannot live in `id-groups`,
//! which is below this crate and must not name world types).
//! - The directory cluster — [`directory`], [`directory_auth`],
//! [`directory_view`], [`directory_mail`] — the world runtime's own
//! state: `WorldCore` holds the directory, the world actor executes
//! directory actions against it, and `world_store` persists it
//! beside the journal, so the cluster moves as the consumer side
//! (the seam-6 pattern). Seam 10's remaining half is unchanged:
//! step 6's `id-directory` extraction must still invert or re-home
//! `WorldCore`'s hold on the directory, exactly as it would have
//! had to from the facade. The facade re-exports these modules at
//! their historical `id::` paths until then.
//!
//! The world core, sessions, sandbox and the rest of the family
//! follow in later step-5 PRs. The facade re-exports each module at
//! its historical `id::` path, so no call site outside the moved
//! modules changed.
//! The facade re-exports each module at its historical `id::` path,
//! so no call site outside the moved modules changed. The module
//! aliases below (`frames`, `world_caps`, …) exist so the moved
//! modules' `crate::` paths resolve exactly as they did in the
//! facade; they name the lower crates that own those modules.

pub mod blob_gate;
pub mod directory;
pub mod directory_auth;
pub mod directory_mail;
pub mod directory_view;
pub mod groups;
#[cfg(feature = "sandbox")]
pub mod sandbox;
mod session_host;
pub mod shell_contract;
pub mod world;
pub mod world_cache;
pub mod world_compile;
pub mod world_fixture;
pub mod world_hub;
pub mod world_line;
pub mod world_native;
pub mod world_net;
pub mod world_records;
pub mod world_session;
pub mod world_store;
pub mod world_terminal;

pub use id_sync::artifact;
pub use id_core::abuse;
pub use id_store::chain;
pub use id_core::connectivity;
pub use id_sync::envelope_outbox;
pub use id_events::event_store;
pub use id_core::frames;
pub(crate) use id_core::is_format_char;
pub use id_core::petname;
pub use id_store::store;
pub use id_store::tags;
pub(crate) use id_core::text;
pub(crate) use id_core::time;
pub use id_caps::world_caps;
pub use id_caps::world_limits;
pub use id_core::world_presentation;

#[cfg(test)]
pub(crate) use id_core::test_forgeries;
Loading
Loading