Skip to content

Commit 20b7e9e

Browse files
committed
docs: update file/image paths, deduplicate titles, and inline code snippets
1 parent d737bae commit 20b7e9e

21 files changed

+94
-86
lines changed

hugo-site/content/resources/manual/architecture/irouting.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ draft: false
55
weight: 2
66
---
77

8-
## Intelligent Routing
9-
108
Freenet's request routing mechanism plays a crucial role in the efficiency of
119
the network.
1210

hugo-site/content/resources/manual/architecture/p2p-network.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: "P2P Network"
33
date: 2025-04-13
44
draft: false
5-
weight: 1
65
---
76

87
# Freenet Network Topology
@@ -14,7 +13,7 @@ a [small-world network](https://en.wikipedia.org/wiki/Small-world_network). This
1413
network topology is scalable and efficient, allowing contract state to be found
1514
quickly and without any reliance on a central authority.
1615

17-
![Small World Network](p2p-network.svg)
16+
![Small World Network](/p2p-network.svg)
1817

1918
## Freenet Peers
2019

hugo-site/content/resources/manual/architecture/transport.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
---
2-
title: "Transport"
2+
title: "Freenet Transport Protocol (FrTP)"
33
date: 2025-04-13
44
draft: false
5-
weight: 3
65
---
76

8-
# Freenet Transport Protocol (FrTP)
9-
107
**Note**: This document is a work in progress and is subject to change, it is currently out-of-sync
118
with the codebase and should be updated to reflect the current state of the codebase once it has
129
stabilized.

hugo-site/content/resources/manual/community.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
title: "Community"
33
date: 2025-04-13
44
draft: false
5-
weight: 1
65
---
76

8-
# Community
9-
107
- [Github](https://github.com/freenet/freenet-core)
118
- [Matrix](https://matrix.to/#/#locutus:matrix.org)

hugo-site/content/resources/manual/components/contracts.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
title: "Contracts"
33
date: 2025-04-13
44
draft: false
5-
weight: 2
65
---
76

8-
## Contracts
9-
107
Freenet is essentially a global decentralized key-value store where keys are
118
WebAssembly code called Contracts. Contracts are stored in the network,
129
along with their data or "state". The contract controls what state is permitted
@@ -116,19 +113,41 @@ Rust contracts implement the [`ContractInterface`](https://docs.rs/freenet-stdli
116113
functions that the core calls to interact with the contract.
117114

118115
```rust
119-
// TODO: Replace this comment with the actual code snippet for 'contractifce'.
120-
// Option 1: Manually paste the code here.
121-
// Option 2: Use Hugo's readFile function if the file is accessible
122-
// (e.g., {{ readFile "assets/code/contract_interface.rs" | safeHTML }})
123-
// Note: readFile includes the *entire* file.
124-
// Option 3: Implement a custom shortcode for dynamic section inclusion.
125-
126116
pub trait ContractInterface {
127-
// ... (Paste or dynamically include the relevant interface definition here)
117+
/// Verify that the state is valid, given the parameters.
118+
fn validate_state(
119+
parameters: Parameters<'static>,
120+
state: State<'static>,
121+
related: RelatedContracts<'static>,
122+
) -> Result<ValidateResult, ContractError>;
123+
124+
/// Update the state to account for the new data
125+
fn update_state(
126+
parameters: Parameters<'static>,
127+
state: State<'static>,
128+
data: Vec<UpdateData<'static>>,
129+
) -> Result<UpdateModification<'static>, ContractError>;
130+
131+
/// Generate a concise summary of a state that can be used to create deltas
132+
/// relative to this state.
133+
fn summarize_state(
134+
parameters: Parameters<'static>,
135+
state: State<'static>,
136+
) -> Result<StateSummary<'static>, ContractError>;
137+
138+
/// Generate a state delta using a summary from the current state.
139+
/// This along with [`Self::summarize_state`] allows flexible and efficient
140+
/// state synchronization between peers.
141+
fn get_state_delta(
142+
parameters: Parameters<'static>,
143+
state: State<'static>,
144+
summary: StateSummary<'static>,
145+
) -> Result<StateDelta<'static>, ContractError>;
128146
}
129147
```
130148

131-
#### Flexibility versus Convenience
149+
150+
### Flexibility versus Convenience
132151

133152
The `ContractInterface` trait is a low-level "Layer 0" API that provides direct
134153
access to the contract's state and parameters. This API is useful for contracts

hugo-site/content/resources/manual/components/delegates.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
title: "Delegates"
33
date: 2025-04-13
44
draft: false
5-
weight: 3
65
---
76

8-
# Delegates
9-
107
In Freenet, Delegates are software components that can act on the user's behalf.
118
Think of them as a more sophisticated version of a web browser's local storage,
129
with similarities to Unix "Daemons". Operating within the Freenet core on your

hugo-site/content/resources/manual/components/overview.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ weight: 1
66
---
77

88

9-
# Components of Decentralized Software
9+
## Components of Decentralized Software
1010

1111
Delegates, contracts, and user interfaces (UIs) each serve distinct roles in the
12-
Freenet ecosystem. [Contracts](contracts.md) control public data, or "shared
13-
state". [Delegates](delegates.md) act as the user's agent and can store private
14-
data on the user's behalf, while [User Interfaces](ui.md) provide an interface
12+
Freenet ecosystem. [Contracts](/manual/components/contracts) control public data, or "shared
13+
state". [Delegates](/manual/components/delegates) act as the user's agent and can store private
14+
data on the user's behalf, while [User Interfaces](/manual/components/ui) provide an interface
1515
between these and the user through a web browser. UIs are distributed through
1616
the P2P network via contracts.
1717

18-
![Architectural Primitives Diagram](components.svg)
18+
![Architectural Primitives Diagram](/components.svg)
1919

2020
## Freenet Core
2121

2222
The Freenet Core is the software that enables a user's computer to connect to
2323
the Freenet network. Its primary functions are:
2424

2525
- Providing a user-friendly interface to access Freenet via a web browser
26-
- Host the user's [delegates](delegates.md) and the private data they store
27-
- Host [contracts](contracts.md) and their associated data on behalf of the
26+
- Host the user's [delegates](/manual/components/delegates) and the private data they store
27+
- Host [contracts](/manual/components/contracts) and their associated data on behalf of the
2828
network
2929
- Manage communication between contracts, delegates, and UI components
3030

hugo-site/content/resources/manual/components/ui.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22
title: "User Interface"
33
date: 2025-04-13
44
draft: false
5-
weight: 4
65
---
76

8-
## User Interface
9-
107
On the normal web, a user might visit `https://gmail.com/`, their browser
118
will download the Gmail user interface which then runs in their browser and connects back to the Gmail servers.
129

1310
On Freenet the user interface is downloaded from a Freenet contract, and it
14-
[interacts](overview.md) with contracts and delegates by sending messages
11+
[interacts](/manual/components/overview) with contracts and delegates by sending messages
1512
through the Freenet core.
1613

17-
![Delegate, Contrat, and UI Diagram](ui_delegate_contract.svg)
14+
![Delegate, Contrat, and UI Diagram](/ui_delegate_contract.svg)
1815

1916
These UIs are built using web technologies such as HTML, CSS, and JavaScript,
2017
and are distributed over Freenet and run in a web browser. UIs can create,

hugo-site/content/resources/manual/contract-interface.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,42 @@
22
title: "Contract Interfaces"
33
date: 2025-04-13
44
draft: false
5-
weight: 2
65
---
76

8-
# Contract Interface
9-
107
## Terms
118

12-
- [Contract State](glossary.md#contract-state) - data associated with a contract that can be retrieved by Applications and Delegates.
13-
- [Delta](glossary.md#delta) - Represents a modification to some state - similar to a [diff](https://en.wikipedia.org/wiki/Diff) in source code
14-
- [Parameters](glossary.md#parameters) - Data that forms part of a contract along with the WebAssembly code
15-
- [State Summary](glossary.md#state-summary) - A compact summary of a contract's state that can be used to create a delta
9+
- [Contract State](/manual/glossary#contract-state) - data associated with a contract that can be retrieved by Applications and Delegates.
10+
- [Delta](/manual/glossary#delta) - Represents a modification to some state - similar to a [diff](https://en.wikipedia.org/wiki/Diff) in source code
11+
- [Parameters](/manual/glossary#parameters) - Data that forms part of a contract along with the WebAssembly code
12+
- [State Summary](/manual/glossary#state-summary) - A compact summary of a contract's state that can be used to create a delta
1613

1714
## Interface
1815

1916
Freenet contracts must implement the [`ContractInterface`](https://docs.rs/freenet-stdlib/latest/freenet_stdlib/prelude/trait.ContractInterface.html) trait:
2017

21-
```rust,no_run,noplayground
22-
{{#include ../../stdlib/rust/src/contract_interface.rs:contractifce}}
18+
```rust
19+
pub trait ContractInterface {
20+
// Required methods
21+
fn validate_state(
22+
parameters: Parameters<'static>,
23+
state: State<'static>,
24+
related: RelatedContracts<'static>,
25+
) -> Result<ValidateResult, ContractError>;
26+
fn update_state(
27+
parameters: Parameters<'static>,
28+
state: State<'static>,
29+
data: Vec<UpdateData<'static>>,
30+
) -> Result<UpdateModification<'static>, ContractError>;
31+
fn summarize_state(
32+
parameters: Parameters<'static>,
33+
state: State<'static>,
34+
) -> Result<StateSummary<'static>, ContractError>;
35+
fn get_state_delta(
36+
parameters: Parameters<'static>,
37+
state: State<'static>,
38+
summary: StateSummary<'static>,
39+
) -> Result<StateDelta<'static>, ContractError>;
40+
}
2341
```
2442

2543
[`Parameters`](https://docs.rs/freenet-stdlib/latest/freenet_stdlib/prelude/struct.Parameters.html),

hugo-site/content/resources/manual/docker.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
---
2-
title: "Docker"
2+
title: "Building with Docker Images"
33
date: 2025-04-13
44
draft: false
5-
weight: 3
65
---
76

8-
# Building with Docker Images
97

108
## Prerequisites
119

0 commit comments

Comments
 (0)