[PR #3939] [CLOSED] Refuse a LAN guest whose content blocks differ from the host's (#3899) #5304

Closed
opened 2026-11-03 05:11:39 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3939
Author: @DUzzL
Created: 10/29/2026
Status: ❌ Closed

Base: main ← Head: fix/issue-3899-content-block-registry


📝 Commits (1)

  • 473a9ea Refuse a LAN guest whose content blocks differ from the host's (#3899)

📊 Changes

8 files changed (+214 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/mods.rs (+2 -0)
📝 crates/horizon-client/src/lan/conn.rs (+54 -0)
📝 crates/horizon-client/src/mod_content.rs (+24 -1)
📝 crates/horizon-client/src/mod_content_tests.rs (+9 -0)
📝 crates/horizon-client/src/net.rs (+9 -0)
📝 crates/horizon-items/src/content_namespaces.rs (+13 -0)
➕ crates/horizon-protocol/src/content.rs (+102 -0)
📝 crates/horizon-protocol/src/lib.rs (+1 -0)

📄 Description

Opened by DUzzL's AI agent, not by DUzzL personally.

Fixes #3899.

Content-mod blocks get block-state ids after vanilla's, assigned from each game's own mod files. Nothing compared them across a LAN connection, so a guest with a different set drew other blocks than the host placed.

Change:

  • The content root build records its blocks (<id> <template>, in state-id order) in horizon-mod-blocks.json; horizon_items::content_namespaces::blocks reads it.
  • New horizon_protocol::content::Fingerprint (count + SHA-256 of the ordered blocks) and the horizon:content_blocks configuration payload.
  • A Horizon client always sends its fingerprint after its brand. A host that has content blocks disconnects a Horizon guest whose fingerprint is missing or different, with a message to install the same content mods. A host without content blocks takes every guest (it never sends a state id past vanilla's).
  • Not changed: vanilla clients joining a content-modded host (the issue's open question). They are not refused here.

Tested:

  • cargo test -p horizon-protocol --lib content: 4 new tests pass (round trip, order/content sensitivity, bad payload).
  • cargo test -p horizon-client --lib content_blocks: the host/guest refusal decision passes.
  • cargo clippy -D warnings --all-targets on horizon-client, horizon-protocol, horizon-items: clean; cargo fmt applied.

Not tested: the two-game LAN reproduction from the issue, tools/pr_ready.py, parity harnesses, and the added assertion in mod_content_tests.rs (it needs the prepared vanilla data in .local/, which this machine does not have; it is #[ignore]d and runs in CI).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3939 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-3899-content-block-registry` --- ### 📝 Commits (1) - [`473a9ea`](https://github.com/horizon-rust/horizon/commit/473a9eabf6af564f91944d2295b107496a5c7650) Refuse a LAN guest whose content blocks differ from the host's (#3899) ### 📊 Changes **8 files changed** (+214 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/mods.rs` (+2 -0) 📝 `crates/horizon-client/src/lan/conn.rs` (+54 -0) 📝 `crates/horizon-client/src/mod_content.rs` (+24 -1) 📝 `crates/horizon-client/src/mod_content_tests.rs` (+9 -0) 📝 `crates/horizon-client/src/net.rs` (+9 -0) 📝 `crates/horizon-items/src/content_namespaces.rs` (+13 -0) ➕ `crates/horizon-protocol/src/content.rs` (+102 -0) 📝 `crates/horizon-protocol/src/lib.rs` (+1 -0) </details> ### 📄 Description Opened by DUzzL's AI agent, not by DUzzL personally. Fixes #3899. Content-mod blocks get block-state ids after vanilla's, assigned from each game's own mod files. Nothing compared them across a LAN connection, so a guest with a different set drew other blocks than the host placed. Change: - The content root build records its blocks (`<id> <template>`, in state-id order) in `horizon-mod-blocks.json`; `horizon_items::content_namespaces::blocks` reads it. - New `horizon_protocol::content::Fingerprint` (count + SHA-256 of the ordered blocks) and the `horizon:content_blocks` configuration payload. - A Horizon client always sends its fingerprint after its brand. A host that has content blocks disconnects a Horizon guest whose fingerprint is missing or different, with a message to install the same content mods. A host without content blocks takes every guest (it never sends a state id past vanilla's). - Not changed: vanilla clients joining a content-modded host (the issue's open question). They are not refused here. Tested: - `cargo test -p horizon-protocol --lib content`: 4 new tests pass (round trip, order/content sensitivity, bad payload). - `cargo test -p horizon-client --lib content_blocks`: the host/guest refusal decision passes. - `cargo clippy -D warnings --all-targets` on horizon-client, horizon-protocol, horizon-items: clean; `cargo fmt` applied. Not tested: the two-game LAN reproduction from the issue, `tools/pr_ready.py`, parity harnesses, and the added assertion in `mod_content_tests.rs` (it needs the prepared vanilla data in `.local/`, which this machine does not have; it is `#[ignore]`d and runs in CI). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:39 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5304
No description provided.